Merge
diff --git a/.hgtags b/.hgtags
index 485994c..7c3ac27 100644
--- a/.hgtags
+++ b/.hgtags
@@ -348,3 +348,20 @@
 ca1adc7c848370dda8dbf9e3a970c3e6427fb05b jdk8u31-b08
 1c0cc3bbe07d52906d7ffbb72fa4733c327f1326 jdk8u31-b09
 291505d802d9075e227f9ee865a67234e1d737cf jdk8u31-b10
+e6ed015afbbf3459ba3297e270b4f3170e989c80 jdk8u40-b00
+6e223d48080ef40f4ec11ecbcd19b4a20813b9eb jdk8u40-b01
+4797cd0713b44b009525f1276d571ade7e24f3f5 jdk8u40-b02
+c67acfb24eed87629887128df51007218ddf1f60 jdk8u40-b03
+dde62d949f7847469b2ede2ca4190c95066adc91 jdk8u40-b04
+d587834579dadd18cb8b096e61d92e2dbccc2782 jdk8u40-b05
+25788892a6723c0742a24050cc25ab103d9804de jdk8u40-b06
+07f0e22b5c238dd7b89fedbed35f02ac6b392c96 jdk8u40-b07
+0f0d70abca09b4ddb0981204ad5a427d4ce935e9 jdk8u40-b08
+064adeb65ce82f9ff3cc7898e59d19eb64743c63 jdk8u40-b09
+c3a4729c70fa29d79ad77e0643ad7715ebbc96b5 jdk8u40-b10
+693da296b395139f2fe6d7131eb0b0d85f6015f6 jdk8u40-b11
+fb8db13639204e37388904bb6e57778c5d762631 jdk8u40-b12
+ba80109a9b3eb92b56012c9ec3aafd9aee2efa69 jdk8u40-b13
+ffc348308de2e872f5d510d440604c3726a67a18 jdk8u40-b14
+31dac938108da722c56a0526fba7f6ae84773056 jdk8u40-b15
+9dc67d03e6e540f646f27092ed23e94e95fa789e jdk8u40-b16
diff --git a/make/CompileDemos.gmk b/make/CompileDemos.gmk
index 3b18391..36829b3 100644
--- a/make/CompileDemos.gmk
+++ b/make/CompileDemos.gmk
@@ -456,7 +456,7 @@
 ##################################################################################################
 
 ifndef OPENJDK
-  DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)
+  DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/db-derby-*-bin.zip)
 
   $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
 	$(MKDIR) -p $(@D)
diff --git a/make/CompileJavaClasses.gmk b/make/CompileJavaClasses.gmk
index e4c7b3a..93ca5a5 100644
--- a/make/CompileJavaClasses.gmk
+++ b/make/CompileJavaClasses.gmk
@@ -37,6 +37,11 @@
 EXCLUDES :=
 
 ##########################################################################################
+# Include the corresponding custom file, if present.
+
+-include $(CUSTOM_MAKE_DIR)/CompileJavaClasses.gmk
+
+##########################################################################################
 
 EXCLUDES += com/sun/pept \
     com/sun/tools/example/trace \
@@ -52,8 +57,9 @@
 endif
 
 ifndef OPENJDK
-  # There exists two versions of this file...
-  EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
+  # There exists two versions of these files...
+  EXFILES += $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
+  EXFILES += $(JDK_TOPDIR)/src/share/classes/sun/management/ExtendedPlatformComponent.java
 
   ifeq ($(OPENJDK_TARGET_OS), windows)
     # This gets built on unix platforms implicitly in the old build even though
diff --git a/make/CompileNativeLibraries.gmk b/make/CompileNativeLibraries.gmk
index 57ef12e..c23b958 100644
--- a/make/CompileNativeLibraries.gmk
+++ b/make/CompileNativeLibraries.gmk
@@ -87,6 +87,9 @@
 
 include lib/SoundLibraries.gmk
 
+# Include the corresponding custom file, if present. 
+-include $(CUSTOM_MAKE_DIR)/CompileNativeLibraries.gmk
+
 ##########################################################################################
 
 all: $(COPY_FILES) $(BUILD_LIBRARIES)
diff --git a/make/Images.gmk b/make/Images.gmk
index 884dc4f..51d0c14 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -562,7 +562,7 @@
 	$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
 
   JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%, $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped, \
-      $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)) \
+      $(wildcard $(JDK_TOPDIR)/src/closed/share/db/db-derby-*-bin.zip)) \
       $(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
 
 endif
diff --git a/make/Setup.gmk b/make/Setup.gmk
index d2e706f..30cc62f 100644
--- a/make/Setup.gmk
+++ b/make/Setup.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 # boot jdk to generate tools that need to be run with the boot jdk.
 # Thus we force the target bytecode to the previous JDK version.
 $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
@@ -60,7 +60,7 @@
 # I.e. the rt.jar, but since rt.jar has not yet been generated
 # (it will be in "make images") therefore we use classes instead.
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
diff --git a/make/Tools.gmk b/make/Tools.gmk
index aa61c1f..7ef8698 100644
--- a/make/Tools.gmk
+++ b/make/Tools.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -54,84 +54,85 @@
 BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
 
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
-TOOL_ADDJSUM = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.addjsum.AddJsum
 
 # The buildmetaindex tool creates a meta-index to make core class loaders lazier.
-TOOL_BUILDMETAINDEX = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.buildmetaindex.BuildMetaIndex
 
-TOOL_COMPILEFONTCONFIG = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compilefontconfig.CompileFontConfig
 
-TOOL_COMPILEPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compileproperties.CompileProperties
 
-TOOL_STRIPPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_STRIPPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.stripproperties.StripProperties
 
-TOOL_JARREORDER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.jarreorder.JarReorder
 
-TOOL_GENERATECHARACTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.GenerateCharacter
 
-TOOL_CHARACTERNAME = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.CharacterName
 
-TOOL_DTDBUILDER = $(JAVA) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
+TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
+    -Djava.awt.headless=true \
     -cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
 
-TOOL_GENERATEBREAKITERATORDATA = $(JAVA) \
+TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
     -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatebreakiteratordata.GenerateBreakIteratorData
 
-TOOL_GENERATECURRENCYDATA = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecurrencydata.GenerateCurrencyData
 
-TOOL_HASHER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.hasher.Hasher
 
-TOOL_TZDB = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
 
 # TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
 # and nbproject/project.properties in the same dir. Needs to be looked at.
-TOOL_JDWPGEN = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
+TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
 
 # TODO: Lots of files in jdk/make/tools/CharsetMapping dir
-TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.charsetmapping.Main
 
-TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
+TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
 
 # Nimbus is used somewhere in the swing build.
-TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatenimbus.Generator
 
-TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     WrapperGenerator
 
-TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.awt.ToBin
 
-TOOL_OSX_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.osxapp.ToBin
 
-TOOL_CLDRCONVERTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.cldrconverter.CLDRConverter
 
-TOOL_REMOVEMETHODS = $(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+TOOL_REMOVEMETHODS = $(JAVA_SMALL) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
     -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
     build.tools.classfile.RemoveMethods
 
-TOOL_CHECKDEPS = $(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
     -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
     build.tools.deps.CheckDeps
 
-TOOL_ADDTORESTRICTEDPKGS=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
- 	build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
+TOOL_ADDTORESTRICTEDPKGS=$(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+    build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
 
 ##########################################################################################
 
diff --git a/make/data/jdwp/jdwp.spec b/make/data/jdwp/jdwp.spec
index 7ddbaf4..aadede2 100644
--- a/make/data/jdwp/jdwp.spec
+++ b/make/data/jdwp/jdwp.spec
@@ -1147,7 +1147,8 @@
         (ErrorSet
             (Error INVALID_CLASS     "clazz is not the ID of a class.")
             (Error INVALID_OBJECT    "clazz is not a known ID.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in "
+                                     "this class type or one of its superclasses.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
@@ -1250,6 +1251,83 @@
     )
 )
 (CommandSet InterfaceType=5
+    (Command InvokeMethod=1
+        "Invokes a static method. "
+        "The method must not be a static initializer. "
+        "The method must be a member of the interface type. "
+        "<p>Since JDWP version 1.8 "
+        "<p>"
+        "The method invocation will occur in the specified thread. "
+        "Method invocation can occur only if the specified thread "
+        "has been suspended by an event. "
+        "Method invocation is not supported "
+        "when the target VM has been suspended by the front-end. "
+        "<p>"
+        "The specified method is invoked with the arguments in the specified "
+        "argument list. "
+        "The method invocation is synchronous; the reply packet is not "
+        "sent until the invoked method returns in the target VM. "
+        "The return value (possibly the void value) is "
+        "included in the reply packet. "
+        "If the invoked method throws an exception, the "
+        "exception object ID is set in the reply packet; otherwise, the "
+        "exception object ID is null. "
+        "<p>"
+        "For primitive arguments, the argument value's type must match the "
+        "argument's type exactly. For object arguments, there must exist a "
+        "widening reference conversion from the argument value's type to the "
+        "argument's type and the argument's type must be loaded. "
+        "<p>"
+        "By default, all threads in the target VM are resumed while "
+        "the method is being invoked if they were previously "
+        "suspended by an event or by a command. "
+        "This is done to prevent the deadlocks "
+        "that will occur if any of the threads own monitors "
+        "that will be needed by the invoked method. It is possible that "
+        "breakpoints or other events might occur during the invocation. "
+        "Note, however, that this implicit resume acts exactly like "
+        "the ThreadReference resume command, so if the thread's suspend "
+        "count is greater than 1, it will remain in a suspended state "
+        "during the invocation. By default, when the invocation completes, "
+        "all threads in the target VM are suspended, regardless their state "
+        "before the invocation. "
+        "<p>"
+        "The resumption of other threads during the invoke can be prevented "
+        "by specifying the INVOKE_SINGLE_THREADED "
+        "bit flag in the <code>options</code> field; however, "
+        "there is no protection against or recovery from the deadlocks "
+        "described above, so this option should be used with great caution. "
+        "Only the specified thread will be resumed (as described for all "
+        "threads above). Upon completion of a single threaded invoke, the invoking thread "
+        "will be suspended once again. Note that any threads started during "
+        "the single threaded invocation will not be suspended when the "
+        "invocation completes. "
+        "<p>"
+        "If the target VM is disconnected during the invoke (for example, through "
+        "the VirtualMachine dispose command) the method invocation continues. "
+        (Out
+            (interfaceType clazz "The interface type ID.")
+            (threadObject thread "The thread in which to invoke.")
+            (method methodID "The method to invoke.")
+            (Repeat arguments
+                (value arg "The argument value.")
+            )
+            (int options "Invocation <a href=\"#JDWP_InvokeOptions\">options</a>")
+        )
+        (Reply
+            (value returnValue "The returned value.")
+            (tagged-object exception "The thrown exception.")
+        )
+        (ErrorSet
+            (Error INVALID_CLASS     "clazz is not the ID of an interface.")
+            (Error INVALID_OBJECT    "clazz is not a known ID.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in this "
+                                     "interface type or is the ID of a static initializer.")
+            (Error INVALID_THREAD)
+            (Error THREAD_NOT_SUSPENDED)
+            (Error VM_DEAD)
+        )
+    )
 )
 (CommandSet Method=6
     (Command LineTable=1
@@ -1543,7 +1621,7 @@
         "<p>"
         "By default, all threads in the target VM are resumed while "
         "the method is being invoked if they were previously "
-        "suspended by an event or by command. "
+        "suspended by an event or by a command. "
         "This is done to prevent the deadlocks "
         "that will occur if any of the threads own monitors "
         "that will be needed by the invoked method. It is possible that "
@@ -1586,7 +1664,9 @@
             (Error INVALID_OBJECT)
             (Error INVALID_CLASS     "clazz is not the ID of a reference "
                                      "type.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of an instance method "
+                                     "in this object's type or one of its superclasses, "
+                                     "superinterfaces, or implemented interfaces.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
diff --git a/make/gensrc/GensrcMisc.gmk b/make/gensrc/GensrcMisc.gmk
index 90b10b7..33a655e 100644
--- a/make/gensrc/GensrcMisc.gmk
+++ b/make/gensrc/GensrcMisc.gmk
@@ -62,25 +62,6 @@
 
 ##########################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
-  UPSUFFIX := $(OPENJDK_TARGET_OS)
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    UPSUFFIX := bsd
-  endif
-  # UNIXProcess.java is different for solaris and linux. We need to copy
-  # the correct UNIXProcess.java over to $(JDK_OUTPUTDIR)/gensrc/java/lang/.
-
-  $(JDK_OUTPUTDIR)/gensrc/java/lang/UNIXProcess.java: \
-      $(JDK_TOPDIR)/src/solaris/classes/java/lang/UNIXProcess.java.$(UPSUFFIX)
-	$(ECHO) $(LOG_INFO) Copying UNIXProcess.java.$(OPENJDK_TARGET_OS) to java/lang/UNIXProcess.java
-	$(call install-file)
-	$(CHMOD) u+rw $@
-
-  GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/java/lang/UNIXProcess.java
-endif
-
-##########################################################################################
-
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java
 
 GENSRC_SOR_SRC := $(JDK_TOPDIR)/src/share/native/sun/nio/ch
diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk
index f1703fd..fe3eb02 100644
--- a/make/lib/Awt2dLibraries.gmk
+++ b/make/lib/Awt2dLibraries.gmk
@@ -318,7 +318,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
+  LIBAWT_FILES += awt_LoadLibrary.c
   LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
 endif
 
@@ -611,7 +611,6 @@
         debug_mem.c \
         debug_trace.c \
         debug_util.c \
-        awt_Plugin.c \
         gnome_interface.c \
         gtk2_interface.c \
         swing_GTKEngine.c \
diff --git a/make/lib/CoreLibraries.gmk b/make/lib/CoreLibraries.gmk
index 1eaea90..a36bf90 100644
--- a/make/lib/CoreLibraries.gmk
+++ b/make/lib/CoreLibraries.gmk
@@ -129,9 +129,9 @@
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util
 
-ifneq ($(OPENJDK_TARGET_OS), macosx)
+ifeq ($(OPENJDK_TARGET_OS), windows)
   LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
-else
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
 endif
 
diff --git a/make/lib/ServiceabilityLibraries.gmk b/make/lib/ServiceabilityLibraries.gmk
index d95fc7e..bd31a44 100644
--- a/make/lib/ServiceabilityLibraries.gmk
+++ b/make/lib/ServiceabilityLibraries.gmk
@@ -23,6 +23,10 @@
 # questions.
 #
 
+# Include custom extensions if available.
+-include $(CUSTOM_MAKE_DIR)/lib/ServiceabilityLibraries.gmk
+
+
 LIBATTACH_EXCLUDE_FILES :=
 ifneq ($(OPENJDK_TARGET_OS), solaris)
   LIBATTACH_EXCLUDE_FILES += SolarisVirtualMachine.c
@@ -283,12 +287,12 @@
 
 ##########################################################################################
 
-BUILD_LIBMANAGEMENT_SRC := $(JDK_TOPDIR)/src/share/native/sun/management \
+BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/share/native/sun/management \
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management
 
 BUILD_LIBMANAGEMENT_EXCLUDES :=
 
-BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/management
+BUILD_LIBMANAGEMENT_CFLAGS += -I$(JDK_TOPDIR)/src/share/native/sun/management
 
 ifneq ($(OPENJDK_TARGET_OS), solaris)
   BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c
@@ -309,6 +313,9 @@
   endif
 endif
 
+# Make it possible to override this variable
+LIBMANAGEMENT_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers
+
 $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
     LIBRARY := management, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -317,7 +324,7 @@
     LANG := C, \
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \
-    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \
+    MAPFILE := $(LIBMANAGEMENT_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_solaris := -lkstat, \
diff --git a/make/mapfiles/libawt/mapfile-mawt-vers b/make/mapfiles/libawt/mapfile-mawt-vers
index a50c13a..b8ea163 100644
--- a/make/mapfiles/libawt/mapfile-mawt-vers
+++ b/make/mapfiles/libawt/mapfile-mawt-vers
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -249,11 +249,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
diff --git a/make/mapfiles/libawt/mapfile-vers b/make/mapfiles/libawt/mapfile-vers
index 0c981e5..636c255 100644
--- a/make/mapfiles/libawt/mapfile-vers
+++ b/make/mapfiles/libawt/mapfile-vers
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -174,13 +174,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
diff --git a/make/mapfiles/libawt/mapfile-vers-linux b/make/mapfiles/libawt/mapfile-vers-linux
index f8967e0..922b015 100644
--- a/make/mapfiles/libawt/mapfile-vers-linux
+++ b/make/mapfiles/libawt/mapfile-vers-linux
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -152,13 +152,6 @@
                 # Evidently CDE needs this for backward compatability.
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
@@ -283,11 +276,6 @@
 		# CDE private entry point
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
diff --git a/make/mapfiles/libawt_xawt/mapfile-vers b/make/mapfiles/libawt_xawt/mapfile-vers
index 15089a1..3ae8af3 100644
--- a/make/mapfiles/libawt_xawt/mapfile-vers
+++ b/make/mapfiles/libawt_xawt/mapfile-vers
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -449,12 +449,6 @@
         awt_Lock;
         awt_GetComponent;
 
-        # Java Plugin
-        # This is in awt_LoadLibrary.c and falls through to libmawt.
-        # Evidently plugin needs this for backward compatability.
-        getAwtLockFunctions;
-        getAwtData;
-        getAwtDisplay;
         #XAWT entry point for CDE
         Java_sun_awt_motif_XsessionWMcommand;
         Java_sun_awt_motif_XsessionWMcommand_New;
diff --git a/make/mapfiles/libjava/mapfile-vers b/make/mapfiles/libjava/mapfile-vers
index d3fe7ce..152053c 100644
--- a/make/mapfiles/libjava/mapfile-vers
+++ b/make/mapfiles/libjava/mapfile-vers
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -78,13 +78,13 @@
 		Java_java_io_FileInputStream_available;
 		Java_java_io_FileInputStream_close0;
 		Java_java_io_FileInputStream_initIDs;
-		Java_java_io_FileInputStream_open;
+		Java_java_io_FileInputStream_open0;
 		Java_java_io_FileInputStream_read0;
 		Java_java_io_FileInputStream_readBytes;
 		Java_java_io_FileInputStream_skip;
 		Java_java_io_FileOutputStream_close0;
 		Java_java_io_FileOutputStream_initIDs;
-		Java_java_io_FileOutputStream_open;
+		Java_java_io_FileOutputStream_open0;
 		Java_java_io_FileOutputStream_write;
 		Java_java_io_FileOutputStream_writeBytes;
 		Java_java_io_ObjectInputStream_bytesToDoubles;
@@ -97,7 +97,7 @@
 		Java_java_io_RandomAccessFile_getFilePointer;
 		Java_java_io_RandomAccessFile_initIDs;
 		Java_java_io_RandomAccessFile_length;
-		Java_java_io_RandomAccessFile_open;
+		Java_java_io_RandomAccessFile_open0;
 		Java_java_io_RandomAccessFile_read0;
 		Java_java_io_RandomAccessFile_readBytes;
 		Java_java_io_RandomAccessFile_seek0;
@@ -269,6 +269,9 @@
 		Java_sun_reflect_Reflection_getCallerClass__;
 		Java_sun_reflect_Reflection_getCallerClass__I;
 		Java_sun_reflect_Reflection_getClassAccessFlags;
+		Java_sun_misc_URLClassPath_knownToNotExist0;
+                Java_sun_misc_URLClassPath_getLookupCacheURLs;
+                Java_sun_misc_URLClassPath_getLookupCacheForClassLoader;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJdkSpecialVersion;
                 Java_sun_misc_Version_getJvmVersionInfo;
@@ -287,8 +290,6 @@
 #		Java_sun_misc_VM_unsuspendSomeThreads;		threads.c
 #		Java_sun_misc_VM_unsuspendThreads;		threads.c
 
-		Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern;
-
 	# Outcalls from libjvm done using dlsym().
 
 		VerifyClassCodes;
diff --git a/make/mapfiles/libjava/reorder-sparc b/make/mapfiles/libjava/reorder-sparc
index 4a5cbf4..d100376 100644
--- a/make/mapfiles/libjava/reorder-sparc
+++ b/make/mapfiles/libjava/reorder-sparc
@@ -44,7 +44,7 @@
 text: .text%Java_java_io_UnixFileSystem_canonicalize;
 text: .text%JNU_GetStringPlatformChars;
 text: .text%JNU_ReleaseStringPlatformChars;
-text: .text%Java_java_io_FileInputStream_open;
+text: .text%Java_java_io_FileInputStream_open0;
 text: .text%fileOpen;
 text: .text%Java_java_io_FileInputStream_readBytes;
 text: .text%readBytes;
diff --git a/make/mapfiles/libjava/reorder-sparcv9 b/make/mapfiles/libjava/reorder-sparcv9
index 81cbfcb..2609711 100644
--- a/make/mapfiles/libjava/reorder-sparcv9
+++ b/make/mapfiles/libjava/reorder-sparcv9
@@ -47,7 +47,7 @@
 text: .text%Java_java_io_UnixFileSystem_canonicalize;
 text: .text%JNU_GetStringPlatformChars;
 text: .text%JNU_ReleaseStringPlatformChars;
-text: .text%Java_java_io_FileInputStream_open;
+text: .text%Java_java_io_FileInputStream_open0;
 text: .text%fileOpen;
 text: .text%Java_java_io_FileInputStream_readBytes;
 text: .text%readBytes;
diff --git a/make/mapfiles/libjava/reorder-x86 b/make/mapfiles/libjava/reorder-x86
index 1c971b8..b8ea2d4 100644
--- a/make/mapfiles/libjava/reorder-x86
+++ b/make/mapfiles/libjava/reorder-x86
@@ -57,7 +57,7 @@
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
 text: .text%Java_java_lang_Float_floatToIntBits;
 text: .text%Java_java_lang_Double_doubleToLongBits;
-text: .text%Java_java_io_FileInputStream_open;
+text: .text%Java_java_io_FileInputStream_open0;
 text: .text%fileOpen;
 text: .text%Java_java_io_UnixFileSystem_getLength;
 text: .text%Java_java_io_FileInputStream_readBytes;
@@ -90,7 +90,7 @@
 text: .text%JNU_CallMethodByName;
 text: .text%JNU_CallMethodByNameV;
 text: .text%Java_java_util_logging_FileHandler_lockFile;
-text: .text%Java_java_io_FileOutputStream_open;
+text: .text%Java_java_io_FileOutputStream_open0;
 text: .text%Java_java_io_UnixFileSystem_createDirectory;
 text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
 text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
diff --git a/make/mapfiles/libjfr/mapfile-vers b/make/mapfiles/libjfr/mapfile-vers
index dea13dd..0bb2cbc 100644
--- a/make/mapfiles/libjfr/mapfile-vers
+++ b/make/mapfiles/libjfr/mapfile-vers
@@ -10,8 +10,13 @@
       Java_oracle_jrockit_jfr_Process_getpid;
       Java_oracle_jrockit_jfr_Timing_counterTime;
       Java_oracle_jrockit_jfr_Timing_init;
-      Java_oracle_jrockit_jfr_NativeLogger_output0;
-      Java_oracle_jrockit_jfr_VMJFR_isEnabled;
+      Java_oracle_jrockit_jfr_Logger_output0;
+      Java_oracle_jrockit_jfr_JFR_isCommercialFeaturesUnlocked;
+      Java_oracle_jrockit_jfr_JFR_isStarted;
+      Java_oracle_jrockit_jfr_JFR_isSupportedInVM;
+      Java_oracle_jrockit_jfr_JFR_startFlightRecorder;
+      Java_oracle_jrockit_jfr_JFR_isDisabledOnCommandLine;
+      Java_oracle_jrockit_jfr_JFR_isEnabled;
       Java_oracle_jrockit_jfr_VMJFR_options;
       Java_oracle_jrockit_jfr_VMJFR_init;
       Java_oracle_jrockit_jfr_VMJFR_addConstPool;
@@ -33,7 +38,6 @@
       Java_oracle_jrockit_jfr_VMJFR_setPeriod;
       Java_oracle_jrockit_jfr_VMJFR_getPeriod;
       Java_oracle_jrockit_jfr_VMJFR_descriptors;
-      Java_oracle_jrockit_jfr_VMJFR_redefineClass0;
       Java_oracle_jrockit_jfr_VMJFR_retransformClasses0;
       JNI_OnLoad;
   local:
diff --git a/make/mapfiles/libsplashscreen/mapfile-vers b/make/mapfiles/libsplashscreen/mapfile-vers
index b950732..2be756b 100644
--- a/make/mapfiles/libsplashscreen/mapfile-vers
+++ b/make/mapfiles/libsplashscreen/mapfile-vers
@@ -35,6 +35,7 @@
                 Java_java_awt_SplashScreen__1getImageFileName;
                 Java_java_awt_SplashScreen__1getImageJarName;
                 Java_java_awt_SplashScreen__1setImageData;
+                Java_java_awt_SplashScreen__1getScaleFactor;
 
 		SplashLoadMemory;
 		SplashLoadFile;
diff --git a/make/profile-rtjar-includes.txt b/make/profile-rtjar-includes.txt
index 3f0934c..ba90ac6 100644
--- a/make/profile-rtjar-includes.txt
+++ b/make/profile-rtjar-includes.txt
@@ -117,6 +117,8 @@
     com/sun/security/ntlm \
     com/sun/security/sasl \
     com/sun/tracing \
+    jdk/management \
+    jdk/internal/cmm \
     java/lang/instrument \
     java/lang/management \
     java/security/acl \
diff --git a/src/aix/classes/sun/awt/fontconfigs/aix.fontconfig.properties b/src/aix/classes/sun/awt/fontconfigs/aix.fontconfig.properties
index 29e7c7d..f203f75 100644
--- a/src/aix/classes/sun/awt/fontconfigs/aix.fontconfig.properties
+++ b/src/aix/classes/sun/awt/fontconfigs/aix.fontconfig.properties
@@ -24,9 +24,14 @@
 # questions.
 #
 
-# Minimal version for AIX using the standard Latin Type1 Fonts from the
-# package X11.fnt.iso_T1. These fonts are installed by default into
-# "/usr/lpp/X11/lib/X11/fonts/Type1" and sym-linked to "/usr/lib/X11/fonts/Type1"
+#
+# Portions Copyright (c) 2014 IBM Corporation
+#
+
+# This file references the standard Latin Type1 fonts from the AIX package
+# X11.fnt.iso_T1 and the Unicode TrueType fonts from X11.fnt.ucs.ttf. They
+# are located by default under "/usr/lpp/X11/lib/X11/fonts/{Type1,TrueType}"
+# and sym-linked to "/usr/lib/X11/fonts/".
 
 # Version
 
@@ -34,44 +39,381 @@
 
 # Component Font Mappings
 
-dialog.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1
-dialog.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1
-dialog.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1
-dialog.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1
+allfonts.iso10646-extB=-monotype-sansmonowtextb-medium-r-normal--*-%d-75-75-m-*-unicode-2
 
-dialoginput.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1
-dialoginput.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1
-dialoginput.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1
-dialoginput.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1
 
-sansserif.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1
-sansserif.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1
-sansserif.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1
-sansserif.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1
+dialog.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso8859-1
+dialog.plain.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+dialog.plain.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+dialog.plain.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialog.plain.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialog.plain.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialog.plain.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialog.plain.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialog.plain.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialog.plain.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialog.plain.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialog.plain.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
 
-serif.plain.latin-1=-*-times new roman-medium-r-normal--*-%d-100-100-p-*-iso10646-1
-serif.bold.latin-1=-*-times new roman-bold-r-normal--*-%d-100-100-p-*-iso10646-1
-serif.italic.latin-1=-*-times new roman-medium-i-normal--*-%d-100-100-p-*-iso10646-1
-serif.bolditalic.latin-1=-*-times new roman-bold-i-normal--*-%d-100-100-p-*-iso10646-1
+dialog.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso8859-1
+dialog.bold.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+dialog.bold.ukranian-ibm1124=-*-*-bold-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+dialog.bold.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialog.bold.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialog.bold.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialog.bold.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialog.bold.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialog.bold.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialog.bold.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialog.bold.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialog.bold.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
 
-monospaced.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1
-monospaced.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1
-monospaced.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1
-monospaced.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1
+dialog.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso8859-1
+dialog.italic.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+dialog.italic.ukranian-ibm1124=-*-*-medium-i-normal--*-%d-75-75-p-*-ucs2.i18n-0
+dialog.italic.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialog.italic.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialog.italic.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialog.italic.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialog.italic.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialog.italic.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialog.italic.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialog.italic.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialog.italic.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+dialog.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso8859-1
+dialog.bolditalic.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+dialog.bolditalic.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+dialog.bolditalic.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialog.bolditalic.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialog.bolditalic.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialog.bolditalic.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialog.bolditalic.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialog.bolditalic.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialog.bolditalic.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialog.bolditalic.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialog.bolditalic.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+dialoginput.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso8859-1
+dialoginput.plain.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+dialoginput.plain.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+dialoginput.plain.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialoginput.plain.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialoginput.plain.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialoginput.plain.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialoginput.plain.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialoginput.plain.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialoginput.plain.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialoginput.plain.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialoginput.plain.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+dialoginput.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso8859-1
+dialoginput.bold.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+dialoginput.bold.ukranian-ibm1124=-*-*-bold-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+dialoginput.bold.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialoginput.bold.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialoginput.bold.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialoginput.bold.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialoginput.bold.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialoginput.bold.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialoginput.bold.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialoginput.bold.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialoginput.bold.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+dialoginput.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso8859-1
+dialoginput.italic.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+dialoginput.italic.ukranian-ibm1124=-*-*-medium-i-normal--*-%d-75-75-m-*-ucs2.i18n-0
+dialoginput.italic.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialoginput.italic.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialoginput.italic.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialoginput.italic.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialoginput.italic.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialoginput.italic.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialoginput.italic.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialoginput.italic.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialoginput.italic.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+dialoginput.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso8859-1
+dialoginput.bolditalic.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+dialoginput.bolditalic.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+dialoginput.bolditalic.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+dialoginput.bolditalic.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+dialoginput.bolditalic.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+dialoginput.bolditalic.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+dialoginput.bolditalic.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+dialoginput.bolditalic.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+dialoginput.bolditalic.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+dialoginput.bolditalic.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+dialoginput.bolditalic.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+sansserif.plain.latin-1=-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso8859-1
+sansserif.plain.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+sansserif.plain.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+sansserif.plain.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+sansserif.plain.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+sansserif.plain.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+sansserif.plain.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+sansserif.plain.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+sansserif.plain.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+sansserif.plain.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+sansserif.plain.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+sansserif.plain.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+sansserif.bold.latin-1=-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso8859-1
+sansserif.bold.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+sansserif.bold.ukranian-ibm1124=-*-*-bold-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+sansserif.bold.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+sansserif.bold.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+sansserif.bold.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+sansserif.bold.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+sansserif.bold.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+sansserif.bold.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+sansserif.bold.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+sansserif.bold.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+sansserif.bold.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+sansserif.italic.latin-1=-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso8859-1
+sansserif.italic.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+sansserif.italic.ukranian-ibm1124=-*-*-medium-i-normal--*-%d-75-75-p-*-ucs2.i18n-0
+sansserif.italic.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+sansserif.italic.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+sansserif.italic.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+sansserif.italic.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+sansserif.italic.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+sansserif.italic.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+sansserif.italic.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+sansserif.italic.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+sansserif.italic.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+sansserif.bolditalic.latin-1=-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso8859-1
+sansserif.bolditalic.thai=-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+sansserif.bolditalic.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+sansserif.bolditalic.japanese-x0208=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+sansserif.bolditalic.japanese-x0201=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+sansserif.bolditalic.japanese-udc=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+sansserif.bolditalic.japanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+sansserif.bolditalic.korean=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+sansserif.bolditalic.korean-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+sansserif.bolditalic.chinese=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+sansserif.bolditalic.chinese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+sansserif.bolditalic.taiwanese-iso10646=-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+serif.plain.latin-1=-*-times new roman-medium-r-normal--*-%d-100-100-p-*-iso8859-1
+serif.plain.thai=-ibm-thaitimes-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+serif.plain.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+serif.plain.japanese-x0208=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+serif.plain.japanese-x0201=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+serif.plain.japanese-udc=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+serif.plain.japanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+serif.plain.korean=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+serif.plain.korean-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+serif.plain.chinese=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+serif.plain.chinese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+serif.plain.taiwanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+serif.bold.latin-1=-*-times new roman-bold-r-normal--*-%d-100-100-p-*-iso8859-1
+serif.bold.thai=-ibm-thaitimes-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+serif.bold.ukranian-ibm1124=-*-*-bold-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+serif.bold.japanese-x0208=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+serif.bold.japanese-x0201=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+serif.bold.japanese-udc=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+serif.bold.japanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+serif.bold.korean=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+serif.bold.korean-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+serif.bold.chinese=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+serif.bold.chinese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+serif.bold.taiwanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+
+serif.italic.latin-1=-*-times new roman-medium-i-normal--*-%d-100-100-p-*-iso8859-1
+serif.italic.thai=-ibm-thaitimes-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+serif.italic.ukranian-ibm1124=-*-*-medium-i-normal--*-%d-75-75-p-*-ucs2.i18n-0
+serif.italic.japanese-x0208=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+serif.italic.japanese-x0201=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+serif.italic.japanese-udc=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+serif.italic.japanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+serif.italic.korean=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+serif.italic.korean-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+serif.italic.chinese=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+serif.italic.chinese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+serif.italic.taiwanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+serif.bolditalic.latin-1=-*-times new roman-bold-i-normal--*-%d-100-100-p-*-iso8859-1
+serif.bolditalic.thai=-ibm-thaitimes-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0
+serif.bolditalic.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0
+serif.bolditalic.japanese-x0208=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+serif.bolditalic.japanese-x0201=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+serif.bolditalic.japanese-udc=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+serif.bolditalic.japanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+serif.bolditalic.korean=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+serif.bolditalic.korean-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+serif.bolditalic.chinese=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+serif.bolditalic.chinese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+serif.bolditalic.taiwanese-iso10646=-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+monospaced.plain.latin-1=-*-courier-medium-r-normal--*-%d-100-100-m-*-iso8859-1
+monospaced.plain.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+monospaced.plain.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+monospaced.plain.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+monospaced.plain.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+monospaced.plain.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+monospaced.plain.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+monospaced.plain.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+monospaced.plain.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+monospaced.plain.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+monospaced.plain.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+monospaced.plain.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+monospaced.bold.latin-1=-*-courier-bold-r-normal--*-%d-100-100-m-*-iso8859-1
+monospaced.bold.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+monospaced.bold.ukranian-ibm1124=-*-*-bold-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+monospaced.bold.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+monospaced.bold.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+monospaced.bold.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+monospaced.bold.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+monospaced.bold.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+monospaced.bold.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+monospaced.bold.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+monospaced.bold.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+monospaced.bold.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+monospaced.italic.latin-1=-*-courier-medium-o-normal--*-%d-100-100-m-*-iso8859-1
+monospaced.italic.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+monospaced.italic.ukranian-ibm1124=-*-*-medium-i-normal--*-%d-75-75-m-*-ucs2.i18n-0
+monospaced.italic.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+monospaced.italic.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+monospaced.italic.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+monospaced.italic.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+monospaced.italic.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+monospaced.italic.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+monospaced.italic.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+monospaced.italic.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+monospaced.italic.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
+
+monospaced.bolditalic.latin-1=-*-courier-bold-o-normal--*-%d-100-100-m-*-iso8859-1
+monospaced.bolditalic.thai=-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0
+monospaced.bolditalic.ukranian-ibm1124=-*-*-medium-r-normal--*-%d-75-75-m-*-ucs2.i18n-0
+monospaced.bolditalic.japanese-x0208=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0
+monospaced.bolditalic.japanese-x0201=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0
+monospaced.bolditalic.japanese-udc=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp
+monospaced.bolditalic.japanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0
+monospaced.bolditalic.korean=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0
+monospaced.bolditalic.korean-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0
+monospaced.bolditalic.chinese=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0
+monospaced.bolditalic.chinese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0
+monospaced.bolditalic.taiwanese-iso10646=-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0
 
 # Search Sequences
 
 sequence.allfonts=latin-1
+sequence.allfonts.UTF-8=latin-1,japanese-iso10646
+# Uk_UA
+sequence.allfonts.x-IBM1124=latin-1,ukranian-ibm1124
+# Japanese
+sequence.allfonts.x-IBM943C=latin-1,japanese-x0201,japanese-x0208,japanese-udc
+sequence.allfonts.x-IBM29626C=latin-1,japanese-x0201,japanese-x0208,japanese-udc
+sequence.allfonts.UTF-8.ja=japanese-iso10646,latin-1,iso10646-extB
+# Chinese
+sequence.allfonts.x-EUC_CN=latin-1,chinese
+sequence.allfonts.GB18030=latin-1,chinese-iso10646,iso10646-extB
+sequence.allfonts.UTF-8.zh.CN=latin-1,chinese-iso10646,iso10646-extB
+# Taiwanese
+sequence.allfonts.x-IBM964=latin-1,taiwanese-iso10646
+sequence.allfonts.Big5=latin-1,taiwanese-iso10646
+sequence.allfonts.UTF-8.zh.TW=latin-1,taiwanese-iso10646
+# Korean
+sequence.allfonts.x-IBM970=latin-1,korean
+sequence.allfonts.UTF-8.ko=latin-1,korean-iso10646
+# Thai
+sequence.allfonts.TIS-620=latin-1,thai
+sequence.allfonts.UTF-8.th=latin-1,thai
+# fallback
+sequence.fallback=thai,chinese-iso10646,taiwanese-iso10646,japanese-iso10646,korean-iso10646,iso10646-extB
 
-filename.-*-courier-medium-r-normal--*-%d-100-100-m-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/cour.pfa
-filename.-*-courier-bold-r-normal--*-%d-100-100-m-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/courb.pfa
-filename.-*-courier-medium-o-normal--*-%d-100-100-m-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/couri.pfa
-filename.-*-courier-bold-o-normal--*-%d-100-100-m-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/courbi.pfa
-filename.-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/helv.pfa
-filename.-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvb.pfa
-filename.-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvi.pfa
-filename.-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvbi.pfa
-filename.-*-times_new_roman-medium-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnr.pfa
-filename.-*-times_new_roman-bold-r-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnrb.pfa
-filename.-*-times_new_roman-medium-i-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnri.pfa
-filename.-*-times_new_roman-bold-i-normal--*-%d-100-100-p-*-iso10646-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnrbi.pfa
+# Exclusion Ranges
+exclusion.japanese-iso10646=0000-00ff
+
+# Font File Names
+filename.-*-courier-medium-r-normal--*-%d-100-100-m-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/cour.pfa
+filename.-*-courier-bold-r-normal--*-%d-100-100-m-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/courb.pfa
+filename.-*-courier-medium-o-normal--*-%d-100-100-m-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/couri.pfa
+filename.-*-courier-bold-o-normal--*-%d-100-100-m-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/courbi.pfa
+filename.-*-helvetica-medium-r-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/helv.pfa
+filename.-*-helvetica-bold-r-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvb.pfa
+filename.-*-helvetica-medium-o-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvi.pfa
+filename.-*-helvetica-bold-o-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/helvbi.pfa
+filename.-*-times_new_roman-medium-r-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnr.pfa
+filename.-*-times_new_roman-bold-r-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnrb.pfa
+filename.-*-times_new_roman-medium-i-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnri.pfa
+filename.-*-times_new_roman-bold-i-normal--*-%d-100-100-p-*-iso8859-1=/usr/lpp/X11/lib/X11/fonts/Type1/tnrbi.pfa
+
+
+filename.-monotype-sansmonowtextb-medium-r-normal--*-%d-75-75-m-*-unicode-2=/usr/lpp/X11/lib/X11/fonts/TrueType/MTSanXBA.ttf
+
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_k.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_k.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_s.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_s.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_s.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_s.ttf
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_t.ttf
+
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdk.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdk.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansds.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansds.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdt.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0208.1983-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_j.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-jisx0201.1976-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_j.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ibm-udcjp=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_j.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_japan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_j.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ksc5601.1987-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_k.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_korea-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_k.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-gb2312.1980-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_s.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_china-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_s.ttf
+filename.-monotype-sanswt-medium-r-normal--*-%d-75-75-*-*-ucs2.cjk_taiwan-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsans_t.ttf
+
+filename.-monotype-timesnewromanwt-medium-r-normal--*-%d-75-75-*-*-iso8859-15=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-monotype-sansmonowt-medium-r-normal--*-%d-75-75-*-*-iso8859-15=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+
+filename.-ibm-thaicourier-medium-r-normal--*-%d-75-75-m-*-ucs2.thai-0=/usr/lpp/X11/lib/X11/fonts/TrueType/courth.ttf
+filename.-ibm-thaihelvetica-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0=/usr/lpp/X11/lib/X11/fonts/TrueType/helvth.ttf
+filename.-ibm-thaitimes-medium-r-normal--*-%d-75-75-p-*-ucs2.thai-0=/usr/lpp/X11/lib/X11/fonts/TrueType/timeth.ttf
+
+filename.-*-*-medium-r-normal--*-%d-*-*-p-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-bold-r-normal--*-%d-*-*-p-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-medium-i-normal--*-%d-*-*-p-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-bold-i-normal--*-%d-*-*-p-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-medium-r-normal--*-%d-*-*-m-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-*-*-bold-r-normal--*-%d-*-*-m-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-*-*-medium-i-normal--*-%d-*-*-m-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-*-*-bold-i-normal--*-%d-*-*-m-*-ibm-1046=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+
+filename.-*-*-medium-r-normal--*-%d-75-75-p-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-bold-r-normal--*-%d-75-75-p-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-medium-i-normal--*-%d-75-75-p-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/tnrwt_j.ttf
+filename.-*-*-medium-r-normal--*-%d-75-75-m-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-*-*-bold-r-normal--*-%d-75-75-m-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+filename.-*-*-medium-i-normal--*-%d-75-75-m-*-ucs2.i18n-0=/usr/lpp/X11/lib/X11/fonts/TrueType/mtsansdj.ttf
+
+# AWT font path
+awtfontpath.japanese-x0201=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.japanese-x0208=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.japanese-udc=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.japanese-iso10646=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.korean=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.korean-iso10646=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.chinese=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.chinese-iso10646=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.taiwanese-iso10646=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.thai=/usr/lpp/X11/lib/X11/fonts/TrueType
+awtfontpath.iso10646-extB=/usr/lpp/X11/lib/X11/fonts/TrueType
+
diff --git a/src/bsd/doc/man/java.1 b/src/bsd/doc/man/java.1
index bc8f1f1..552dd48 100644
--- a/src/bsd/doc/man/java.1
+++ b/src/bsd/doc/man/java.1
@@ -1,3461 +1,2198 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: java
-.\" Language: English
-.\" Date: 08 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: java.1
 .\"
 .if n .pl 99999
-.TH "java" "1" "08 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH java 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 java \- Launches a Java application\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fIclassname\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.fi     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fB\-jar\fR \fIfilename\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options separated by spaces\&. See Options\&.
-.RE
-.PP
+Command-line options separated by spaces\&. See Options\&.
+.TP     
 \fIclassname\fR
-.RS 4
 The name of the class to be launched\&.
-.RE
-.PP
+.TP     
 \fIfilename\fR
-.RS 4
-The name of the Java Archive (JAR) file to be called\&. Used only with the
-\fB\-jar\fR
-option\&.
-.RE
-.PP
+The name of the Java Archive (JAR) file to be called\&. Used only with the \f3-jar\fR option\&.
+.TP     
 \fIargs\fR
-.RS 4
-The arguments passed to the
-\fBmain()\fR
-method separated by spaces\&.
-.RE
-.SH "DESCRIPTION"
+The arguments passed to the \f3main()\fR method separated by spaces\&.
+.SH DESCRIPTION    
+The \f3java\fR command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\&'s \f3main()\fR method\&. The method must be declared \fIpublic\fR and \fIstatic\fR, it must not return any value, and it must accept a \f3String\fR array as a parameter\&. The method declaration has the following form:
+.sp     
+.nf     
+\f3public static void main(String[] args)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3java\fR command can be used to launch a JavaFX application by loading a class that either has a \f3main()\fR method or that extends \f3javafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the \f3Application\fR class, calls its \f3init()\fR method, and then calls the \f3start(javafx\&.stage\&.Stage)\fR method\&.
 .PP
-The
-\fBjava\fR
-command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\*(Aqs
-\fBmain()\fR
-method\&. The method must be declared
-\fIpublic\fR
-and
-\fIstatic\fR, it must not return any value, and it must accept a
-\fBString\fR
-array as a parameter\&. The method declaration has the following form:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static void main(String[] args)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The
-\fBjava\fR
-command can be used to launch a JavaFX application by loading a class that either has a
-\fBmain()\fR
-method or that extends
-\fBjavafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the
-\fBApplication\fR
-class, calls its
-\fBinit()\fR
-method, and then calls the
-\fBstart(javafx\&.stage\&.Stage)\fR
-method\&.
-.PP
-By default, the first argument that is not an option of the
-\fBjava\fR
-command is the fully qualified name of the class to be called\&. If the
-\fB\-jar\fR
-option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the
-\fBMain\-Class\fR
-manifest header in its source code\&.
+By default, the first argument that is not an option of the \f3java\fR command is the fully qualified name of the class to be called\&. If the \f3-jar\fR option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the \f3Main-Class\fR manifest header in its source code\&.
 .PP
 The JRE searches for the startup class (and other classes used by the application) in three sets of locations: the bootstrap class path, the installed extensions, and the user\(cqs class path\&.
 .PP
-Arguments after the class file name or the JAR file name are passed to the
-\fBmain()\fR
-method\&.
-.SH "OPTIONS"
-.PP
-The
-\fBjava\fR
-command supports a wide range of options that can be divided into the following categories:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+Arguments after the class file name or the JAR file name are passed to the \f3main()\fR method\&.
+.SH OPTIONS    
+The \f3java\fR command supports a wide range of options that can be divided into the following categories:
+.TP 0.2i    
+\(bu
 Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Non\-Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
+Non-Standard Options
+.TP 0.2i    
+\(bu
 Advanced Runtime Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced JIT Compiler Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Serviceability Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Garbage Collection Options
-.RE
 .PP
 Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM)\&. They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on\&.
 .PP
-Non\-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with
-\fB\-X\fR\&.
+Non-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with \f3-X\fR\&.
 .PP
-Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with
-\fB\-XX\fR\&.
+Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with \f3-XX\fR\&.
 .PP
 To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document\&.
 .PP
-Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean
-\fB\-XX\fR
-options are enabled using the plus sign (\fB\-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\fB\-XX:\-\fR\fIOptionName\fR)\&.
+Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean \f3-XX\fR options are enabled using the plus sign (\f3-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\f3-XX:-\fR\fIOptionName\fR)\&.
 .PP
-For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix
-\fBk\fR
-or
-\fBK\fR
-for kilobytes (KB),
-\fBm\fR
-or
-\fBM\fR
-for megabytes (MB),
-\fBg\fR
-or
-\fBG\fR
-for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either
-\fB8g\fR,
-\fB8192m\fR,
-\fB8388608k\fR, or
-\fB8589934592\fR
-as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify
-\fB0\&.25\fR
-for 25%)\&.
-.SS "Standard Options"
-.PP
+For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix \f3k\fR or \f3K\fR for kilobytes (KB), \f3m\fR or \f3M\fR for megabytes (MB), \f3g\fR or \f3G\fR for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either \f38g\fR, \f38192m\fR, \f38388608k\fR, or \f38589934592\fR as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify \f30\&.25\fR for 25%)\&.
+.SS STANDARD\ OPTIONS    
 These are the most commonly used options that are supported by all implementations of the JVM\&.
-.PP
-\-agentlib:\fIlibname\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified native agent library\&. After the library name, a comma\-separated list of options specific to the library can be used\&.
-.sp
-If the option
-\fB\-agentlib:foo\fR
-is specified, then the JVM attempts to load the library named
-\fBlibfoo\&.so\fR
-in the location specified by the
-\fBLD_LIBRARY_PATH\fR
-system variable (on OS X this variable is
-\fBDYLD_LIBRARY_PATH\fR)\&.
-.sp
+.TP
+-agentlib:\fIlibname\fR[=\fIoptions\fR]
+.br
+Loads the specified native agent library\&. After the library name, a comma-separated list of options specific to the library can be used\&.
+
+If the option \f3-agentlib:foo\fR is specified, then the JVM attempts to load the library named \f3libfoo\&.so\fR in the location specified by the \f3LD_LIBRARY_PATH\fR system variable (on OS X this variable is \f3DYLD_LIBRARY_PATH\fR)\&.
+
 The following example shows how to load the heap profiling tool (HPROF) library and get sample CPU information every 20 ms, with a stack depth of 3:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:hprof=cpu=samples,interval=20,depth=3\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:hprof=cpu=samples,interval=20,depth=3\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 For more information about the native agent libraries, refer to the following:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The
-\fBjava\&.lang\&.instrument\fR
-package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
+The \f3java\&.lang\&.instrument\fR package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP 0.2i    
+\(bu
 Agent Command Line Options in the JVM Tools Interface guide at http://docs\&.oracle\&.com/javase/8/docs/platform/jvmti/jvmti\&.html#starting
-.RE
-.RE
-.PP
-\-agentpath:\fIpathname\fR[=\fIoptions\fR]
-.RS 4
-Loads the native agent library specified by the absolute path name\&. This option is equivalent to
-\fB\-agentlib\fR
-but uses the full path and file name of the library\&.
-.RE
-.PP
-\-client
-.RS 4
-Selects the Java HotSpot Client VM\&. The 64\-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.RE     
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-D\fIproperty\fR=\fIvalue\fR
-.RS 4
-Sets a system property value\&. The
-\fIproperty\fR
-variable is a string with no spaces that represents the name of the property\&. The
-\fIvalue\fR
-variable is a string that represents the value of the property\&. If
-\fIvalue\fR
-is a string with spaces, then enclose it in quotation marks (for example
-\fB\-Dfoo="foo bar"\fR)\&.
-.RE
-.PP
-\-d32
-.RS 4
-Runs the application in a 32\-bit environment\&. If a 32\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.RE
-.PP
-\-d64
-.RS 4
-Runs the application in a 64\-bit environment\&. If a 64\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.sp
-Currently only the Java HotSpot Server VM supports 64\-bit operation, and the
-\fB\-server\fR
-option is implicit with the use of
-\fB\-d64\fR\&. The
-\fB\-client\fR
-option is ignored with the use of
-\fB\-d64\fR\&. This is subject to change in a future release\&.
-.RE
-.PP
-\-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+-agentpath:\fIpathname\fR[=\fIoptions\fR]
 .br
-\-da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+Loads the native agent library specified by the absolute path name\&. This option is equivalent to \f3-agentlib\fR but uses the full path and file name of the library\&.
+.TP
+-client
+.br
+Selects the Java HotSpot Client VM\&. The 64-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
+
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-D\fIproperty\fR=\fIvalue\fR
+.br
+Sets a system property value\&. The \fIproperty\fR variable is a string with no spaces that represents the name of the property\&. The \fIvalue\fR variable is a string that represents the value of the property\&. If \fIvalue\fR is a string with spaces, then enclose it in quotation marks (for example \f3-Dfoo="foo bar"\fR)\&.
+.TP
+-d32
+.br
+Runs the application in a 32-bit environment\&. If a 32-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+.TP
+-d64
+.br
+Runs the application in a 64-bit environment\&. If a 64-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+
+Currently only the Java HotSpot Server VM supports 64-bit operation, and the \f3-server\fR option is implicit with the use of \f3-d64\fR\&. The \f3-client\fR option is ignored with the use of \f3-d64\fR\&. This is subject to change in a future release\&.
+.TP
+.nf
+-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.br
+.fi
 Disables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-disableassertions\fR
-(\fB\-da\fR) disables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch disables assertions in the specified class\&.
-.sp
-The
-\fB\-disableassertions\fR
-(\fB\-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The
-\fB\-disablesystemassertions\fR
-option enables you to disable assertions in all system classes\&.
-.sp
-To explicitly enable assertions in specific packages or classes, use the
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-disablesystemassertions
+
+With no arguments, \f3-disableassertions\fR (\f3-da\fR) disables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch disables assertions in the specified class\&.
+
+The \f3-disableassertions\fR (\f3-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The \f3-disablesystemassertions\fR option enables you to disable assertions in all system classes\&.
+
+To explicitly enable assertions in specific packages or classes, use the \f3-enableassertions\fR (\f3-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the \f3MyClass\fR application with assertions enabled in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-disablesystemassertions, -dsa
 .br
-\-dsa
-.RS 4
 Disables assertions in all system classes\&.
-.RE
-.PP
-\-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+.nf
+-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 .br
-\-ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+.fi
 Enables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-enableassertions\fR
-(\fB\-ea\fR) enables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch enables assertions in the specified class\&.
-.sp
-The
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The
-\fB\-enablesystemassertions\fR
-option provides a separate switch to enable assertions in all system classes\&.
-.sp
-To explicitly disable assertions in specific packages or classes, use the
-\fB\-disableassertions\fR
-(\fB\-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled only in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-enablesystemassertions
+
+With no arguments, \f3-enableassertions\fR (\f3-ea\fR) enables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch enables assertions in the specified class\&.
+
+The \f3-enableassertions\fR (\f3-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The \f3-enablesystemassertions\fR option provides a separate switch to enable assertions in all system classes\&.
+
+To explicitly disable assertions in specific packages or classes, use the \f3-disableassertions\fR (\f3-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the \f3MyClass\fR application with assertions enabled only in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-enablesystemassertions, -esa
 .br
-\-esa
-.RS 4
 Enables assertions in all system classes\&.
-.RE
-.PP
-\-help
+.TP
+-help, -?
 .br
-\-?
-.RS 4
-Displays usage information for the
-\fBjava\fR
-command without actually running the JVM\&.
-.RE
-.PP
-\-jar \fIfilename\fR
-.RS 4
-Executes a program encapsulated in a JAR file\&. The
-\fIfilename\fR
-argument is the name of a JAR file with a manifest that contains a line in the form
-\fBMain\-Class:\fR\fIclassname\fR
-that defines the class with the
-\fBpublic static void main(String[] args)\fR
-method that serves as your application\*(Aqs starting point\&.
-.sp
-When you use the
-\fB\-jar\fR
-option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
-.sp
+Displays usage information for the \f3java\fR command without actually running the JVM\&.
+.TP
+-jar \fIfilename\fR
+.br
+Executes a program encapsulated in a JAR file\&. The \fIfilename\fR argument is the name of a JAR file with a manifest that contains a line in the form \f3Main-Class:\fR\fIclassname\fR that defines the class with the \f3public static void main(String[] args)\fR method that serves as your application\&'s starting point\&.
+
+When you use the \f3-jar\fR option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
+
 For more information about JAR files, see the following resources:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 The Java Archive (JAR) Files guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/jar/index\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Lesson: Packaging Programs in JAR Files at
+.TP 0.2i    
+\(bu
+Lesson: Packaging Programs in JAR Files at http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
+.RE     
 
-http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
-.RE
-.RE
-.PP
-\-javaagent:\fIjarpath\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the
-\fBjava\&.lang\&.instrument\fR
-package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.PP
-\-jre\-restrict\-search
-.RS 4
-Includes user\-private JREs in the version search\&.
-.RE
-.PP
-\-no\-jre\-restrict\-search
-.RS 4
-Excludes user\-private JREs from the version search\&.
-.RE
-.PP
-\-server
-.RS 4
-Selects the Java HotSpot Server VM\&. The 64\-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.TP
+-javaagent:\fIjarpath\fR[=\fIoptions\fR]
+.br
+Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the \f3java\&.lang\&.instrument\fR package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP
+-jre-restrict-search
+.br
+Includes user-private JREs in the version search\&.
+.TP
+-no-jre-restrict-search
+.br
+Excludes user-private JREs from the version search\&.
+.TP
+-server
+.br
+Selects the Java HotSpot Server VM\&. The 64-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-showversion
-.RS 4
-Displays version information and continues execution of the application\&. This option is equivalent to the
-\fB\-version\fR
-option except that the latter instructs the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-splash:\fIimgname\fR
-.RS 4
-Shows the splash screen with the image specified by
-\fIimgname\fR\&. For example, to show the
-\fBsplash\&.gif\fR
-file from the
-\fBimages\fR
-directory when starting your application, use the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-splash:images/splash\&.gif\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-verbose:class
-.RS 4
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-showversion
+.br
+Displays version information and continues execution of the application\&. This option is equivalent to the \f3-version\fR option except that the latter instructs the JVM to exit after displaying version information\&.
+.TP
+-splash:\fIimgname\fR
+.br
+Shows the splash screen with the image specified by \fIimgname\fR\&. For example, to show the \f3splash\&.gif\fR file from the \f3images\fR directory when starting your application, use the following option:
+.sp     
+.nf     
+\f3\-splash:images/splash\&.gif\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-verbose:class
+.br
 Displays information about each loaded class\&.
-.RE
-.PP
-\-verbose:gc
-.RS 4
+.TP
+-verbose:gc
+.br
 Displays information about each garbage collection (GC) event\&.
-.RE
-.PP
-\-verbose:jni
-.RS 4
+.TP
+-verbose:jni
+.br
 Displays information about the use of native methods and other Java Native Interface (JNI) activity\&.
-.RE
-.PP
-\-version
-.RS 4
-Displays version information and then exits\&. This option is equivalent to the
-\fB\-showversion\fR
-option except that the latter does not instruct the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-version:\fIrelease\fR
-.RS 4
-Specifies the release version to be used for running the application\&. If the version of the
-\fBjava\fR
-command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
-.sp
-The
-\fIrelease\fR
-argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A
-\fIversion string\fR
-is the developer designation of the version number in the following form:
-\fB1\&.\fR\fIx\fR\fB\&.0_\fR\fIu\fR
-(where
-\fIx\fR
-is the major version number, and
-\fIu\fR
-is the update version number)\&. A
-\fIversion range\fR
-is made up of a version string followed by a plus sign (\fB+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\fB*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical
-\fIOR\fR
-combination, or an ampersand (\fB&\fR) for a logical
-\fIAND\fR
-combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Quotation marks are necessary only if there are spaces in the
-\fIrelease\fR
-parameter\&.
-.sp
+.TP
+-version
+.br
+Displays version information and then exits\&. This option is equivalent to the \f3-showversion\fR option except that the latter does not instruct the JVM to exit after displaying version information\&.
+.TP
+-version:\fIrelease\fR
+.br
+Specifies the release version to be used for running the application\&. If the version of the \f3java\fR command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
+
+The \fIrelease\fR argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A \fIversion string\fR is the developer designation of the version number in the following form: \f31\&.\fR\fIx\fR\f3\&.0_\fR\fIu\fR (where \fIx\fR is the major version number, and \fIu\fR is the update version number)\&. A \fIversion range\fR is made up of a version string followed by a plus sign (\f3+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\f3*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical \fIOR\fR combination, or an ampersand (\f3&\fR) for a logical \fIAND\fR combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
+.sp     
+.nf     
+\f3\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Quotation marks are necessary only if there are spaces in the \fIrelease\fR parameter\&.
+
 For JAR files, the preference is to specify version requirements in the JAR file manifest rather than on the command line\&.
-.RE
-.SS "Non\-Standard Options"
-.PP
+.SS NON-STANDARD\ OPTIONS    
 These options are general purpose options that are specific to the Java HotSpot Virtual Machine\&.
-.PP
-\-X
-.RS 4
-Displays help for all available
-\fB\-X\fR
-options\&.
-.RE
-.PP
-\-Xbatch
-.RS 4
-Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The
-\fB\-Xbatch\fR
-flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
-.sp
-This option is equivalent to
-\fB\-XX:\-BackgroundCompilation\fR\&.
-.RE
-.PP
-\-Xbootclasspath:\fIpath\fR
-.RS 4
+.TP
+-X
+.br
+Displays help for all available \f3-X\fR options\&.
+.TP
+-Xbatch
+.br
+Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The \f3-Xbatch\fR flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
+
+This option is equivalent to \f3-XX:-BackgroundCompilation\fR\&.
+.TP
+-Xbootclasspath:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to search for boot class files\&. These are used in place of the boot class files included in the JDK\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+
+\fI\fRDo not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to append to the end of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to prepend to the front of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xcheck:jni
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xcheck:jni
+.br
 Performs additional checks for Java Native Interface (JNI) functions\&. Specifically, it validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request\&. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with an irrecoverable error in such cases\&. Expect a performance degradation when this option is used\&.
-.RE
-.PP
-\-Xcomp
-.RS 4
-Forces compilation of methods on first invocation\&. By default, the Client VM (\fB\-client\fR) performs 1,000 interpreted method invocations and the Server VM (\fB\-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the
-\fB\-Xcomp\fR
-option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
-.sp
-You can also change the number of interpreted method invocations before compilation using the
-\fB\-XX:CompileThreshold\fR
-option\&.
-.RE
-.PP
-\-Xdebug
-.RS 4
+.TP
+-Xcomp
+.br
+Forces compilation of methods on first invocation\&. By default, the Client VM (\f3-client\fR) performs 1,000 interpreted method invocations and the Server VM (\f3-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the \f3-Xcomp\fR option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
+
+You can also change the number of interpreted method invocations before compilation using the \f3-XX:CompileThreshold\fR option\&.
+.TP
+-Xdebug
+.br
 Does nothing\&. Provided for backward compatibility\&.
-.RE
-.PP
-\-Xdiag
-.RS 4
+.TP
+-Xdiag
+.br
 Shows additional diagnostic messages\&.
-.RE
-.PP
-\-Xfuture
-.RS 4
-Enables strict class\-file format checks that enforce close conformance to the class\-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
-.RE
-.PP
-\-Xint
-.RS 4
-Runs the application in interpreted\-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
-.RE
-.PP
-\-Xinternalversion
-.RS 4
-Displays more detailed JVM version information than the
-\fB\-version\fR
-option, and then exits\&.
-.RE
-.PP
-\-Xloggc:\fIfilename\fR
-.RS 4
-Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of
-\fB\-verbose:gc\fR
-with the time elapsed since the first GC event preceding each logged event\&. The
-\fB\-Xloggc\fR
-option overrides
-\fB\-verbose:gc\fR
-if both are given with the same
-\fBjava\fR
-command\&.
-.sp
+.TP
+-Xfuture
+.br
+Enables strict class-file format checks that enforce close conformance to the class-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
+.TP
+-Xint
+.br
+Runs the application in interpreted-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
+.TP
+-Xinternalversion
+.br
+Displays more detailed JVM version information than the \f3-version\fR option, and then exits\&.
+.TP
+-Xloggc:\fIfilename\fR
+.br
+Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of \f3-verbose:gc\fR with the time elapsed since the first GC event preceding each logged event\&. The \f3-Xloggc\fR option overrides \f3-verbose:gc\fR if both are given with the same \f3java\fR command\&.
+
 Example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xloggc:garbage\-collection\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xmaxjitcodesize=\fIsize\fR
-.RS 4
-Specifies the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the value is set to 48 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmaxjitcodesize=48m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ReservedCodeCacheSize\fR\&.
-.RE
-.PP
-\-Xmixed
-.RS 4
+.sp     
+.nf     
+\f3\-Xloggc:garbage\-collection\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xmaxjitcodesize=\fIsize\fR
+.br
+Specifies the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the value is set to 48 MB:
+.sp     
+.nf     
+\f3\-Xmaxjitcodesize=48m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ReservedCodeCacheSize\fR\&.
+.TP
+-Xmixed
+.br
 Executes all bytecode by the interpreter except for hot methods, which are compiled to native code\&.
-.RE
-.PP
-\-Xmn\fIsize\fR
-.RS 4
-Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.TP
+-Xmn\fIsize\fR
+.br
+Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too small, then a lot of minor garbage collections will be performed\&. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial and maximum size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmn256m\fR
-\fB\-Xmn262144k\fR
-\fB\-Xmn268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Instead of the
-\fB\-Xmn\fR
-option to set both the initial and maximum size of the heap for the young generation, you can use
-\fB\-XX:NewSize\fR
-to set the initial size and
-\fB\-XX:MaxNewSize\fR
-to set the maximum size\&.
-.RE
-.PP
-\-Xms\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-Xmn256m\fP
+.fi     
+.nf     
+\f3\-Xmn262144k\fP
+.fi     
+.nf     
+\f3\-Xmn268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Instead of the \f3-Xmn\fR option to set both the initial and maximum size of the heap for the young generation, you can use \f3-XX:NewSize\fR to set the initial size and \f3-XX:MaxNewSize\fR to set the maximum size\&.
+.TP
+-Xms\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xms6291456\fR
-\fB\-Xms6144k\fR
-\fB\-Xms6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the
-\fB\-Xmn\fR
-option or the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-Xmx\fIsize\fR
-.RS 4
-Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-Xms\fR
-and
-\fB\-Xmx\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-Xms6291456\fP
+.fi     
+.nf     
+\f3\-Xms6144k\fP
+.fi     
+.nf     
+\f3\-Xms6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the \f3-Xmn\fR option or the \f3-XX:NewSize\fR option\&.
+.TP
+-Xmx\fIsize\fR
+.br
+Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-Xms\fR and \f3-Xmx\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmx83886080\fR
-\fB\-Xmx81920k\fR
-\fB\-Xmx80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-Xmx\fR
-option is equivalent to
-\fB\-XX:MaxHeapSize\fR\&.
-.RE
-.PP
-\-Xnoclassgc
-.RS 4
+.sp     
+.nf     
+\f3\-Xmx83886080\fP
+.fi     
+.nf     
+\f3\-Xmx81920k\fP
+.fi     
+.nf     
+\f3\-Xmx80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-Xmx\fR option is equivalent to \f3-XX:MaxHeapSize\fR\&.
+.TP
+-Xnoclassgc
+.br
 Disables garbage collection (GC) of classes\&. This can save some GC time, which shortens interruptions during the application run\&.
-.sp
-When you specify
-\fB\-Xnoclassgc\fR
-at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
-.RE
-.PP
-\-Xprof
-.RS 4
+
+When you specify \f3-Xnoclassgc\fR at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
+.TP
+-Xprof
+.br
 Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
-.RE
-.PP
-\-Xrs
-.RS 4
+.TP
+-Xrs
+.br
 Reduces the use of operating system signals by the JVM\&.
-.sp
+
 Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly\&.
-.sp
-The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses
-\fBSIGHUP\fR,
-\fBSIGINT\fR, and
-\fBSIGTERM\fR
-to initiate the running of shutdown hooks\&.
-.sp
-The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses
-\fBSIGQUIT\fR
-to perform thread dumps\&.
-.sp
-Applications embedding the JVM frequently need to trap signals such as
-\fBSIGINT\fR
-or
-\fBSIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The
-\fB\-Xrs\fR
-option is available to address this issue\&. When
-\fB\-Xrs\fR
-is used, the signal masks for
-\fBSIGINT\fR,
-\fBSIGTERM\fR,
-\fBSIGHUP\fR, and
-\fBSIGQUIT\fR
-are not changed by the JVM, and signal handlers for these signals are not installed\&.
-.sp
-There are two consequences of specifying
-\fB\-Xrs\fR:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fBSIGQUIT\fR
-thread dumps are not available\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-User code is responsible for causing shutdown hooks to run, for example, by calling
-\fBSystem\&.exit()\fR
-when the JVM is to be terminated\&.
-.RE
-.RE
-.PP
-\-Xshare:\fImode\fR
-.RS 4
-Sets the class data sharing mode\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+
+The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses \f3SIGHUP\fR, \f3SIGINT\fR, and \f3SIGTERM\fR to initiate the running of shutdown hooks\&.
+
+The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses \f3SIGQUIT\fR to perform thread dumps\&.
+
+Applications embedding the JVM frequently need to trap signals such as \f3SIGINT\fR or \f3SIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The \f3-Xrs\fR option is available to address this issue\&. When \f3-Xrs\fR is used, the signal masks for \f3SIGINT\fR, \f3SIGTERM\fR, \f3SIGHUP\fR, and \f3SIGQUIT\fR are not changed by the JVM, and signal handlers for these signals are not installed\&.
+
+There are two consequences of specifying \f3-Xrs\fR:
+.RS     
+.TP 0.2i    
+\(bu
+\f3SIGQUIT\fR thread dumps are not available\&.
+.TP 0.2i    
+\(bu
+User code is responsible for causing shutdown hooks to run, for example, by calling \f3System\&.exit()\fR when the JVM is to be terminated\&.
+.RE     
+
+.TP
+-Xshare:\fImode\fR
+.br
+Sets the class data sharing mode\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 auto
-.RS 4
-Use shared class data if possible\&. This is the default value for Java HotSpot 32\-Bit Client VM\&.
-.RE
-.PP
+Use shared class data if possible\&. This is the default value for Java HotSpot 32-Bit Client VM\&.
+.TP     
 on
-.RS 4
 Require the use of class data sharing\&. Print an error message and exit if class data sharing cannot be used\&.
-.RE
-.PP
+.TP     
 off
-.RS 4
-Do not use shared class data\&. This is the default value for Java HotSpot 32\-Bit Server VM, Java HotSpot 64\-Bit Client VM, and Java HotSpot 64\-Bit Server VM\&.
-.RE
-.PP
+Do not use shared class data\&. This is the default value for Java HotSpot 32-Bit Server VM, Java HotSpot 64-Bit Client VM, and Java HotSpot 64-Bit Server VM\&.
+.TP     
 dump
-.RS 4
 Manually generate the class data sharing archive\&.
-.RE
-.RE
-.PP
-\-XshowSettings:\fIcategory\fR
-.RS 4
-Shows settings and continues\&. Possible
-\fIcategory\fR
-arguments for this option include the following:
-.PP
+.RE     
+
+.TP
+-XshowSettings:\fIcategory\fR
+.br
+Shows settings and continues\&. Possible \fIcategory\fR arguments for this option include the following:
+.RS     
+.TP     
 all
-.RS 4
 Shows all categories of settings\&. This is the default value\&.
-.RE
-.PP
+.TP     
 locale
-.RS 4
 Shows settings related to locale\&.
-.RE
-.PP
+.TP     
 properties
-.RS 4
 Shows settings related to system properties\&.
-.RE
-.PP
+.TP     
 vm
-.RS 4
 Shows the settings of the JVM\&.
-.RE
-.RE
-.PP
-\-Xss\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate KB,
-\fBm\fR
-or
-\fBM\fR
-to indicate MB,
-\fBg\fR
-or
-\fBG\fR
-to indicate GB\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RE     
+
+.TP
+-Xss\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate KB, \f3m\fR or \f3M\fR to indicate MB, \f3g\fR or \f3G\fR to indicate GB\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xss1m\fR
-\fB\-Xss1024k\fR
-\fB\-Xss1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ThreadStackSize\fR\&.
-.RE
-.PP
-\-Xusealtsigs
-.RS 4
-Use alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. This option is equivalent to
-\fB\-XX:+UseAltSigs\fR\&.
-.RE
-.PP
-\-Xverify:\fImode\fR
-.RS 4
-Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-Xss1m\fP
+.fi     
+.nf     
+\f3\-Xss1024k\fP
+.fi     
+.nf     
+\f3\-Xss1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ThreadStackSize\fR\&.
+.TP
+-Xusealtsigs
+.br
+Use alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. This option is equivalent to \f3-XX:+UseAltSigs\fR\&.
+.TP
+-Xverify:\fImode\fR
+.br
+Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 none
-.RS 4
 Do not verify the bytecode\&. This reduces startup time and also reduces the protection provided by Java\&.
-.RE
-.PP
+.TP     
 remote
-.RS 4
-Verify only those classes that are loaded remotely over the network\&. This is the default behavior if you do not specify the
-\fB\-Xverify\fR
-option\&.
-.RE
-.PP
+Verify those classes that are not loaded by the bootstrap class loader\&. This is the default behavior if you do not specify the \f3-Xverify\fR option\&.
+.TP     
 all
-.RS 4
 Verify all classes\&.
-.RE
-.RE
-.SS "Advanced Runtime Options"
-.PP
+.RE     
+
+.SS ADVANCED\ RUNTIME\ OPTIONS    
 These options control the runtime behavior of the Java HotSpot VM\&.
-.PP
-\-XX:+DisableAttachMechanism
-.RS 4
-Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as
-\fBjcmd\fR,
-\fBjstack\fR,
-\fBjmap\fR, and
-\fBjinfo\fR\&.
-.RE
-.PP
-\-XX:ErrorFile=\fIfilename\fR
-.RS 4
-Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named
-\fBhs_err_pid\fR\fIpid\fR\fB\&.log\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as
-\fB%p\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the error log to
-\fB/var/log/java/java_error\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=/var/log/java/java_error\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is
-\fB/tmp\fR\&.
-.RE
-.PP
-\-XX:+FailOverToOldVerifier
-.RS 4
+.TP
+-XX:+DisableAttachMechanism
+.br
+Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as \f3jcmd\fR, \f3jstack\fR, \f3jmap\fR, and \f3jinfo\fR\&.
+.TP
+-XX:ErrorFile=\fIfilename\fR
+.br
+Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named \f3hs_err_pid\fR\fIpid\fR\f3\&.log\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as \f3%p\fR):
+.sp     
+.nf     
+\f3\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example shows how to set the error log to \f3/var/log/java/java_error\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:ErrorFile=/var/log/java/java_error\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is \f3/tmp\fR\&.
+.TP
+-XX:+FailOverToOldVerifier
+.br
 Enables automatic failover to the old verifier when the new type checker fails\&. By default, this option is disabled and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:LargePageSizeInBytes=\fIsize\fR
-.RS 4
-Sets the maximum size (in bytes) for large pages used for Java heap\&. The
-\fIsize\fR
-argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
-.sp
+.TP
+-XX:LargePageSizeInBytes=\fIsize\fR
+.br
+On Solaris, sets the maximum size (in bytes) for large pages used for Java heap\&. The \fIsize\fR argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
+
 The following example illustrates how to set the large page size to 4 megabytes (MB):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LargePageSizeInBytes=4m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxDirectMemorySize=\fIsize\fR
-.RS 4
-Sets the maximum total size (in bytes) of the New I/O (the
-\fBjava\&.nio\fR
-package) direct\-buffer allocations\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct\-buffer allocations automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:LargePageSizeInBytes=4m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxDirectMemorySize=\fIsize\fR
+.br
+Sets the maximum total size (in bytes) of the New I/O (the \f3java\&.nio\fR package) direct-buffer allocations\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct-buffer allocations automatically\&.
+
 The following examples illustrate how to set the NIO size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxDirectMemorySize=1m\fR
-\fB\-XX:MaxDirectMemorySize=1024k\fR
-\fB\-XX:MaxDirectMemorySize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NativeMemoryTracking=\fImode\fR
-.RS 4
-Specifies the mode for tracking JVM native memory usage\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1m\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NativeMemoryTracking=\fImode\fR
+.br
+Specifies the mode for tracking JVM native memory usage\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 off
-.RS 4
-Do not track JVM native memory usage\&. This is the default behavior if you do not specify the
-\fB\-XX:NativeMemoryTracking\fR
-option\&.
-.RE
-.PP
+Do not track JVM native memory usage\&. This is the default behavior if you do not specify the \f3-XX:NativeMemoryTracking\fR option\&.
+.TP     
 summary
-.RS 4
 Only track memory usage by JVM subsystems, such as Java heap, class, code, and thread\&.
-.RE
-.PP
+.TP     
 detail
-.RS 4
-In addition to tracking memory usage by JVM subsystems, track memory usage by individual
-\fBCallSite\fR, individual virtual memory region and its committed regions\&.
-.RE
-.RE
-.PP
-\-XX:OnError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
-.sp
-The following example shows how the
-\fB\-XX:OnError\fR
-option can be used to run the
-\fBgcore\fR
-command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the
-\fB%p\fR
-designates the current process):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:OnError="gcore %p;dbx \- %p"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:OnOutOfMemoryError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an
-\fBOutOfMemoryError\fR
-exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the
-\fB\-XX:OnError\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintCommandLineFlags
-.RS 4
+In addition to tracking memory usage by JVM subsystems, track memory usage by individual \f3CallSite\fR, individual virtual memory region and its committed regions\&.
+.RE     
+
+.TP
+-XX:ObjectAlignmentInBytes=\fIalignment\fR
+.br
+Sets the memory alignment of Java objects (in bytes)\&. By default, the value is set to 8 bytes\&. The specified value should be a power of two, and must be within the range of 8 and 256 (inclusive)\&. This option makes it possible to use compressed pointers with large Java heap sizes\&.
+
+The heap size limit in bytes is calculated as:
+
+\f34GB * ObjectAlignmentInBytes\fR
+
+Note: As the alignment value increases, the unused space between objects will also increase\&. As a result, you may not realize any benefits from using compressed pointers with large Java heap sizes\&.
+.TP
+-XX:OnError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
+
+\fI\fRThe following example shows how the \f3-XX:OnError\fR option can be used to run the \f3gcore\fR command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the \f3%p\fR designates the current process):
+.sp     
+.nf     
+\f3\-XX:OnError="gcore %p;dbx \- %p"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:OnOutOfMemoryError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an \f3OutOfMemoryError\fR exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the \f3-XX:OnError\fR option\&.
+.TP
+-XX:+PerfDataSaveToFile
+.br
+If enabled, saves jstat(1) binary data when the Java application exits\&. This binary data is saved in a file named \f3hsperfdata_\fR\fI<pid>\fR, where \fI<pid>\fR is the process identifier of the Java application you ran\&. Use \f3jstat\fR to display the performance data contained in this file as follows:
+.sp     
+.nf     
+\f3jstat \-class file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.nf     
+\f3jstat \-gc file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintCommandLineFlags
+.br
 Enables printing of ergonomically selected JVM flags that appeared on the command line\&. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector\&. By default, this option is disabled and flags are not printed\&.
-.RE
-.PP
-\-XX:+PrintNMTStatistics
-.RS 4
-Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see
-\fB\-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
-.RE
-.PP
-\-XX:+RelaxAccessControlCheck
-.RS 4
+.TP
+-XX:+PrintNMTStatistics
+.br
+Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see \f3-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
+.TP
+-XX:+RelaxAccessControlCheck
+.br
 Decreases the amount of access control checks in the verifier\&. By default, this option is disabled, and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:+ShowMessageBoxOnError
-.RS 4
+.TP
+-XX:+ShowMessageBoxOnError
+.br
 Enables displaying of a dialog box when the JVM experiences an irrecoverable error\&. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:ThreadStackSize=\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP
+-XX:ThreadStackSize=\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples show how to set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ThreadStackSize=1m\fR
-\fB\-XX:ThreadStackSize=1024k\fR
-\fB\-XX:ThreadStackSize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-Xss\fR\&.
-.RE
-.PP
-\-XX:+TraceClassLoading
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ThreadStackSize=1m\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-Xss\fR\&.
+.TP
+-XX:+TraceClassLoading
+.br
 Enables tracing of classes as they are loaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassLoadingPreorder
-.RS 4
+.TP
+-XX:+TraceClassLoadingPreorder
+.br
 Enables tracing of all loaded classes in the order in which they are referenced\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassResolution
-.RS 4
+.TP
+-XX:+TraceClassResolution
+.br
 Enables tracing of constant pool resolutions\&. By default, this option is disabled and constant pool resolutions are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassUnloading
-.RS 4
+.TP
+-XX:+TraceClassUnloading
+.br
 Enables tracing of classes as they are unloaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceLoaderConstraints
-.RS 4
+.TP
+-XX:+TraceLoaderConstraints
+.br
 Enables tracing of the loader constraints recording\&. By default, this option is disabled and loader constraints recording is not traced\&.
-.RE
-.PP
-\-XX:+UseAltSigs
-.RS 4
-Enables the use of alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to
-\fB\-Xusealtsigs\fR\&.
-.RE
-.PP
-\-XX:\-UseBiasedLocking
-.RS 4
-Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning\-139912\&.html#section4\&.2\&.5
-.sp
+.TP
+-XX:+UseAltSigs
+.br
+Enables the use of alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to \f3-Xusealtsigs\fR\&.
+.TP
+-XX:-UseBiasedLocking
+.br
+Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning-139912\&.html#section4\&.2\&.5
+
 By default, this option is enabled\&.
-.RE
-.PP
-\-XX:\-UseCompressedOops
-.RS 4
-Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32\-bit offsets instead of 64\-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64\-bit JVMs\&.
-.RE
-.PP
-\-XX:\-UseLargePages
-.RS 4
-Disables the use of large page memory\&. This option is enabled by default\&.
-.sp
-For more information, see Java Support for Large Memory Pages at http://www\&.oracle\&.com/technetwork/java/javase/tech/largememory\-jsp\-137182\&.html
-.RE
-.PP
-\-XX:+UseMembar
-.RS 4
+.TP
+-XX:-UseCompressedOops
+.br
+Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32-bit offsets instead of 64-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64-bit JVMs\&.
+
+It is also possible to use compressed pointers when Java heap sizes are greater than 32GB\&. See the \f3-XX:ObjectAlignmentInBytes\fR option\&.
+.TP
+-XX:+UseHugeTLBFS
+.br
+This option for Linux is the equivalent of specifying \f3-XX:+UseLargePages\fR\&. This option is disabled by default\&. This option pre-allocates all large pages up-front, when memory is reserved; consequently the JVM cannot dynamically grow or shrink large pages memory areas; see \f3-XX:UseTransparentHugePages\fR if you want this behavior\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseLargePages
+.br
+Enables the use of large page memory\&. By default, this option is disabled and large page memory is not used\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseMembar
+.br
 Enables issuing of membars on thread state transitions\&. This option is disabled by default on all platforms except ARM servers, where it is enabled\&. (It is recommended that you do not disable this option on ARM servers\&.)
-.RE
-.PP
-\-XX:+UsePerfData
-.RS 4
-Enables the
-\fBperfdata\fR
-feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the
-\fBhsperfdata_userid\fR
-directories\&. To disable the
-\fBperfdata\fR
-feature, specify
-\fB\-XX:\-UsePerfData\fR\&.
-.RE
-.PP
-\-XX:+AllowUserSignalHandlers
-.RS 4
+.TP
+-XX:+UsePerfData
+.br
+Enables the \f3perfdata\fR feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the \f3hsperfdata_userid\fR directories\&. To disable the \f3perfdata\fR feature, specify \f3-XX:-UsePerfData\fR\&.
+.TP
+-XX:+UseTransparentHugePages
+.br
+On Linux, enables the use of large pages that can dynamically grow or shrink\&. This option is disabled by default\&. You may encounter performance problems with transparent huge pages as the OS moves other pages around to create huge pages; this option is made available for experimentation\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+AllowUserSignalHandlers
+.br
 Enables installation of signal handlers by the application\&. By default, this option is disabled and the application is not allowed to install signal handlers\&.
-.RE
-.SS "Advanced JIT Compiler Options"
-.PP
-These options control the dynamic just\-in\-time (JIT) compilation performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveOpts
-.RS 4
+.SS ADVANCED\ JIT\ COMPILER\ OPTIONS    
+These options control the dynamic just-in-time (JIT) compilation performed by the Java HotSpot VM\&.
+.TP
+-XX:+AggressiveOpts
+.br
 Enables the use of aggressive performance optimization features, which are expected to become default in upcoming releases\&. By default, this option is disabled and experimental performance features are not used\&.
-.RE
-.PP
-\-XX:AllocateInstancePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocateInstancePrefetchLines=\fIlines\fR
+.br
 Sets the number of lines to prefetch ahead of the instance allocation pointer\&. By default, the number of lines to prefetch is set to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocateInstancePrefetchLines=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocateInstancePrefetchLines=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchDistance=\fIsize\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchDistance=\fIsize\fR
+.br
 Sets the size (in bytes) of the prefetch distance for object allocation\&. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object\&. Each Java thread has its own allocation point\&.
-.sp
-Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to \-1\&.
-.sp
+
+Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to -1\&.
+
 The following example shows how to set the prefetch distance to 1024 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchDistance=1024\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchDistance=1024\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchInstr=\fIinstruction\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchInstr=\fIinstruction\fR
+.br
 Sets the prefetch instruction to prefetch ahead of the allocation pointer\&. Only the Java HotSpot Server VM supports this option\&. Possible values are from 0 to 3\&. The actual instructions behind the values depend on the platform\&. By default, the prefetch instruction is set to 0:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchInstr=0\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchInstr=0\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchLines=\fIlines\fR
+.br
 Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code\&. The default value is 1 if the last allocated object was an instance, and 3 if it was an array\&.
-.sp
+
 The following example shows how to set the number of loaded cache lines to 5:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchLines=5\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchLines=5\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStepSize=\fIsize\fR
-.RS 4
-Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the step size is set to 16 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchStepSize=16\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-XX:AllocatePrefetchStepSize=\fIsize\fR
+.br
+Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the step size is set to 16 bytes:
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchStepSize=16\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStyle=\fIstyle\fR
-.RS 4
-Sets the generated code style for prefetch instructions\&. The
-\fIstyle\fR
-argument is an integer from 0 to 3:
-.PP
+.TP
+-XX:AllocatePrefetchStyle=\fIstyle\fR
+.br
+Sets the generated code style for prefetch instructions\&. The \fIstyle\fR argument is an integer from 0 to 3:
+.RS     
+.TP     
 0
-.RS 4
 Do not generate prefetch instructions\&.
-.RE
-.PP
+.TP     
 1
-.RS 4
 Execute prefetch instructions after each allocation\&. This is the default parameter\&.
-.RE
-.PP
+.TP     
 2
-.RS 4
-Use the thread\-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
-.RE
-.PP
+Use the thread-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
+.TP     
 3
-.RS 4
 Use BIS instruction on SPARC for allocation prefetch\&.
-.RE
-.sp
+.RE     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+BackgroundCompilation
-.RS 4
-Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify
-\fB\-XX:\-BackgroundCompilation\fR
-(this is equivalent to specifying
-\fB\-Xbatch\fR)\&.
-.RE
-.PP
-\-XX:CICompilerCount=\fIthreads\fR
-.RS 4
+.TP
+-XX:+BackgroundCompilation
+.br
+Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify \f3-XX:-BackgroundCompilation\fR (this is equivalent to specifying \f3-Xbatch\fR)\&.
+.TP
+-XX:CICompilerCount=\fIthreads\fR
+.br
 Sets the number of compiler threads to use for compilation\&. By default, the number of threads is set to 2 for the server JVM, to 1 for the client JVM, and it scales to the number of cores if tiered compilation is used\&. The following example shows how to set the number of threads to 2:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CICompilerCount=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
-.RS 4
-Sets the minimum free space (in bytes) required for compilation\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CodeCacheMinimumFreeSpace=1024m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
-.RS 4
-Specifies a command to perform on a method\&. For example, to exclude the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the
-\fBindexOf(String)\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all
-\fBindexOf()\fR
-methods in all classes from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,*\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to
-\fB\-XX:CompileCommand\fR
-using spaces as separators by enclosing the argument in quotation marks:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude java/lang/String indexOf"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that after parsing the commands passed on the command line using the
-\fB\-XX:CompileCommand\fR
-options, the JIT compiler then reads commands from the
-\fB\&.hotspot_compiler\fR
-file\&. You can add commands to this file or specify a different file using the
-\fB\-XX:CompileCommandFile\fR
-option\&.
-.sp
-To add several commands, either specify the
-\fB\-XX:CompileCommand\fR
-option multiple times, or separate each argument with the newline separator (\fB\en\fR)\&. The following commands are available:
-.PP
+.sp     
+.nf     
+\f3\-XX:CICompilerCount=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
+.br
+Sets the minimum free space (in bytes) required for compilation\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
+.sp     
+.nf     
+\f3\-XX:CodeCacheMinimumFreeSpace=1024m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
+.br
+Specifies a command to perform on a method\&. For example, to exclude the \f3indexOf()\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the \f3indexOf(String)\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all \f3indexOf()\fR methods in all classes from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,*\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to \f3-XX:CompileCommand\fR using spaces as separators by enclosing the argument in quotation marks:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude java/lang/String indexOf"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that after parsing the commands passed on the command line using the \f3-XX:CompileCommand\fR options, the JIT compiler then reads commands from the \f3\&.hotspot_compiler\fR file\&. You can add commands to this file or specify a different file using the \f3-XX:CompileCommandFile\fR option\&.
+
+To add several commands, either specify the \f3-XX:CompileCommand\fR option multiple times, or separate each argument with the newline separator (\f3\en\fR)\&. The following commands are available:
+.RS     
+.TP     
 break
-.RS 4
 Set a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method\&.
-.RE
-.PP
+.TP     
 compileonly
-.RS 4
-Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the
-\fB\-XX:CompileOnly\fR
-option, which allows to specify several methods\&.
-.RE
-.PP
+Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the \f3-XX:CompileOnly\fR option, which allows to specify several methods\&.
+.TP     
 dontinline
-.RS 4
 Prevent inlining of the specified method\&.
-.RE
-.PP
+.TP     
 exclude
-.RS 4
 Exclude the specified method from compilation\&.
-.RE
-.PP
+.TP     
 help
-.RS 4
-Print a help message for the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
+Print a help message for the \f3-XX:CompileCommand\fR option\&.
+.TP     
 inline
-.RS 4
 Attempt to inline the specified method\&.
-.RE
-.PP
+.TP     
 log
-.RS 4
-Exclude compilation logging (with the
-\fB\-XX:+LogCompilation\fR
-option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
-.RE
-.PP
+Exclude compilation logging (with the \f3-XX:+LogCompilation\fR option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
+.TP     
 option
-.RS 4
-This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the
-\fBBlockLayoutByFrequency\fR
-option for the
-\fBappend()\fR
-method of the
-\fBStringBuffer\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the \f3BlockLayoutByFrequency\fR option for the \f3append()\fR method of the \f3StringBuffer\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 You can specify multiple compilation options, separated by commas or spaces\&.
-.RE
-.PP
+.TP     
 print
-.RS 4
 Print generated assembler code after compilation of the specified method\&.
-.RE
-.PP
+.TP     
 quiet
-.RS 4
-Do not print the compile commands\&. By default, the commands that you specify with the \-\fBXX:CompileCommand\fR
-option are printed; for example, if you exclude from compilation the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class, then the following will be printed to standard output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBCompilerOracle: exclude java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can suppress this by specifying the
-\fB\-XX:CompileCommand=quiet\fR
-option before other
-\fB\-XX:CompileCommand\fR
-options\&.
-.RE
-.RE
-.PP
-\-XX:CompileCommandFile=\fIfilename\fR
-.RS 4
-Sets the file from which JIT compiler commands are read\&. By default, the
-\fB\&.hotspot_compiler\fR
-file is used to store commands performed by the JIT compiler\&.
-.sp
-Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the
-\fBtoString()\fR
-method of the
-\fBString\fR
-class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBprint java/lang/String toString\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-For more information about specifying the commands for the JIT compiler to perform on methods, see the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
-\-XX:CompileOnly=\fImethods\fR
-.RS 4
-Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the
-\fBlength()\fR
-method of the
-\fBString\fR
-class and the
-\fBsize()\fR
-method of the
-\fBList\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Do not print the compile commands\&. By default, the commands that you specify with the -\f3XX:CompileCommand\fR option are printed; for example, if you exclude from compilation the \f3indexOf()\fR method of the \f3String\fR class, then the following will be printed to standard output:
+.sp     
+.nf     
+\f3CompilerOracle: exclude java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can suppress this by specifying the \f3-XX:CompileCommand=quiet\fR option before other \f3-XX:CompileCommand\fR options\&.
+.RE     
+
+.TP
+-XX:CompileCommandFile=\fIfilename\fR
+.br
+Sets the file from which JIT compiler commands are read\&. By default, the \f3\&.hotspot_compiler\fR file is used to store commands performed by the JIT compiler\&.
+
+Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the \f3toString()\fR method of the \f3String\fR class:
+.sp     
+.nf     
+\f3print java/lang/String toString\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+For more information about specifying the commands for the JIT compiler to perform on methods, see the \f3-XX:CompileCommand\fR option\&.
+.TP
+-XX:CompileOnly=\fImethods\fR
+.br
+Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the \f3length()\fR method of the \f3String\fR class and the \f3size()\fR method of the \f3List\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Although wildcards are not supported, you can specify only the class or package name to compile all methods in that class or package, as well as specify just the method to compile methods with this name in any class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\fR
-\fB\-XX:CompileOnly=java/lang\fR
-\fB\-XX:CompileOnly=\&.length\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileThreshold=\fIinvocations\fR
-.RS 4
-Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. The following example shows how to set the number of interpreted method invocations to 5,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileThreshold=5000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can completely disable interpretation of Java methods before compilation by specifying the
-\fB\-Xcomp\fR
-option\&.
-.RE
-.PP
-\-XX:+DoEscapeAnalysis
-.RS 4
-Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify
-\fB\-XX:\-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:InitialCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the initial code cache size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to 500 KB\&. The following example shows how to set the initial code cache size to 32 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialCodeCacheSize=32k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+Inline
-.RS 4
-Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify
-\fB\-XX:\-Inline\fR\&.
-.RE
-.PP
-\-XX:InlineSmallCode=\fIsize\fR
-.RS 4
-Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InlineSmallCode=1000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+LogCompilation
-.RS 4
-Enables logging of compilation activity to a file named
-\fBhotspot\&.log\fR
-in the current working directory\&. You can specify a different log file path and name using the
-\fB\-XX:LogFile\fR
-option\&.
-.sp
-By default, this option is disabled and compilation activity is not logged\&. The
-\fB\-XX:+LogCompilation\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.sp
-You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the
-\fB\-XX:+PrintCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:MaxInlineSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxInlineSize=35\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNodeLimit=\fInodes\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=java/lang\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=\&.length\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileThreshold=\fIinvocations\fR
+.br
+Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. This option is ignored when tiered compilation is enabled; see the option \f3-XX:+TieredCompilation\fR\&. The following example shows how to set the number of interpreted method invocations to 5,000:
+.sp     
+.nf     
+\f3\-XX:CompileThreshold=5000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can completely disable interpretation of Java methods before compilation by specifying the \f3-Xcomp\fR option\&.
+.TP
+-XX:+DoEscapeAnalysis
+.br
+Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify \f3-XX:-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:InitialCodeCacheSize=\fIsize\fR
+.br
+Sets the initial code cache size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to 500 KB\&. The initial code cache size should be not less than the system\&'s minimal memory page size\&. The following example shows how to set the initial code cache size to 32 KB:
+.sp     
+.nf     
+\f3\-XX:InitialCodeCacheSize=32k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+Inline
+.br
+Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify \f3-XX:-Inline\fR\&.
+.TP
+-XX:InlineSmallCode=\fIsize\fR
+.br
+Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
+.sp     
+.nf     
+\f3\-XX:InlineSmallCode=1000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+LogCompilation
+.br
+Enables logging of compilation activity to a file named \f3hotspot\&.log\fR in the current working directory\&. You can specify a different log file path and name using the \f3-XX:LogFile\fR option\&.
+
+By default, this option is disabled and compilation activity is not logged\&. The \f3-XX:+LogCompilation\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+
+You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the \f3-XX:+PrintCompilation\fR option\&.
+.TP
+-XX:MaxInlineSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxInlineSize=35\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNodeLimit=\fInodes\fR
+.br
 Sets the maximum number of nodes to be used during single method compilation\&. By default, the maximum number of nodes is set to 65,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxNodeLimit=65000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxTrivialSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTrivialSize=6\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+OptimizeStringConcat
-.RS 4
-Enables the optimization of
-\fBString\fR
-concatenation operations\&. This option is enabled by default\&. To disable the optimization of
-\fBString\fR
-concatenation operations, specify
-\fB\-XX:\-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+PrintAssembly
-.RS 4
-Enables printing of assembly code for bytecoded and native methods by using the external
-\fBdisassembler\&.so\fR
-library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
-.sp
-By default, this option is disabled and assembly code is not printed\&. The
-\fB\-XX:+PrintAssembly\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:+PrintCompilation
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxNodeLimit=65000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxTrivialSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxTrivialSize=6\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+OptimizeStringConcat
+.br
+Enables the optimization of \f3String\fR concatenation operations\&. This option is enabled by default\&. To disable the optimization of \f3String\fR concatenation operations, specify \f3-XX:-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:+PrintAssembly
+.br
+Enables printing of assembly code for bytecoded and native methods by using the external \f3disassembler\&.so\fR library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
+
+By default, this option is disabled and assembly code is not printed\&. The \f3-XX:+PrintAssembly\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:+PrintCompilation
+.br
 Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled\&. This enables you to see which methods actually get compiled\&. By default, this option is disabled and diagnostic output is not printed\&.
-.sp
-You can also log compilation activity to a file by using the
-\fB\-XX:+LogCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintInlining
-.RS 4
+
+You can also log compilation activity to a file by using the \f3-XX:+LogCompilation\fR option\&.
+.TP
+-XX:+PrintInlining
+.br
 Enables printing of inlining decisions\&. This enables you to see which methods are getting inlined\&.
-.sp
-By default, this option is disabled and inlining information is not printed\&. The
-\fB\-XX:+PrintInlining\fR
-option has to be used together with the
-\fB\-XX:+UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:ReservedCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. This option is equivalent to
-\fB\-Xmaxjitcodesize\fR\&.
-.RE
-.PP
-\-XX:+TieredCompilation
-.RS 4
+
+By default, this option is disabled and inlining information is not printed\&. The \f3-XX:+PrintInlining\fR option has to be used together with the \f3-XX:+UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:ReservedCodeCacheSize=\fIsize\fR
+.br
+Sets the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. This option has a limit of 2 GB; otherwise, an error is generated\&. The maximum code cache size should not be less than the initial code cache size; see the option \f3-XX:InitialCodeCacheSize\fR\&. This option is equivalent to \f3-Xmaxjitcodesize\fR\&.
+.TP
+-XX:RTMAbortRatio=\fIabort_ratio\fR
+.br
+The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the \f3-XX:+UseRTMDeopt\fR option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
+.TP
+-XX:RTMRetryCount=\fInumber_of_retries\fR
+.br
+RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The \f3-XX:UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+TieredCompilation
+.br
 Enables the use of tiered compilation\&. By default, this option is enabled\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseAES
-.RS 4
-Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
-.RE
-.PP
-\-XX:+UseAESIntrinsics
-.RS 4
-UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32\-bit and 64\-bit\&. To disable hardware\-based AES intrinsics, specify
-\fB\-XX:\-UseAES \-XX:\-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:+UseAES \-XX:+UseAESIntrinsics\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To support UseAES and UseAESIntrinsics flags for 32\-bit and 64\-bit use
-\fB\-server\fR
-option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
-.RE
-.PP
-\-XX:+UseCodeCacheFlushing
-.RS 4
-Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify
-\fB\-XX:\-UseCodeCacheFlushing\fR\&.
-.RE
-.PP
-\-XX:+UseCondCardMark
-.RS 4
+.TP
+-XX:+UseAES
+.br
+Enables hardware-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
+.TP
+-XX:+UseAESIntrinsics
+.br
+UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32-bit and 64-bit\&. To disable hardware-based AES intrinsics, specify \f3-XX:-UseAES -XX:-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
+.sp     
+.nf     
+\f3\-XX:+UseAES \-XX:+UseAESIntrinsics\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To support UseAES and UseAESIntrinsics flags for 32-bit and 64-bit use \f3-server\fR option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
+.TP
+-XX:+UseCodeCacheFlushing
+.br
+Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify \f3-XX:-UseCodeCacheFlushing\fR\&.
+.TP
+-XX:+UseCondCardMark
+.br
 Enables checking of whether the card is already marked before updating the card table\&. This option is disabled by default and should only be used on machines with multiple sockets, where it will increase performance of Java applications that rely heavily on concurrent operations\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseSuperWord
-.RS 4
-Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify
-\fB\-XX:\-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.SS "Experimental JIT Compiler Options"
-.PP
-The options related to the Restricted Transactional Memory (RTM) locking feature in this section are experimental and are not officially supported in Java SE 8u20; you must enable the
-\fB\-XX:+UnlockExperimentalVMOptions\fR
-option to use them\&. These options are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
-.PP
-\-XX:RTMAbortRatio=\fIabort_ratio\fR
-.RS 4
-The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the
-\fB\-XX:+UseRTMDeopt\fR
-option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
-.RE
-.PP
-\-XX:RTMRetryCount=\fInumber_of_retries\fR
-.RS 4
-RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMDeopt
-.RS 4
-Auto\-tunes RTM locking depending on the abort ratio\&. This ratio is specified by
-\fB\-XX:RTMAbortRatio\fR
-option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMLocking
-.RS 4
-Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&.
-.sp
-RTM is part of Intel\*(Aqs Transactional Synchronization Extensions (TSX), which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions
-\fBXBEGIN\fR,
-\fBXABORT\fR,
-\fBXEND\fR, and
-\fBXTEST\fR\&. The
-\fBXBEGIN\fR
-and
-\fBXEND\fR
-instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the
-\fBXEND\fR
-instruction\&. The
-\fBXABORT\fR
-instruction can be used to explicitly abort a transaction and the
-\fBXEND\fR
-instruction to check if a set of instructions are being run in a transaction\&.
-.sp
-A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\*(Aqs system\&.
-.sp
-RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse\-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse\-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine\-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping\-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
-.RE
-.SS "Advanced Serviceability Options"
-.PP
+.TP
+-XX:+UseRTMDeopt
+.br
+Auto-tunes RTM locking depending on the abort ratio\&. This ratio is specified by \f3-XX:RTMAbortRatio\fR option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The \f3-XX:+UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+UseRTMLocking
+.br
+Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&. Options related to RTM are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
+
+RTM is part of Intel\&'s TSX, which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions \f3XBEGIN\fR, \f3XABORT\fR, \f3XEND\fR, and \f3XTEST\fR\&. The \f3XBEGIN\fR and \f3XEND\fR instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the \f3XEND\fR instruction\&. The \f3XABORT\fR instruction can be used to explicitly abort a transaction and the \f3XEND\fR instruction to check if a set of instructions are being run in a transaction\&.
+
+A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\&'s system\&.
+
+RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
+.TP
+-XX:+UseSHA
+.br
+Enables hardware-based intrinsics for SHA crypto hash functions for SPARC hardware\&. \f3UseSHA\fR is used in conjunction with the \f3UseSHA1Intrinsics\fR, \f3UseSHA256Intrinsics\fR, and \f3UseSHA512Intrinsics\fR options\&.
+
+The \f3UseSHA\fR and \f3UseSHA*Intrinsics\fR flags are enabled by default, and are supported only for Java HotSpot Server VM 64-bit on SPARC T4 and newer\&.
+
+This feature is only applicable when using the \f3sun\&.security\&.provider\&.Sun\fR provider for SHA operations\&.
+
+To disable all hardware-based SHA intrinsics, specify \f3-XX:-UseSHA\fR\&. To disable only a particular SHA intrinsic, use the appropriate corresponding option\&. For example: \f3-XX:-UseSHA256Intrinsics\fR\&.
+.TP
+-XX:+UseSHA1Intrinsics
+.br
+Enables intrinsics for SHA-1 crypto hash function\&.
+.TP
+-XX:+UseSHA256Intrinsics
+.br
+Enables intrinsics for SHA-224 and SHA-256 crypto hash functions\&.
+.TP
+-XX:+UseSHA512Intrinsics
+.br
+Enables intrinsics for SHA-384 and SHA-512 crypto hash functions\&.
+.TP
+-XX:+UseSuperWord
+.br
+Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify \f3-XX:-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.SS ADVANCED\ SERVICEABILITY\ OPTIONS    
 These options provide the ability to gather system information and perform extensive debugging\&.
-.PP
-\-XX:+ExtendedDTraceProbes
-.RS 4
-Enables additional
-\fBdtrace\fR
-tool probes that impact the performance\&. By default, this option is disabled and
-\fBdtrace\fR
-performs only standard probes\&.
-.RE
-.PP
-\-XX:+HeapDumpOnOutOfMemory
-.RS 4
-Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a
-\fBjava\&.lang\&.OutOfMemoryError\fR
-exception is thrown\&. You can explicitly set the heap dump file path and name using the
-\fB\-XX:HeapDumpPath\fR
-option\&. By default, this option is disabled and the heap is not dumped when an
-\fBOutOfMemoryError\fR
-exception is thrown\&.
-.RE
-.PP
-\-XX:HeapDumpPath=\fIpath\fR
-.RS 4
-Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the
-\fB\-XX:+HeapDumpOnOutOfMemoryError\fR
-option is set\&. By default, the file is created in the current working directory, and it is named
-\fBjava_pid\fR\fIpid\fR\fB\&.hprof\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\fB%p\fR
-represents the current process identificator):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the heap dump file to
-\fB/var/log/java/java_heapdump\&.hprof\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:LogFile=\fIpath\fR
-.RS 4
-Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named
-\fBhotspot\&.log\fR\&.
-.sp
-The following example shows how to set the log file to
-\fB/var/log/java/hotspot\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LogFile=/var/log/java/hotspot\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+PrintClassHistogram
-.RS 4
-Enables printing of a class instance histogram after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjmap \-histo\fR
-command, or the
-\fBjcmd \fR\fIpid\fR\fB GC\&.class_histogram\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+PrintConcurrentLocks
-.RS 4
-Enables printing of j locks after a event\&. By default, this option is disabled\&.
-.sp
-Enables printing of j\fBava\&.util\&.concurrent\fR
-locks after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjstack \-l\fR
-command or the
-\fBjcmd \fR\fIpid\fR\fB Thread\&.print \-l\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+UnlockDiagnosticVMOptions
-.RS 4
+.TP
+-XX:+ExtendedDTraceProbes
+.br
+Enables additional \f3dtrace\fR tool probes that impact the performance\&. By default, this option is disabled and \f3dtrace\fR performs only standard probes\&.
+.TP
+-XX:+HeapDumpOnOutOfMemory
+.br
+Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a \f3java\&.lang\&.OutOfMemoryError\fR exception is thrown\&. You can explicitly set the heap dump file path and name using the \f3-XX:HeapDumpPath\fR option\&. By default, this option is disabled and the heap is not dumped when an \f3OutOfMemoryError\fR exception is thrown\&.
+.TP
+-XX:HeapDumpPath=\fIpath\fR
+.br
+Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the \f3-XX:+HeapDumpOnOutOfMemoryError\fR option is set\&. By default, the file is created in the current working directory, and it is named \f3java_pid\fR\fIpid\fR\f3\&.hprof\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\f3%p\fR represents the current process identificator):
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fI\fRThe following example shows how to set the heap dump file to \f3/var/log/java/java_heapdump\&.hprof\fR:
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:LogFile=\fIpath\fR
+.br
+Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named \f3hotspot\&.log\fR\&.
+
+\fI\fRThe following example shows how to set the log file to \f3/var/log/java/hotspot\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:LogFile=/var/log/java/hotspot\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintClassHistogram
+.br
+\fI\fREnables printing of a class instance histogram after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jmap -histo\fR command, or the \f3jcmd\fR\fIpid\fR\f3GC\&.class_histogram\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP     
+-XX:+PrintConcurrentLocks
+
+
+Enables printing of \f3java\&.util\&.concurrent\fR locks after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jstack -l\fR command or the \f3jcmd\fR\fIpid\fR\f3Thread\&.print -l\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP
+-XX:+UnlockDiagnosticVMOptions
+.br
 Unlocks the options intended for diagnosing the JVM\&. By default, this option is disabled and diagnostic options are not available\&.
-.RE
-.SS "Advanced Garbage Collection Options"
-.PP
+.SS ADVANCED\ GARBAGE\ COLLECTION\ OPTIONS    
 These options control how garbage collection (GC) is performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveHeap
-.RS 4
-Enables Java heap optimization\&. This sets various parameters to be optimal for long\-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
-.RE
-.PP
-\-XX:+AlwaysPreTouch
-.RS 4
-Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the
-\fBmain()\fR
-method\&. The option can be used in testing to simulate a long\-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
-.RE
-.PP
-\-XX:+CMSClassUnloadingEnabled
-.RS 4
-Enables class unloading when using the concurrent mark\-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify
-\fB\-XX:\-CMSClassUnloadingEnabled\fR\&.
-.RE
-.PP
-\-XX:CMSExpAvgFactor=\fIpercent\fR
-.RS 4
+.TP
+-XX:+AggressiveHeap
+.br
+Enables Java heap optimization\&. This sets various parameters to be optimal for long-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
+.TP
+-XX:+AlwaysPreTouch
+.br
+Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the \f3main()\fR method\&. The option can be used in testing to simulate a long-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
+.TP
+-XX:+CMSClassUnloadingEnabled
+.br
+Enables class unloading when using the concurrent mark-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify \f3-XX:-CMSClassUnloadingEnabled\fR\&.
+.TP
+-XX:CMSExpAvgFactor=\fIpercent\fR
+.br
 Sets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics\&. By default, the exponential averages factor is set to 25%\&. The following example shows how to set the factor to 15%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSExpAvgFactor=15\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
-.RS 4
-Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to \-1\&. Any negative value (including the default) implies that
-\fB\-XX:CMSTriggerRatio\fR
-is used to define the value of the initiating occupancy fraction\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:CMSExpAvgFactor=15\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
+.br
+Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to -1\&. Any negative value (including the default) implies that \f3-XX:CMSTriggerRatio\fR is used to define the value of the initiating occupancy fraction\&.
+
 The following example shows how to set the occupancy fraction to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSInitiatingOccupancyFraction=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+CMSScavengeBeforeRemark
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSInitiatingOccupancyFraction=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+CMSScavengeBeforeRemark
+.br
 Enables scavenging attempts before the CMS remark step\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:CMSTriggerRatio=\fIpercent\fR
-.RS 4
-Sets the percentage (0 to 100) of the value specified by
-\fB\-XX:MinHeapFreeRatio\fR
-that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
-.sp
+.TP
+-XX:CMSTriggerRatio=\fIpercent\fR
+.br
+Sets the percentage (0 to 100) of the value specified by \f3-XX:MinHeapFreeRatio\fR that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
+
 The following example shows how to set the occupancy fraction to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSTriggerRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:ConcGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSTriggerRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:ConcGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for concurrent GC\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for concurrent GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ConcGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+DisableExplicitGC
-.RS 4
-Enables the option that disables processing of calls to
-\fBSystem\&.gc()\fR\&. This option is disabled by default, meaning that calls to
-\fBSystem\&.gc()\fR
-are processed\&. If processing of calls to
-\fBSystem\&.gc()\fR
-is disabled, the JVM still performs GC when necessary\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrent
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:G1HeapRegionSize=\fIsize\fR
-.RS 4
-Sets the size of the regions into which the Java heap is subdivided when using the garbage\-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:ConcGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+DisableExplicitGC
+.br
+Enables the option that disables processing of calls to \f3System\&.gc()\fR\&. This option is disabled by default, meaning that calls to \f3System\&.gc()\fR are processed\&. If processing of calls to \f3System\&.gc()\fR is disabled, the JVM still performs GC when necessary\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrent
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:G1HeapRegionSize=\fIsize\fR
+.br
+Sets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
+
 The following example shows how to set the size of the subdivisions to 16 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1HeapRegionSize=16m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+G1PrintHeapRegions
-.RS 4
+.sp     
+.nf     
+\f3\-XX:G1HeapRegionSize=16m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+G1PrintHeapRegions
+.br
 Enables the printing of information about which regions are allocated and which are reclaimed by the G1 collector\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:G1ReservePercent=\fIpercent\fR
-.RS 4
+.TP
+-XX:G1ReservePercent=\fIpercent\fR
+.br
 Sets the percentage of the heap (0 to 50) that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector\&. By default, this option is set to 10%\&.
-.sp
+
 The following example shows how to set the reserved heap to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1ReservePercent=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitialHeapSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:G1ReservePercent=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitialHeapSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialHeapSize=6291456\fR
-\fB\-XX:InitialHeapSize=6144k\fR
-\fB\-XX:InitialHeapSize=6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-XX:InitialSurvivorRatio=\fIratio\fR
-.RS 4
-Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the
-\fB\-XX:+UseParallelGC\fR
-and/or \-\fBXX:+UseParallelOldGC\fR
-options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the
-\fB\-XX:+UseParallelGC\fR
-and
-\fB\-XX:+UseParallelOldGC\fR
-options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-option), then the
-\fB\-XX:SurvivorRatio\fR
-option should be used to set the size of the survivor space for the entire execution of the application\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:InitialHeapSize=6291456\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6144k\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the \f3-XX:NewSize\fR option\&.
+.TP
+-XX:InitialSurvivorRatio=\fIratio\fR
+.br
+Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the \f3-XX:+UseParallelGC\fR and/or -\f3XX:+UseParallelOldGC\fR options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the \f3-XX:+UseParallelGC\fR and \f3-XX:+UseParallelOldGC\fR options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the \f3-XX:-UseAdaptiveSizePolicy\fR option), then the \f3-XX:SurvivorRatio\fR option should be used to set the size of the survivor space for the entire execution of the application\&.
+
 The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBS=Y/(R+2)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3S=Y/(R+2)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The 2 in the equation denotes two survivor spaces\&. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size\&.
-.sp
+
 By default, the initial survivor space ratio is set to 8\&. If the default value for the young generation space size is used (2 MB), the initial size of the survivor space will be 0\&.2 MB\&.
-.sp
+
 The following example shows how to set the initial survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialSurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitialSurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
+.br
 Sets the percentage of the heap occupancy (0 to 100) at which to start a concurrent GC cycle\&. It is used by garbage collectors that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (for example, the G1 garbage collector)\&.
-.sp
+
 By default, the initiating value is set to 45%\&. A value of 0 implies nonstop GC cycles\&. The following example shows how to set the initiating heap occupancy to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitiatingHeapOccupancyPercent=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxGCPauseMillis=\fItime\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitiatingHeapOccupancyPercent=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxGCPauseMillis=\fItime\fR
+.br
 Sets a target for the maximum GC pause time (in milliseconds)\&. This is a soft goal, and the JVM will make its best effort to achieve it\&. By default, there is no maximum pause time value\&.
-.sp
+
 The following example shows how to set the maximum target pause time to 500 ms:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxGCPauseMillis=500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxHeapSize=\fIsize\fR
-.RS 4
-Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-XX:InitialHeapSize\fR
-and
-\fB\-XX:MaxHeapSize\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:MaxGCPauseMillis=500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxHeapSize=\fIsize\fR
+.br
+Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-XX:InitialHeapSize\fR and \f3-XX:MaxHeapSize\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapSize=83886080\fR
-\fB\-XX:MaxHeapSize=81920k\fR
-\fB\-XX:MaxHeapSize=80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:MaxHeapSize=83886080\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=81920k\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus overhead amounts\&. On Oracle Solaris 2\&.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&.
-.sp
-The
-\fB\-XX:MaxHeapSize\fR
-option is equivalent to
-\fB\-Xmx\fR\&.
-.RE
-.PP
-\-XX:MaxHeapFreeRatio=\fIpercent\fR
-.RS 4
+
+The \f3-XX:MaxHeapSize\fR option is equivalent to \f3-Xmx\fR\&.
+.TP
+-XX:MaxHeapFreeRatio=\fIpercent\fR
+.br
 Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space expands above this value, then the heap will be shrunk\&. By default, this value is set to 70%\&.
-.sp
+
 The following example shows how to set the maximum free heap ratio to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapFreeRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxMetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxHeapFreeRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxMetaspaceSize=\fIsize\fR
+.br
 Sets the maximum amount of native memory that can be allocated for class metadata\&. By default, the size is not limited\&. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system\&.
-.sp
+
 The following example shows how to set the maximum class metadata size to 256 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxMetaspaceSize=256m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNewSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxMetaspaceSize=256m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNewSize=\fIsize\fR
+.br
 Sets the maximum size (in bytes) of the heap for the young generation (nursery)\&. The default value is set ergonomically\&.
-.RE
-.PP
-\-XX:MaxTenuringThreshold=\fIthreshold\fR
-.RS 4
+.TP
+-XX:MaxTenuringThreshold=\fIthreshold\fR
+.br
 Sets the maximum tenuring threshold for use in adaptive GC sizing\&. The largest value is 15\&. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector\&.
-.sp
+
 The following example shows how to set the maximum tenuring threshold to 10:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTenuringThreshold=10\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxTenuringThreshold=10\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MetaspaceSize=\fIsize\fR
+.br
 Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded\&. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used\&. The default size depends on the platform\&.
-.RE
-.PP
-\-XX:MinHeapFreeRatio=\fIpercent\fR
-.RS 4
+.TP
+-XX:MinHeapFreeRatio=\fIpercent\fR
+.br
 Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space falls below this value, then the heap will be expanded\&. By default, this value is set to 40%\&.
-.sp
+
 The following example shows how to set the minimum free heap ratio to 25%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MinHeapFreeRatio=25\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MinHeapFreeRatio=25\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewRatio=\fIratio\fR
+.br
 Sets the ratio between young and old generation sizes\&. By default, this option is set to 2\&. The following example shows how to set the young/old ratio to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewRatio=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:NewRatio=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too low, then a large number of minor GCs will be performed\&. If the size is too high, then only full GCs will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewSize=256m\fR
-\fB\-XX:NewSize=262144k\fR
-\fB\-XX:NewSize=268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-XX:NewSize\fR
-option is equivalent to
-\fB\-Xmn\fR\&.
-.RE
-.PP
-\-XX:ParallelGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:NewSize=256m\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=262144k\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-XX:NewSize\fR option is equivalent to \f3-Xmn\fR\&.
+.TP
+-XX:ParallelGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for parallel garbage collection in the young and old generations\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for parallel GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ParallelGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+ParallelRefProcEnabled
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ParallelGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+ParallelRefProcEnabled
+.br
 Enables parallel reference processing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintAdaptiveSizePolicy
-.RS 4
+.TP
+-XX:+PrintAdaptiveSizePolicy
+.br
 Enables printing of information about adaptive generation sizing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGC
-.RS 4
+.TP
+-XX:+PrintGC
+.br
 Enables printing of messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationConcurrentTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationConcurrentTime
+.br
 Enables printing of how much time elapsed since the last pause (for example, a GC pause)\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationStoppedTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationStoppedTime
+.br
 Enables printing of how much time the pause (for example, a GC pause) lasted\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDateStamps
-.RS 4
+.TP
+-XX:+PrintGCDateStamps
+.br
 Enables printing of a date stamp at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDetails
-.RS 4
+.TP
+-XX:+PrintGCDetails
+.br
 Enables printing of detailed messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTaskTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTaskTimeStamps
+.br
 Enables printing of time stamps for every individual GC worker thread task\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTimeStamps
+.br
 Enables printing of time stamps at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintStringDeduplicationStatistics
-.RS 4
-Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintTenuringDistribution
-.RS 4
+.TP
+-XX:+PrintStringDeduplicationStatistics
+.br
+Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:+PrintTenuringDistribution
+.br
 Enables printing of tenuring age information\&. The following is an example of the output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBDesired survivor size 48286924 bytes, new threshold 10 (max 10)\fR
-\fB\- age 1: 28992024 bytes, 28992024 total\fR
-\fB\- age 2: 1366864 bytes, 30358888 total\fR
-\fB\- age 3: 1425912 bytes, 31784800 total\fR
-\fB\&.\&.\&.\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3Desired survivor size 48286924 bytes, new threshold 10 (max 10)\fP
+.fi     
+.nf     
+\f3\- age 1: 28992024 bytes, 28992024 total\fP
+.fi     
+.nf     
+\f3\- age 2: 1366864 bytes, 30358888 total\fP
+.fi     
+.nf     
+\f3\- age 3: 1425912 bytes, 31784800 total\fP
+.fi     
+.nf     
+\f3\&.\&.\&.\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Age 1 objects are the youngest survivors (they were created after the previous scavenge, survived the latest scavenge, and moved from eden to survivor space)\&. Age 2 objects have survived two scavenges (during the second scavenge they were copied from one survivor space to the next)\&. And so on\&.
-.sp
+
 In the preceding example, 28 992 024 bytes survived one scavenge and were copied from eden to survivor space, 1 366 864 bytes are occupied by age 2 objects, etc\&. The third value in each row is the cumulative size of objects of age n or less\&.
-.sp
+
 By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+ScavengeBeforeFullGC
-.RS 4
-Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you
-\fIdo not\fR
-disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify
-\fB\-XX:\-ScavengeBeforeFullGC\fR\&.
-.RE
-.PP
-\-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
-.RS 4
-Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The
-\fB\-XX:SoftRefLRUPolicyMSPerMB\fR
-option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the
-\fB\-Xmx\fR
-option has a significant effect on how quickly soft references are garbage collected\&.
-.sp
+.TP
+-XX:+ScavengeBeforeFullGC
+.br
+Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you \fIdo not\fR disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify \f3-XX:-ScavengeBeforeFullGC\fR\&.
+.TP
+-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
+.br
+Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The \f3-XX:SoftRefLRUPolicyMSPerMB\fR option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the \f3-Xmx\fR option has a significant effect on how quickly soft references are garbage collected\&.
+
 The following example shows how to set the value to 2\&.5 seconds:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SoftRefLRUPolicyMSPerMB=2500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
-.RS 4
-\fBString\fR
-objects reaching the specified age are considered candidates for deduplication\&. An object\*(Aqs age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the
-\fB\-XX:+PrintTenuringDistribution\fR
-option\&. Note that
-\fBString\fR
-objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is
-\fB3\fR\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:SurvivorRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SoftRefLRUPolicyMSPerMB=2500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
+.br
+\f3String\fR objects reaching the specified age are considered candidates for deduplication\&. An object\&'s age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the \f3-XX:+PrintTenuringDistribution\fR option\&. Note that \f3String\fR objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is \f33\fR\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:SurvivorRatio=\fIratio\fR
+.br
 Sets the ratio between eden space size and survivor space size\&. By default, this option is set to 8\&. The following example shows how to set the eden/survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TargetSurvivorRatio=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TargetSurvivorRatio=\fIpercent\fR
+.br
 Sets the desired percentage of survivor space (0 to 100) used after young garbage collection\&. By default, this option is set to 50%\&.
-.sp
+
 The following example shows how to set the target survivor space ratio to 30%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TargetSurvivorRatio=30\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TLABSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of a thread\-local allocation buffer (TLAB)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:TargetSurvivorRatio=30\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TLABSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of a thread-local allocation buffer (TLAB)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
+
 The following example shows how to set the initial TLAB size to 512 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TLABSize=512k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+UseAdaptiveSizePolicy
-.RS 4
-Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-and set the size of the memory allocation pool explicitly (see the
-\fB\-XX:SurvivorRatio\fR
-option)\&.
-.RE
-.PP
-\-XX:+UseCMSInitiatingOccupancyOnly
-.RS 4
+.sp     
+.nf     
+\f3\-XX:TLABSize=512k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+UseAdaptiveSizePolicy
+.br
+Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify \f3-XX:-UseAdaptiveSizePolicy\fR and set the size of the memory allocation pool explicitly (see the \f3-XX:SurvivorRatio\fR option)\&.
+.TP
+-XX:+UseCMSInitiatingOccupancyOnly
+.br
 Enables the use of the occupancy value as the only criterion for initiating the CMS collector\&. By default, this option is disabled and other criteria may be used\&.
-.RE
-.PP
-\-XX:+UseConcMarkSweepGC
-.RS 4
-Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\fB\-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\fB\-XX:+UseG1GC\fR) is another alternative\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the
-\fB\-XX:+UseParNewGC\fR
-option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8:
-\fB\-XX:+UseConcMarkSweepGC \-XX:\-UseParNewGC\fR\&.
-.RE
-.PP
-\-XX:+UseG1GC
-.RS 4
-Enables the use of the garbage\-first (G1) garbage collector\&. It is a server\-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
-.sp
+.TP
+-XX:+UseConcMarkSweepGC
+.br
+Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\f3-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\f3-XX:+UseG1GC\fR) is another alternative\&.
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the \f3-XX:+UseParNewGC\fR option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8: \f3-XX:+UseConcMarkSweepGC -XX:-UseParNewGC\fR\&.
+.TP
+-XX:+UseG1GC
+.br
+Enables the use of the garbage-first (G1) garbage collector\&. It is a server-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
+
 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseGCOverheadLimit
-.RS 4
-Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an
-\fBOutOfMemoryError\fR
-exception is thrown\&. This option is enabled, by default and the parallel GC will throw an
-\fBOutOfMemoryError\fR
-if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify
-\fB\-XX:\-UseGCOverheadLimit\fR\&.
-.RE
-.PP
-\-XX:+UseNUMA
-.RS 4
-Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\*(Aqs use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\fB\-XX:+UseParallelGC\fR)\&.
-.RE
-.PP
-\-XX:+UseParallelGC
-.RS 4
+.TP
+-XX:+UseGCOverheadLimit
+.br
+Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an \f3OutOfMemoryError\fR exception is thrown\&. This option is enabled, by default and the parallel GC will throw an \f3OutOfMemoryError\fR if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify \f3-XX:-UseGCOverheadLimit\fR\&.
+.TP
+-XX:+UseNUMA
+.br
+Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\&'s use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\f3-XX:+UseParallelGC\fR)\&.
+.TP
+-XX:+UseParallelGC
+.br
 Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the
-\fB\-XX:+UseParallelOldGC\fR
-option is automatically enabled, unless you explicitly disable it\&.
-.RE
-.PP
-\-XX:+UseParallelOldGC
-.RS 4
-Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the
-\fB\-XX:+UseParallelGC\fR
-option\&.
-.RE
-.PP
-\-XX:+UseParNewGC
-.RS 4
-Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&. Using the
-\fB\-XX:+UseParNewGC\fR
-option without the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option was deprecated in JDK 8\&.
-.RE
-.PP
-\-XX:+UseSerialGC
-.RS 4
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the \f3-XX:+UseParallelOldGC\fR option is automatically enabled, unless you explicitly disable it\&.
+.TP
+-XX:+UseParallelOldGC
+.br
+Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the \f3-XX:+UseParallelGC\fR option\&.
+.TP
+-XX:+UseParNewGC
+.br
+Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the \f3-XX:+UseConcMarkSweepGC\fR option\&. Using the \f3-XX:+UseParNewGC\fR option without the \f3-XX:+UseConcMarkSweepGC\fR option was deprecated in JDK 8\&.
+.TP
+-XX:+UseSerialGC
+.br
 Enables the use of the serial garbage collector\&. This is generally the best choice for small and simple applications that do not require any special functionality from garbage collection\&. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseStringDeduplication
-.RS 4
-Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage\-first (G1) garbage collector\&. See the
-\fB\-XX:+UseG1GC\fR
-option\&.
-.sp
-\fIString deduplication\fR
-reduces the memory footprint of
-\fBString\fR
-objects on the Java heap by taking advantage of the fact that many
-\fBString\fR
-objects are identical\&. Instead of each
-\fBString\fR
-object pointing to its own character array, identical
-\fBString\fR
-objects can point to and share the same character array\&.
-.RE
-.PP
-\-XX:+UseTLAB
-.RS 4
-Enables the use of thread\-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify
-\fB\-XX:\-UseTLAB\fR\&.
-.RE
-.SS "Deprecated and Removed Options"
-.PP
+.TP
+-XX:+UseSHM
+.br
+On Linux, enables the JVM to use shared memory to setup large pages\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseStringDeduplication
+.br
+Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage-first (G1) garbage collector\&. See the \f3-XX:+UseG1GC\fR option\&.
+
+\fIString deduplication\fR reduces the memory footprint of \f3String\fR objects on the Java heap by taking advantage of the fact that many \f3String\fR objects are identical\&. Instead of each \f3String\fR object pointing to its own character array, identical \f3String\fR objects can point to and share the same character array\&.
+.TP
+-XX:+UseTLAB
+.br
+Enables the use of thread-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify \f3-XX:-UseTLAB\fR\&.
+.SS DEPRECATED\ AND\ REMOVED\ OPTIONS    
 These options were included in the previous release, but have since been considered unnecessary\&.
-.PP
-\-Xincgc
-.RS 4
+.TP
+-Xincgc
+.br
 Enables incremental garbage collection\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-Xrun\fIlibname\fR
-.RS 4
-Loads the specified debugging/profiling library\&. This option was superseded by the
-\fB\-agentlib\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycle=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when
-\fB\-XX:+CMSIncrementalPacing\fR
-is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalMode
-.RS 4
-Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with
-\fBCMSIncremental\fR\&.
-.RE
-.PP
-\-XX:CMSIncrementalOffset=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalPacing
-.RS 4
-Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
-.RS 4
+.TP
+-Xrun\fIlibname\fR
+.br
+Loads the specified debugging/profiling library\&. This option was superseded by the \f3-agentlib\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycle=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when \f3-XX:+CMSIncrementalPacing\fR is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalMode
+.br
+Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with \f3CMSIncremental\fR\&.
+.TP
+-XX:CMSIncrementalOffset=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalPacing
+.br
+Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
+.br
 Sets the percentage of the permanent generation occupancy (0 to 100) at which to start a GC\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-XX:MaxPermSize=\fIsize\fR
-.RS 4
-Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the
-\fB\-XX:MaxMetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:PermSize=\fIsize\fR
-.RS 4
-Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the
-\fB\-XX:MetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:+UseSplitVerifier
-.RS 4
+.TP
+-XX:MaxPermSize=\fIsize\fR
+.br
+Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the \f3-XX:MaxMetaspaceSize\fR option\&.
+.TP
+-XX:PermSize=\fIsize\fR
+.br
+Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the \f3-XX:MetaspaceSize\fR option\&.
+.TP
+-XX:+UseSplitVerifier
+.br
 Enables splitting of the verification process\&. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime)\&. This option was deprecated in JDK 8, and verification is now split by default without a way to disable it\&.
-.RE
-.PP
-\-XX:+UseStringCache
-.RS 4
+.TP
+-XX:+UseStringCache
+.br
 Enables caching of commonly allocated strings\&. This option was removed from JDK 8 with no replacement\&.
-.RE
-.SH "PERFORMANCE TUNING EXAMPLES"
-.PP
+.SH PERFORMANCE\ TUNING\ EXAMPLES    
 The following examples show how to use experimental tuning flags to either optimize throughput or to provide lower response time\&.
 .PP
-\fBExample 1\fR
-.br
-Tuning for Higher Throughput
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+\f3Example 1 Tuning for Higher Throughput\fR
+.sp     
+.nf     
+\f3java \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Tuning for Lower Response Time\fR
+.sp     
+.nf     
+\f3java \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH LARGE\ PAGES    
+Also known as huge pages, large pages are memory pages that are significantly larger than the standard memory page size (which varies depending on the processor and operating system)\&. Large pages optimize processor Translation-Lookaside Buffers\&.
 .PP
-\fBExample 2\fR
-.br
-Tuning for Lower Response Time
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "EXIT STATUS"
+A Translation-Lookaside Buffer (TLB) is a page translation cache that holds the most-recently used virtual-to-physical address translations\&. TLB is a scarce system resource\&. A TLB miss can be costly as the processor must then read from the hierarchical page table, which may require multiple memory accesses\&. By using a larger memory page size, a single TLB entry can represent a larger memory range\&. There will be less pressure on TLB, and memory-intensive applications may have better performance\&.
 .PP
-The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call
-\fBSystem\&.exit(exitValue)\fR\&. The values are:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB0\fR: Successful completion
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB>0\fR: An error occurred
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+However, large pages page memory can negatively affect system performance\&. For example, when a large mount of memory is pinned by an application, it may create a shortage of regular memory and cause excessive paging in other applications and slow down the entire system\&. Also, a system that has been up for a long time could produce excessive fragmentation, which could make it impossible to reserve enough large page memory\&. When this happens, either the OS or JVM reverts to using regular pages\&.
+.SS LARGE\ PAGES\ SUPPORT    
+Solaris and Linux support large pages\&.
+.PP
+Solaris 9 and later include Multiple Page Size Support (MPSS); no additional configuration is necessary\&. See http://www\&.oracle\&.com/technetwork/server-storage/solaris10/overview/solaris9-features-scalability-135663\&.html\&.
+.PP
+The 2\&.6 kernel supports large pages\&. Some vendors have backported the code to their 2\&.4-based releases\&. To check if your system can support large page memory, try the following:
+.sp     
+.nf     
+\f3# cat /proc/meminfo | grep Huge\fP
+.fi     
+.nf     
+\f3HugePages_Total: 0\fP
+.fi     
+.nf     
+\f3HugePages_Free: 0\fP
+.fi     
+.nf     
+\f3Hugepagesize: 2048 kB\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If the output shows the three "Huge" variables, then your system can support large page memory but it needs to be configured\&. If the command prints nothing, then your system does not support large pages\&. To configure the system to use large page memory, login as \f3root\fR, and then follow these steps:
+.TP 0.4i    
+1\&.
+If you are using the option \f3-XX:+UseSHM\fR (instead of \f3-XX:+UseHugeTLBFS\fR), then increase the \f3SHMMAX\fR value\&. It must be larger than the Java heap size\&. On a system with 4 GB of physical RAM (or less), the following will make all the memory sharable:
+.sp     
+.nf     
+\f3# echo 4294967295 > /proc/sys/kernel/shmmax\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP 0.4i    
+2\&.
+If you are using the option \f3-XX:+UseSHM\fR or \f3-XX:+UseHugeTLBFS\fR, then specify the number of large pages\&. In the following example, 3 GB of a 4 GB system are reserved for large pages (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048 kB = 1536):
+.sp     
+.nf     
+\f3# echo 1536 > /proc/sys/vm/nr_hugepages\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.PP
+Note
+.PP
+Note that the values contained in \f3/proc\fR will reset after you reboot your system, so may want to set them in an initialization script (for example, \f3rc\&.local\fR or \f3sysctl\&.conf\fR)\&.
+.PP
+If you configure (or resize) the OS kernel parameters \f3/proc/sys/kernel/shmmax\fR or \f3/proc/sys/vm/nr_hugepages\fR, Java processes may allocate large pages for areas in addition to the Java heap\&. These steps can allocate large pages for the following areas:
+.PP
+Java heap
+.PP
+Permanent generation
+.PP
+Code cache
+.PP
+The marking bitmap data structure for the parallel GC
+.PP
+Consequently, if you configure the \f3nr_hugepages\fR parameter to the size of the Java heap, then the JVM can fail in allocating the permanent generation and code cache areas on large pages because these areas are quite large in size\&.
+.SH EXIT\ STATUS    
+The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call \f3System\&.exit(exitValue)\fR\&. The values are:
+.TP 0.2i    
+\(bu
+\f30\fR: Successful completion
+.TP 0.2i    
+\(bu
+\f3>0\fR: An error occurred
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 javac(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.TP 0.2i    
+\(bu
+jstat(1)
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/bsd/doc/man/javac.1 b/src/bsd/doc/man/javac.1
index a3d55e2..5cc8c18 100644
--- a/src/bsd/doc/man/javac.1
+++ b/src/bsd/doc/man/javac.1
@@ -1,2116 +1,1370 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: javac
-.\" Language: English
-.\" Date: 8 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: javac.1
 .\"
 .if n .pl 99999
-.TH "javac" "1" "8 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH javac 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 javac \- Reads Java class and interface definitions and compiles them into bytecode and class files\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjavac\fR [ \fIoptions\fR ] [ \fIsourcefiles\fR ] [ \fIclasses\fR] [ \fI@argfiles\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
 Arguments can be in any order:
-.PP
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options\&. See Options\&.
-.RE
-.PP
+Command-line options\&. See Options\&.
+.TP     
 \fIsourcefiles\fR
-.RS 4
-One or more source files to be compiled (such as
-\fBMyClass\&.java\fR)\&.
-.RE
-.PP
+One or more source files to be compiled (such as \f3MyClass\&.java\fR)\&.
+.TP     
 \fIclasses\fR
-.RS 4
-One or more classes to be processed for annotations (such as
-\fBMyPackage\&.MyClass\fR)\&.
-.RE
-.PP
+One or more classes to be processed for annotations (such as \f3MyPackage\&.MyClass\fR)\&.
+.TP     
 \fI@argfiles\fR
-.RS 4
-One or more files that list options and source files\&. The
-\fB\-J\fR
-options are not allowed in these files\&. See Command\-Line Argument Files\&.
-.RE
-.SH "DESCRIPTION"
+One or more files that list options and source files\&. The \f3-J\fR options are not allowed in these files\&. See Command-Line Argument Files\&.
+.SH DESCRIPTION    
+The \f3javac\fR command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The \f3javac\fR command can also process annotations in Java source files and classes\&.
 .PP
-The
-\fBjavac\fR
-command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The
-\fBjavac\fR
-command can also process annotations in Java source files and classes\&.
-.PP
-There are two ways to pass source code file names to
-\fBjavac\fR\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+There are two ways to pass source code file names to \f3javac\fR\&.
+.TP 0.2i    
+\(bu
 For a small number of source files, list the file names on the command line\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the
-\fBjavac\fR
-command\&.
-.RE
+.TP 0.2i    
+\(bu
+For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the \f3javac\fR command\&.
 .PP
-Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called
-\fBMyClass\fR
-would be written in a source file called
-\fBMyClass\&.java\fR
-and compiled into a bytecode class file called
-\fBMyClass\&.class\fR\&.
+Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called \f3MyClass\fR would be written in a source file called \f3MyClass\&.java\fR and compiled into a bytecode class file called \f3MyClass\&.class\fR\&.
 .PP
-Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as
-\fBMyClass$MyInnerClass\&.class\fR\&.
+Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as \f3MyClass$MyInnerClass\&.class\fR\&.
 .PP
-Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in
-\fB/workspace\fR, then put the source code for
-\fBcom\&.mysoft\&.mypack\&.MyClass\fR
-in
-\fB/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
+Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in \f3/workspace\fR, then put the source code for \f3com\&.mysoft\&.mypack\&.MyClass\fR in \f3/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
 .PP
-By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.SH "OPTIONS"
-.PP
-The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the
-\fB\-X\fR
-option\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-See also Cross\-Compilation Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the \f3-d\fR option\&.
+.SH OPTIONS    
+The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the \f3-X\fR option\&.
+.TP 0.2i    
+\(bu
+See also Cross-Compilation Options
+.TP 0.2i    
+\(bu
 See also Nonstandard Options
-.RE
-.SS "Standard Options"
-.PP
-\-A\fIkey\fR[\fI=value\fR]
-.RS 4
-Specifies options to pass to annotation processors\&. These options are not interpreted by
-\fBjavac\fR
-directly, but are made available for use by individual processors\&. The
-\fBkey\fR
-value should be one or more identifiers separated by a dot (\&.)\&.
-.RE
-.PP
-\-cp \fIpath\fR or \-classpath \fIpath\fR
-.RS 4
-Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the
-\fBCLASSPATH\fR
-environment variable\&. If neither
-\fBCLASSPATH\fR,
-\fB\-cp\fR
-nor
-\fB\-classpath\fR
-is specified, then the user
-\fIclass path\fR
-is the current directory\&. See Setting the Class Path \&.
-.sp
-If the
-\fB\-sourcepath\fR
-option is not specified, then the user class path is also searched for source files\&.
-.sp
-If the
-\fB\-processorpath\fR
-option is not specified, then the class path is also searched for annotation processors\&.
-.RE
-.PP
-\-Djava\&.ext\&.dirs=\fIdirectories\fR
-.RS 4
+.SS STANDARD\ OPTIONS    
+.TP
+-A\fIkey\fR[\fI=value\fR]
+.br
+Specifies options to pass to annotation processors\&. These options are not interpreted by \f3javac\fR directly, but are made available for use by individual processors\&. The \f3key\fR value should be one or more identifiers separated by a dot (\&.)\&.
+.TP
+-cp \fIpath\fR or -classpath \fIpath\fR
+.br
+Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the \f3CLASSPATH\fR environment variable\&. If neither \f3CLASSPATH\fR, \f3-cp\fR nor \f3-classpath\fR is specified, then the user \fIclass path\fR is the current directory\&. See Setting the Class Path\&.
+
+If the \f3-sourcepath\fR option is not specified, then the user class path is also searched for source files\&.
+
+If the \f3-processorpath\fR option is not specified, then the class path is also searched for annotation processors\&.
+.TP
+-Djava\&.ext\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of installed extensions\&.
-.RE
-.PP
-\-Djava\&.endorsed\&.dirs=\fIdirectories\fR
-.RS 4
+.TP
+-Djava\&.endorsed\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-d \fIdirectory\fR
-.RS 4
-Sets the destination directory for class files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then
-\fBjavac\fR
-puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-d\fR
-\fB/home/myclasses\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the class file is
-\fB/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
-.sp
-If the
-\fI\-d\fR
-option is not specified, then
-\fBjavac\fR
-puts each class file in the same directory as the source file from which it was generated\&.
-.sp
-\fBNote:\fR
-The directory specified by the
-\fI\-d\fR
-option is not automatically added to your user class path\&.
-.RE
-.PP
-\-deprecation
-.RS 4
-Shows a description of each use or override of a deprecated member or class\&. Without the
-\fB\-deprecation\fR
-option,
-\fBjavac\fR
-shows a summary of the source files that use or override deprecated members or classes\&. The
-\fB\-deprecation\fR
-option is shorthand for
-\fB\-Xlint:deprecation\fR\&.
-.RE
-.PP
-\-encoding \fIencoding\fR
-.RS 4
-Sets the source file encoding name, such as EUC\-JP and UTF\-8\&. If the
-\fB\-encoding\fR
-option is not specified, then the platform default converter is used\&.
-.RE
-.PP
-\-endorseddirs \fIdirectories\fR
-.RS 4
+.TP
+-d \fIdirectory\fR
+.br
+Sets the destination directory for class files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then \f3javac\fR puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-d\fR\f3/home/myclasses\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the class file is \f3/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
+
+If the \fI-d\fR option is not specified, then \f3javac\fR puts each class file in the same directory as the source file from which it was generated\&.
+
+\fINote:\fR The directory specified by the \fI-d\fR option is not automatically added to your user class path\&.
+.TP
+-deprecation
+.br
+Shows a description of each use or override of a deprecated member or class\&. Without the \f3-deprecation\fR option, \f3javac\fR shows a summary of the source files that use or override deprecated members or classes\&. The \f3-deprecation\fR option is shorthand for \f3-Xlint:deprecation\fR\&.
+.TP
+-encoding \fIencoding\fR
+.br
+Sets the source file encoding name, such as EUC-JP and UTF-8\&. If the \f3-encoding\fR option is not specified, then the platform default converter is used\&.
+.TP
+-endorseddirs \fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-extdirs \fIdirectories\fR
-.RS 4
-Overrides the location of the
-\fBext\fR
-directory\&. The directories variable is a colon\-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
-.sp
-If you are cross\-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross\-Compilation Options for more information\&.
-.RE
-.PP
-\-g
-.RS 4
+.TP
+-extdirs \fIdirectories\fR
+.br
+Overrides the location of the \f3ext\fR directory\&. The directories variable is a colon-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
+
+If you are cross-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross-Compilation Options for more information\&.
+.TP
+-g
+.br
 Generates all debugging information, including local variables\&. By default, only line number and source file information is generated\&.
-.RE
-.PP
-\-g:none
-.RS 4
+.TP
+-g:none
+.br
 Does not generate any debugging information\&.
-.RE
-.PP
-\-g:[\fIkeyword list\fR]
-.RS 4
+.TP
+-g:[\fIkeyword list\fR]
+.br
 Generates only some kinds of debugging information, specified by a comma separated list of keywords\&. Valid keywords are:
-.PP
+.RS     
+.TP     
 source
-.RS 4
 Source file debugging information\&.
-.RE
-.PP
+.TP     
 lines
-.RS 4
 Line number debugging information\&.
-.RE
-.PP
+.TP     
 vars
-.RS 4
 Local variable debugging information\&.
-.RE
-.RE
-.PP
-\-help
-.RS 4
+.RE     
+
+.TP
+-help
+.br
 Prints a synopsis of standard options\&.
-.RE
-.PP
-\-implicit:[\fIclass, none\fR]
-.RS 4
-Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use
-\fB\-implicit:class\fR\&. To suppress class file generation, use
-\fB\-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the
-\fB\-implicit\fR
-option is set explicitly\&. See Searching for Types\&.
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Passes
-\fBoption\fR
-to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example,
-\fB\-J\-Xms48m\fR
-sets the startup memory to 48 MB\&. See
-java(1)\&.
-.sp
-\fBNote:\fR
-The
-\fICLASSPATH\fR,
-\fB\-classpath\fR,
-\fB\-bootclasspath\fR, and
-\fB\-extdirs\fR
-options do not specify the classes used to run
-\fBjavac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the
-\fB\-J\fR
-option to pass options through to the underlying Java launcher\&.
-.RE
-.PP
-\-nowarn
-.RS 4
-Disables warning messages\&. This option operates the same as the
-\fB\-Xlint:none\fR
-option\&.
-.RE
-.PP
-\-parameters
-.RS 4
-Stores formal parameter names of constructors and methods in the generated class file so that the method
-\fBjava\&.lang\&.reflect\&.Executable\&.getParameters\fR
-from the Reflection API can retrieve them\&.
-.RE
-.PP
-\-proc: [\fInone\fR, \fIonly\fR]
-.RS 4
-Controls whether annotation processing and compilation are done\&.
-\fB\-proc:none\fR
-means that compilation takes place without annotation processing\&.
-\fB\-proc:only\fR
-means that only annotation processing is done, without any subsequent compilation\&.
-.RE
-.PP
-\-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
-.RS 4
+.TP
+-implicit:[\fIclass, none\fR]
+.br
+Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use \f3-implicit:class\fR\&. To suppress class file generation, use \f3-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the \f3-implicit\fR option is set explicitly\&. See Searching for Types\&.
+.TP
+-J\fIoption\fR
+.br
+Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
+
+\fINote:\fR The \fICLASSPATH\fR, \f3-classpath\fR, \f3-bootclasspath\fR, and \f3-extdirs\fR options do not specify the classes used to run \f3javac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the \f3-J\fR option to pass options through to the underlying \f3\fRJava launcher\&.
+.TP
+-nowarn
+.br
+Disables warning messages\&. This option operates the same as the \f3-Xlint:none\fR option\&.
+.TP
+-parameters
+.br
+Stores formal parameter names of constructors and methods in the generated class file so that the method \f3java\&.lang\&.reflect\&.Executable\&.getParameters\fR from the Reflection API can retrieve them\&.
+.TP
+-proc: [\fInone\fR, \fIonly\fR]
+.br
+Controls whether annotation processing and compilation are done\&. \f3-proc:none\fR means that compilation takes place without annotation processing\&. \f3-proc:only\fR means that only annotation processing is done, without any subsequent compilation\&.
+.TP
+-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
+.br
 Names of the annotation processors to run\&. This bypasses the default discovery process\&.
-.RE
-.PP
-\-processorpath \fIpath\fR
-.RS 4
+.TP
+-processorpath \fIpath\fR
+.br
 Specifies where to find annotation processors\&. If this option is not used, then the class path is searched for processors\&.
-.RE
-.PP
-\-s \fIdir\fR
-.RS 4
-Specifies the directory where to place the generated source files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-s /home/mysrc\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the source file is put in
-\fB/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
-.RE
-.PP
-\-source \fIrelease\fR
-.RS 4
-Specifies the version of source code accepted\&. The following values for
-\fBrelease\fR
-are allowed:
-.PP
+.TP
+-s \fIdir\fR
+.br
+Specifies the directory where to place the generated source files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-s /home/mysrc\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the source file is put in \f3/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
+.TP
+-source \fIrelease\fR
+.br
+Specifies the version of source code accepted\&. The following values for \f3release\fR are allowed:
+.RS     
+.TP     
 1\&.3
-.RS 4
 The compiler does not support assertions, generics, or other language features introduced after Java SE 1\&.3\&.
-.RE
-.PP
+.TP     
 1\&.4
-.RS 4
 The compiler accepts code containing assertions, which were introduced in Java SE 1\&.4\&.
-.RE
-.PP
+.TP     
 1\&.5
-.RS 4
 The compiler accepts code containing generics and other language features introduced in Java SE 5\&.
-.RE
-.PP
+.TP     
 5
-.RS 4
 Synonym for 1\&.5\&.
-.RE
-.PP
+.TP     
 1\&.6
-.RS 4
 No language changes were introduced in Java SE 6\&. However, encoding errors in source files are now reported as errors instead of warnings as in earlier releases of Java Platform, Standard Edition\&.
-.RE
-.PP
+.TP     
 6
-.RS 4
 Synonym for 1\&.6\&.
-.RE
-.PP
+.TP     
 1\&.7
-.RS 4
 The compiler accepts code with features introduced in Java SE 7\&.
-.RE
-.PP
+.TP     
 7
-.RS 4
 Synonym for 1\&.7\&.
-.RE
-.PP
+.TP     
 1\&.8
-.RS 4
 This is the default value\&. The compiler accepts code with features introduced in Java SE 8\&.
-.RE
-.PP
+.TP     
 8
-.RS 4
 Synonym for 1\&.8\&.
-.RE
-.RE
-.PP
-\-sourcepath \fIsourcepath\fR
-.RS 4
+.RE     
+
+.TP
+-sourcepath \fIsourcepath\fR
+.br
 Specifies the source code path to search for class or interface definitions\&. As with the user class path, source path entries are separated by colons (:) on Oracle Solaris and semicolons on Windows and can be directories, JAR archives, or ZIP archives\&. If packages are used, then the local path name within the directory or archive must reflect the package name\&.
-.sp
-\fBNote:\fR
-Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
-.RE
-.PP
-\-verbose
-.RS 4
+
+\fINote:\fR Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
+.TP
+-verbose
+.br
 Uses verbose output, which includes information about each class loaded and each source file compiled\&.
-.RE
-.PP
-\-version
-.RS 4
+.TP
+-version
+.br
 Prints release information\&.
-.RE
-.PP
-\-werror
-.RS 4
+.TP
+-werror
+.br
 Terminates compilation when warnings occur\&.
-.RE
-.PP
-\-X
-.RS 4
+.TP
+-X
+.br
 Displays information about nonstandard options and exits\&.
-.RE
-.SS "Cross\-Compilation Options"
-.PP
-By default, classes are compiled against the bootstrap and extension classes of the platform that
-\fBjavac\fR
-shipped with\&. But
-\fBjavac\fR
-also supports cross\-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the
-\fB\-bootclasspath\fR
-and
-\fB\-extdirs\fR
-options when cross\-compiling\&.
-.PP
-\-target \fIversion\fR
-.RS 4
+.SS CROSS-COMPILATION\ OPTIONS    
+By default, classes are compiled against the bootstrap and extension classes of the platform that \f3javac\fR shipped with\&. But \f3javac\fR also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the \f3-bootclasspath\fR and \f3-extdirs\fR options when cross-compiling\&.
+.TP
+-target \fIversion\fR
+.br
 Generates class files that target a specified release of the virtual machine\&. Class files will run on the specified target and on later releases, but not on earlier releases of the JVM\&. Valid targets are 1\&.1, 1\&.2, 1\&.3, 1\&.4, 1\&.5 (also 5), 1\&.6 (also 6), 1\&.7 (also 7), and 1\&.8 (also 8)\&.
-.sp
-The default for the
-\fB\-target\fR
-option depends on the value of the
-\fB\-source\fR
-option:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is not specified, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.2, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.3, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.5, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.6, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.7, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For all other values of the
-\fB\-source\fR
-option, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option\&.
-.RE
-.RE
+
+The default for the \f3-target\fR option depends on the value of the \f3-source\fR option:
+.RS     
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is not specified, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.2, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.3, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.5, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.6, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.7, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+For all other values of the \f3-source\fR option, the value of the \f3-target\fR option is the value of the \f3-source\fR option\&.
+.RE     
+
+.TP
+-bootclasspath \fIbootclasspath\fR
+.br
+Cross-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
+.SS COMPACT\ PROFILE\ OPTION    
+Beginning with JDK 8, the \f3javac\fR compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
 .PP
-\-bootclasspath \fIbootclasspath\fR
-.RS 4
-Cross\-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
-.RE
-.SS "Compact Profile Option"
-.PP
-Beginning with JDK 8, the
-\fBjavac\fR
-compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
-.PP
-The supported profile values are
-\fBcompact1\fR,
-\fBcompact2\fR, and
-\fBcompact3\fR\&. These are additive layers\&. Each higher\-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
-.PP
-\-profile
-.RS 4
+The supported profile values are \f3compact1\fR, \f3compact2\fR, and \f3compact3\fR\&. These are additive layers\&. Each higher-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
+.TP
+-profile
+.br
 When using compact profiles, this option specifies the profile name when compiling\&. For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-profile compact1 Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3javac \-profile compact1 Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 javac does not compile source code that uses any Java SE APIs that is not in the specified profile\&. Here is an example of the error message that results from attempting to compile such source code:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBcd jdk1\&.8\&.0/bin\fR
-\fB\&./javac \-profile compact1 Paint\&.java\fR
-\fBPaint\&.java:5: error: Applet is not available in profile \*(Aqcompact1\*(Aq\fR
-\fBimport java\&.applet\&.Applet;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-In this example, you can correct the error by modifying the source to not use the
-\fBApplet\fR
-class\&. You could also correct the error by compiling without the \-profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the
-\fBApplet\fR
-class\&.)
-.sp
-An alternative way to compile with compact profiles is to use the
-\fB\-bootclasspath\fR
-option to specify a path to an
-\fBrt\&.jar\fR
-file that specifies a profile\*(Aqs image\&. Using the
-\fB\-profile\fR
-option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross\-compiling\&.
-.RE
-.SS "Nonstandard Options"
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+.sp     
+.nf     
+\f3cd jdk1\&.8\&.0/bin\fP
+.fi     
+.nf     
+\f3\&./javac \-profile compact1 Paint\&.java\fP
+.fi     
+.nf     
+\f3Paint\&.java:5: error: Applet is not available in profile \&'compact1\&'\fP
+.fi     
+.nf     
+\f3import java\&.applet\&.Applet;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+In this example, you can correct the error by modifying the source to not use the \f3Applet\fR class\&. You could also correct the error by compiling without the -profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the \f3Applet\fR class\&.)
+
+An alternative way to compile with compact profiles is to use the \f3-bootclasspath\fR option to specify a path to an \f3rt\&.jar\fR file that specifies a profile\&'s image\&. Using the \f3-profile\fR option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross-compiling\&.
+.SS NONSTANDARD\ OPTIONS    
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Adds a suffix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Adds a prefix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/:\fIpath\fR
+.br
 Overrides the location of the bootstrap class files\&.
-.RE
-.PP
-\-Xdoclint:[\-]\fIgroup\fR [\fI/access\fR]
-.RS 4
-Enables or disables specific groups of checks, where
-\fIgroup\fR
-is one of the following values:
-\fBaccessibility\fR,
-\fBsyntax\fR,
-\fBreference\fR,
-\fBhtml\fR
-or
-\fBmissing\fR\&. For more information about these groups of checks see the
-\fB\-Xdoclint\fR
-option of the
-\fBjavadoc\fR
-command\&. The
-\fB\-Xdoclint\fR
-option is disabled by default in the
-\fBjavac\fR
-command\&.
-.sp
-The variable
-\fIaccess\fR
-specifies the minimum visibility level of classes and members that the
-\fB\-Xdoclint\fR
-option checks\&. It can have one of the following values (in order of most to least visible) :
-\fBpublic\fR,
-\fBprotected\fR,
-\fBpackage\fR
-and
-\fBprivate\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all/protected\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-Xdoclint:[-]\fIgroup\fR [\fI/access\fR]
+.br
+Enables or disables specific groups of checks, where \fIgroup\fR is one of the following values: \f3accessibility\fR, \f3syntax\fR, \f3reference\fR, \f3html\fR or \f3missing\fR\&. For more information about these groups of checks see the \f3-Xdoclint\fR option of the \f3javadoc\fR command\&. The \f3-Xdoclint\fR option is disabled by default in the \f3javac\fR command\&.
+
+The variable \fIaccess\fR specifies the minimum visibility level of classes and members that the \f3-Xdoclint\fR option checks\&. It can have one of the following values (in order of most to least visible) : \f3public\fR, \f3protected\fR, \f3package\fR and \f3private\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
+.sp     
+.nf     
+\f3\-Xdoclint:all/protected\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following option enables all groups of checks for all access levels, except it will not check for HTML errors for classes and members that have access level package and higher (which includes package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all,\-html/package\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xdoclint:none
-.RS 4
+.sp     
+.nf     
+\f3\-Xdoclint:all,\-html/package\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xdoclint:none
+.br
 Disables all groups of checks\&.
-.RE
-.PP
-\-Xdoclint:all[\fI/access\fR]
-.RS 4
+.TP
+-Xdoclint:all[\fI/access\fR]
+.br
 Enables all groups of checks\&.
-.RE
-.PP
-\-Xlint
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:all
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:none
-.RS 4
+.TP
+-Xlint
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:all
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:none
+.br
 Disables all warnings\&.
-.RE
-.PP
-\-Xlint:\fIname\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option for a list of warnings you can disable with this option\&.
-.RE
-.PP
-\-Xlint:\fI\-name\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option with the
-\fB\-Xlint\fR
-option to get a list of warnings that you can disable with this option\&.
-.RE
-.PP
-\-Xmaxerrs \fInumber\fR
-.RS 4
+.TP
+-Xlint:\fIname\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option for a list of warnings you can disable with this option\&.
+.TP
+-Xlint:\fI-name\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option with the \f3-Xlint\fR option to get a list of warnings that you can disable with this option\&.
+.TP
+-Xmaxerrs \fInumber\fR
+.br
 Sets the maximum number of errors to print\&.
-.RE
-.PP
-\-Xmaxwarns \fInumber\fR
-.RS 4
+.TP
+-Xmaxwarns \fInumber\fR
+.br
 Sets the maximum number of warnings to print\&.
-.RE
-.PP
-\-Xstdout \fIfilename\fR
-.RS 4
-Sends compiler messages to the named file\&. By default, compiler messages go to
-\fBSystem\&.err\fR\&.
-.RE
-.PP
-\-Xprefer:[\fInewer,source\fR]
-.RS 4
-Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the
-\fB\-Xprefer:newer\fR
-option is used, then it reads the newer of the source or class file for a type (default)\&. If the
-\fB\-Xprefer:source\fR
-option is used, then it reads the source file\&. Use \-\fBXprefer:source\fR
-when you want to be sure that any annotation processors can access annotations declared with a retention policy of
-\fBSOURCE\fR\&.
-.RE
-.PP
-\-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
-.RS 4
-Control whether javac generates
-\fBpackage\-info\&.class\fR
-files from package\-info\&.java files\&. Possible mode arguments for this option include the following\&.
-.PP
+.TP
+-Xstdout \fIfilename\fR
+.br
+Sends compiler messages to the named file\&. By default, compiler messages go to \f3System\&.err\fR\&.
+.TP
+-Xprefer:[\fInewer,source\fR]
+.br
+Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the \f3-Xprefer:newer\fR option is used, then it reads the newer of the source or class file for a type (default)\&. If the \f3-Xprefer:source\fR option is used, then it reads the source file\&. Use -\f3Xprefer:source\fR when you want to be sure that any annotation processors can access annotations declared with a retention policy of \f3SOURCE\fR\&.
+.TP
+-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
+.br
+Control whether javac generates \f3package-info\&.class\fR files from package-info\&.java files\&. Possible mode arguments for this option include the following\&.
+.RS     
+.TP     
 always
-.RS 4
-Always generate a
-\fBpackage\-info\&.class\fR
-file for every
-\fBpackage\-info\&.java\fR
-file\&. This option may be useful if you use a build system such as Ant, which checks that each
-\fB\&.java\fR
-file has a corresponding
-\fB\&.class\fR
-file\&.
-.RE
-.PP
+Always generate a \f3package-info\&.class\fR file for every \f3package-info\&.java\fR file\&. This option may be useful if you use a build system such as Ant, which checks that each \f3\&.java\fR file has a corresponding \f3\&.class\fR file\&.
+.TP     
 legacy
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations\&. Don\*(Aqt generate a
-\fBpackage\-info\&.class\fR
-file if package\-info\&.java only contains comments\&.
-.sp
-\fBNote:\fR
-A
-\fBpackage\-info\&.class\fR
-file might be generated but be empty if all the annotations in the package\-info\&.java file have
-\fBRetentionPolicy\&.SOURCE\fR\&.
-.RE
-.PP
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations\&. Don\&'t generate a \f3package-info\&.class\fR file if package-info\&.java only contains comments\&.
+
+\fINote:\fR A \f3package-info\&.class\fR file might be generated but be empty if all the annotations in the package-info\&.java file have \f3RetentionPolicy\&.SOURCE\fR\&.
+.TP     
 nonempty
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations with
-\fBRetentionPolicy\&.CLASS\fR
-or
-\fBRetentionPolicy\&.RUNTIME\fR\&.
-.RE
-.RE
-.PP
-\-Xprint
-.RS 4
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations with \f3RetentionPolicy\&.CLASS\fR or \f3RetentionPolicy\&.RUNTIME\fR\&.
+.RE     
+
+.TP
+-Xprint
+.br
 Prints a textual representation of specified types for debugging purposes\&. Perform neither annotation processing nor compilation\&. The format of the output could change\&.
-.RE
-.PP
-\-XprintProcessorInfo
-.RS 4
+.TP
+-XprintProcessorInfo
+.br
 Prints information about which annotations a processor is asked to process\&.
-.RE
-.PP
-\-XprintRounds
-.RS 4
+.TP
+-XprintRounds
+.br
 Prints information about initial and subsequent annotation processing rounds\&.
-.RE
-.SH "ENABLE OR DISABLE WARNINGS WITH THE -XLINT OPTION"
-.PP
-Enable warning
-\fIname\fR
-with the
-\fB\-Xlint:name\fR
-option, where
-\fBname\fR
-is one of the following warning names\&. Note that you can disable a warning with the
-\fB\-Xlint:\-name:\fR
-option\&.
-.PP
+.SH ENABLE\ OR\ DISABLE\ WARNINGS\ WITH\ THE\ -XLINT\ OPTION    
+Enable warning \fIname\fR with the \f3-Xlint:name\fR option, where \f3name\fR is one of the following warning names\&. Note that you can disable a warning with the \f3-Xlint:-name:\fR option\&.
+.TP     
 cast
-.RS 4
 Warns about unnecessary and redundant casts, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBString s = (String) "Hello!"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3String s = (String) "Hello!"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 classfile
-.RS 4
 Warns about issues related to class file contents\&.
-.RE
-.PP
+.TP     
 deprecation
-.RS 4
 Warns about the use of deprecated items, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava\&.util\&.Date myDate = new java\&.util\&.Date();\fR
-\fBint currentDay = myDate\&.getDay();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The method
-\fBjava\&.util\&.Date\&.getDay\fR
-has been deprecated since JDK 1\&.1
-.RE
-.PP
-dep\-ann
-.RS 4
-Warns about items that are documented with an
-\fB@deprecated\fR
-Javadoc comment, but do not have a
-\fB@Deprecated\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB/**\fR
-\fB  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fR
-\fB  */\fR
-\fBpublic static void deprecatedMethood() { }\fR
-\fBpublic static void newMethod() { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3java\&.util\&.Date myDate = new java\&.util\&.Date();\fP
+.fi     
+.nf     
+\f3int currentDay = myDate\&.getDay();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The method \f3java\&.util\&.Date\&.getDay\fR has been deprecated since JDK 1\&.1
+.TP     
+dep-ann
+Warns about items that are documented with an \f3@deprecated\fR Javadoc comment, but do not have a \f3@Deprecated\fR annotation, for example:
+.sp     
+.nf     
+\f3/**\fP
+.fi     
+.nf     
+\f3  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fP
+.fi     
+.nf     
+\f3  */\fP
+.fi     
+.nf     
+\f3public static void deprecatedMethood() { }\fP
+.fi     
+.nf     
+\f3public static void newMethod() { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 divzero
-.RS 4
 Warns about division by the constant integer 0, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBint divideByZero = 42 / 0;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3int divideByZero = 42 / 0;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 empty
-.RS 4
-Warns about empty statements after
-\fBif \fRstatements, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass E {\fR
-\fB    void m() {\fR
-\fB         if (true) ;\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about empty statements after \f3if\fRstatements, for example:
+.sp     
+.nf     
+\f3class E {\fP
+.fi     
+.nf     
+\f3    void m() {\fP
+.fi     
+.nf     
+\f3         if (true) ;\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 fallthrough
-.RS 4
-Checks the switch blocks for fall\-through cases and provides a warning message for any that are found\&. Fall\-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBswitch (x) {\fR
-\fBcase 1:\fR
-\fB  System\&.out\&.println("1");\fR
-\fB  // No break statement here\&.\fR
-\fBcase 2:\fR
-\fB  System\&.out\&.println("2");\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the
-\fB\-Xlint:fallthrough\fR
-option was used when compiling this code, then the compiler emits a warning about possible fall\-through into case, with the line number of the case in question\&.
-.RE
-.PP
+Checks the switch blocks for fall-through cases and provides a warning message for any that are found\&. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
+.sp     
+.nf     
+\f3switch (x) {\fP
+.fi     
+.nf     
+\f3case 1:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("1");\fP
+.fi     
+.nf     
+\f3  // No break statement here\&.\fP
+.fi     
+.nf     
+\f3case 2:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("2");\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the \f3-Xlint:fallthrough\fR option was used when compiling this code, then the compiler emits a warning about possible fall-through into case, with the line number of the case in question\&.
+.TP     
 finally
-.RS 4
-Warns about
-\fBfinally\fR
-clauses that cannot complete normally, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int m() {\fR
-\fB  try {\fR
-\fB     throw new NullPointerException();\fR
-\fB  }  catch (NullPointerException(); {\fR
-\fB     System\&.err\&.println("Caught NullPointerException\&.");\fR
-\fB     return 1;\fR
-\fB   } finally {\fR
-\fB     return 0;\fR
-\fB   }\fR
-\fB  }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The compiler generates a warning for the
-\fBfinally\fR
-block in this example\&. When the
-\fBint\fR
-method is called, it returns a value of 0\&. A
-\fBfinally\fR
-block executes when the
-\fBtry\fR
-block exits\&. In this example, when control is transferred to the
-\fBcatch\fR
-block, the
-\fBint\fR
-method exits\&. However, the
-\fBfinally\fR
-block must execute, so it is executed, even though control was transferred outside the method\&.
-.RE
-.PP
+Warns about \f3finally\fR clauses that cannot complete normally, for example:
+.sp     
+.nf     
+\f3public static int m() {\fP
+.fi     
+.nf     
+\f3  try {\fP
+.fi     
+.nf     
+\f3     throw new NullPointerException();\fP
+.fi     
+.nf     
+\f3  }  catch (NullPointerException(); {\fP
+.fi     
+.nf     
+\f3     System\&.err\&.println("Caught NullPointerException\&.");\fP
+.fi     
+.nf     
+\f3     return 1;\fP
+.fi     
+.nf     
+\f3   } finally {\fP
+.fi     
+.nf     
+\f3     return 0;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The compiler generates a warning for the \f3finally\fR block in this example\&. When the \f3int\fR method is called, it returns a value of 0\&. A \f3finally\fR block executes when the \f3try\fR block exits\&. In this example, when control is transferred to the \f3catch\fR block, the \f3int\fR method exits\&. However, the \f3finally\fR block must execute, so it is executed, even though control was transferred outside the method\&.
+.TP     
 options
-.RS 4
-Warns about issues that related to the use of command\-line options\&. See Cross\-Compilation Options\&.
-.RE
-.PP
+Warns about issues that related to the use of command-line options\&. See Cross-Compilation Options\&.
+.TP     
 overrides
-.RS 4
 Warns about issues regarding method overrides\&. For example, consider the following two classes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ClassWithVarargsMethod {\fR
-\fB  void varargsMethod(String\&.\&.\&. s) { }\fR
-\fB}\fR
- 
-\fBpublic class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fR
-\fB   @Override\fR
-\fB   void varargsMethod(String[] s) { }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3public class ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3  void varargsMethod(String\&.\&.\&. s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3   @Override\fP
+.fi     
+.nf     
+\f3   void varargsMethod(String[] s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates a warning similar to the following:\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fR
-\fBoverrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fR
-\fBmethod is missing \*(Aq\&.\&.\&.\*(Aq\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a
-\fBvarargs\fR
-method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. In the method
-\fBClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBString\&.\&.\&. s\fR
-to the formal parameter
-\fBString[] s\fR, an array, which matches the formal parameter of the method
-\fBClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fP
+.fi     
+.nf     
+\f3overrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fP
+.fi     
+.nf     
+\f3method is missing \&'\&.\&.\&.\&'\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a \f3varargs\fR method, it translates the \f3varargs\fR formal parameter into an array\&. In the method \f3ClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the \f3varargs\fR formal parameter \f3String\&.\&.\&. s\fR to the formal parameter \f3String[] s\fR, an array, which matches the formal parameter of the method \f3ClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
+.TP     
 path
-.RS 4
-Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the
-\fB@SuppressWarnings\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the \f3@SuppressWarnings\fR annotation, for example:
+.sp     
+.nf     
+\f3javac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 processing
-.RS 4
 Warn about issues regarding annotation processing\&. The compiler generates this warning when you have a class that has an annotation, and you use an annotation processor that cannot handle that type of exception\&. For example, the following is a simple annotation processor:
-.sp
-\fBSource file AnnocProc\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBimport java\&.util\&.*;\fR
-\fBimport javax\&.annotation\&.processing\&.*;\fR
-\fBimport javax\&.lang\&.model\&.*;\fR
-\fBimport\&.javaz\&.lang\&.model\&.element\&.*;\fR
- 
-\fB@SupportedAnnotationTypes("NotAnno")\fR
-\fBpublic class AnnoProc extends AbstractProcessor {\fR
-\fB  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fR
-\fB     return true;\fR
-\fB  }\fR
- 
-\fB  public SourceVersion getSupportedSourceVersion() {\fR
-\fB     return SourceVersion\&.latest();\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBSource file AnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB@interface Anno { }\fR
-\fB \fR
-\fB@Anno\fR
-\fBclass AnnosWithoutProcessors { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following commands compile the annotation processor
-\fBAnnoProc\fR, then run this annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac AnnoProc\&.java\fR
-\fBjavac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler runs the annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR, it generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [processing] No processor claimed any of these annotations: Anno\fR
-\fB \fR
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can rename the annotation defined and used in the class
-\fBAnnosWithoutProcessors\fR
-from
-\fBAnno\fR
-to
-\fBNotAnno\fR\&.
-.RE
-.PP
+
+\fISource file AnnocProc\&.java\fR:
+.sp     
+.nf     
+\f3import java\&.util\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.annotation\&.processing\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.lang\&.model\&.*;\fP
+.fi     
+.nf     
+\f3import\&.javaz\&.lang\&.model\&.element\&.*;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@SupportedAnnotationTypes("NotAnno")\fP
+.fi     
+.nf     
+\f3public class AnnoProc extends AbstractProcessor {\fP
+.fi     
+.nf     
+\f3  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fP
+.fi     
+.nf     
+\f3     return true;\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3  public SourceVersion getSupportedSourceVersion() {\fP
+.fi     
+.nf     
+\f3     return SourceVersion\&.latest();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fISource file AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3@interface Anno { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@Anno\fP
+.fi     
+.nf     
+\f3class AnnosWithoutProcessors { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following commands compile the annotation processor \f3AnnoProc\fR, then run this annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3javac AnnoProc\&.java\fP
+.fi     
+.nf     
+\f3javac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler runs the annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR, it generates the following warning:
+.sp     
+.nf     
+\f3warning: [processing] No processor claimed any of these annotations: Anno\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can rename the annotation defined and used in the class \f3AnnosWithoutProcessors\fR from \f3Anno\fR to \f3NotAnno\fR\&.
+.TP     
 rawtypes
-.RS 4
-Warns about unchecked operations on raw types\&. The following statement generates a
-\fBrawtypes\fR
-warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example does not generate a
-\fBrawtypes\fR
-warning
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List<?> l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBList\fR
-is a raw type\&. However,
-\fBList<?>\fR
-is an unbounded wildcard parameterized type\&. Because
-\fBList\fR
-is a parameterized interface, always specify its type argument\&. In this example, the
-\fBList\fR
-formal argument is specified with an unbounded wildcard (\fB?\fR) as its formal type parameter, which means that the
-\fBcountElements\fR
-method can accept any instantiation of the
-\fBList\fR
-interface\&.
-.RE
-.PP
+Warns about unchecked operations on raw types\&. The following statement generates a \f3rawtypes\fR warning:
+.sp     
+.nf     
+\f3void countElements(List l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example does not generate a \f3rawtypes\fR warning
+.sp     
+.nf     
+\f3void countElements(List<?> l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\f3List\fR is a raw type\&. However, \f3List<?>\fR is an unbounded wildcard parameterized type\&. Because \f3List\fR is a parameterized interface, always specify its type argument\&. In this example, the \f3List\fR formal argument is specified with an unbounded wildcard (\f3?\fR) as its formal type parameter, which means that the \f3countElements\fR method can accept any instantiation of the \f3List\fR interface\&.
+.TP     
 Serial
-.RS 4
-Warns about missing
-\fBserialVersionUID\fR
-definitions on serializable classes, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class PersistentTime implements Serializable\fR
-\fB{\fR
-\fB  private Date time;\fR
-\fB \fR
-\fB   public PersistentTime() {\fR
-\fB     time = Calendar\&.getInstance()\&.getTime();\fR
-\fB   }\fR
-\fB \fR
-\fB   public Date getTime() {\fR
-\fB     return time;\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Warns about missing \f3serialVersionUID\fR definitions on serializable classes, for example:
+.sp     
+.nf     
+\f3public class PersistentTime implements Serializable\fP
+.fi     
+.nf     
+\f3{\fP
+.fi     
+.nf     
+\f3  private Date time;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public PersistentTime() {\fP
+.fi     
+.nf     
+\f3     time = Calendar\&.getInstance()\&.getTime();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public Date getTime() {\fP
+.fi     
+.nf     
+\f3     return time;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [serial] serializable class PersistentTime has no definition of\fR
-\fBserialVersionUID\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If a serializable class does not explicitly declare a field named
-\fBserialVersionUID\fR, then the serialization runtime environment calculates a default
-\fBserialVersionUID\fR
-value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare
-\fBserialVersionUID\fR
-values because the default process of computing
-\fBserialVersionUID\fR
-vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected
-\fBInvalidClassExceptions\fR
-during deserialization\&. To guarantee a consistent
-\fBserialVersionUID\fR
-value across different Java compiler implementations, a serializable class must declare an explicit
-\fBserialVersionUID\fR
-value\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [serial] serializable class PersistentTime has no definition of\fP
+.fi     
+.nf     
+\f3serialVersionUID\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If a serializable class does not explicitly declare a field named \f3serialVersionUID\fR, then the serialization runtime environment calculates a default \f3serialVersionUID\fR value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare \f3serialVersionUID\fR values because the default process of computing \f3serialVersionUID\fR vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected \f3InvalidClassExceptions\fR during deserialization\&. To guarantee a consistent \f3serialVersionUID\fR value across different Java compiler implementations, a serializable class must declare an explicit \f3serialVersionUID\fR value\&.
+.TP     
 static
-.RS 4
 Warns about issues relating to the use of statics, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass XLintStatic {\fR
-\fB    static void m1() { }\fR
-\fB    void m2() { this\&.m1(); }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3class XLintStatic {\fP
+.fi     
+.nf     
+\f3    static void m1() { }\fP
+.fi     
+.nf     
+\f3    void m2() { this\&.m1(); }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [static] static method should be qualified by type name, \fR
-\fBXLintStatic, instead of by an expression\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can call the
-\fBstatic\fR
-method
-\fBm1\fR
-as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBXLintStatic\&.m1();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Alternately, you can remove the
-\fBstatic\fR
-keyword from the declaration of the method
-\fBm1\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [static] static method should be qualified by type name, \fP
+.fi     
+.nf     
+\f3XLintStatic, instead of by an expression\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can call the \f3static\fR method \f3m1\fR as follows:
+.sp     
+.nf     
+\f3XLintStatic\&.m1();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Alternately, you can remove the \f3static\fR keyword from the declaration of the method \f3m1\fR\&.
+.TP     
 try
-.RS 4
-Warns about issues relating to use of
-\fBtry\fR
-blocks, including try\-with\-resources statements\&. For example, a warning is generated for the following statement because the resource
-\fBac\fR
-declared in the
-\fBtry\fR
-block is not used:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBtry ( AutoCloseable ac = getResource() ) {    // do nothing}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about issues relating to use of \f3try\fR blocks, including try-with-resources statements\&. For example, a warning is generated for the following statement because the resource \f3ac\fR declared in the \f3try\fR block is not used:
+.sp     
+.nf     
+\f3try ( AutoCloseable ac = getResource() ) {    // do nothing}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 unchecked
-.RS 4
 Gives more detail for unchecked conversion warnings that are mandated by the Java Language Specification, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBList l = new ArrayList<Number>();\fR
-\fBList<String> ls = l;       // unchecked warning\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-During type erasure, the types
-\fBArrayList<Number>\fR
-and
-\fBList<String>\fR
-become
-\fBArrayList\fR
-and
-\fBList\fR, respectively\&.
-.sp
-The
-\fBls\fR
-command has the parameterized type
-\fBList<String>\fR\&. When the
-\fBList\fR
-referenced by
-\fBl\fR
-is assigned to
-\fBls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether
-\fBl\fR
-refers to a
-\fBList<String>\fR
-type\&. In this case,
-\fBl\fR
-does not refer to a
-\fBList<String>\fR
-type\&. As a result, heap pollution occurs\&.
-.sp
-A heap pollution situation occurs when the
-\fBList\fR
-object
-\fBl\fR, whose static type is
-\fBList<Number>\fR, is assigned to another
-\fBList\fR
-object,
-\fBls\fR, that has a different static type,
-\fBList<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure,
-\fBList<Number>\fR
-and
-\fBList<String>\fR
-both become
-\fBList\fR\&. Consequently, the compiler allows the assignment of the object
-\fBl\fR\fB,\fR
-which has a raw type of
-\fBList\fR, to the object
-\fBls\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3List l = new ArrayList<Number>();\fP
+.fi     
+.nf     
+\f3List<String> ls = l;       // unchecked warning\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+During type erasure, the types \f3ArrayList<Number>\fR and \f3List<String>\fR become \f3ArrayList\fR and \f3List\fR, respectively\&.
+
+The \f3ls\fR command has the parameterized type \f3List<String>\fR\&. When the \f3List\fR referenced by \f3l\fR is assigned to \f3ls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether \f3l\fR refers to a \f3List<String>\fR type\&. In this case, \f3l\fR does not refer to a \f3List<String>\fR type\&. As a result, heap pollution occurs\&.
+
+A heap pollution situation occurs when the \f3List\fR object \f3l\fR, whose static type is \f3List<Number>\fR, is assigned to another \f3List\fR object, \f3ls\fR, that has a different static type, \f3List<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure, \f3List<Number>\fR and \f3List<String>\fR both become \f3List\fR\&. Consequently, the compiler allows the assignment of the object \f3l\fR\f3,\fR which has a raw type of \f3List\fR, to the object \f3ls\fR\&.
+.TP     
 varargs
-.RS 4
-Warns about unsafe usages of variable arguments (\fBvarargs\fR) methods, in particular, those that contain non\-reifiable arguments, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ArrayBuilder {\fR
-\fB  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fR
-\fB    for (T x : elements) {\fR
-\fB      listArg\&.add(x);\fR
-\fB    }\fR
-\fB  }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBNote:\fR
-A non\-reifiable type is a type whose type information is not fully available at runtime\&.
-.sp
-The compiler generates the following warning for the definition of the method
-\fBArrayBuilder\&.addToList\fR
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [varargs] Possible heap pollution from parameterized vararg type T\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a varargs method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method
-\fBArrayBuilder\&.addToList\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBT\&.\&.\&.\fR
-elements to the formal parameter
-\fBT[]\fR
-elements, an array\&. However, because of type erasure, the compiler converts the
-\fBvarargs\fR
-formal parameter to
-\fBObject[]\fR
-elements\&. Consequently, there is a possibility of heap pollution\&.
-.RE
-.SH "COMMAND-LINE ARGUMENT FILES"
+Warns about unsafe usages of variable arguments (\f3varargs\fR) methods, in particular, those that contain non-reifiable arguments, for example:
+.sp     
+.nf     
+\f3public class ArrayBuilder {\fP
+.fi     
+.nf     
+\f3  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fP
+.fi     
+.nf     
+\f3    for (T x : elements) {\fP
+.fi     
+.nf     
+\f3      listArg\&.add(x);\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fINote:\fR A non-reifiable type is a type whose type information is not fully available at runtime\&.
+
+The compiler generates the following warning for the definition of the method \f3ArrayBuilder\&.addToList\fR
+.sp     
+.nf     
+\f3warning: [varargs] Possible heap pollution from parameterized vararg type T\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a varargs method, it translates the \f3varargs\fR formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method \f3ArrayBuilder\&.addToList\fR, the compiler translates the \f3varargs\fR formal parameter \f3T\&.\&.\&.\fR elements to the formal parameter \f3T[]\fR elements, an array\&. However, because of type erasure, the compiler converts the \f3varargs\fR formal parameter to \f3Object[]\fR elements\&. Consequently, there is a possibility of heap pollution\&.
+.SH COMMAND-LINE\ ARGUMENT\ FILES    
+To shorten or simplify the \f3javac\fR command, you can specify one or more files that contain arguments to the \f3javac\fR command (except \f3-J\fR options)\&. This enables you to create \f3javac\fR commands of any length on any operating system\&.
 .PP
-To shorten or simplify the
-\fBjavac\fR
-command, you can specify one or more files that contain arguments to the
-\fBjavac\fR
-command (except
-\fB\-J\fR
-options)\&. This enables you to create
-\fBjavac\fR
-commands of any length on any operating system\&.
+An argument file can include \f3javac\fR options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
 .PP
-An argument file can include
-\fBjavac\fR
-options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
+File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying \f3*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The \f3-J\fR options are not supported because they are passed to the launcher, which does not support argument files\&.
 .PP
-File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying
-\fB*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The
-\fB\-J\fR
-options are not supported because they are passed to the launcher, which does not support argument files\&.
+When executing the \f3javac\fR command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the \f3javac\fR command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
 .PP
-When executing the
-\fBjavac\fR
-command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the
-\fBjavac\fR
-command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
+\f3Example 1 Single Argument File\fR
 .PP
-\fBExample 1\fR
-.br
-Single Argument File
-.RS 4
-You could use a single argument file named
-\fBargfile\fR
-to hold all
-\fBjavac\fR
-arguments:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @argfile\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+You could use a single argument file named \f3argfile\fR to hold all \f3javac\fR arguments:
+.sp     
+.nf     
+\f3javac @argfile\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 This argument file could contain the contents of both files shown in Example 2
-.RE
 .PP
-\fBExample 2\fR
-.br
-Two Argument Files
-.RS 4
-You can create two argument files: one for the
-\fBjavac\fR
-options and the other for the source file names\&. Note that the following lists have no line\-continuation characters\&.
-.sp
+\f3Example 2 Two Argument Files\fR
+.PP
+You can create two argument files: one for the \f3javac\fR options and the other for the source file names\&. Note that the following lists have no line-continuation characters\&.
+.PP
 Create a file named options that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-d classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-g\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-d classes\fP
+.fi     
+.nf     
+\f3\-g\fP
+.fi     
+.nf     
+\f3\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Create a file named classes that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBMyClass1\&.java\fR
-\fBMyClass2\&.java\fR
-\fBMyClass3\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Then, run the
-\fBjavac\fR
-command as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @options @classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3MyClass1\&.java\fP
+.fi     
+.nf     
+\f3MyClass2\&.java\fP
+.fi     
+.nf     
+\f3MyClass3\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Then, run the \f3javac\fR command as follows:
+.sp     
+.nf     
+\f3javac @options @classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Argument Files with Paths\fR
 .PP
-\fBExample 3\fR
-.br
-Argument Files with Paths
-.RS 4
-The argument files can have paths, but any file names inside the files are relative to the current working directory (not
-\fBpath1\fR
-or
-\fBpath2\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @path1/options @path2/classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "ANNOTATION PROCESSING"
+The argument files can have paths, but any file names inside the files are relative to the current working directory (not \f3path1\fR or \f3path2\fR):
+.sp     
+.nf     
+\f3javac @path1/options @path2/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH ANNOTATION\ PROCESSING    
+The \f3javac\fR command provides direct support for annotation processing, superseding the need for the separate annotation processing command, \f3apt\fR\&.
 .PP
-The
-\fBjavac\fR
-command provides direct support for annotation processing, superseding the need for the separate annotation processing command,
-\fBapt\fR\&.
-.PP
-The API for annotation processors is defined in the
-\fBjavax\&.annotation\&.processing\fR
-and j\fBavax\&.lang\&.model\fR
-packages and subpackages\&.
-.SS "How Annotation Processing Works"
-.PP
-Unless annotation processing is disabled with the
-\fB\-proc:none\fR
-option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the
-\fB\-processorpath\fR
-option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider\-configuration files named
-\fBMETA\-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the
-\fB\-processor\fR
-option\&.
+The API for annotation processors is defined in the \f3javax\&.annotation\&.processing\fR and j\f3avax\&.lang\&.model\fR packages and subpackages\&.
+.SS HOW\ ANNOTATION\ PROCESSING\ WORKS    
+Unless annotation processing is disabled with the \f3-proc:none\fR option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the \f3-processorpath\fR option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider-configuration files named \f3META-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the \f3-processor\fR option\&.
 .PP
 After scanning the source files and classes on the command line to determine what annotations are present, the compiler queries the processors to determine what annotations they process\&. When a match is found, the processor is called\&. A processor can claim the annotations it processes, in which case no further attempt is made to find any processors for those annotations\&. After all of the annotations are claimed, the compiler does not search for additional processors\&.
 .PP
 If any processors generate new source files, then another round of annotation processing occurs: Any newly generated source files are scanned, and the annotations processed as before\&. Any processors called on previous rounds are also called on all subsequent rounds\&. This continues until no new source files are generated\&.
 .PP
-After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the
-\fB\-proc:only\fR
-option is used, the compiler compiles the original and all generated source files\&.
-.SS "Implicitly Loaded Source Files"
-.PP
-To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The
-\fB\-implicit\fR
-option provides a way to suppress the warning\&.
-.SH "SEARCHING FOR TYPES"
-.PP
+After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the \f3-proc:only\fR option is used, the compiler compiles the original and all generated source files\&.
+.SS IMPLICITLY\ LOADED\ SOURCE\ FILES    
+To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The \f3-implicit\fR option provides a way to suppress the warning\&.
+.SH SEARCHING\ FOR\ TYPES    
 To compile a source file, the compiler often needs information about a type, but the type definition is not in the source files specified on the command line\&. The compiler needs type information for every class or interface used, extended, or implemented in the source file\&. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance\&.
 .PP
-For example, when you create a subclass
-\fBjava\&.applet\&.Applet\fR, you are also using the ancestor classes of
-\fBApplet\fR:
-\fBjava\&.awt\&.Panel\fR,
-\fBjava\&.awt\&.Container\fR,
-\fBjava\&.awt\&.Component\fR, and
-\fBjava\&.lang\&.Object\fR\&.
+For example, when you create a subclass \f3java\&.applet\&.Applet\fR, you are also using the ancestor classes of \f3Applet\fR: \f3java\&.awt\&.Panel\fR, \f3java\&.awt\&.Container\fR, \f3java\&.awt\&.Component\fR, and \f3java\&.lang\&.Object\fR\&.
 .PP
-When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the
-\fBCLASSPATH\fR
-environment variable or by using the
-\fB\-classpath\fR
-option\&.
+When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the \f3CLASSPATH\fR environment variable or by using the \f3-classpath\fR option\&.
 .PP
-If you set the
-\fB\-sourcepath\fR
-option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
+If you set the \f3-sourcepath\fR option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
 .PP
-You can specify different bootstrap or extension classes with the
-\fB\-bootclasspath\fR
-and the
-\fB\-extdirs\fR
-options\&. See Cross\-Compilation Options\&.
+You can specify different bootstrap or extension classes with the \f3-bootclasspath\fR and the \f3-extdirs\fR options\&. See Cross-Compilation Options\&.
 .PP
-A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the
-\fB\-Xprefer\fR
-option to instruct the compiler which to use\&. If
-\fBnewer\fR
-is specified, then the compiler uses the newer of the two files\&. If
-\fBsource\fR
-is specified, the compiler uses the source file\&. The default is
-\fBnewer\fR\&.
+A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the \f3-Xprefer\fR option to instruct the compiler which to use\&. If \f3newer\fR is specified, then the compiler uses the newer of the two files\&. If \f3source\fR is specified, the compiler uses the source file\&. The default is \f3newer\fR\&.
 .PP
-If a type search finds a source file for a required type, either by itself, or as a result of the setting for the
-\fB\-Xprefer\fR
-option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the
-\fB\-implicit\fR
-option to specify the behavior\&. If
-\fBnone\fR
-is specified, then no class files are generated for the source file\&. If
-\fBclass\fR
-is specified, then class files are generated for the source file\&.
+If a type search finds a source file for a required type, either by itself, or as a result of the setting for the \f3-Xprefer\fR option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the \f3-implicit\fR option to specify the behavior\&. If \f3none\fR is specified, then no class files are generated for the source file\&. If \f3class\fR is specified, then class files are generated for the source file\&.
 .PP
-The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no
-\fB\-implicit\fR
-option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the
-\fB\-implicit\fR
-option to specify whether or not class files should be generated for such source files\&.
-.SH "PROGRAMMATIC INTERFACE"
+The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no \f3-implicit\fR option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the \f3-implicit\fR option to specify whether or not class files should be generated for such source files\&.
+.SH PROGRAMMATIC\ INTERFACE    
+The \f3javac\fR command supports the new Java Compiler API defined by the classes and interfaces in the \f3javax\&.tools\fR package\&.
+.SS EXAMPLE    
+To compile as though providing command-line arguments, use the following syntax:
+.sp     
+.nf     
+\f3JavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The example writes diagnostics to the standard output stream and returns the exit code that \f3javac\fR would give when called from the command line\&.
 .PP
-The
-\fBjavac\fR
-command supports the new Java Compiler API defined by the classes and interfaces in the
-\fBjavax\&.tools\fR
-package\&.
-.SS "Example"
+You can use other methods in the \f3javax\&.tools\&.JavaCompiler\fR interface to handle diagnostics, control where files are read from and written to, and more\&.
+.SS OLD\ INTERFACE    
+\fINote:\fR This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
 .PP
-To compile as though providing command\-line arguments, use the following syntax:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBJavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The \f3com\&.sun\&.tools\&.javac\&.Main\fR class provides two static methods to call the compiler from a program:
+.sp     
+.nf     
+\f3public static int compile(String[] args);\fP
+.fi     
+.nf     
+\f3public static int compile(String[] args, PrintWriter out);\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3args\fR parameter represents any of the command-line arguments that would typically be passed to the compiler\&.
 .PP
-The example writes diagnostics to the standard output stream and returns the exit code that
-\fBjavac\fR
-would give when called from the command line\&.
+The \f3out\fR parameter indicates where the compiler diagnostic output is directed\&.
 .PP
-You can use other methods in the
-\fBjavax\&.tools\&.JavaCompiler\fR
-interface to handle diagnostics, control where files are read from and written to, and more\&.
-.SS "Old Interface"
+The \f3return\fR value is equivalent to the \f3exit\fR value from \f3javac\fR\&.
 .PP
-\fBNote:\fR
-This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
+\fINote:\fR All other classes and methods found in a package with names that start with \f3com\&.sun\&.tools\&.javac\fR (subpackages of \f3com\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
+.SH EXAMPLES    
+\f3Example 1 Compile a Simple Program\fR
 .PP
-The
-\fBcom\&.sun\&.tools\&.javac\&.Main\fR
-class provides two static methods to call the compiler from a program:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int compile(String[] args);\fR
-\fBpublic static int compile(String[] args, PrintWriter out);\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This example shows how to compile the \f3Hello\&.java\fR source file in the greetings directory\&. The class defined in \f3Hello\&.java\fR is called \f3greetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the \f3-d\fR option\&.
 .PP
-The
-\fBargs\fR
-parameter represents any of the command\-line arguments that would typically be passed to the compiler\&.
-.PP
-The
-\fBout\fR
-parameter indicates where the compiler diagnostic output is directed\&.
-.PP
-The
-\fBreturn\fR
-value is equivalent to the
-\fBexit\fR
-value from
-\fBjavac\fR\&.
-.PP
-\fBNote:\fR
-All other classes and methods found in a package with names that start with
-\fBcom\&.sun\&.tools\&.javac\fR
-(subpackages of
-\fBcom\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
-.SH "EXAMPLES"
-.PP
-\fBExample 1\fR
-.br
-Compile a Simple Program
-.RS 4
-This example shows how to compile the
-\fBHello\&.java\fR
-source file in the greetings directory\&. The class defined in
-\fBHello\&.java\fR
-is called
-\fBgreetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.sp
-The source code in
-\fBHello\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpackage greetings;\fR
-\fB \fR
-\fBpublic class Hello {\fR
-\fB    public static void main(String[] args) {\fR
-\fB        for (int i=0; i < args\&.length; i++) {\fR
-\fB            System\&.out\&.println("Hello " + args[i]);\fR
-\fB        }\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The source code in \f3Hello\&.java\fR:
+.sp     
+.nf     
+\f3package greetings;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class Hello {\fP
+.fi     
+.nf     
+\f3    public static void main(String[] args) {\fP
+.fi     
+.nf     
+\f3        for (int i=0; i < args\&.length; i++) {\fP
+.fi     
+.nf     
+\f3            System\&.out\&.println("Hello " + args[i]);\fP
+.fi     
+.nf     
+\f3        }\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Compile greetings\&.Hello:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac greetings/Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Run
-\fBgreetings\&.Hello\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava greetings\&.Hello World Universe Everyone\fR
-\fBHello World\fR
-\fBHello Universe\fR
-\fBHello Everyone\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3javac greetings/Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Run \f3greetings\&.Hello\fR:
+.sp     
+.nf     
+\f3java greetings\&.Hello World Universe Everyone\fP
+.fi     
+.nf     
+\f3Hello World\fP
+.fi     
+.nf     
+\f3Hello Universe\fP
+.fi     
+.nf     
+\f3Hello Everyone\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Compile Multiple Source Files\fR
 .PP
-\fBExample 2\fR
-.br
-Compile Multiple Source Files
-.RS 4
-This example compiles the
-\fBAloha\&.java\fR,
-\fBGutenTag\&.java\fR,
-\fBHello\&.java\fR, and
-\fBHi\&.java\fR
-source files in the
-\fBgreetings\fR
-package\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB% javac greetings/*\&.java\fR
-\fB% ls greetings\fR
-\fBAloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fR
-\fBAloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+This example compiles the \f3Aloha\&.java\fR, \f3GutenTag\&.java\fR, \f3Hello\&.java\fR, and \f3Hi\&.java\fR source files in the \f3greetings\fR package\&.
+.sp     
+.nf     
+\f3% javac greetings/*\&.java\fP
+.fi     
+.nf     
+\f3% ls greetings\fP
+.fi     
+.nf     
+\f3Aloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fP
+.fi     
+.nf     
+\f3Aloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Specify a User Class Path\fR
 .PP
-\fBExample 3\fR
-.br
-Specify a User Class Path
-.RS 4
 After changing one of the source files in the previous example, recompile it:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpwd\fR
-\fB/examples\fR
-\fBjavac greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Because
-\fBgreetings\&.Hi\fR
-refers to other classes in the
-\fBgreetings\fR
-package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting
-\fBCLASSPATH\fR\&. This example uses the
-\fB\-classpath\fR
-option\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you change
-\fBgreetings\&.Hi\fR
-to use a banner utility, then that utility also needs to be accessible through the user class path\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples:/lib/Banners\&.jar \e\fR
-\fB            /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To execute a class in the
-\fBgreetings\fR
-package, the program needs access to the
-\fBgreetings\fR
-package, and to the classes that the
-\fBgreetings\fR
-classes use\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3pwd\fP
+.fi     
+.nf     
+\f3/examples\fP
+.fi     
+.nf     
+\f3javac greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Because \f3greetings\&.Hi\fR refers to other classes in the \f3greetings\fR package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting \f3CLASSPATH\fR\&. This example uses the \f3-classpath\fR option\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If you change \f3greetings\&.Hi\fR to use a banner utility, then that utility also needs to be accessible through the user class path\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples:/lib/Banners\&.jar \e\fP
+.fi     
+.nf     
+\f3            /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+To execute a class in the \f3greetings\fR package, the program needs access to the \f3greetings\fR package, and to the classes that the \f3greetings\fR classes use\&.
+.sp     
+.nf     
+\f3java \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 4 Separate Source Files and Class Files\fR
 .PP
-\fBExample 4\fR
-.br
-Separate Source Files and Class Files
-.RS 4
-The following example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fR
-\fB\-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile
-\fBOldCode\&.java\fR\&. The option
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option; in this example, you can omit the
-\fB\-target\fR
-option\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \fR
-\fB\-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The following example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fP
+.fi     
+.nf     
+\f3\-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile \f3OldCode\&.java\fR\&. The option \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the \f3-target\fR option is the value of the \f3-source\fR option; in this example, you can omit the \f3-target\fR option\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \fP
+.fi     
+.nf     
+\f3\-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules (in this example, it uses version 1\&.7 of the Java programming language) combined with the new bootstrap classes, which can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&.
-.RE
 .PP
-\fBExample 5\fR
-.br
-Cross Compile
-.RS 4
-This example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fR
-\fB            \-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The\fB \-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. In most cases, the value of the
-\fB\-target\fR
-is the value of
-\fB\-source\fR\&. In this example, the
-\fB\-target\fR
-option is omitted\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+\f3Example 5 Cross Compile\fR
+.PP
+This example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fP
+.fi     
+.nf     
+\f3            \-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The\f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules combined with the new bootstrap classes\&. This combination can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&. In this example, the compiler uses release 1\&.7 of the Java programming language\&.
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 java(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javadoc(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/bsd/doc/man/javadoc.1 b/src/bsd/doc/man/javadoc.1
index b48535a..f4b342b 100644
--- a/src/bsd/doc/man/javadoc.1
+++ b/src/bsd/doc/man/javadoc.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: javadoc.1
 .\"
 .if n .pl 99999
-.TH javadoc 1 "10 May 2011" "JDK 8" "Basic Tools"
+.TH javadoc 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -209,7 +209,7 @@
 \f3package java\&.lang\&.applet;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -251,7 +251,7 @@
 \f3initialize, start, and stop the applet\&. \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3@since 1\&.0 \fP
@@ -266,7 +266,7 @@
 \f3</HTML>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3package\&.html\fR file is a typical HTML file and does not include a package declaration\&. The content of the package comment file is written in HTML with one exception\&. The documentation comment should not include the comment separators \f3/**\fR and \f3*/\fR or leading asterisks\&. When writing the comment, make the first sentence a summary about the package, and do not put a title or any other text between the \f3<body>\fR tag and the first sentence\&. You can include package tags\&. All block tags must appear after the main description\&. If you add an \f3@see\fR tag in a package comment file, then it must have a fully qualified name\&.
@@ -334,7 +334,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS TEST\ AND\ TEMPLATE\ FILES    
@@ -350,7 +350,7 @@
 \f3com/package1/test\-files/\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 If your test files contain documentation comments, then you can set up a separate run of the \f3javadoc\fR command to produce test file documentation by passing in their test source file names with wild cards, such as \f3com/package1/test-files/*\&.java\fR\&.
@@ -560,7 +560,7 @@
 \f3implements Serializable\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The declaration for the \f3Boolean\&.valueOf\fR method is:
@@ -569,7 +569,7 @@
 \f3public static Boolean valueOf(String s)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command can include the modifiers \f3public\fR, \f3protected\fR, \f3private\fR, \f3abstract\fR, \f3final\fR, \f3static\fR, \f3transient\fR, and \f3volatile\fR, but not \f3synchronized\fR or \f3native\fR\&. The \f3synchronized\fR and \f3native\fR modifiers are considered implementation detail and not part of the API specification\&.
@@ -593,7 +593,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To save space you can put a comment on one line:
@@ -602,7 +602,7 @@
 \f3/** This comment takes up only one line\&. */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -623,19 +623,19 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3import com\&.example;   // MISTAKE \- Important not to put import statement here\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class Whatever{ }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -657,7 +657,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -676,7 +676,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -700,7 +700,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -730,7 +730,7 @@
 \f3public int x, y;      // Avoid this \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command generates the following documentation from the previous code:
@@ -739,7 +739,7 @@
 \f3public int x\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -748,7 +748,7 @@
 \f3public int y\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -872,7 +872,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -899,11 +899,10 @@
 .TP 0.2i    
 \(bu
 In the text arguments of the \f3@return\fR, \f3@param,\fR and \f3@throws\fR tags of a method\&. In this case, the tag text is copied from the corresponding tag up the hierarchy\&.
-.RE
-.RS
-See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
+.RE     
 
-.RE
+
+See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
 .TP     
 {@link \fIpackage\&.class#member label\fR}
 Introduced in JDK 1\&.2
@@ -920,7 +919,7 @@
 \f3Use the {@link #getComponentAt(int, int) getComponentAt} method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -931,7 +930,7 @@
 \f3Use the <a href="Component\&.html#getComponentAt(int, int)">getComponentAt</a> method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -942,7 +941,7 @@
 \f3Use the getComponentAt method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -982,7 +981,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1014,7 +1013,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1071,7 +1070,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1091,7 +1090,7 @@
 \f3</dl>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1128,7 +1127,7 @@
 \f3@see #constructor(Type argname, Type argname,\&.\&.\&.) \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing another class in the current or imported packages\fR\fP
@@ -1155,7 +1154,7 @@
 \f3@see Class \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing an element in another package (fully qualified)\fR\fP
@@ -1185,7 +1184,7 @@
 \f3@see package\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3\fRNotes about the previous listing:
@@ -1215,7 +1214,7 @@
 Any enclosing classes and interfaces searching the closest first\&.
 .TP 0.4i    
 3\&.
-Any superclasses and superonterfaces, searching the closest first\&.
+Any superclasses and superinterfaces, searching the closest first\&.
 .TP 0.4i    
 4\&.
 The current package\&.
@@ -1307,7 +1306,7 @@
 \f3@see "The Java Programming Language"    //  "The Java Programming Language" \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \fINote:\fR You can extend the \f3@se\fR\f3e\fR tag to link to classes not being documented with the \f3-link\fR option\&.
@@ -1317,7 +1316,7 @@
 
 Used in the documentation comment for a default serializable field\&. See Documenting Serializable Fields and Data for a Class at http://docs\&.oracle\&.com/javase/8/docs/platform/serialization/spec/serial-arch\&.html#5251
 
-See also Oracle\(cqs Criteria for Including Classes in the Serialilzed Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
+See also Oracle\(cqs Criteria for Including Classes in the Serialized Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
 
 An optional \f3field-description\fR should explain the meaning of the field and list the acceptable values\&. When needed, the description can span multiple lines\&. The standard doclet adds this information to the serialized form page\&. See Cross-Reference Pages\&.
 
@@ -1331,13 +1330,12 @@
 .TP 0.2i    
 \(bu
 A private or package-private class that implements \f3Serializable\fR is excluded unless that class (or its package) is marked with the \f3@serial include\fR tag\&.
-.RE
-.RS
+.RE     
+
+
 For example, the \f3javax\&.swing\fR package is marked with the \f3@serial\fR\f3exclude\fR tag in package\&.html or package-info\&.java\&. The public class \f3java\&.security\&.BasicPermission\fR is marked with the \f3@serial exclude\fR tag\&. The package-private class \f3java\&.util\&.PropertyPermissionCollection\fR is marked with the \f3@serial include\fR tag\&.
 
 The \f3@serial\fR tag at the class level overrides the \f3@serial\fR tag at the package level\&.
-
-.RE
 .TP     
 @serialData \fIdata-description\fR
 Introduced in JDK 1\&.2
@@ -1387,7 +1385,7 @@
 \f3public static final String SCRIPT_START = "<script>"\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1407,7 +1405,7 @@
 \f3public String evalScript(String script) {}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1494,7 +1492,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS FIELD\ TAGS    
@@ -1523,7 +1521,7 @@
 \f3    int x = 1263732;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS CONSTRUCTOR\ AND\ METHOD\ TAGS    
@@ -1578,7 +1576,7 @@
 \f3    }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH OPTIONS    
@@ -1592,7 +1590,7 @@
 .PP
 The options are:
 .PP
--1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
+-1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -javafx ||-keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
 .PP
 The following options are the core Javadoc options that are available to all doclets\&. The standard doclet provides the rest of the doclets: \f3-bootclasspath\fR, \f3-breakiterator\fR, \f3-classpath\fR, \f3-doclet\fR, \f3-docletpath\fR, \f3-encoding\fR, -\f3exclude\fR, \f3-extdirs\fR, \f3-help\fR, \f3-locale\fR, \f3-\fR\f3overview\fR, \f3-package\fR, \f3-private\fR, \f3-protected\fR, \f3-public\fR, \f3-quiet\fR, \f3-source\fR, \f3-sourcepath\fR, \f3-subpackages\fR, and \f3-verbose\fR\&.
 .SS JAVADOC\ OPTIONS    
@@ -1635,12 +1633,11 @@
 .TP 0.2i    
 \(bu
 \f3-Xdoclint all,\fR\fI-group\fR : enable all except \fIgroup\fR checks
-.RE
-.RS
+.RE     
+
+
 The variable \fIgroup\fR has one of the following values:
 .RS     
-
-.RE
 .TP 0.2i    
 \(bu
 \f3accessibility\fR : Checks for the issues to be detected by an accessibility checker (for example, no caption or summary attributes specified in a \f3<table>\fR tag)\&.
@@ -1656,8 +1653,9 @@
 .TP 0.2i    
 \(bu
 \f3syntax\fR : Checks for low level issues like unescaped angle brackets (\f3<\fR and \f3>\fR) and ampersands (\f3&\fR) and invalid Javadoc tags\&.
-.RE
-.RS
+.RE     
+
+
 You can specify the \f3-Xdoclint\fR option multiple times to enable the option to check errors and warnings in multiple categories\&. Alternatively, you can specify multiple error and warning categories by using the preceding options\&. For example, use either of the following commands to check for the HTML, syntax, and accessibility issues in the file \fIfilename\fR\&.
 .sp     
 .nf     
@@ -1667,7 +1665,7 @@
 \f3javadoc \-Xdoclint:html,syntax,accessibility \fIfilename\fR\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1675,8 +1673,6 @@
 \fINote:\fR The \f3javadoc\fR command does not guarantee the completeness of these checks\&. In particular, it is not a full HTML compliance checker\&. The goal of the -\f3Xdoclint\fR option is to enable the \f3javadoc\fR command to report majority of common errors\&.
 
 The \f3javadoc\fR command does not attempt to fix invalid input, it just reports it\&.
-
-.RE
 .TP
 -public
 .br
@@ -1740,7 +1736,7 @@
 \f3javadoc \-sourcepath /home/user/src/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1755,7 +1751,7 @@
 \f3javadoc \-sourcepath /home/user1/src:/home/user2/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1766,13 +1762,13 @@
 
 If you omit \f3-sourcepath\fR, then the \f3javadoc\fR command uses \f3-classpath\fR to find the source files and class files (for backward compatibility)\&. If you want to search for source and class files in separate paths, then use both \f3-sourcepath\fR and \f3-classpath\fR\&.
 
-For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/libthen you would use the following command:
+For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/lib, then you would use the following command:
 .sp     
 .nf     
 \f3javadoc \-sourcepath /home/user/lib \-classpath /home/user/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1795,7 +1791,7 @@
 \f3javadoc \-d docs \-sourcepath /home/user/src  \-subpackages java:javax\&.swing \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1813,7 +1809,7 @@
 \f3    java\&.net:java\&.lang\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1846,11 +1842,10 @@
 .TP 0.2i    
 \(bu
 Breakiterator sentence-break algorithm\&. Stops at a period, question mark, or exclamation point followed by a space when the next word starts with a capital letter\&. This is meant to handle most abbreviations (such as "The serial no\&. is valid", but will not handle "Mr\&. Smith")\&. The \f3-breakiterator\fR option does not stop at HTML tags or sentences that begin with numbers or symbols\&. The algorithm stops at the last period in \&.\&./filename, even when embedded in an HTML tag\&.
-.RE
-.RS
-In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
+.RE     
 
-.RE
+
+In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
 .TP
 -locale \fIlanguage_country_variant\fR
 .br
@@ -1885,7 +1880,21 @@
 \f3Java HotSpot(TM) 64\-Bit Server VM (build 23\&.5\-b02, mixed mode)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-javafx
+.br
+Generates HTML documentation using the JavaFX extensions to the standard doclet\&. The generated documentation includes a Property Summary section in addition to the other summary sections generated by the standard Java doclet\&. The listed properties are linked to the sections for the getter and setter methods of each property\&.
+
+If there are no documentation comments written explicitly for getter and setter methods, the documentation comments from the property method are automatically copied to the generated documentation for these methods\&. This option also adds a new \f3@defaultValue\fR tag that allows documenting the default value for a property\&.
+
+Example:
+.sp     
+.nf     
+\f3javadoc \-javafx MyClass\&.java \-d testdir\fP
 .fi     
 .sp     
 
@@ -1957,7 +1966,7 @@
 \f3\-link <directory>/<directory>/\&.\&.\&./<name>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1982,7 +1991,7 @@
 \f3javadoc \-link http://docs\&.oracle\&.com/javase/8/docs/api/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The command generates documentation for the package \f3com\&.mypackage\fR with links to the Java SE packages\&. The generated documentation contains links to the \f3Object\fR class, for example, in the class \f3trees\fR\&. Other options, such as the \f3-sourcepath\fR and \f3-d\fR options, are not shown\&.
@@ -2044,7 +2053,7 @@
 \f3and so on \&.\&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When \f3javadoc\fR is run without the \f3-link\fR option and encounters a name that belongs to an externally referenced class, it prints the name with no link\&. However, when the \f3-link\fR option is used, the \f3javadoc\fR command searches the package-list file at the specified \fIextdocURL\fR location for that package name\&. When it finds the package name, it prefixes the name with \fIextdocURL\fR\&.
@@ -2094,7 +2103,7 @@
 \f3javadoc \-linkoffline http://docs\&.oracle\&.com/javase/8/docs/api/ \&.  com\&.mypackage \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2118,7 +2127,7 @@
 \f3packagelistLoc2 \&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2133,7 +2142,7 @@
 \f3javadoc \-d update \-linkoffline \&. html com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When the \f3javadoc\fR command completes, copy these generated class pages in update/com/package (not the overview or index) to the original files in html/com/package\&.
@@ -2150,7 +2159,7 @@
 \f3public class Button extends Component implements Accessible\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2161,7 +2170,7 @@
 \f3public String getLabel()\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2176,8 +2185,9 @@
 .TP 0.2i    
 \(bu
 The \f3packagepattern\fR value can be any package name at the start of any package name followed by an asterisk (*)\&. The asterisk is the only wildcard allowed and means match any characters\&. Multiple patterns can be included in a group by separating them with colons (:)\&. If you use an asterisk in a pattern or pattern list, then the pattern list must be inside quotation marks, such as \f3"java\&.lang*:java\&.util"\fR\&.
-.RE
-.RS
+.RE     
+
+
 When you do not supply a \f3-group\fR option, all packages are placed in one group with the heading \fIPackages\fR and appropriate subheadings\&. If the subheadings do not include all documented packages (all groups), then the remaining packages appear in a separate group with the subheading Other Packages\&.
 
 For example, the following \f3javadoc\fR command separates the three documented packages into \fICore\fR, \fIExtension\fR, and \fIOther Packages\fR\&. The trailing dot (\&.) does not appear in \f3java\&.lang*\fR\&. Including the dot, such as \f3java\&.lang\&.*\fR omits the\f3java\&.lang\fR package\&.
@@ -2192,7 +2202,7 @@
 \f3        java\&.lang java\&.lang\&.reflect java\&.util javax\&.servlet java\&.new\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2212,8 +2222,6 @@
 \fIOther Packages\fR
 
 \f3java\&.new\fR
-
-.RE
 .TP
 -nodeprecated
 .br
@@ -2251,7 +2259,7 @@
 \f3javadoc \-helpfile /home/user/myhelp\&.html java\&.awt\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2264,7 +2272,7 @@
 \f3javadoc \-stylesheet file /home/user/mystylesheet\&.css com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2283,7 +2291,7 @@
 \f3<META http\-equiv="Content\-Type" content="text/html; charset=ISO\-8859\-1">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2296,7 +2304,7 @@
 .br
 Specifies the encoding of the generated HTML files\&. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets at http://www\&.iana\&.org/assignments/character-sets
 
-If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding"iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
+If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding "iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
 .TP
 -keywords
 .br
@@ -2315,7 +2323,7 @@
 \f3<META NAME="keywords" CONTENT="charAt()">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2360,7 +2368,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2390,7 +2398,7 @@
 \f3\-tag example:X\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2433,7 +2441,7 @@
 \f3\-tag see\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2523,7 +2531,7 @@
 \f3\-sourcepath /java/pubs/ws/1\&.7\&.0/src/share/classes\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Create a file named packages that contains:
@@ -2538,7 +2546,7 @@
 \f3com\&.mypackage3\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:
@@ -2547,7 +2555,7 @@
 \f3javadoc @options @packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Argument Files with Paths\fR
@@ -2558,7 +2566,7 @@
 \f3javadoc @path1/options @path2/packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Option Arguments\fR
@@ -2581,7 +2589,7 @@
 \f3    Other names may be trademarks of their respective owners\&.</font>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:\f3javadoc -bottom @bottom @packages\fR\&.
@@ -2616,7 +2624,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src \-subpackages java \-exclude\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to Root and Run Explicit Packages\fR
@@ -2630,7 +2638,7 @@
 \f3javadoc \-d /home/html java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To also traverse down other package trees, append their names to the \f3-subpackages\fR argument, such as j\f3ava:javax:org\&.xml\&.sax\fR\&.
@@ -2643,7 +2651,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Run from Any Directory on Explicit Packages in Multiple Trees\fR
@@ -2654,7 +2662,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src1:/home/src2 java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The result is that all cases generate HTML-formatted documentation for the \f3public\fR and \f3protected\fR classes and interfaces in packages j\f3ava\&.awt\fR and \f3java\&.awt\&.even\fRt and save the HTML files in the specified destination directory\&. Because two or more packages are being generated, the document has three HTML frames: one for the list of packages, another for the list of classes, and the third for the main class pages\&.
@@ -2676,7 +2684,7 @@
 \f3javadoc \-d /home/html Button\&.java Canvas\&.java Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to the Root Directory of the Package\fR
@@ -2690,7 +2698,7 @@
 \f3javadoc \-d /home/html java/awt/Button\&.java java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Document Files from Any Directory\fR
@@ -2704,7 +2712,7 @@
 \f3/home/src/java/awt/Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2720,7 +2728,7 @@
 \f3/home/src/java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS REAL-WORLD\ EXAMPLES    
@@ -2784,7 +2792,7 @@
 \f3@packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2802,7 +2810,7 @@
 \f3import javax\&.tools\&.ToolProvider;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class JavaAccessSample{\fP
@@ -2838,7 +2846,7 @@
 \f3 }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The first three arguments of the \f3run\fR method specify input, standard output, and standard error streams\&. \f3Null\fR is the default value for \f3System\&.in\fR, \f3System\&.out\fR, and \f3System\&.err\fR, respectively\&.
@@ -2891,7 +2899,7 @@
 \f3        java\&.applet\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3WINDOWTITLE = \&'Java\(tm SE 7 API Specification\&'\fP
@@ -2927,7 +2935,7 @@
 \f3SRCDIR = \&'/java/jdk/1\&.7\&.0/src/share/classes\&'\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS NOTES    
diff --git a/src/bsd/doc/man/jjs.1 b/src/bsd/doc/man/jjs.1
index 47b5602..f223cf8 100644
--- a/src/bsd/doc/man/jjs.1
+++ b/src/bsd/doc/man/jjs.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: jjs.1
 .\"
 .if n .pl 99999
-.TH jjs 1 "21 November 2013" "JDK 8" "Basic Tools"
+.TH jjs 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -82,7 +82,7 @@
 \f3\-css=1k\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -91,7 +91,7 @@
 .br
 Compiles the script without running it\&.
 .TP
--cp \fIpath\fR , --classpath \fIpath\fR
+-cp \fIpath\fR , -classpath \fIpath\fR
 .br
 Specifies the path to the supporting class files To set multiple paths, the option can be repeated, or you can separate each path with a colon (:)\&.
 .TP
@@ -112,7 +112,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -133,7 +133,7 @@
 .TP
 -doe, --dump-on-error
 .br
-Provides a full stack trace when an arror occurs\&. By default, only a brief error message is printed\&.
+Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&.
 .TP
 --early-lvalue-error
 .br
@@ -180,13 +180,17 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
 
 This option can be repeated to pass multiple \f3java\fR command options\&.
 .TP
+--language=[es5]
+.br
+Specifies the ECMAScript language version\&. The default version is ES5\&.
+.TP
 --lazy-compilation
 .br
 Enables lazy code generation strategies (that is, the entire script is not compiled at once)\&. This option is experimental\&.
@@ -202,12 +206,13 @@
 .nf     
 \f3\-\-log=fields:finest,codegen:info\fP
 .fi     
-.nf     
-\f3\fR
-.fi     
 .sp     
 
 .TP
+--optimistic-types=[true|false]
+.br
+Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&.
+.TP
 --package=\fIname\fR
 .br
 Specifies the package to which generated class files are added\&.
@@ -302,7 +307,7 @@
 \f3jjs script\&.js\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Running Nashorn in Interactive Mode\fR
@@ -323,7 +328,7 @@
 \f3>>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Passing Arguments to Nashorn\fR
@@ -341,7 +346,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH SEE\ ALSO    
diff --git a/src/bsd/doc/man/jstat.1 b/src/bsd/doc/man/jstat.1
index 405df26..b8ec74b 100644
--- a/src/bsd/doc/man/jstat.1
+++ b/src/bsd/doc/man/jstat.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Monitoring Tools
 .\"     Title: jstat.1
 .\"
 .if n .pl 99999
-.TH jstat 1 "10 May 2011" "JDK 8" "Monitoring Tools"
+.TH jstat 1 "03 March 2015" "JDK 8" "Monitoring Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -101,7 +101,7 @@
 The communications protocol\&. If the \fIprotocol\fR value is omitted and a host name is not specified, then the default protocol is a platform-specific optimized local protocol\&. If the \fIprotocol\fR value is omitted and a host name is specified, then the default protocol is \f3rmi\fR\&.
 .TP     
 \fIlvmid\fR
-The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on UNIX platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
+The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on Solaris, Linux, and OS X platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
 .TP     
 \fIhostname\fR
 A hostname or IP address that indicates the target host\&. If the \fIhostname\fR value is omitted, then the target host is the local host\&.
@@ -154,7 +154,7 @@
 
 \f3gcnewcapacity\fR: Displays statistics about the sizes of the new generations and its corresponding spaces\&.
 
-\f3gcold\fR: Displays statistics about the behavior of the old generation and Metaspace Statistics\&.
+\f3gcold\fR: Displays statistics about the behavior of the old generation and metaspace statistics\&.
 
 \f3gcoldcapacity\fR: Displays statistics about the sizes of the old generation\&.
 
@@ -170,7 +170,7 @@
 .TP
 -t
 .br
-Display sa timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
+Displays a timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
 .TP
 -J\fIjavaOption\fR
 .br
@@ -184,7 +184,7 @@
 
 \f3Loaded\fR: Number of classes loaded\&.
 
-\f3Bytes\fR: Number of KBs loaded\&.
+\f3Bytes\fR: Number of kBs loaded\&.
 
 \f3Unloaded\fR: Number of classes unloaded\&.
 
@@ -212,25 +212,29 @@
 .br
 Garbage-collected heap statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3OU\fR: Old space utilization (KB)\&.
+\f3OU\fR: Old space utilization (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metacspace utilization (KB)\&.
+\f3MU\fR: Metacspace utilization (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3CCSU\fR: Compressed class space used (kB)\&.
 
 \f3YGC\fR: Number of young generation garbage collection events\&.
 
@@ -246,67 +250,71 @@
 .br
 Memory pool generation and space capacities\&.
 
-\f3NGCMN\fR: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3YGC\fR: Number of Young generation GC Events\&.
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3YGC\fR: Number of young generation GC events\&.
+
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gccause \fIoption\fR
 .br
 This option displays the same summary of garbage collection statistics as the \f3-gcutil\fR option, but includes the causes of the last garbage collection event and (when applicable) the current garbage collection event\&. In addition to the columns listed for \f3-gcutil\fR, this option adds the following columns\&.
 
-Garbage collection statistics, including garbage collection Events\&.
+\f3LGCC\fR: Cause of last garbage collection
 
-\f3LGCC\fR: Cause of last garbage collection\&.
-
-\f3GCC\fR: Cause of current garbage collection\&.
+\f3GCC\fR: Cause of current garbage collection
 .TP
 -gcnew \fIoption\fR
 .br
 New generation statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
 \f3TT\fR: Tenuring threshold\&.
 
 \f3MTT\fR: Maximum tenuring threshold\&.
 
-\f3DSS\fR: Desired survivor size (KB)\&.
+\f3DSS\fR: Desired survivor size (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -316,39 +324,43 @@
 .br
 New generation space size statistics\&.
 
-NGCMN: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0CMX\fR: Maximum survivor space 0 capacity (KB)\&.
+\f3S0CMX\fR: Maximum survivor space 0 capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1CMX\fR: Maximum survivor space 1 capacity (KB)\&.
+\f3S1CMX\fR: Maximum survivor space 1 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3ECMX\fR: Maximum eden space capacity (KB)\&.
+\f3ECMX\fR: Maximum eden space capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gcold \fIoption\fR
 .br
-old and permanent generation statistics\&.
+Old and permanent generation statistics\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metaspace utilization (KB)\&.
+\f3MU\fR: Metaspace utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
 
-\f3OU\fR: old space utilization (KB)\&.
+\f3CCSU\fR: Compressed class space used (kB)\&.
+
+\f3OC\fR: Current old space capacity (kB)\&.
+
+\f3OU\fR: Old space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -362,13 +374,13 @@
 .br
 Old generation statistics\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -382,11 +394,15 @@
 .br
 Permanent generation statistics\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
+
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
+
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -410,6 +426,8 @@
 
 \f3M\fR: Metaspace utilization as a percentage of the space\&'s current capacity\&.
 
+\f3CCS\fR: Compressed class space utilization as a percentage\&.
+
 \f3YGC\fR: Number of young generation GC events\&.
 
 \f3YGCT\fR: Young generation garbage collection time\&.
@@ -430,47 +448,44 @@
 
 \f3Type\fR: Compilation type of the most recently compiled method\&.
 
-\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintComplation\fR option\&.
+\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintCompilation\fR option\&.
 .SH EXAMPLES    
 This section presents some examples of monitoring a local JVM with an \fIlvmid\fR of 21891\&.
 .SS THE\ GCUTIL\ OPTION    
 This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified by the -\f3gcutil\fR option\&.
 .PP
-The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.001 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 9\&.49% to 9\&.51%\&. Before the collection, the survivor space was 12\&.44% utilized, but after this collection it is only 7\&.74% utilized\&.
+The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.078 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 66\&.80% to 68\&.19%\&. Before the collection, the survivor space was 97\&.02% utilized, but after this collection it is 91\&.03% utilized\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 21891 250 7\fP
 .fi     
 .nf     
-\f3  S0     S1     E      O      M       YGC    YGCT    FGC    FGCT     GCT\fP
+\f3  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   \fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  70\&.31  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  86\&.23  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  96\&.53  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00   1\&.98  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  15\&.82  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
-.fi     
-.nf     
-\f3\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .sp     
 .SS REPEAT\ THE\ COLUMN\ HEADER\ STRING    
-This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcutil\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
+This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcnew\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
 .PP
 In addition to showing the repeating header string, this example shows that between the second and third samples, a young GC occurred\&. Its duration was 0\&.001 seconds\&. The collection found enough active data that the survivor space 0 utilization (S0U) would have exceeded the desired survivor Size (DSS)\&. As a result, objects were promoted to the old generation (not visible in this output), and the tenuring threshold (TT) was lowered from 31 to 2\&.
 .PP
@@ -516,7 +531,7 @@
 .SS INCLUDE\ A\ TIME\ STAMP\ FOR\ EACH\ SAMPLE    
 This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals\&. The \f3-t\fR option is used to generate a time stamp for each sample in the first column\&.
 .PP
-The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown to from 11,696 KB to 13820 KB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 KB (OGCMX), so it still has room to expand\&.
+The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown from 11,696 kB to 13,820 kB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 kB (OGCMX), so it still has room to expand\&.
 .sp     
 .nf     
 \f3Timestamp      OGCMN    OGCMX     OGC       OC       YGC   FGC    FGCT    GCT\fP
@@ -537,7 +552,7 @@
 .SS MONITOR\ INSTRUMENTATION\ FOR\ A\ REMOTE\ JVM    
 This example attaches to lvmid 40496 on the system named remote\&.domain using the \f3-gcutil\fR option, with samples taken every second indefinitely\&.
 .PP
-The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the rmiregistry on \f3remote\&.domain\fR that is bound to the default rmiregistry port (port 1099)\&.
+The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the \f3rmiregistry\fR command on \f3remote\&.domain\fR that is bound to the default port of the \f3rmiregistry\fR command (port 1099)\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 40496@remote\&.domain 1000\fP
diff --git a/src/bsd/doc/man/keytool.1 b/src/bsd/doc/man/keytool.1
index 7275889..5a89779 100644
--- a/src/bsd/doc/man/keytool.1
+++ b/src/bsd/doc/man/keytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 6 August 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: keytool.1
 .\"
 .if n .pl 99999
-.TH keytool 1 "6 August 2013" "JDK 8" "Security Tools"
+.TH keytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -185,10 +185,16 @@
 .TP 0.2i    
 \(bu
 Items in italics (option values) represent the actual values that must be supplied\&. For example, here is the format of the \f3-printcert\fR command:
+.sp     
+.nf     
+\f3keytool \-printcert {\-file \fIcert_file\fR} {\-v}\fP
+.fi     
+.sp     
 
-\f3keytool -printcert {-file cert_file} {-v}\fR
 
-When you specify a \f3-printcert\fR command, replace \f3cert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
+
+
+When you specify a \f3-printcert\fR command, replace \fIcert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
 .TP 0.2i    
 \(bu
 Option values must be put in quotation marks when they contain a blank (space)\&.
@@ -385,10 +391,39 @@
 .PP
 \fINote:\fR Users should be aware that some combinations of extensions (and other certificate fields) may not conform to the Internet standard\&. See Certificate Conformance Warning\&.
 .SH COMMANDS    
-.TP
+.TP     
 -gencert
-.br
-\f3{-rfc} {-infile infile} {-outfile outfile} {-alias alias} {-sigalg sigalg} {-dname dname} {-startdate startdate {-ext ext}* {-validity valDays} [-keypass keypass] {-keystore keystore} [-storepass storepass] {-storetype storetype} {-providername provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-rfc} {\-infile \fIinfile\fR} {\-outfile \fIoutfile\fR} {\-alias \fIalias\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-dname \fIdname\fR} {\-startdate \fIstartdate\fR {\-ext \fIext\fR}* {\-validity \fIvalDays\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-providername \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a certificate as a response to a certificate request file (which can be created by the \f3keytool\fR\f3-certreq\fR command)\&. The command reads the request from \fIinfile\fR (if omitted, from the standard input), signs it using alias\&'s private key, and outputs the X\&.509 certificate into \fIoutfile\fR (if omitted, to the standard output)\&. When\f3-rfc\fR is specified, the output format is Base64-encoded PEM; otherwise, a binary DER is created\&.
 
@@ -459,10 +494,39 @@
 .fi     
 .sp     
 
-.TP
+.TP     
 -genkeypair
-.br
-\f3{-alias alias} {-keyalg keyalg} {-keysize keysize} {-sigalg sigalg} [-dname dname] [-keypass keypass] {-startdate value} {-ext ext}* {-validity valDays} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-dname \fIdname\fR] [\-keypass \fIkeypass\fR] {\-startdate \fIvalue\fR} {\-ext \fIext\fR}*\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-validity \fIvalDays\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a key pair (a public key and associated private key)\&. Wraps the public key into an X\&.509 v3 self-signed certificate, which is stored as a single-element certificate chain\&. This certificate chain and the private key are stored in a new keystore entry identified by alias\&.
 
@@ -510,18 +574,61 @@
 The value of \f3valDays\fR specifies the number of days (starting at the date specified by \f3-startdate\fR, or the current date when \f3-startdate\fR is not specified) for which the certificate should be considered valid\&.
 
 This command was named \f3-genkey\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-genkeypair\fR, is preferred going forward\&.
-.TP
+.TP     
 -genseckey
-.br
-\f3-genseckey {-alias alias} {-keyalg keyalg} {-keysize keysize} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} [\-keypass \fIkeypass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a secret key and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&.
 
 The value of \f3keyalg\fR specifies the algorithm to be used to generate the secret key, and the value of \f3keysize\fR specifies the size of the key to be generated\&. The \f3keypass\fR value is a password that protects the secret key\&. If no password is provided, then the user is prompted for it\&. If you press the Return key at the prompt, then the key password is set to the same password that is used for the \f3keystore\fR\&. The \f3keypass\fR value must be at least 6 characters\&.
-.TP
+.TP     
 -importcert
-.br
-\f3-importcert {-alias alias} {-file cert_file} [-keypass keypass] {-noprompt} {-trustcacerts} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} [\-keypass \fIkeypass\fR] {\-noprompt} {\-trustcacerts}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate or certificate chain (where the latter is supplied in a PKCS#7 formatted reply or a sequence of X\&.509 certificates) from the file \f3cert_file\fR, and stores it in the \f3keystore\fR entry identified by \f3alias\fR\&. If no file is specified, then the certificate or certificate chain is read from \f3stdin\fR\&.
 
@@ -530,16 +637,74 @@
 You import a certificate for two reasons: To add it to the list of trusted certificates, and to import a certificate reply received from a certificate authority (CA) as the result of submitting a Certificate Signing Request to that CA (see the \f3-certreq\fR option in Commands)\&.
 
 Which type of import is intended is indicated by the value of the \f3-alias\fR option\&. If the alias does not point to a key entry, then the \f3keytool\fR command assumes you are adding a trusted certificate entry\&. In this case, the alias should not already exist in the keystore\&. If the alias does already exist, then the \f3keytool\fR command outputs an error because there is already a trusted certificate for that alias, and does not import the certificate\&. If the alias points to a key entry, then the \f3keytool\fR command assumes you are importing a certificate reply\&.
-.TP
+.TP     
 -importpassword
-.br
-\f3{-alias alias} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a passphrase and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&. The passphrase may be supplied via the standard input stream; otherwise the user is prompted for it\&. \f3keypass\fR is a password used to protect the imported passphrase\&. If no password is provided, the user is prompted for it\&. If you press the Return key at the prompt, the key password is set to the same password as that used for the \f3keystore\fR\&. \f3keypass\fR must be at least 6 characters long\&.
-.TP
+.TP     
 -importkeystore
-.br
-\f3{-srcstoretype srcstoretype} {-deststoretype deststoretype} [-srcstorepass srcstorepass] [-deststorepass deststorepass] {-srcprotected} {-destprotected} {-srcalias srcalias {-destalias destalias} [-srckeypass srckeypass] } [-destkeypass destkeypass] {-noprompt} {-srcProviderName src_provider_name} {-destProviderName dest_provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-srcstoretype \fIsrcstoretype\fR} {\-deststoretype \fIdeststoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-srcstorepass \fIsrcstorepass\fR] [\-deststorepass \fIdeststorepass\fR] {\-srcprotected}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-destprotected} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcalias \fIsrcalias\fR {\-destalias \fIdestalias\fR} [\-srckeypass \fIsrckeypass\fR]} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-destkeypass \fIdestkeypass\fR] {\-noprompt}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcProviderName \fIsrc_provider_name\fR} {\-destProviderName \fIdest_provider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a single entry or all entries from a source keystore to a destination keystore\&.
 
@@ -550,16 +715,44 @@
 If the destination alias already exists in the destination keystore, then the user is prompted to either overwrite the entry or to create a new entry under a different alias name\&.
 
 If the \f3-noprompt\fR option is provided, then the user is not prompted for a new destination alias\&. Existing entries are overwritten with the destination alias name\&. Entries that cannot be imported are skipped and a warning is displayed\&.
-.TP
+.TP     
 -printcertreq
-.br
-\f3{-file file}\fR
+.sp     
+.nf     
+\f3{\-file \fIfile\fR}\fP
+.fi     
+.sp     
+
 
 Prints the content of a PKCS #10 format certificate request, which can be generated by the \f3keytool\fR\f3-certreq\fR command\&. The command reads the request from file\&. If there is no file, then the request is read from the standard input\&.
-.TP
+.TP     
 -certreq
-.br
-\f3{-alias alias} {-dname dname} {-sigalg sigalg} {-file certreq_file} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-dname \fIdname\fR} {\-sigalg \fIsigalg\fR} {\-file \fIcertreq_file\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a Certificate Signing Request (CSR) using the PKCS #10 format\&.
 
@@ -572,10 +765,29 @@
 The CSR is stored in the file certreq_file\&. If no file is specified, then the CSR is output to \f3stdout\fR\&.
 
 Use the \f3importcert\fR command to import the response from the CA\&.
-.TP
+.TP     
 -exportcert
-.br
-\f3{-alias alias} {-file cert_file} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-rfc} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-rfc} {\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads from the keystore the certificate associated with \fIalias\fR and stores it in the cert_file file\&. When no file is specified, the certificate is output to \f3stdout\fR\&.
 
@@ -584,20 +796,48 @@
 If \f3alias\fR refers to a trusted certificate, then that certificate is output\&. Otherwise, \f3alias\fR refers to a key entry with an associated certificate chain\&. In that case, the first certificate in the chain is returned\&. This certificate authenticates the public key of the entity addressed by \f3alias\fR\&.
 
 This command was named \f3-export\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-exportcert\fR, is preferred going forward\&.
-.TP
+.TP     
 -list
-.br
-\f3{-alias alias} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v | -rfc} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v | \-rfc} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Prints to \f3stdout\fR the contents of the keystore entry identified by \f3alias\fR\&. If no \f3alias\fR is specified, then the contents of the entire keystore are printed\&.
 
 This command by default prints the SHA1 fingerprint of a certificate\&. If the \f3-v\fR option is specified, then the certificate is printed in human-readable format, with additional information such as the owner, issuer, serial number, and any extensions\&. If the \f3-rfc\fR option is specified, then the certificate contents are printed using the printable encoding format, as defined by the Internet RFC 1421 Certificate Encoding Standard\&.
 
 You cannot specify both \f3-v\fR and \f3-rfc\fR\&.
-.TP
+.TP     
 -printcert
-.br
-\f3{-file cert_file | -sslserver host[:port]} {-jarfile JAR_file {-rfc} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-file \fIcert_file\fR | \-sslserver \fIhost\fR[:\fIport\fR]} {\-jarfile \fIJAR_file\fR {\-rfc} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate from the file cert_file, the SSL server located at host:port, or the signed JAR file \f3JAR_file\fR (with the \f3-jarfile\fR option and prints its contents in a human-readable format\&. When no port is specified, the standard HTTPS port 443 is assumed\&. Note that \f3-sslserver\fR and -file options cannot be provided at the same time\&. Otherwise, an error is reported\&. If neither option is specified, then the certificate is read from \f3stdin\fR\&.
 
@@ -608,40 +848,120 @@
 If the SSL server is behind a firewall, then the \f3-J-Dhttps\&.proxyHost=proxyhost\fR and \f3-J-Dhttps\&.proxyPort=proxyport\fR options can be specified on the command line for proxy tunneling\&. See Java Secure Socket Extension (JSSE) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide\&.html
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -printcrl
-.br
-\f3-file crl_ {-v}\fR
+.sp     
+.nf     
+\f3\-file \fIcrl_\fR {\-v}\fP
+.fi     
+.sp     
+
 
 Reads the Certificate Revocation List (CRL) from the file \f3crl_\fR\&. A CRL is a list of digital certificates that were revoked by the CA that issued them\&. The CA generates the \f3crl_\fR file\&.
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -storepasswd
-.br
-\f3[-new new_storepass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-new \fInew_storepass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password used to protect the integrity of the keystore contents\&. The new password is \f3new_storepass\fR, which must be at least 6 characters\&.
-.TP
+.TP     
 -keypasswd
-.br
-\f3{-alias alias} [-keypass old_keypass] [-new new_keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIold_keypass\fR] [\-new \fInew_keypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password under which the private/secret key identified by \f3alias\fR is protected, from \f3old_keypass\fR to \f3new_keypass\fR, which must be at least 6 characters\&.
 
 If the \f3-keypass\fR option is not provided at the command line, and the key password is different from the keystore password, then the user is prompted for it\&.
 
 If the \f3-new\fR option is not provided at the command line, then the user is prompted for it
-.TP
+.TP     
 -delete
-.br
-\f3[-alias alias] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-alias \fIalias\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}  \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Deletes from the keystore the entry identified by \f3alias\fR\&. The user is prompted for the alias, when no alias is provided at the command line\&.
-.TP
+.TP     
 -changealias
-.br
-\f3{-alias alias} [-destalias destalias] [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-destalias \fIdestalias\fR] [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Move an existing keystore entry from the specified \f3alias\fR to a new alias, \f3destalias\fR\&. If no destination alias is provided, then the command prompts for one\&. If the original entry is protected with an entry password, then the password can be supplied with the \f3-keypass\fR option\&. If no key password is provided, then the \f3storepass\fR (if provided) is attempted first\&. If the attempt fails, then the user is prompted for a password\&.
 .TP
diff --git a/src/bsd/doc/man/policytool.1 b/src/bsd/doc/man/policytool.1
index a82f7be..c7fb46b 100644
--- a/src/bsd/doc/man/policytool.1
+++ b/src/bsd/doc/man/policytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: policytool.1
 .\"
 .if n .pl 99999
-.TH policytool 1 "21 November 2013" "JDK 8" "Security Tools"
+.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -80,7 +80,7 @@
 Run the \f3policytool\fR command and load the specified file:
 .sp     
 .nf     
-\f3policytool\-file mypolicyfile\fP
+\f3policytool \-file \fImypolicyfile\fR\fP
 .fi     
 .nf     
 \f3\fP
diff --git a/src/linux/doc/man/java.1 b/src/linux/doc/man/java.1
index bc8f1f1..552dd48 100644
--- a/src/linux/doc/man/java.1
+++ b/src/linux/doc/man/java.1
@@ -1,3461 +1,2198 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: java
-.\" Language: English
-.\" Date: 08 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: java.1
 .\"
 .if n .pl 99999
-.TH "java" "1" "08 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH java 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 java \- Launches a Java application\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fIclassname\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.fi     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fB\-jar\fR \fIfilename\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options separated by spaces\&. See Options\&.
-.RE
-.PP
+Command-line options separated by spaces\&. See Options\&.
+.TP     
 \fIclassname\fR
-.RS 4
 The name of the class to be launched\&.
-.RE
-.PP
+.TP     
 \fIfilename\fR
-.RS 4
-The name of the Java Archive (JAR) file to be called\&. Used only with the
-\fB\-jar\fR
-option\&.
-.RE
-.PP
+The name of the Java Archive (JAR) file to be called\&. Used only with the \f3-jar\fR option\&.
+.TP     
 \fIargs\fR
-.RS 4
-The arguments passed to the
-\fBmain()\fR
-method separated by spaces\&.
-.RE
-.SH "DESCRIPTION"
+The arguments passed to the \f3main()\fR method separated by spaces\&.
+.SH DESCRIPTION    
+The \f3java\fR command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\&'s \f3main()\fR method\&. The method must be declared \fIpublic\fR and \fIstatic\fR, it must not return any value, and it must accept a \f3String\fR array as a parameter\&. The method declaration has the following form:
+.sp     
+.nf     
+\f3public static void main(String[] args)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3java\fR command can be used to launch a JavaFX application by loading a class that either has a \f3main()\fR method or that extends \f3javafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the \f3Application\fR class, calls its \f3init()\fR method, and then calls the \f3start(javafx\&.stage\&.Stage)\fR method\&.
 .PP
-The
-\fBjava\fR
-command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\*(Aqs
-\fBmain()\fR
-method\&. The method must be declared
-\fIpublic\fR
-and
-\fIstatic\fR, it must not return any value, and it must accept a
-\fBString\fR
-array as a parameter\&. The method declaration has the following form:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static void main(String[] args)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The
-\fBjava\fR
-command can be used to launch a JavaFX application by loading a class that either has a
-\fBmain()\fR
-method or that extends
-\fBjavafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the
-\fBApplication\fR
-class, calls its
-\fBinit()\fR
-method, and then calls the
-\fBstart(javafx\&.stage\&.Stage)\fR
-method\&.
-.PP
-By default, the first argument that is not an option of the
-\fBjava\fR
-command is the fully qualified name of the class to be called\&. If the
-\fB\-jar\fR
-option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the
-\fBMain\-Class\fR
-manifest header in its source code\&.
+By default, the first argument that is not an option of the \f3java\fR command is the fully qualified name of the class to be called\&. If the \f3-jar\fR option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the \f3Main-Class\fR manifest header in its source code\&.
 .PP
 The JRE searches for the startup class (and other classes used by the application) in three sets of locations: the bootstrap class path, the installed extensions, and the user\(cqs class path\&.
 .PP
-Arguments after the class file name or the JAR file name are passed to the
-\fBmain()\fR
-method\&.
-.SH "OPTIONS"
-.PP
-The
-\fBjava\fR
-command supports a wide range of options that can be divided into the following categories:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+Arguments after the class file name or the JAR file name are passed to the \f3main()\fR method\&.
+.SH OPTIONS    
+The \f3java\fR command supports a wide range of options that can be divided into the following categories:
+.TP 0.2i    
+\(bu
 Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Non\-Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
+Non-Standard Options
+.TP 0.2i    
+\(bu
 Advanced Runtime Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced JIT Compiler Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Serviceability Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Garbage Collection Options
-.RE
 .PP
 Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM)\&. They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on\&.
 .PP
-Non\-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with
-\fB\-X\fR\&.
+Non-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with \f3-X\fR\&.
 .PP
-Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with
-\fB\-XX\fR\&.
+Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with \f3-XX\fR\&.
 .PP
 To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document\&.
 .PP
-Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean
-\fB\-XX\fR
-options are enabled using the plus sign (\fB\-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\fB\-XX:\-\fR\fIOptionName\fR)\&.
+Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean \f3-XX\fR options are enabled using the plus sign (\f3-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\f3-XX:-\fR\fIOptionName\fR)\&.
 .PP
-For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix
-\fBk\fR
-or
-\fBK\fR
-for kilobytes (KB),
-\fBm\fR
-or
-\fBM\fR
-for megabytes (MB),
-\fBg\fR
-or
-\fBG\fR
-for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either
-\fB8g\fR,
-\fB8192m\fR,
-\fB8388608k\fR, or
-\fB8589934592\fR
-as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify
-\fB0\&.25\fR
-for 25%)\&.
-.SS "Standard Options"
-.PP
+For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix \f3k\fR or \f3K\fR for kilobytes (KB), \f3m\fR or \f3M\fR for megabytes (MB), \f3g\fR or \f3G\fR for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either \f38g\fR, \f38192m\fR, \f38388608k\fR, or \f38589934592\fR as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify \f30\&.25\fR for 25%)\&.
+.SS STANDARD\ OPTIONS    
 These are the most commonly used options that are supported by all implementations of the JVM\&.
-.PP
-\-agentlib:\fIlibname\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified native agent library\&. After the library name, a comma\-separated list of options specific to the library can be used\&.
-.sp
-If the option
-\fB\-agentlib:foo\fR
-is specified, then the JVM attempts to load the library named
-\fBlibfoo\&.so\fR
-in the location specified by the
-\fBLD_LIBRARY_PATH\fR
-system variable (on OS X this variable is
-\fBDYLD_LIBRARY_PATH\fR)\&.
-.sp
+.TP
+-agentlib:\fIlibname\fR[=\fIoptions\fR]
+.br
+Loads the specified native agent library\&. After the library name, a comma-separated list of options specific to the library can be used\&.
+
+If the option \f3-agentlib:foo\fR is specified, then the JVM attempts to load the library named \f3libfoo\&.so\fR in the location specified by the \f3LD_LIBRARY_PATH\fR system variable (on OS X this variable is \f3DYLD_LIBRARY_PATH\fR)\&.
+
 The following example shows how to load the heap profiling tool (HPROF) library and get sample CPU information every 20 ms, with a stack depth of 3:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:hprof=cpu=samples,interval=20,depth=3\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:hprof=cpu=samples,interval=20,depth=3\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 For more information about the native agent libraries, refer to the following:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The
-\fBjava\&.lang\&.instrument\fR
-package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
+The \f3java\&.lang\&.instrument\fR package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP 0.2i    
+\(bu
 Agent Command Line Options in the JVM Tools Interface guide at http://docs\&.oracle\&.com/javase/8/docs/platform/jvmti/jvmti\&.html#starting
-.RE
-.RE
-.PP
-\-agentpath:\fIpathname\fR[=\fIoptions\fR]
-.RS 4
-Loads the native agent library specified by the absolute path name\&. This option is equivalent to
-\fB\-agentlib\fR
-but uses the full path and file name of the library\&.
-.RE
-.PP
-\-client
-.RS 4
-Selects the Java HotSpot Client VM\&. The 64\-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.RE     
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-D\fIproperty\fR=\fIvalue\fR
-.RS 4
-Sets a system property value\&. The
-\fIproperty\fR
-variable is a string with no spaces that represents the name of the property\&. The
-\fIvalue\fR
-variable is a string that represents the value of the property\&. If
-\fIvalue\fR
-is a string with spaces, then enclose it in quotation marks (for example
-\fB\-Dfoo="foo bar"\fR)\&.
-.RE
-.PP
-\-d32
-.RS 4
-Runs the application in a 32\-bit environment\&. If a 32\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.RE
-.PP
-\-d64
-.RS 4
-Runs the application in a 64\-bit environment\&. If a 64\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.sp
-Currently only the Java HotSpot Server VM supports 64\-bit operation, and the
-\fB\-server\fR
-option is implicit with the use of
-\fB\-d64\fR\&. The
-\fB\-client\fR
-option is ignored with the use of
-\fB\-d64\fR\&. This is subject to change in a future release\&.
-.RE
-.PP
-\-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+-agentpath:\fIpathname\fR[=\fIoptions\fR]
 .br
-\-da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+Loads the native agent library specified by the absolute path name\&. This option is equivalent to \f3-agentlib\fR but uses the full path and file name of the library\&.
+.TP
+-client
+.br
+Selects the Java HotSpot Client VM\&. The 64-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
+
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-D\fIproperty\fR=\fIvalue\fR
+.br
+Sets a system property value\&. The \fIproperty\fR variable is a string with no spaces that represents the name of the property\&. The \fIvalue\fR variable is a string that represents the value of the property\&. If \fIvalue\fR is a string with spaces, then enclose it in quotation marks (for example \f3-Dfoo="foo bar"\fR)\&.
+.TP
+-d32
+.br
+Runs the application in a 32-bit environment\&. If a 32-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+.TP
+-d64
+.br
+Runs the application in a 64-bit environment\&. If a 64-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+
+Currently only the Java HotSpot Server VM supports 64-bit operation, and the \f3-server\fR option is implicit with the use of \f3-d64\fR\&. The \f3-client\fR option is ignored with the use of \f3-d64\fR\&. This is subject to change in a future release\&.
+.TP
+.nf
+-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.br
+.fi
 Disables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-disableassertions\fR
-(\fB\-da\fR) disables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch disables assertions in the specified class\&.
-.sp
-The
-\fB\-disableassertions\fR
-(\fB\-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The
-\fB\-disablesystemassertions\fR
-option enables you to disable assertions in all system classes\&.
-.sp
-To explicitly enable assertions in specific packages or classes, use the
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-disablesystemassertions
+
+With no arguments, \f3-disableassertions\fR (\f3-da\fR) disables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch disables assertions in the specified class\&.
+
+The \f3-disableassertions\fR (\f3-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The \f3-disablesystemassertions\fR option enables you to disable assertions in all system classes\&.
+
+To explicitly enable assertions in specific packages or classes, use the \f3-enableassertions\fR (\f3-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the \f3MyClass\fR application with assertions enabled in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-disablesystemassertions, -dsa
 .br
-\-dsa
-.RS 4
 Disables assertions in all system classes\&.
-.RE
-.PP
-\-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+.nf
+-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 .br
-\-ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+.fi
 Enables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-enableassertions\fR
-(\fB\-ea\fR) enables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch enables assertions in the specified class\&.
-.sp
-The
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The
-\fB\-enablesystemassertions\fR
-option provides a separate switch to enable assertions in all system classes\&.
-.sp
-To explicitly disable assertions in specific packages or classes, use the
-\fB\-disableassertions\fR
-(\fB\-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled only in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-enablesystemassertions
+
+With no arguments, \f3-enableassertions\fR (\f3-ea\fR) enables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch enables assertions in the specified class\&.
+
+The \f3-enableassertions\fR (\f3-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The \f3-enablesystemassertions\fR option provides a separate switch to enable assertions in all system classes\&.
+
+To explicitly disable assertions in specific packages or classes, use the \f3-disableassertions\fR (\f3-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the \f3MyClass\fR application with assertions enabled only in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-enablesystemassertions, -esa
 .br
-\-esa
-.RS 4
 Enables assertions in all system classes\&.
-.RE
-.PP
-\-help
+.TP
+-help, -?
 .br
-\-?
-.RS 4
-Displays usage information for the
-\fBjava\fR
-command without actually running the JVM\&.
-.RE
-.PP
-\-jar \fIfilename\fR
-.RS 4
-Executes a program encapsulated in a JAR file\&. The
-\fIfilename\fR
-argument is the name of a JAR file with a manifest that contains a line in the form
-\fBMain\-Class:\fR\fIclassname\fR
-that defines the class with the
-\fBpublic static void main(String[] args)\fR
-method that serves as your application\*(Aqs starting point\&.
-.sp
-When you use the
-\fB\-jar\fR
-option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
-.sp
+Displays usage information for the \f3java\fR command without actually running the JVM\&.
+.TP
+-jar \fIfilename\fR
+.br
+Executes a program encapsulated in a JAR file\&. The \fIfilename\fR argument is the name of a JAR file with a manifest that contains a line in the form \f3Main-Class:\fR\fIclassname\fR that defines the class with the \f3public static void main(String[] args)\fR method that serves as your application\&'s starting point\&.
+
+When you use the \f3-jar\fR option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
+
 For more information about JAR files, see the following resources:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 The Java Archive (JAR) Files guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/jar/index\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Lesson: Packaging Programs in JAR Files at
+.TP 0.2i    
+\(bu
+Lesson: Packaging Programs in JAR Files at http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
+.RE     
 
-http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
-.RE
-.RE
-.PP
-\-javaagent:\fIjarpath\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the
-\fBjava\&.lang\&.instrument\fR
-package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.PP
-\-jre\-restrict\-search
-.RS 4
-Includes user\-private JREs in the version search\&.
-.RE
-.PP
-\-no\-jre\-restrict\-search
-.RS 4
-Excludes user\-private JREs from the version search\&.
-.RE
-.PP
-\-server
-.RS 4
-Selects the Java HotSpot Server VM\&. The 64\-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.TP
+-javaagent:\fIjarpath\fR[=\fIoptions\fR]
+.br
+Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the \f3java\&.lang\&.instrument\fR package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP
+-jre-restrict-search
+.br
+Includes user-private JREs in the version search\&.
+.TP
+-no-jre-restrict-search
+.br
+Excludes user-private JREs from the version search\&.
+.TP
+-server
+.br
+Selects the Java HotSpot Server VM\&. The 64-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-showversion
-.RS 4
-Displays version information and continues execution of the application\&. This option is equivalent to the
-\fB\-version\fR
-option except that the latter instructs the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-splash:\fIimgname\fR
-.RS 4
-Shows the splash screen with the image specified by
-\fIimgname\fR\&. For example, to show the
-\fBsplash\&.gif\fR
-file from the
-\fBimages\fR
-directory when starting your application, use the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-splash:images/splash\&.gif\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-verbose:class
-.RS 4
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-showversion
+.br
+Displays version information and continues execution of the application\&. This option is equivalent to the \f3-version\fR option except that the latter instructs the JVM to exit after displaying version information\&.
+.TP
+-splash:\fIimgname\fR
+.br
+Shows the splash screen with the image specified by \fIimgname\fR\&. For example, to show the \f3splash\&.gif\fR file from the \f3images\fR directory when starting your application, use the following option:
+.sp     
+.nf     
+\f3\-splash:images/splash\&.gif\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-verbose:class
+.br
 Displays information about each loaded class\&.
-.RE
-.PP
-\-verbose:gc
-.RS 4
+.TP
+-verbose:gc
+.br
 Displays information about each garbage collection (GC) event\&.
-.RE
-.PP
-\-verbose:jni
-.RS 4
+.TP
+-verbose:jni
+.br
 Displays information about the use of native methods and other Java Native Interface (JNI) activity\&.
-.RE
-.PP
-\-version
-.RS 4
-Displays version information and then exits\&. This option is equivalent to the
-\fB\-showversion\fR
-option except that the latter does not instruct the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-version:\fIrelease\fR
-.RS 4
-Specifies the release version to be used for running the application\&. If the version of the
-\fBjava\fR
-command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
-.sp
-The
-\fIrelease\fR
-argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A
-\fIversion string\fR
-is the developer designation of the version number in the following form:
-\fB1\&.\fR\fIx\fR\fB\&.0_\fR\fIu\fR
-(where
-\fIx\fR
-is the major version number, and
-\fIu\fR
-is the update version number)\&. A
-\fIversion range\fR
-is made up of a version string followed by a plus sign (\fB+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\fB*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical
-\fIOR\fR
-combination, or an ampersand (\fB&\fR) for a logical
-\fIAND\fR
-combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Quotation marks are necessary only if there are spaces in the
-\fIrelease\fR
-parameter\&.
-.sp
+.TP
+-version
+.br
+Displays version information and then exits\&. This option is equivalent to the \f3-showversion\fR option except that the latter does not instruct the JVM to exit after displaying version information\&.
+.TP
+-version:\fIrelease\fR
+.br
+Specifies the release version to be used for running the application\&. If the version of the \f3java\fR command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
+
+The \fIrelease\fR argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A \fIversion string\fR is the developer designation of the version number in the following form: \f31\&.\fR\fIx\fR\f3\&.0_\fR\fIu\fR (where \fIx\fR is the major version number, and \fIu\fR is the update version number)\&. A \fIversion range\fR is made up of a version string followed by a plus sign (\f3+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\f3*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical \fIOR\fR combination, or an ampersand (\f3&\fR) for a logical \fIAND\fR combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
+.sp     
+.nf     
+\f3\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Quotation marks are necessary only if there are spaces in the \fIrelease\fR parameter\&.
+
 For JAR files, the preference is to specify version requirements in the JAR file manifest rather than on the command line\&.
-.RE
-.SS "Non\-Standard Options"
-.PP
+.SS NON-STANDARD\ OPTIONS    
 These options are general purpose options that are specific to the Java HotSpot Virtual Machine\&.
-.PP
-\-X
-.RS 4
-Displays help for all available
-\fB\-X\fR
-options\&.
-.RE
-.PP
-\-Xbatch
-.RS 4
-Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The
-\fB\-Xbatch\fR
-flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
-.sp
-This option is equivalent to
-\fB\-XX:\-BackgroundCompilation\fR\&.
-.RE
-.PP
-\-Xbootclasspath:\fIpath\fR
-.RS 4
+.TP
+-X
+.br
+Displays help for all available \f3-X\fR options\&.
+.TP
+-Xbatch
+.br
+Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The \f3-Xbatch\fR flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
+
+This option is equivalent to \f3-XX:-BackgroundCompilation\fR\&.
+.TP
+-Xbootclasspath:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to search for boot class files\&. These are used in place of the boot class files included in the JDK\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+
+\fI\fRDo not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to append to the end of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to prepend to the front of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xcheck:jni
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xcheck:jni
+.br
 Performs additional checks for Java Native Interface (JNI) functions\&. Specifically, it validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request\&. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with an irrecoverable error in such cases\&. Expect a performance degradation when this option is used\&.
-.RE
-.PP
-\-Xcomp
-.RS 4
-Forces compilation of methods on first invocation\&. By default, the Client VM (\fB\-client\fR) performs 1,000 interpreted method invocations and the Server VM (\fB\-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the
-\fB\-Xcomp\fR
-option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
-.sp
-You can also change the number of interpreted method invocations before compilation using the
-\fB\-XX:CompileThreshold\fR
-option\&.
-.RE
-.PP
-\-Xdebug
-.RS 4
+.TP
+-Xcomp
+.br
+Forces compilation of methods on first invocation\&. By default, the Client VM (\f3-client\fR) performs 1,000 interpreted method invocations and the Server VM (\f3-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the \f3-Xcomp\fR option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
+
+You can also change the number of interpreted method invocations before compilation using the \f3-XX:CompileThreshold\fR option\&.
+.TP
+-Xdebug
+.br
 Does nothing\&. Provided for backward compatibility\&.
-.RE
-.PP
-\-Xdiag
-.RS 4
+.TP
+-Xdiag
+.br
 Shows additional diagnostic messages\&.
-.RE
-.PP
-\-Xfuture
-.RS 4
-Enables strict class\-file format checks that enforce close conformance to the class\-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
-.RE
-.PP
-\-Xint
-.RS 4
-Runs the application in interpreted\-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
-.RE
-.PP
-\-Xinternalversion
-.RS 4
-Displays more detailed JVM version information than the
-\fB\-version\fR
-option, and then exits\&.
-.RE
-.PP
-\-Xloggc:\fIfilename\fR
-.RS 4
-Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of
-\fB\-verbose:gc\fR
-with the time elapsed since the first GC event preceding each logged event\&. The
-\fB\-Xloggc\fR
-option overrides
-\fB\-verbose:gc\fR
-if both are given with the same
-\fBjava\fR
-command\&.
-.sp
+.TP
+-Xfuture
+.br
+Enables strict class-file format checks that enforce close conformance to the class-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
+.TP
+-Xint
+.br
+Runs the application in interpreted-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
+.TP
+-Xinternalversion
+.br
+Displays more detailed JVM version information than the \f3-version\fR option, and then exits\&.
+.TP
+-Xloggc:\fIfilename\fR
+.br
+Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of \f3-verbose:gc\fR with the time elapsed since the first GC event preceding each logged event\&. The \f3-Xloggc\fR option overrides \f3-verbose:gc\fR if both are given with the same \f3java\fR command\&.
+
 Example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xloggc:garbage\-collection\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xmaxjitcodesize=\fIsize\fR
-.RS 4
-Specifies the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the value is set to 48 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmaxjitcodesize=48m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ReservedCodeCacheSize\fR\&.
-.RE
-.PP
-\-Xmixed
-.RS 4
+.sp     
+.nf     
+\f3\-Xloggc:garbage\-collection\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xmaxjitcodesize=\fIsize\fR
+.br
+Specifies the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the value is set to 48 MB:
+.sp     
+.nf     
+\f3\-Xmaxjitcodesize=48m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ReservedCodeCacheSize\fR\&.
+.TP
+-Xmixed
+.br
 Executes all bytecode by the interpreter except for hot methods, which are compiled to native code\&.
-.RE
-.PP
-\-Xmn\fIsize\fR
-.RS 4
-Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.TP
+-Xmn\fIsize\fR
+.br
+Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too small, then a lot of minor garbage collections will be performed\&. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial and maximum size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmn256m\fR
-\fB\-Xmn262144k\fR
-\fB\-Xmn268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Instead of the
-\fB\-Xmn\fR
-option to set both the initial and maximum size of the heap for the young generation, you can use
-\fB\-XX:NewSize\fR
-to set the initial size and
-\fB\-XX:MaxNewSize\fR
-to set the maximum size\&.
-.RE
-.PP
-\-Xms\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-Xmn256m\fP
+.fi     
+.nf     
+\f3\-Xmn262144k\fP
+.fi     
+.nf     
+\f3\-Xmn268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Instead of the \f3-Xmn\fR option to set both the initial and maximum size of the heap for the young generation, you can use \f3-XX:NewSize\fR to set the initial size and \f3-XX:MaxNewSize\fR to set the maximum size\&.
+.TP
+-Xms\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xms6291456\fR
-\fB\-Xms6144k\fR
-\fB\-Xms6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the
-\fB\-Xmn\fR
-option or the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-Xmx\fIsize\fR
-.RS 4
-Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-Xms\fR
-and
-\fB\-Xmx\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-Xms6291456\fP
+.fi     
+.nf     
+\f3\-Xms6144k\fP
+.fi     
+.nf     
+\f3\-Xms6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the \f3-Xmn\fR option or the \f3-XX:NewSize\fR option\&.
+.TP
+-Xmx\fIsize\fR
+.br
+Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-Xms\fR and \f3-Xmx\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmx83886080\fR
-\fB\-Xmx81920k\fR
-\fB\-Xmx80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-Xmx\fR
-option is equivalent to
-\fB\-XX:MaxHeapSize\fR\&.
-.RE
-.PP
-\-Xnoclassgc
-.RS 4
+.sp     
+.nf     
+\f3\-Xmx83886080\fP
+.fi     
+.nf     
+\f3\-Xmx81920k\fP
+.fi     
+.nf     
+\f3\-Xmx80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-Xmx\fR option is equivalent to \f3-XX:MaxHeapSize\fR\&.
+.TP
+-Xnoclassgc
+.br
 Disables garbage collection (GC) of classes\&. This can save some GC time, which shortens interruptions during the application run\&.
-.sp
-When you specify
-\fB\-Xnoclassgc\fR
-at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
-.RE
-.PP
-\-Xprof
-.RS 4
+
+When you specify \f3-Xnoclassgc\fR at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
+.TP
+-Xprof
+.br
 Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
-.RE
-.PP
-\-Xrs
-.RS 4
+.TP
+-Xrs
+.br
 Reduces the use of operating system signals by the JVM\&.
-.sp
+
 Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly\&.
-.sp
-The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses
-\fBSIGHUP\fR,
-\fBSIGINT\fR, and
-\fBSIGTERM\fR
-to initiate the running of shutdown hooks\&.
-.sp
-The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses
-\fBSIGQUIT\fR
-to perform thread dumps\&.
-.sp
-Applications embedding the JVM frequently need to trap signals such as
-\fBSIGINT\fR
-or
-\fBSIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The
-\fB\-Xrs\fR
-option is available to address this issue\&. When
-\fB\-Xrs\fR
-is used, the signal masks for
-\fBSIGINT\fR,
-\fBSIGTERM\fR,
-\fBSIGHUP\fR, and
-\fBSIGQUIT\fR
-are not changed by the JVM, and signal handlers for these signals are not installed\&.
-.sp
-There are two consequences of specifying
-\fB\-Xrs\fR:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fBSIGQUIT\fR
-thread dumps are not available\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-User code is responsible for causing shutdown hooks to run, for example, by calling
-\fBSystem\&.exit()\fR
-when the JVM is to be terminated\&.
-.RE
-.RE
-.PP
-\-Xshare:\fImode\fR
-.RS 4
-Sets the class data sharing mode\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+
+The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses \f3SIGHUP\fR, \f3SIGINT\fR, and \f3SIGTERM\fR to initiate the running of shutdown hooks\&.
+
+The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses \f3SIGQUIT\fR to perform thread dumps\&.
+
+Applications embedding the JVM frequently need to trap signals such as \f3SIGINT\fR or \f3SIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The \f3-Xrs\fR option is available to address this issue\&. When \f3-Xrs\fR is used, the signal masks for \f3SIGINT\fR, \f3SIGTERM\fR, \f3SIGHUP\fR, and \f3SIGQUIT\fR are not changed by the JVM, and signal handlers for these signals are not installed\&.
+
+There are two consequences of specifying \f3-Xrs\fR:
+.RS     
+.TP 0.2i    
+\(bu
+\f3SIGQUIT\fR thread dumps are not available\&.
+.TP 0.2i    
+\(bu
+User code is responsible for causing shutdown hooks to run, for example, by calling \f3System\&.exit()\fR when the JVM is to be terminated\&.
+.RE     
+
+.TP
+-Xshare:\fImode\fR
+.br
+Sets the class data sharing mode\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 auto
-.RS 4
-Use shared class data if possible\&. This is the default value for Java HotSpot 32\-Bit Client VM\&.
-.RE
-.PP
+Use shared class data if possible\&. This is the default value for Java HotSpot 32-Bit Client VM\&.
+.TP     
 on
-.RS 4
 Require the use of class data sharing\&. Print an error message and exit if class data sharing cannot be used\&.
-.RE
-.PP
+.TP     
 off
-.RS 4
-Do not use shared class data\&. This is the default value for Java HotSpot 32\-Bit Server VM, Java HotSpot 64\-Bit Client VM, and Java HotSpot 64\-Bit Server VM\&.
-.RE
-.PP
+Do not use shared class data\&. This is the default value for Java HotSpot 32-Bit Server VM, Java HotSpot 64-Bit Client VM, and Java HotSpot 64-Bit Server VM\&.
+.TP     
 dump
-.RS 4
 Manually generate the class data sharing archive\&.
-.RE
-.RE
-.PP
-\-XshowSettings:\fIcategory\fR
-.RS 4
-Shows settings and continues\&. Possible
-\fIcategory\fR
-arguments for this option include the following:
-.PP
+.RE     
+
+.TP
+-XshowSettings:\fIcategory\fR
+.br
+Shows settings and continues\&. Possible \fIcategory\fR arguments for this option include the following:
+.RS     
+.TP     
 all
-.RS 4
 Shows all categories of settings\&. This is the default value\&.
-.RE
-.PP
+.TP     
 locale
-.RS 4
 Shows settings related to locale\&.
-.RE
-.PP
+.TP     
 properties
-.RS 4
 Shows settings related to system properties\&.
-.RE
-.PP
+.TP     
 vm
-.RS 4
 Shows the settings of the JVM\&.
-.RE
-.RE
-.PP
-\-Xss\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate KB,
-\fBm\fR
-or
-\fBM\fR
-to indicate MB,
-\fBg\fR
-or
-\fBG\fR
-to indicate GB\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RE     
+
+.TP
+-Xss\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate KB, \f3m\fR or \f3M\fR to indicate MB, \f3g\fR or \f3G\fR to indicate GB\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xss1m\fR
-\fB\-Xss1024k\fR
-\fB\-Xss1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ThreadStackSize\fR\&.
-.RE
-.PP
-\-Xusealtsigs
-.RS 4
-Use alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. This option is equivalent to
-\fB\-XX:+UseAltSigs\fR\&.
-.RE
-.PP
-\-Xverify:\fImode\fR
-.RS 4
-Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-Xss1m\fP
+.fi     
+.nf     
+\f3\-Xss1024k\fP
+.fi     
+.nf     
+\f3\-Xss1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ThreadStackSize\fR\&.
+.TP
+-Xusealtsigs
+.br
+Use alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. This option is equivalent to \f3-XX:+UseAltSigs\fR\&.
+.TP
+-Xverify:\fImode\fR
+.br
+Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 none
-.RS 4
 Do not verify the bytecode\&. This reduces startup time and also reduces the protection provided by Java\&.
-.RE
-.PP
+.TP     
 remote
-.RS 4
-Verify only those classes that are loaded remotely over the network\&. This is the default behavior if you do not specify the
-\fB\-Xverify\fR
-option\&.
-.RE
-.PP
+Verify those classes that are not loaded by the bootstrap class loader\&. This is the default behavior if you do not specify the \f3-Xverify\fR option\&.
+.TP     
 all
-.RS 4
 Verify all classes\&.
-.RE
-.RE
-.SS "Advanced Runtime Options"
-.PP
+.RE     
+
+.SS ADVANCED\ RUNTIME\ OPTIONS    
 These options control the runtime behavior of the Java HotSpot VM\&.
-.PP
-\-XX:+DisableAttachMechanism
-.RS 4
-Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as
-\fBjcmd\fR,
-\fBjstack\fR,
-\fBjmap\fR, and
-\fBjinfo\fR\&.
-.RE
-.PP
-\-XX:ErrorFile=\fIfilename\fR
-.RS 4
-Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named
-\fBhs_err_pid\fR\fIpid\fR\fB\&.log\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as
-\fB%p\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the error log to
-\fB/var/log/java/java_error\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=/var/log/java/java_error\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is
-\fB/tmp\fR\&.
-.RE
-.PP
-\-XX:+FailOverToOldVerifier
-.RS 4
+.TP
+-XX:+DisableAttachMechanism
+.br
+Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as \f3jcmd\fR, \f3jstack\fR, \f3jmap\fR, and \f3jinfo\fR\&.
+.TP
+-XX:ErrorFile=\fIfilename\fR
+.br
+Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named \f3hs_err_pid\fR\fIpid\fR\f3\&.log\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as \f3%p\fR):
+.sp     
+.nf     
+\f3\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example shows how to set the error log to \f3/var/log/java/java_error\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:ErrorFile=/var/log/java/java_error\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is \f3/tmp\fR\&.
+.TP
+-XX:+FailOverToOldVerifier
+.br
 Enables automatic failover to the old verifier when the new type checker fails\&. By default, this option is disabled and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:LargePageSizeInBytes=\fIsize\fR
-.RS 4
-Sets the maximum size (in bytes) for large pages used for Java heap\&. The
-\fIsize\fR
-argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
-.sp
+.TP
+-XX:LargePageSizeInBytes=\fIsize\fR
+.br
+On Solaris, sets the maximum size (in bytes) for large pages used for Java heap\&. The \fIsize\fR argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
+
 The following example illustrates how to set the large page size to 4 megabytes (MB):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LargePageSizeInBytes=4m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxDirectMemorySize=\fIsize\fR
-.RS 4
-Sets the maximum total size (in bytes) of the New I/O (the
-\fBjava\&.nio\fR
-package) direct\-buffer allocations\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct\-buffer allocations automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:LargePageSizeInBytes=4m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxDirectMemorySize=\fIsize\fR
+.br
+Sets the maximum total size (in bytes) of the New I/O (the \f3java\&.nio\fR package) direct-buffer allocations\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct-buffer allocations automatically\&.
+
 The following examples illustrate how to set the NIO size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxDirectMemorySize=1m\fR
-\fB\-XX:MaxDirectMemorySize=1024k\fR
-\fB\-XX:MaxDirectMemorySize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NativeMemoryTracking=\fImode\fR
-.RS 4
-Specifies the mode for tracking JVM native memory usage\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1m\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NativeMemoryTracking=\fImode\fR
+.br
+Specifies the mode for tracking JVM native memory usage\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 off
-.RS 4
-Do not track JVM native memory usage\&. This is the default behavior if you do not specify the
-\fB\-XX:NativeMemoryTracking\fR
-option\&.
-.RE
-.PP
+Do not track JVM native memory usage\&. This is the default behavior if you do not specify the \f3-XX:NativeMemoryTracking\fR option\&.
+.TP     
 summary
-.RS 4
 Only track memory usage by JVM subsystems, such as Java heap, class, code, and thread\&.
-.RE
-.PP
+.TP     
 detail
-.RS 4
-In addition to tracking memory usage by JVM subsystems, track memory usage by individual
-\fBCallSite\fR, individual virtual memory region and its committed regions\&.
-.RE
-.RE
-.PP
-\-XX:OnError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
-.sp
-The following example shows how the
-\fB\-XX:OnError\fR
-option can be used to run the
-\fBgcore\fR
-command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the
-\fB%p\fR
-designates the current process):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:OnError="gcore %p;dbx \- %p"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:OnOutOfMemoryError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an
-\fBOutOfMemoryError\fR
-exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the
-\fB\-XX:OnError\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintCommandLineFlags
-.RS 4
+In addition to tracking memory usage by JVM subsystems, track memory usage by individual \f3CallSite\fR, individual virtual memory region and its committed regions\&.
+.RE     
+
+.TP
+-XX:ObjectAlignmentInBytes=\fIalignment\fR
+.br
+Sets the memory alignment of Java objects (in bytes)\&. By default, the value is set to 8 bytes\&. The specified value should be a power of two, and must be within the range of 8 and 256 (inclusive)\&. This option makes it possible to use compressed pointers with large Java heap sizes\&.
+
+The heap size limit in bytes is calculated as:
+
+\f34GB * ObjectAlignmentInBytes\fR
+
+Note: As the alignment value increases, the unused space between objects will also increase\&. As a result, you may not realize any benefits from using compressed pointers with large Java heap sizes\&.
+.TP
+-XX:OnError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
+
+\fI\fRThe following example shows how the \f3-XX:OnError\fR option can be used to run the \f3gcore\fR command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the \f3%p\fR designates the current process):
+.sp     
+.nf     
+\f3\-XX:OnError="gcore %p;dbx \- %p"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:OnOutOfMemoryError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an \f3OutOfMemoryError\fR exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the \f3-XX:OnError\fR option\&.
+.TP
+-XX:+PerfDataSaveToFile
+.br
+If enabled, saves jstat(1) binary data when the Java application exits\&. This binary data is saved in a file named \f3hsperfdata_\fR\fI<pid>\fR, where \fI<pid>\fR is the process identifier of the Java application you ran\&. Use \f3jstat\fR to display the performance data contained in this file as follows:
+.sp     
+.nf     
+\f3jstat \-class file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.nf     
+\f3jstat \-gc file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintCommandLineFlags
+.br
 Enables printing of ergonomically selected JVM flags that appeared on the command line\&. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector\&. By default, this option is disabled and flags are not printed\&.
-.RE
-.PP
-\-XX:+PrintNMTStatistics
-.RS 4
-Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see
-\fB\-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
-.RE
-.PP
-\-XX:+RelaxAccessControlCheck
-.RS 4
+.TP
+-XX:+PrintNMTStatistics
+.br
+Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see \f3-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
+.TP
+-XX:+RelaxAccessControlCheck
+.br
 Decreases the amount of access control checks in the verifier\&. By default, this option is disabled, and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:+ShowMessageBoxOnError
-.RS 4
+.TP
+-XX:+ShowMessageBoxOnError
+.br
 Enables displaying of a dialog box when the JVM experiences an irrecoverable error\&. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:ThreadStackSize=\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP
+-XX:ThreadStackSize=\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples show how to set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ThreadStackSize=1m\fR
-\fB\-XX:ThreadStackSize=1024k\fR
-\fB\-XX:ThreadStackSize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-Xss\fR\&.
-.RE
-.PP
-\-XX:+TraceClassLoading
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ThreadStackSize=1m\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-Xss\fR\&.
+.TP
+-XX:+TraceClassLoading
+.br
 Enables tracing of classes as they are loaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassLoadingPreorder
-.RS 4
+.TP
+-XX:+TraceClassLoadingPreorder
+.br
 Enables tracing of all loaded classes in the order in which they are referenced\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassResolution
-.RS 4
+.TP
+-XX:+TraceClassResolution
+.br
 Enables tracing of constant pool resolutions\&. By default, this option is disabled and constant pool resolutions are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassUnloading
-.RS 4
+.TP
+-XX:+TraceClassUnloading
+.br
 Enables tracing of classes as they are unloaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceLoaderConstraints
-.RS 4
+.TP
+-XX:+TraceLoaderConstraints
+.br
 Enables tracing of the loader constraints recording\&. By default, this option is disabled and loader constraints recording is not traced\&.
-.RE
-.PP
-\-XX:+UseAltSigs
-.RS 4
-Enables the use of alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to
-\fB\-Xusealtsigs\fR\&.
-.RE
-.PP
-\-XX:\-UseBiasedLocking
-.RS 4
-Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning\-139912\&.html#section4\&.2\&.5
-.sp
+.TP
+-XX:+UseAltSigs
+.br
+Enables the use of alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to \f3-Xusealtsigs\fR\&.
+.TP
+-XX:-UseBiasedLocking
+.br
+Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning-139912\&.html#section4\&.2\&.5
+
 By default, this option is enabled\&.
-.RE
-.PP
-\-XX:\-UseCompressedOops
-.RS 4
-Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32\-bit offsets instead of 64\-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64\-bit JVMs\&.
-.RE
-.PP
-\-XX:\-UseLargePages
-.RS 4
-Disables the use of large page memory\&. This option is enabled by default\&.
-.sp
-For more information, see Java Support for Large Memory Pages at http://www\&.oracle\&.com/technetwork/java/javase/tech/largememory\-jsp\-137182\&.html
-.RE
-.PP
-\-XX:+UseMembar
-.RS 4
+.TP
+-XX:-UseCompressedOops
+.br
+Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32-bit offsets instead of 64-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64-bit JVMs\&.
+
+It is also possible to use compressed pointers when Java heap sizes are greater than 32GB\&. See the \f3-XX:ObjectAlignmentInBytes\fR option\&.
+.TP
+-XX:+UseHugeTLBFS
+.br
+This option for Linux is the equivalent of specifying \f3-XX:+UseLargePages\fR\&. This option is disabled by default\&. This option pre-allocates all large pages up-front, when memory is reserved; consequently the JVM cannot dynamically grow or shrink large pages memory areas; see \f3-XX:UseTransparentHugePages\fR if you want this behavior\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseLargePages
+.br
+Enables the use of large page memory\&. By default, this option is disabled and large page memory is not used\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseMembar
+.br
 Enables issuing of membars on thread state transitions\&. This option is disabled by default on all platforms except ARM servers, where it is enabled\&. (It is recommended that you do not disable this option on ARM servers\&.)
-.RE
-.PP
-\-XX:+UsePerfData
-.RS 4
-Enables the
-\fBperfdata\fR
-feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the
-\fBhsperfdata_userid\fR
-directories\&. To disable the
-\fBperfdata\fR
-feature, specify
-\fB\-XX:\-UsePerfData\fR\&.
-.RE
-.PP
-\-XX:+AllowUserSignalHandlers
-.RS 4
+.TP
+-XX:+UsePerfData
+.br
+Enables the \f3perfdata\fR feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the \f3hsperfdata_userid\fR directories\&. To disable the \f3perfdata\fR feature, specify \f3-XX:-UsePerfData\fR\&.
+.TP
+-XX:+UseTransparentHugePages
+.br
+On Linux, enables the use of large pages that can dynamically grow or shrink\&. This option is disabled by default\&. You may encounter performance problems with transparent huge pages as the OS moves other pages around to create huge pages; this option is made available for experimentation\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+AllowUserSignalHandlers
+.br
 Enables installation of signal handlers by the application\&. By default, this option is disabled and the application is not allowed to install signal handlers\&.
-.RE
-.SS "Advanced JIT Compiler Options"
-.PP
-These options control the dynamic just\-in\-time (JIT) compilation performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveOpts
-.RS 4
+.SS ADVANCED\ JIT\ COMPILER\ OPTIONS    
+These options control the dynamic just-in-time (JIT) compilation performed by the Java HotSpot VM\&.
+.TP
+-XX:+AggressiveOpts
+.br
 Enables the use of aggressive performance optimization features, which are expected to become default in upcoming releases\&. By default, this option is disabled and experimental performance features are not used\&.
-.RE
-.PP
-\-XX:AllocateInstancePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocateInstancePrefetchLines=\fIlines\fR
+.br
 Sets the number of lines to prefetch ahead of the instance allocation pointer\&. By default, the number of lines to prefetch is set to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocateInstancePrefetchLines=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocateInstancePrefetchLines=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchDistance=\fIsize\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchDistance=\fIsize\fR
+.br
 Sets the size (in bytes) of the prefetch distance for object allocation\&. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object\&. Each Java thread has its own allocation point\&.
-.sp
-Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to \-1\&.
-.sp
+
+Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to -1\&.
+
 The following example shows how to set the prefetch distance to 1024 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchDistance=1024\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchDistance=1024\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchInstr=\fIinstruction\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchInstr=\fIinstruction\fR
+.br
 Sets the prefetch instruction to prefetch ahead of the allocation pointer\&. Only the Java HotSpot Server VM supports this option\&. Possible values are from 0 to 3\&. The actual instructions behind the values depend on the platform\&. By default, the prefetch instruction is set to 0:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchInstr=0\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchInstr=0\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchLines=\fIlines\fR
+.br
 Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code\&. The default value is 1 if the last allocated object was an instance, and 3 if it was an array\&.
-.sp
+
 The following example shows how to set the number of loaded cache lines to 5:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchLines=5\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchLines=5\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStepSize=\fIsize\fR
-.RS 4
-Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the step size is set to 16 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchStepSize=16\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-XX:AllocatePrefetchStepSize=\fIsize\fR
+.br
+Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the step size is set to 16 bytes:
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchStepSize=16\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStyle=\fIstyle\fR
-.RS 4
-Sets the generated code style for prefetch instructions\&. The
-\fIstyle\fR
-argument is an integer from 0 to 3:
-.PP
+.TP
+-XX:AllocatePrefetchStyle=\fIstyle\fR
+.br
+Sets the generated code style for prefetch instructions\&. The \fIstyle\fR argument is an integer from 0 to 3:
+.RS     
+.TP     
 0
-.RS 4
 Do not generate prefetch instructions\&.
-.RE
-.PP
+.TP     
 1
-.RS 4
 Execute prefetch instructions after each allocation\&. This is the default parameter\&.
-.RE
-.PP
+.TP     
 2
-.RS 4
-Use the thread\-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
-.RE
-.PP
+Use the thread-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
+.TP     
 3
-.RS 4
 Use BIS instruction on SPARC for allocation prefetch\&.
-.RE
-.sp
+.RE     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+BackgroundCompilation
-.RS 4
-Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify
-\fB\-XX:\-BackgroundCompilation\fR
-(this is equivalent to specifying
-\fB\-Xbatch\fR)\&.
-.RE
-.PP
-\-XX:CICompilerCount=\fIthreads\fR
-.RS 4
+.TP
+-XX:+BackgroundCompilation
+.br
+Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify \f3-XX:-BackgroundCompilation\fR (this is equivalent to specifying \f3-Xbatch\fR)\&.
+.TP
+-XX:CICompilerCount=\fIthreads\fR
+.br
 Sets the number of compiler threads to use for compilation\&. By default, the number of threads is set to 2 for the server JVM, to 1 for the client JVM, and it scales to the number of cores if tiered compilation is used\&. The following example shows how to set the number of threads to 2:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CICompilerCount=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
-.RS 4
-Sets the minimum free space (in bytes) required for compilation\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CodeCacheMinimumFreeSpace=1024m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
-.RS 4
-Specifies a command to perform on a method\&. For example, to exclude the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the
-\fBindexOf(String)\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all
-\fBindexOf()\fR
-methods in all classes from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,*\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to
-\fB\-XX:CompileCommand\fR
-using spaces as separators by enclosing the argument in quotation marks:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude java/lang/String indexOf"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that after parsing the commands passed on the command line using the
-\fB\-XX:CompileCommand\fR
-options, the JIT compiler then reads commands from the
-\fB\&.hotspot_compiler\fR
-file\&. You can add commands to this file or specify a different file using the
-\fB\-XX:CompileCommandFile\fR
-option\&.
-.sp
-To add several commands, either specify the
-\fB\-XX:CompileCommand\fR
-option multiple times, or separate each argument with the newline separator (\fB\en\fR)\&. The following commands are available:
-.PP
+.sp     
+.nf     
+\f3\-XX:CICompilerCount=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
+.br
+Sets the minimum free space (in bytes) required for compilation\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
+.sp     
+.nf     
+\f3\-XX:CodeCacheMinimumFreeSpace=1024m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
+.br
+Specifies a command to perform on a method\&. For example, to exclude the \f3indexOf()\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the \f3indexOf(String)\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all \f3indexOf()\fR methods in all classes from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,*\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to \f3-XX:CompileCommand\fR using spaces as separators by enclosing the argument in quotation marks:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude java/lang/String indexOf"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that after parsing the commands passed on the command line using the \f3-XX:CompileCommand\fR options, the JIT compiler then reads commands from the \f3\&.hotspot_compiler\fR file\&. You can add commands to this file or specify a different file using the \f3-XX:CompileCommandFile\fR option\&.
+
+To add several commands, either specify the \f3-XX:CompileCommand\fR option multiple times, or separate each argument with the newline separator (\f3\en\fR)\&. The following commands are available:
+.RS     
+.TP     
 break
-.RS 4
 Set a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method\&.
-.RE
-.PP
+.TP     
 compileonly
-.RS 4
-Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the
-\fB\-XX:CompileOnly\fR
-option, which allows to specify several methods\&.
-.RE
-.PP
+Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the \f3-XX:CompileOnly\fR option, which allows to specify several methods\&.
+.TP     
 dontinline
-.RS 4
 Prevent inlining of the specified method\&.
-.RE
-.PP
+.TP     
 exclude
-.RS 4
 Exclude the specified method from compilation\&.
-.RE
-.PP
+.TP     
 help
-.RS 4
-Print a help message for the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
+Print a help message for the \f3-XX:CompileCommand\fR option\&.
+.TP     
 inline
-.RS 4
 Attempt to inline the specified method\&.
-.RE
-.PP
+.TP     
 log
-.RS 4
-Exclude compilation logging (with the
-\fB\-XX:+LogCompilation\fR
-option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
-.RE
-.PP
+Exclude compilation logging (with the \f3-XX:+LogCompilation\fR option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
+.TP     
 option
-.RS 4
-This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the
-\fBBlockLayoutByFrequency\fR
-option for the
-\fBappend()\fR
-method of the
-\fBStringBuffer\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the \f3BlockLayoutByFrequency\fR option for the \f3append()\fR method of the \f3StringBuffer\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 You can specify multiple compilation options, separated by commas or spaces\&.
-.RE
-.PP
+.TP     
 print
-.RS 4
 Print generated assembler code after compilation of the specified method\&.
-.RE
-.PP
+.TP     
 quiet
-.RS 4
-Do not print the compile commands\&. By default, the commands that you specify with the \-\fBXX:CompileCommand\fR
-option are printed; for example, if you exclude from compilation the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class, then the following will be printed to standard output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBCompilerOracle: exclude java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can suppress this by specifying the
-\fB\-XX:CompileCommand=quiet\fR
-option before other
-\fB\-XX:CompileCommand\fR
-options\&.
-.RE
-.RE
-.PP
-\-XX:CompileCommandFile=\fIfilename\fR
-.RS 4
-Sets the file from which JIT compiler commands are read\&. By default, the
-\fB\&.hotspot_compiler\fR
-file is used to store commands performed by the JIT compiler\&.
-.sp
-Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the
-\fBtoString()\fR
-method of the
-\fBString\fR
-class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBprint java/lang/String toString\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-For more information about specifying the commands for the JIT compiler to perform on methods, see the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
-\-XX:CompileOnly=\fImethods\fR
-.RS 4
-Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the
-\fBlength()\fR
-method of the
-\fBString\fR
-class and the
-\fBsize()\fR
-method of the
-\fBList\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Do not print the compile commands\&. By default, the commands that you specify with the -\f3XX:CompileCommand\fR option are printed; for example, if you exclude from compilation the \f3indexOf()\fR method of the \f3String\fR class, then the following will be printed to standard output:
+.sp     
+.nf     
+\f3CompilerOracle: exclude java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can suppress this by specifying the \f3-XX:CompileCommand=quiet\fR option before other \f3-XX:CompileCommand\fR options\&.
+.RE     
+
+.TP
+-XX:CompileCommandFile=\fIfilename\fR
+.br
+Sets the file from which JIT compiler commands are read\&. By default, the \f3\&.hotspot_compiler\fR file is used to store commands performed by the JIT compiler\&.
+
+Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the \f3toString()\fR method of the \f3String\fR class:
+.sp     
+.nf     
+\f3print java/lang/String toString\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+For more information about specifying the commands for the JIT compiler to perform on methods, see the \f3-XX:CompileCommand\fR option\&.
+.TP
+-XX:CompileOnly=\fImethods\fR
+.br
+Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the \f3length()\fR method of the \f3String\fR class and the \f3size()\fR method of the \f3List\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Although wildcards are not supported, you can specify only the class or package name to compile all methods in that class or package, as well as specify just the method to compile methods with this name in any class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\fR
-\fB\-XX:CompileOnly=java/lang\fR
-\fB\-XX:CompileOnly=\&.length\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileThreshold=\fIinvocations\fR
-.RS 4
-Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. The following example shows how to set the number of interpreted method invocations to 5,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileThreshold=5000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can completely disable interpretation of Java methods before compilation by specifying the
-\fB\-Xcomp\fR
-option\&.
-.RE
-.PP
-\-XX:+DoEscapeAnalysis
-.RS 4
-Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify
-\fB\-XX:\-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:InitialCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the initial code cache size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to 500 KB\&. The following example shows how to set the initial code cache size to 32 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialCodeCacheSize=32k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+Inline
-.RS 4
-Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify
-\fB\-XX:\-Inline\fR\&.
-.RE
-.PP
-\-XX:InlineSmallCode=\fIsize\fR
-.RS 4
-Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InlineSmallCode=1000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+LogCompilation
-.RS 4
-Enables logging of compilation activity to a file named
-\fBhotspot\&.log\fR
-in the current working directory\&. You can specify a different log file path and name using the
-\fB\-XX:LogFile\fR
-option\&.
-.sp
-By default, this option is disabled and compilation activity is not logged\&. The
-\fB\-XX:+LogCompilation\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.sp
-You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the
-\fB\-XX:+PrintCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:MaxInlineSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxInlineSize=35\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNodeLimit=\fInodes\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=java/lang\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=\&.length\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileThreshold=\fIinvocations\fR
+.br
+Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. This option is ignored when tiered compilation is enabled; see the option \f3-XX:+TieredCompilation\fR\&. The following example shows how to set the number of interpreted method invocations to 5,000:
+.sp     
+.nf     
+\f3\-XX:CompileThreshold=5000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can completely disable interpretation of Java methods before compilation by specifying the \f3-Xcomp\fR option\&.
+.TP
+-XX:+DoEscapeAnalysis
+.br
+Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify \f3-XX:-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:InitialCodeCacheSize=\fIsize\fR
+.br
+Sets the initial code cache size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to 500 KB\&. The initial code cache size should be not less than the system\&'s minimal memory page size\&. The following example shows how to set the initial code cache size to 32 KB:
+.sp     
+.nf     
+\f3\-XX:InitialCodeCacheSize=32k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+Inline
+.br
+Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify \f3-XX:-Inline\fR\&.
+.TP
+-XX:InlineSmallCode=\fIsize\fR
+.br
+Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
+.sp     
+.nf     
+\f3\-XX:InlineSmallCode=1000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+LogCompilation
+.br
+Enables logging of compilation activity to a file named \f3hotspot\&.log\fR in the current working directory\&. You can specify a different log file path and name using the \f3-XX:LogFile\fR option\&.
+
+By default, this option is disabled and compilation activity is not logged\&. The \f3-XX:+LogCompilation\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+
+You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the \f3-XX:+PrintCompilation\fR option\&.
+.TP
+-XX:MaxInlineSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxInlineSize=35\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNodeLimit=\fInodes\fR
+.br
 Sets the maximum number of nodes to be used during single method compilation\&. By default, the maximum number of nodes is set to 65,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxNodeLimit=65000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxTrivialSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTrivialSize=6\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+OptimizeStringConcat
-.RS 4
-Enables the optimization of
-\fBString\fR
-concatenation operations\&. This option is enabled by default\&. To disable the optimization of
-\fBString\fR
-concatenation operations, specify
-\fB\-XX:\-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+PrintAssembly
-.RS 4
-Enables printing of assembly code for bytecoded and native methods by using the external
-\fBdisassembler\&.so\fR
-library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
-.sp
-By default, this option is disabled and assembly code is not printed\&. The
-\fB\-XX:+PrintAssembly\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:+PrintCompilation
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxNodeLimit=65000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxTrivialSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxTrivialSize=6\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+OptimizeStringConcat
+.br
+Enables the optimization of \f3String\fR concatenation operations\&. This option is enabled by default\&. To disable the optimization of \f3String\fR concatenation operations, specify \f3-XX:-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:+PrintAssembly
+.br
+Enables printing of assembly code for bytecoded and native methods by using the external \f3disassembler\&.so\fR library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
+
+By default, this option is disabled and assembly code is not printed\&. The \f3-XX:+PrintAssembly\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:+PrintCompilation
+.br
 Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled\&. This enables you to see which methods actually get compiled\&. By default, this option is disabled and diagnostic output is not printed\&.
-.sp
-You can also log compilation activity to a file by using the
-\fB\-XX:+LogCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintInlining
-.RS 4
+
+You can also log compilation activity to a file by using the \f3-XX:+LogCompilation\fR option\&.
+.TP
+-XX:+PrintInlining
+.br
 Enables printing of inlining decisions\&. This enables you to see which methods are getting inlined\&.
-.sp
-By default, this option is disabled and inlining information is not printed\&. The
-\fB\-XX:+PrintInlining\fR
-option has to be used together with the
-\fB\-XX:+UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:ReservedCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. This option is equivalent to
-\fB\-Xmaxjitcodesize\fR\&.
-.RE
-.PP
-\-XX:+TieredCompilation
-.RS 4
+
+By default, this option is disabled and inlining information is not printed\&. The \f3-XX:+PrintInlining\fR option has to be used together with the \f3-XX:+UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:ReservedCodeCacheSize=\fIsize\fR
+.br
+Sets the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. This option has a limit of 2 GB; otherwise, an error is generated\&. The maximum code cache size should not be less than the initial code cache size; see the option \f3-XX:InitialCodeCacheSize\fR\&. This option is equivalent to \f3-Xmaxjitcodesize\fR\&.
+.TP
+-XX:RTMAbortRatio=\fIabort_ratio\fR
+.br
+The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the \f3-XX:+UseRTMDeopt\fR option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
+.TP
+-XX:RTMRetryCount=\fInumber_of_retries\fR
+.br
+RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The \f3-XX:UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+TieredCompilation
+.br
 Enables the use of tiered compilation\&. By default, this option is enabled\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseAES
-.RS 4
-Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
-.RE
-.PP
-\-XX:+UseAESIntrinsics
-.RS 4
-UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32\-bit and 64\-bit\&. To disable hardware\-based AES intrinsics, specify
-\fB\-XX:\-UseAES \-XX:\-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:+UseAES \-XX:+UseAESIntrinsics\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To support UseAES and UseAESIntrinsics flags for 32\-bit and 64\-bit use
-\fB\-server\fR
-option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
-.RE
-.PP
-\-XX:+UseCodeCacheFlushing
-.RS 4
-Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify
-\fB\-XX:\-UseCodeCacheFlushing\fR\&.
-.RE
-.PP
-\-XX:+UseCondCardMark
-.RS 4
+.TP
+-XX:+UseAES
+.br
+Enables hardware-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
+.TP
+-XX:+UseAESIntrinsics
+.br
+UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32-bit and 64-bit\&. To disable hardware-based AES intrinsics, specify \f3-XX:-UseAES -XX:-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
+.sp     
+.nf     
+\f3\-XX:+UseAES \-XX:+UseAESIntrinsics\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To support UseAES and UseAESIntrinsics flags for 32-bit and 64-bit use \f3-server\fR option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
+.TP
+-XX:+UseCodeCacheFlushing
+.br
+Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify \f3-XX:-UseCodeCacheFlushing\fR\&.
+.TP
+-XX:+UseCondCardMark
+.br
 Enables checking of whether the card is already marked before updating the card table\&. This option is disabled by default and should only be used on machines with multiple sockets, where it will increase performance of Java applications that rely heavily on concurrent operations\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseSuperWord
-.RS 4
-Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify
-\fB\-XX:\-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.SS "Experimental JIT Compiler Options"
-.PP
-The options related to the Restricted Transactional Memory (RTM) locking feature in this section are experimental and are not officially supported in Java SE 8u20; you must enable the
-\fB\-XX:+UnlockExperimentalVMOptions\fR
-option to use them\&. These options are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
-.PP
-\-XX:RTMAbortRatio=\fIabort_ratio\fR
-.RS 4
-The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the
-\fB\-XX:+UseRTMDeopt\fR
-option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
-.RE
-.PP
-\-XX:RTMRetryCount=\fInumber_of_retries\fR
-.RS 4
-RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMDeopt
-.RS 4
-Auto\-tunes RTM locking depending on the abort ratio\&. This ratio is specified by
-\fB\-XX:RTMAbortRatio\fR
-option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMLocking
-.RS 4
-Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&.
-.sp
-RTM is part of Intel\*(Aqs Transactional Synchronization Extensions (TSX), which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions
-\fBXBEGIN\fR,
-\fBXABORT\fR,
-\fBXEND\fR, and
-\fBXTEST\fR\&. The
-\fBXBEGIN\fR
-and
-\fBXEND\fR
-instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the
-\fBXEND\fR
-instruction\&. The
-\fBXABORT\fR
-instruction can be used to explicitly abort a transaction and the
-\fBXEND\fR
-instruction to check if a set of instructions are being run in a transaction\&.
-.sp
-A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\*(Aqs system\&.
-.sp
-RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse\-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse\-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine\-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping\-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
-.RE
-.SS "Advanced Serviceability Options"
-.PP
+.TP
+-XX:+UseRTMDeopt
+.br
+Auto-tunes RTM locking depending on the abort ratio\&. This ratio is specified by \f3-XX:RTMAbortRatio\fR option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The \f3-XX:+UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+UseRTMLocking
+.br
+Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&. Options related to RTM are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
+
+RTM is part of Intel\&'s TSX, which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions \f3XBEGIN\fR, \f3XABORT\fR, \f3XEND\fR, and \f3XTEST\fR\&. The \f3XBEGIN\fR and \f3XEND\fR instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the \f3XEND\fR instruction\&. The \f3XABORT\fR instruction can be used to explicitly abort a transaction and the \f3XEND\fR instruction to check if a set of instructions are being run in a transaction\&.
+
+A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\&'s system\&.
+
+RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
+.TP
+-XX:+UseSHA
+.br
+Enables hardware-based intrinsics for SHA crypto hash functions for SPARC hardware\&. \f3UseSHA\fR is used in conjunction with the \f3UseSHA1Intrinsics\fR, \f3UseSHA256Intrinsics\fR, and \f3UseSHA512Intrinsics\fR options\&.
+
+The \f3UseSHA\fR and \f3UseSHA*Intrinsics\fR flags are enabled by default, and are supported only for Java HotSpot Server VM 64-bit on SPARC T4 and newer\&.
+
+This feature is only applicable when using the \f3sun\&.security\&.provider\&.Sun\fR provider for SHA operations\&.
+
+To disable all hardware-based SHA intrinsics, specify \f3-XX:-UseSHA\fR\&. To disable only a particular SHA intrinsic, use the appropriate corresponding option\&. For example: \f3-XX:-UseSHA256Intrinsics\fR\&.
+.TP
+-XX:+UseSHA1Intrinsics
+.br
+Enables intrinsics for SHA-1 crypto hash function\&.
+.TP
+-XX:+UseSHA256Intrinsics
+.br
+Enables intrinsics for SHA-224 and SHA-256 crypto hash functions\&.
+.TP
+-XX:+UseSHA512Intrinsics
+.br
+Enables intrinsics for SHA-384 and SHA-512 crypto hash functions\&.
+.TP
+-XX:+UseSuperWord
+.br
+Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify \f3-XX:-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.SS ADVANCED\ SERVICEABILITY\ OPTIONS    
 These options provide the ability to gather system information and perform extensive debugging\&.
-.PP
-\-XX:+ExtendedDTraceProbes
-.RS 4
-Enables additional
-\fBdtrace\fR
-tool probes that impact the performance\&. By default, this option is disabled and
-\fBdtrace\fR
-performs only standard probes\&.
-.RE
-.PP
-\-XX:+HeapDumpOnOutOfMemory
-.RS 4
-Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a
-\fBjava\&.lang\&.OutOfMemoryError\fR
-exception is thrown\&. You can explicitly set the heap dump file path and name using the
-\fB\-XX:HeapDumpPath\fR
-option\&. By default, this option is disabled and the heap is not dumped when an
-\fBOutOfMemoryError\fR
-exception is thrown\&.
-.RE
-.PP
-\-XX:HeapDumpPath=\fIpath\fR
-.RS 4
-Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the
-\fB\-XX:+HeapDumpOnOutOfMemoryError\fR
-option is set\&. By default, the file is created in the current working directory, and it is named
-\fBjava_pid\fR\fIpid\fR\fB\&.hprof\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\fB%p\fR
-represents the current process identificator):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the heap dump file to
-\fB/var/log/java/java_heapdump\&.hprof\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:LogFile=\fIpath\fR
-.RS 4
-Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named
-\fBhotspot\&.log\fR\&.
-.sp
-The following example shows how to set the log file to
-\fB/var/log/java/hotspot\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LogFile=/var/log/java/hotspot\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+PrintClassHistogram
-.RS 4
-Enables printing of a class instance histogram after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjmap \-histo\fR
-command, or the
-\fBjcmd \fR\fIpid\fR\fB GC\&.class_histogram\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+PrintConcurrentLocks
-.RS 4
-Enables printing of j locks after a event\&. By default, this option is disabled\&.
-.sp
-Enables printing of j\fBava\&.util\&.concurrent\fR
-locks after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjstack \-l\fR
-command or the
-\fBjcmd \fR\fIpid\fR\fB Thread\&.print \-l\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+UnlockDiagnosticVMOptions
-.RS 4
+.TP
+-XX:+ExtendedDTraceProbes
+.br
+Enables additional \f3dtrace\fR tool probes that impact the performance\&. By default, this option is disabled and \f3dtrace\fR performs only standard probes\&.
+.TP
+-XX:+HeapDumpOnOutOfMemory
+.br
+Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a \f3java\&.lang\&.OutOfMemoryError\fR exception is thrown\&. You can explicitly set the heap dump file path and name using the \f3-XX:HeapDumpPath\fR option\&. By default, this option is disabled and the heap is not dumped when an \f3OutOfMemoryError\fR exception is thrown\&.
+.TP
+-XX:HeapDumpPath=\fIpath\fR
+.br
+Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the \f3-XX:+HeapDumpOnOutOfMemoryError\fR option is set\&. By default, the file is created in the current working directory, and it is named \f3java_pid\fR\fIpid\fR\f3\&.hprof\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\f3%p\fR represents the current process identificator):
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fI\fRThe following example shows how to set the heap dump file to \f3/var/log/java/java_heapdump\&.hprof\fR:
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:LogFile=\fIpath\fR
+.br
+Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named \f3hotspot\&.log\fR\&.
+
+\fI\fRThe following example shows how to set the log file to \f3/var/log/java/hotspot\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:LogFile=/var/log/java/hotspot\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintClassHistogram
+.br
+\fI\fREnables printing of a class instance histogram after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jmap -histo\fR command, or the \f3jcmd\fR\fIpid\fR\f3GC\&.class_histogram\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP     
+-XX:+PrintConcurrentLocks
+
+
+Enables printing of \f3java\&.util\&.concurrent\fR locks after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jstack -l\fR command or the \f3jcmd\fR\fIpid\fR\f3Thread\&.print -l\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP
+-XX:+UnlockDiagnosticVMOptions
+.br
 Unlocks the options intended for diagnosing the JVM\&. By default, this option is disabled and diagnostic options are not available\&.
-.RE
-.SS "Advanced Garbage Collection Options"
-.PP
+.SS ADVANCED\ GARBAGE\ COLLECTION\ OPTIONS    
 These options control how garbage collection (GC) is performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveHeap
-.RS 4
-Enables Java heap optimization\&. This sets various parameters to be optimal for long\-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
-.RE
-.PP
-\-XX:+AlwaysPreTouch
-.RS 4
-Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the
-\fBmain()\fR
-method\&. The option can be used in testing to simulate a long\-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
-.RE
-.PP
-\-XX:+CMSClassUnloadingEnabled
-.RS 4
-Enables class unloading when using the concurrent mark\-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify
-\fB\-XX:\-CMSClassUnloadingEnabled\fR\&.
-.RE
-.PP
-\-XX:CMSExpAvgFactor=\fIpercent\fR
-.RS 4
+.TP
+-XX:+AggressiveHeap
+.br
+Enables Java heap optimization\&. This sets various parameters to be optimal for long-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
+.TP
+-XX:+AlwaysPreTouch
+.br
+Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the \f3main()\fR method\&. The option can be used in testing to simulate a long-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
+.TP
+-XX:+CMSClassUnloadingEnabled
+.br
+Enables class unloading when using the concurrent mark-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify \f3-XX:-CMSClassUnloadingEnabled\fR\&.
+.TP
+-XX:CMSExpAvgFactor=\fIpercent\fR
+.br
 Sets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics\&. By default, the exponential averages factor is set to 25%\&. The following example shows how to set the factor to 15%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSExpAvgFactor=15\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
-.RS 4
-Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to \-1\&. Any negative value (including the default) implies that
-\fB\-XX:CMSTriggerRatio\fR
-is used to define the value of the initiating occupancy fraction\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:CMSExpAvgFactor=15\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
+.br
+Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to -1\&. Any negative value (including the default) implies that \f3-XX:CMSTriggerRatio\fR is used to define the value of the initiating occupancy fraction\&.
+
 The following example shows how to set the occupancy fraction to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSInitiatingOccupancyFraction=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+CMSScavengeBeforeRemark
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSInitiatingOccupancyFraction=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+CMSScavengeBeforeRemark
+.br
 Enables scavenging attempts before the CMS remark step\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:CMSTriggerRatio=\fIpercent\fR
-.RS 4
-Sets the percentage (0 to 100) of the value specified by
-\fB\-XX:MinHeapFreeRatio\fR
-that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
-.sp
+.TP
+-XX:CMSTriggerRatio=\fIpercent\fR
+.br
+Sets the percentage (0 to 100) of the value specified by \f3-XX:MinHeapFreeRatio\fR that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
+
 The following example shows how to set the occupancy fraction to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSTriggerRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:ConcGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSTriggerRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:ConcGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for concurrent GC\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for concurrent GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ConcGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+DisableExplicitGC
-.RS 4
-Enables the option that disables processing of calls to
-\fBSystem\&.gc()\fR\&. This option is disabled by default, meaning that calls to
-\fBSystem\&.gc()\fR
-are processed\&. If processing of calls to
-\fBSystem\&.gc()\fR
-is disabled, the JVM still performs GC when necessary\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrent
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:G1HeapRegionSize=\fIsize\fR
-.RS 4
-Sets the size of the regions into which the Java heap is subdivided when using the garbage\-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:ConcGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+DisableExplicitGC
+.br
+Enables the option that disables processing of calls to \f3System\&.gc()\fR\&. This option is disabled by default, meaning that calls to \f3System\&.gc()\fR are processed\&. If processing of calls to \f3System\&.gc()\fR is disabled, the JVM still performs GC when necessary\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrent
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:G1HeapRegionSize=\fIsize\fR
+.br
+Sets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
+
 The following example shows how to set the size of the subdivisions to 16 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1HeapRegionSize=16m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+G1PrintHeapRegions
-.RS 4
+.sp     
+.nf     
+\f3\-XX:G1HeapRegionSize=16m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+G1PrintHeapRegions
+.br
 Enables the printing of information about which regions are allocated and which are reclaimed by the G1 collector\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:G1ReservePercent=\fIpercent\fR
-.RS 4
+.TP
+-XX:G1ReservePercent=\fIpercent\fR
+.br
 Sets the percentage of the heap (0 to 50) that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector\&. By default, this option is set to 10%\&.
-.sp
+
 The following example shows how to set the reserved heap to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1ReservePercent=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitialHeapSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:G1ReservePercent=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitialHeapSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialHeapSize=6291456\fR
-\fB\-XX:InitialHeapSize=6144k\fR
-\fB\-XX:InitialHeapSize=6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-XX:InitialSurvivorRatio=\fIratio\fR
-.RS 4
-Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the
-\fB\-XX:+UseParallelGC\fR
-and/or \-\fBXX:+UseParallelOldGC\fR
-options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the
-\fB\-XX:+UseParallelGC\fR
-and
-\fB\-XX:+UseParallelOldGC\fR
-options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-option), then the
-\fB\-XX:SurvivorRatio\fR
-option should be used to set the size of the survivor space for the entire execution of the application\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:InitialHeapSize=6291456\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6144k\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the \f3-XX:NewSize\fR option\&.
+.TP
+-XX:InitialSurvivorRatio=\fIratio\fR
+.br
+Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the \f3-XX:+UseParallelGC\fR and/or -\f3XX:+UseParallelOldGC\fR options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the \f3-XX:+UseParallelGC\fR and \f3-XX:+UseParallelOldGC\fR options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the \f3-XX:-UseAdaptiveSizePolicy\fR option), then the \f3-XX:SurvivorRatio\fR option should be used to set the size of the survivor space for the entire execution of the application\&.
+
 The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBS=Y/(R+2)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3S=Y/(R+2)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The 2 in the equation denotes two survivor spaces\&. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size\&.
-.sp
+
 By default, the initial survivor space ratio is set to 8\&. If the default value for the young generation space size is used (2 MB), the initial size of the survivor space will be 0\&.2 MB\&.
-.sp
+
 The following example shows how to set the initial survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialSurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitialSurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
+.br
 Sets the percentage of the heap occupancy (0 to 100) at which to start a concurrent GC cycle\&. It is used by garbage collectors that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (for example, the G1 garbage collector)\&.
-.sp
+
 By default, the initiating value is set to 45%\&. A value of 0 implies nonstop GC cycles\&. The following example shows how to set the initiating heap occupancy to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitiatingHeapOccupancyPercent=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxGCPauseMillis=\fItime\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitiatingHeapOccupancyPercent=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxGCPauseMillis=\fItime\fR
+.br
 Sets a target for the maximum GC pause time (in milliseconds)\&. This is a soft goal, and the JVM will make its best effort to achieve it\&. By default, there is no maximum pause time value\&.
-.sp
+
 The following example shows how to set the maximum target pause time to 500 ms:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxGCPauseMillis=500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxHeapSize=\fIsize\fR
-.RS 4
-Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-XX:InitialHeapSize\fR
-and
-\fB\-XX:MaxHeapSize\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:MaxGCPauseMillis=500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxHeapSize=\fIsize\fR
+.br
+Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-XX:InitialHeapSize\fR and \f3-XX:MaxHeapSize\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapSize=83886080\fR
-\fB\-XX:MaxHeapSize=81920k\fR
-\fB\-XX:MaxHeapSize=80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:MaxHeapSize=83886080\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=81920k\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus overhead amounts\&. On Oracle Solaris 2\&.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&.
-.sp
-The
-\fB\-XX:MaxHeapSize\fR
-option is equivalent to
-\fB\-Xmx\fR\&.
-.RE
-.PP
-\-XX:MaxHeapFreeRatio=\fIpercent\fR
-.RS 4
+
+The \f3-XX:MaxHeapSize\fR option is equivalent to \f3-Xmx\fR\&.
+.TP
+-XX:MaxHeapFreeRatio=\fIpercent\fR
+.br
 Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space expands above this value, then the heap will be shrunk\&. By default, this value is set to 70%\&.
-.sp
+
 The following example shows how to set the maximum free heap ratio to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapFreeRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxMetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxHeapFreeRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxMetaspaceSize=\fIsize\fR
+.br
 Sets the maximum amount of native memory that can be allocated for class metadata\&. By default, the size is not limited\&. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system\&.
-.sp
+
 The following example shows how to set the maximum class metadata size to 256 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxMetaspaceSize=256m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNewSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxMetaspaceSize=256m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNewSize=\fIsize\fR
+.br
 Sets the maximum size (in bytes) of the heap for the young generation (nursery)\&. The default value is set ergonomically\&.
-.RE
-.PP
-\-XX:MaxTenuringThreshold=\fIthreshold\fR
-.RS 4
+.TP
+-XX:MaxTenuringThreshold=\fIthreshold\fR
+.br
 Sets the maximum tenuring threshold for use in adaptive GC sizing\&. The largest value is 15\&. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector\&.
-.sp
+
 The following example shows how to set the maximum tenuring threshold to 10:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTenuringThreshold=10\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxTenuringThreshold=10\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MetaspaceSize=\fIsize\fR
+.br
 Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded\&. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used\&. The default size depends on the platform\&.
-.RE
-.PP
-\-XX:MinHeapFreeRatio=\fIpercent\fR
-.RS 4
+.TP
+-XX:MinHeapFreeRatio=\fIpercent\fR
+.br
 Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space falls below this value, then the heap will be expanded\&. By default, this value is set to 40%\&.
-.sp
+
 The following example shows how to set the minimum free heap ratio to 25%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MinHeapFreeRatio=25\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MinHeapFreeRatio=25\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewRatio=\fIratio\fR
+.br
 Sets the ratio between young and old generation sizes\&. By default, this option is set to 2\&. The following example shows how to set the young/old ratio to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewRatio=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:NewRatio=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too low, then a large number of minor GCs will be performed\&. If the size is too high, then only full GCs will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewSize=256m\fR
-\fB\-XX:NewSize=262144k\fR
-\fB\-XX:NewSize=268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-XX:NewSize\fR
-option is equivalent to
-\fB\-Xmn\fR\&.
-.RE
-.PP
-\-XX:ParallelGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:NewSize=256m\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=262144k\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-XX:NewSize\fR option is equivalent to \f3-Xmn\fR\&.
+.TP
+-XX:ParallelGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for parallel garbage collection in the young and old generations\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for parallel GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ParallelGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+ParallelRefProcEnabled
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ParallelGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+ParallelRefProcEnabled
+.br
 Enables parallel reference processing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintAdaptiveSizePolicy
-.RS 4
+.TP
+-XX:+PrintAdaptiveSizePolicy
+.br
 Enables printing of information about adaptive generation sizing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGC
-.RS 4
+.TP
+-XX:+PrintGC
+.br
 Enables printing of messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationConcurrentTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationConcurrentTime
+.br
 Enables printing of how much time elapsed since the last pause (for example, a GC pause)\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationStoppedTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationStoppedTime
+.br
 Enables printing of how much time the pause (for example, a GC pause) lasted\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDateStamps
-.RS 4
+.TP
+-XX:+PrintGCDateStamps
+.br
 Enables printing of a date stamp at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDetails
-.RS 4
+.TP
+-XX:+PrintGCDetails
+.br
 Enables printing of detailed messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTaskTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTaskTimeStamps
+.br
 Enables printing of time stamps for every individual GC worker thread task\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTimeStamps
+.br
 Enables printing of time stamps at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintStringDeduplicationStatistics
-.RS 4
-Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintTenuringDistribution
-.RS 4
+.TP
+-XX:+PrintStringDeduplicationStatistics
+.br
+Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:+PrintTenuringDistribution
+.br
 Enables printing of tenuring age information\&. The following is an example of the output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBDesired survivor size 48286924 bytes, new threshold 10 (max 10)\fR
-\fB\- age 1: 28992024 bytes, 28992024 total\fR
-\fB\- age 2: 1366864 bytes, 30358888 total\fR
-\fB\- age 3: 1425912 bytes, 31784800 total\fR
-\fB\&.\&.\&.\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3Desired survivor size 48286924 bytes, new threshold 10 (max 10)\fP
+.fi     
+.nf     
+\f3\- age 1: 28992024 bytes, 28992024 total\fP
+.fi     
+.nf     
+\f3\- age 2: 1366864 bytes, 30358888 total\fP
+.fi     
+.nf     
+\f3\- age 3: 1425912 bytes, 31784800 total\fP
+.fi     
+.nf     
+\f3\&.\&.\&.\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Age 1 objects are the youngest survivors (they were created after the previous scavenge, survived the latest scavenge, and moved from eden to survivor space)\&. Age 2 objects have survived two scavenges (during the second scavenge they were copied from one survivor space to the next)\&. And so on\&.
-.sp
+
 In the preceding example, 28 992 024 bytes survived one scavenge and were copied from eden to survivor space, 1 366 864 bytes are occupied by age 2 objects, etc\&. The third value in each row is the cumulative size of objects of age n or less\&.
-.sp
+
 By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+ScavengeBeforeFullGC
-.RS 4
-Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you
-\fIdo not\fR
-disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify
-\fB\-XX:\-ScavengeBeforeFullGC\fR\&.
-.RE
-.PP
-\-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
-.RS 4
-Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The
-\fB\-XX:SoftRefLRUPolicyMSPerMB\fR
-option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the
-\fB\-Xmx\fR
-option has a significant effect on how quickly soft references are garbage collected\&.
-.sp
+.TP
+-XX:+ScavengeBeforeFullGC
+.br
+Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you \fIdo not\fR disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify \f3-XX:-ScavengeBeforeFullGC\fR\&.
+.TP
+-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
+.br
+Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The \f3-XX:SoftRefLRUPolicyMSPerMB\fR option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the \f3-Xmx\fR option has a significant effect on how quickly soft references are garbage collected\&.
+
 The following example shows how to set the value to 2\&.5 seconds:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SoftRefLRUPolicyMSPerMB=2500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
-.RS 4
-\fBString\fR
-objects reaching the specified age are considered candidates for deduplication\&. An object\*(Aqs age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the
-\fB\-XX:+PrintTenuringDistribution\fR
-option\&. Note that
-\fBString\fR
-objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is
-\fB3\fR\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:SurvivorRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SoftRefLRUPolicyMSPerMB=2500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
+.br
+\f3String\fR objects reaching the specified age are considered candidates for deduplication\&. An object\&'s age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the \f3-XX:+PrintTenuringDistribution\fR option\&. Note that \f3String\fR objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is \f33\fR\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:SurvivorRatio=\fIratio\fR
+.br
 Sets the ratio between eden space size and survivor space size\&. By default, this option is set to 8\&. The following example shows how to set the eden/survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TargetSurvivorRatio=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TargetSurvivorRatio=\fIpercent\fR
+.br
 Sets the desired percentage of survivor space (0 to 100) used after young garbage collection\&. By default, this option is set to 50%\&.
-.sp
+
 The following example shows how to set the target survivor space ratio to 30%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TargetSurvivorRatio=30\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TLABSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of a thread\-local allocation buffer (TLAB)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:TargetSurvivorRatio=30\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TLABSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of a thread-local allocation buffer (TLAB)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
+
 The following example shows how to set the initial TLAB size to 512 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TLABSize=512k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+UseAdaptiveSizePolicy
-.RS 4
-Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-and set the size of the memory allocation pool explicitly (see the
-\fB\-XX:SurvivorRatio\fR
-option)\&.
-.RE
-.PP
-\-XX:+UseCMSInitiatingOccupancyOnly
-.RS 4
+.sp     
+.nf     
+\f3\-XX:TLABSize=512k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+UseAdaptiveSizePolicy
+.br
+Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify \f3-XX:-UseAdaptiveSizePolicy\fR and set the size of the memory allocation pool explicitly (see the \f3-XX:SurvivorRatio\fR option)\&.
+.TP
+-XX:+UseCMSInitiatingOccupancyOnly
+.br
 Enables the use of the occupancy value as the only criterion for initiating the CMS collector\&. By default, this option is disabled and other criteria may be used\&.
-.RE
-.PP
-\-XX:+UseConcMarkSweepGC
-.RS 4
-Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\fB\-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\fB\-XX:+UseG1GC\fR) is another alternative\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the
-\fB\-XX:+UseParNewGC\fR
-option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8:
-\fB\-XX:+UseConcMarkSweepGC \-XX:\-UseParNewGC\fR\&.
-.RE
-.PP
-\-XX:+UseG1GC
-.RS 4
-Enables the use of the garbage\-first (G1) garbage collector\&. It is a server\-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
-.sp
+.TP
+-XX:+UseConcMarkSweepGC
+.br
+Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\f3-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\f3-XX:+UseG1GC\fR) is another alternative\&.
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the \f3-XX:+UseParNewGC\fR option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8: \f3-XX:+UseConcMarkSweepGC -XX:-UseParNewGC\fR\&.
+.TP
+-XX:+UseG1GC
+.br
+Enables the use of the garbage-first (G1) garbage collector\&. It is a server-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
+
 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseGCOverheadLimit
-.RS 4
-Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an
-\fBOutOfMemoryError\fR
-exception is thrown\&. This option is enabled, by default and the parallel GC will throw an
-\fBOutOfMemoryError\fR
-if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify
-\fB\-XX:\-UseGCOverheadLimit\fR\&.
-.RE
-.PP
-\-XX:+UseNUMA
-.RS 4
-Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\*(Aqs use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\fB\-XX:+UseParallelGC\fR)\&.
-.RE
-.PP
-\-XX:+UseParallelGC
-.RS 4
+.TP
+-XX:+UseGCOverheadLimit
+.br
+Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an \f3OutOfMemoryError\fR exception is thrown\&. This option is enabled, by default and the parallel GC will throw an \f3OutOfMemoryError\fR if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify \f3-XX:-UseGCOverheadLimit\fR\&.
+.TP
+-XX:+UseNUMA
+.br
+Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\&'s use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\f3-XX:+UseParallelGC\fR)\&.
+.TP
+-XX:+UseParallelGC
+.br
 Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the
-\fB\-XX:+UseParallelOldGC\fR
-option is automatically enabled, unless you explicitly disable it\&.
-.RE
-.PP
-\-XX:+UseParallelOldGC
-.RS 4
-Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the
-\fB\-XX:+UseParallelGC\fR
-option\&.
-.RE
-.PP
-\-XX:+UseParNewGC
-.RS 4
-Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&. Using the
-\fB\-XX:+UseParNewGC\fR
-option without the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option was deprecated in JDK 8\&.
-.RE
-.PP
-\-XX:+UseSerialGC
-.RS 4
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the \f3-XX:+UseParallelOldGC\fR option is automatically enabled, unless you explicitly disable it\&.
+.TP
+-XX:+UseParallelOldGC
+.br
+Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the \f3-XX:+UseParallelGC\fR option\&.
+.TP
+-XX:+UseParNewGC
+.br
+Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the \f3-XX:+UseConcMarkSweepGC\fR option\&. Using the \f3-XX:+UseParNewGC\fR option without the \f3-XX:+UseConcMarkSweepGC\fR option was deprecated in JDK 8\&.
+.TP
+-XX:+UseSerialGC
+.br
 Enables the use of the serial garbage collector\&. This is generally the best choice for small and simple applications that do not require any special functionality from garbage collection\&. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseStringDeduplication
-.RS 4
-Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage\-first (G1) garbage collector\&. See the
-\fB\-XX:+UseG1GC\fR
-option\&.
-.sp
-\fIString deduplication\fR
-reduces the memory footprint of
-\fBString\fR
-objects on the Java heap by taking advantage of the fact that many
-\fBString\fR
-objects are identical\&. Instead of each
-\fBString\fR
-object pointing to its own character array, identical
-\fBString\fR
-objects can point to and share the same character array\&.
-.RE
-.PP
-\-XX:+UseTLAB
-.RS 4
-Enables the use of thread\-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify
-\fB\-XX:\-UseTLAB\fR\&.
-.RE
-.SS "Deprecated and Removed Options"
-.PP
+.TP
+-XX:+UseSHM
+.br
+On Linux, enables the JVM to use shared memory to setup large pages\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseStringDeduplication
+.br
+Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage-first (G1) garbage collector\&. See the \f3-XX:+UseG1GC\fR option\&.
+
+\fIString deduplication\fR reduces the memory footprint of \f3String\fR objects on the Java heap by taking advantage of the fact that many \f3String\fR objects are identical\&. Instead of each \f3String\fR object pointing to its own character array, identical \f3String\fR objects can point to and share the same character array\&.
+.TP
+-XX:+UseTLAB
+.br
+Enables the use of thread-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify \f3-XX:-UseTLAB\fR\&.
+.SS DEPRECATED\ AND\ REMOVED\ OPTIONS    
 These options were included in the previous release, but have since been considered unnecessary\&.
-.PP
-\-Xincgc
-.RS 4
+.TP
+-Xincgc
+.br
 Enables incremental garbage collection\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-Xrun\fIlibname\fR
-.RS 4
-Loads the specified debugging/profiling library\&. This option was superseded by the
-\fB\-agentlib\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycle=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when
-\fB\-XX:+CMSIncrementalPacing\fR
-is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalMode
-.RS 4
-Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with
-\fBCMSIncremental\fR\&.
-.RE
-.PP
-\-XX:CMSIncrementalOffset=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalPacing
-.RS 4
-Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
-.RS 4
+.TP
+-Xrun\fIlibname\fR
+.br
+Loads the specified debugging/profiling library\&. This option was superseded by the \f3-agentlib\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycle=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when \f3-XX:+CMSIncrementalPacing\fR is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalMode
+.br
+Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with \f3CMSIncremental\fR\&.
+.TP
+-XX:CMSIncrementalOffset=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalPacing
+.br
+Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
+.br
 Sets the percentage of the permanent generation occupancy (0 to 100) at which to start a GC\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-XX:MaxPermSize=\fIsize\fR
-.RS 4
-Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the
-\fB\-XX:MaxMetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:PermSize=\fIsize\fR
-.RS 4
-Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the
-\fB\-XX:MetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:+UseSplitVerifier
-.RS 4
+.TP
+-XX:MaxPermSize=\fIsize\fR
+.br
+Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the \f3-XX:MaxMetaspaceSize\fR option\&.
+.TP
+-XX:PermSize=\fIsize\fR
+.br
+Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the \f3-XX:MetaspaceSize\fR option\&.
+.TP
+-XX:+UseSplitVerifier
+.br
 Enables splitting of the verification process\&. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime)\&. This option was deprecated in JDK 8, and verification is now split by default without a way to disable it\&.
-.RE
-.PP
-\-XX:+UseStringCache
-.RS 4
+.TP
+-XX:+UseStringCache
+.br
 Enables caching of commonly allocated strings\&. This option was removed from JDK 8 with no replacement\&.
-.RE
-.SH "PERFORMANCE TUNING EXAMPLES"
-.PP
+.SH PERFORMANCE\ TUNING\ EXAMPLES    
 The following examples show how to use experimental tuning flags to either optimize throughput or to provide lower response time\&.
 .PP
-\fBExample 1\fR
-.br
-Tuning for Higher Throughput
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+\f3Example 1 Tuning for Higher Throughput\fR
+.sp     
+.nf     
+\f3java \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Tuning for Lower Response Time\fR
+.sp     
+.nf     
+\f3java \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH LARGE\ PAGES    
+Also known as huge pages, large pages are memory pages that are significantly larger than the standard memory page size (which varies depending on the processor and operating system)\&. Large pages optimize processor Translation-Lookaside Buffers\&.
 .PP
-\fBExample 2\fR
-.br
-Tuning for Lower Response Time
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "EXIT STATUS"
+A Translation-Lookaside Buffer (TLB) is a page translation cache that holds the most-recently used virtual-to-physical address translations\&. TLB is a scarce system resource\&. A TLB miss can be costly as the processor must then read from the hierarchical page table, which may require multiple memory accesses\&. By using a larger memory page size, a single TLB entry can represent a larger memory range\&. There will be less pressure on TLB, and memory-intensive applications may have better performance\&.
 .PP
-The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call
-\fBSystem\&.exit(exitValue)\fR\&. The values are:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB0\fR: Successful completion
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB>0\fR: An error occurred
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+However, large pages page memory can negatively affect system performance\&. For example, when a large mount of memory is pinned by an application, it may create a shortage of regular memory and cause excessive paging in other applications and slow down the entire system\&. Also, a system that has been up for a long time could produce excessive fragmentation, which could make it impossible to reserve enough large page memory\&. When this happens, either the OS or JVM reverts to using regular pages\&.
+.SS LARGE\ PAGES\ SUPPORT    
+Solaris and Linux support large pages\&.
+.PP
+Solaris 9 and later include Multiple Page Size Support (MPSS); no additional configuration is necessary\&. See http://www\&.oracle\&.com/technetwork/server-storage/solaris10/overview/solaris9-features-scalability-135663\&.html\&.
+.PP
+The 2\&.6 kernel supports large pages\&. Some vendors have backported the code to their 2\&.4-based releases\&. To check if your system can support large page memory, try the following:
+.sp     
+.nf     
+\f3# cat /proc/meminfo | grep Huge\fP
+.fi     
+.nf     
+\f3HugePages_Total: 0\fP
+.fi     
+.nf     
+\f3HugePages_Free: 0\fP
+.fi     
+.nf     
+\f3Hugepagesize: 2048 kB\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If the output shows the three "Huge" variables, then your system can support large page memory but it needs to be configured\&. If the command prints nothing, then your system does not support large pages\&. To configure the system to use large page memory, login as \f3root\fR, and then follow these steps:
+.TP 0.4i    
+1\&.
+If you are using the option \f3-XX:+UseSHM\fR (instead of \f3-XX:+UseHugeTLBFS\fR), then increase the \f3SHMMAX\fR value\&. It must be larger than the Java heap size\&. On a system with 4 GB of physical RAM (or less), the following will make all the memory sharable:
+.sp     
+.nf     
+\f3# echo 4294967295 > /proc/sys/kernel/shmmax\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP 0.4i    
+2\&.
+If you are using the option \f3-XX:+UseSHM\fR or \f3-XX:+UseHugeTLBFS\fR, then specify the number of large pages\&. In the following example, 3 GB of a 4 GB system are reserved for large pages (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048 kB = 1536):
+.sp     
+.nf     
+\f3# echo 1536 > /proc/sys/vm/nr_hugepages\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.PP
+Note
+.PP
+Note that the values contained in \f3/proc\fR will reset after you reboot your system, so may want to set them in an initialization script (for example, \f3rc\&.local\fR or \f3sysctl\&.conf\fR)\&.
+.PP
+If you configure (or resize) the OS kernel parameters \f3/proc/sys/kernel/shmmax\fR or \f3/proc/sys/vm/nr_hugepages\fR, Java processes may allocate large pages for areas in addition to the Java heap\&. These steps can allocate large pages for the following areas:
+.PP
+Java heap
+.PP
+Permanent generation
+.PP
+Code cache
+.PP
+The marking bitmap data structure for the parallel GC
+.PP
+Consequently, if you configure the \f3nr_hugepages\fR parameter to the size of the Java heap, then the JVM can fail in allocating the permanent generation and code cache areas on large pages because these areas are quite large in size\&.
+.SH EXIT\ STATUS    
+The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call \f3System\&.exit(exitValue)\fR\&. The values are:
+.TP 0.2i    
+\(bu
+\f30\fR: Successful completion
+.TP 0.2i    
+\(bu
+\f3>0\fR: An error occurred
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 javac(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.TP 0.2i    
+\(bu
+jstat(1)
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/linux/doc/man/javac.1 b/src/linux/doc/man/javac.1
index a3d55e2..5cc8c18 100644
--- a/src/linux/doc/man/javac.1
+++ b/src/linux/doc/man/javac.1
@@ -1,2116 +1,1370 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: javac
-.\" Language: English
-.\" Date: 8 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: javac.1
 .\"
 .if n .pl 99999
-.TH "javac" "1" "8 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH javac 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 javac \- Reads Java class and interface definitions and compiles them into bytecode and class files\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjavac\fR [ \fIoptions\fR ] [ \fIsourcefiles\fR ] [ \fIclasses\fR] [ \fI@argfiles\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
 Arguments can be in any order:
-.PP
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options\&. See Options\&.
-.RE
-.PP
+Command-line options\&. See Options\&.
+.TP     
 \fIsourcefiles\fR
-.RS 4
-One or more source files to be compiled (such as
-\fBMyClass\&.java\fR)\&.
-.RE
-.PP
+One or more source files to be compiled (such as \f3MyClass\&.java\fR)\&.
+.TP     
 \fIclasses\fR
-.RS 4
-One or more classes to be processed for annotations (such as
-\fBMyPackage\&.MyClass\fR)\&.
-.RE
-.PP
+One or more classes to be processed for annotations (such as \f3MyPackage\&.MyClass\fR)\&.
+.TP     
 \fI@argfiles\fR
-.RS 4
-One or more files that list options and source files\&. The
-\fB\-J\fR
-options are not allowed in these files\&. See Command\-Line Argument Files\&.
-.RE
-.SH "DESCRIPTION"
+One or more files that list options and source files\&. The \f3-J\fR options are not allowed in these files\&. See Command-Line Argument Files\&.
+.SH DESCRIPTION    
+The \f3javac\fR command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The \f3javac\fR command can also process annotations in Java source files and classes\&.
 .PP
-The
-\fBjavac\fR
-command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The
-\fBjavac\fR
-command can also process annotations in Java source files and classes\&.
-.PP
-There are two ways to pass source code file names to
-\fBjavac\fR\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+There are two ways to pass source code file names to \f3javac\fR\&.
+.TP 0.2i    
+\(bu
 For a small number of source files, list the file names on the command line\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the
-\fBjavac\fR
-command\&.
-.RE
+.TP 0.2i    
+\(bu
+For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the \f3javac\fR command\&.
 .PP
-Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called
-\fBMyClass\fR
-would be written in a source file called
-\fBMyClass\&.java\fR
-and compiled into a bytecode class file called
-\fBMyClass\&.class\fR\&.
+Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called \f3MyClass\fR would be written in a source file called \f3MyClass\&.java\fR and compiled into a bytecode class file called \f3MyClass\&.class\fR\&.
 .PP
-Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as
-\fBMyClass$MyInnerClass\&.class\fR\&.
+Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as \f3MyClass$MyInnerClass\&.class\fR\&.
 .PP
-Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in
-\fB/workspace\fR, then put the source code for
-\fBcom\&.mysoft\&.mypack\&.MyClass\fR
-in
-\fB/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
+Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in \f3/workspace\fR, then put the source code for \f3com\&.mysoft\&.mypack\&.MyClass\fR in \f3/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
 .PP
-By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.SH "OPTIONS"
-.PP
-The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the
-\fB\-X\fR
-option\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-See also Cross\-Compilation Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the \f3-d\fR option\&.
+.SH OPTIONS    
+The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the \f3-X\fR option\&.
+.TP 0.2i    
+\(bu
+See also Cross-Compilation Options
+.TP 0.2i    
+\(bu
 See also Nonstandard Options
-.RE
-.SS "Standard Options"
-.PP
-\-A\fIkey\fR[\fI=value\fR]
-.RS 4
-Specifies options to pass to annotation processors\&. These options are not interpreted by
-\fBjavac\fR
-directly, but are made available for use by individual processors\&. The
-\fBkey\fR
-value should be one or more identifiers separated by a dot (\&.)\&.
-.RE
-.PP
-\-cp \fIpath\fR or \-classpath \fIpath\fR
-.RS 4
-Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the
-\fBCLASSPATH\fR
-environment variable\&. If neither
-\fBCLASSPATH\fR,
-\fB\-cp\fR
-nor
-\fB\-classpath\fR
-is specified, then the user
-\fIclass path\fR
-is the current directory\&. See Setting the Class Path \&.
-.sp
-If the
-\fB\-sourcepath\fR
-option is not specified, then the user class path is also searched for source files\&.
-.sp
-If the
-\fB\-processorpath\fR
-option is not specified, then the class path is also searched for annotation processors\&.
-.RE
-.PP
-\-Djava\&.ext\&.dirs=\fIdirectories\fR
-.RS 4
+.SS STANDARD\ OPTIONS    
+.TP
+-A\fIkey\fR[\fI=value\fR]
+.br
+Specifies options to pass to annotation processors\&. These options are not interpreted by \f3javac\fR directly, but are made available for use by individual processors\&. The \f3key\fR value should be one or more identifiers separated by a dot (\&.)\&.
+.TP
+-cp \fIpath\fR or -classpath \fIpath\fR
+.br
+Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the \f3CLASSPATH\fR environment variable\&. If neither \f3CLASSPATH\fR, \f3-cp\fR nor \f3-classpath\fR is specified, then the user \fIclass path\fR is the current directory\&. See Setting the Class Path\&.
+
+If the \f3-sourcepath\fR option is not specified, then the user class path is also searched for source files\&.
+
+If the \f3-processorpath\fR option is not specified, then the class path is also searched for annotation processors\&.
+.TP
+-Djava\&.ext\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of installed extensions\&.
-.RE
-.PP
-\-Djava\&.endorsed\&.dirs=\fIdirectories\fR
-.RS 4
+.TP
+-Djava\&.endorsed\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-d \fIdirectory\fR
-.RS 4
-Sets the destination directory for class files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then
-\fBjavac\fR
-puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-d\fR
-\fB/home/myclasses\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the class file is
-\fB/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
-.sp
-If the
-\fI\-d\fR
-option is not specified, then
-\fBjavac\fR
-puts each class file in the same directory as the source file from which it was generated\&.
-.sp
-\fBNote:\fR
-The directory specified by the
-\fI\-d\fR
-option is not automatically added to your user class path\&.
-.RE
-.PP
-\-deprecation
-.RS 4
-Shows a description of each use or override of a deprecated member or class\&. Without the
-\fB\-deprecation\fR
-option,
-\fBjavac\fR
-shows a summary of the source files that use or override deprecated members or classes\&. The
-\fB\-deprecation\fR
-option is shorthand for
-\fB\-Xlint:deprecation\fR\&.
-.RE
-.PP
-\-encoding \fIencoding\fR
-.RS 4
-Sets the source file encoding name, such as EUC\-JP and UTF\-8\&. If the
-\fB\-encoding\fR
-option is not specified, then the platform default converter is used\&.
-.RE
-.PP
-\-endorseddirs \fIdirectories\fR
-.RS 4
+.TP
+-d \fIdirectory\fR
+.br
+Sets the destination directory for class files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then \f3javac\fR puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-d\fR\f3/home/myclasses\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the class file is \f3/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
+
+If the \fI-d\fR option is not specified, then \f3javac\fR puts each class file in the same directory as the source file from which it was generated\&.
+
+\fINote:\fR The directory specified by the \fI-d\fR option is not automatically added to your user class path\&.
+.TP
+-deprecation
+.br
+Shows a description of each use or override of a deprecated member or class\&. Without the \f3-deprecation\fR option, \f3javac\fR shows a summary of the source files that use or override deprecated members or classes\&. The \f3-deprecation\fR option is shorthand for \f3-Xlint:deprecation\fR\&.
+.TP
+-encoding \fIencoding\fR
+.br
+Sets the source file encoding name, such as EUC-JP and UTF-8\&. If the \f3-encoding\fR option is not specified, then the platform default converter is used\&.
+.TP
+-endorseddirs \fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-extdirs \fIdirectories\fR
-.RS 4
-Overrides the location of the
-\fBext\fR
-directory\&. The directories variable is a colon\-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
-.sp
-If you are cross\-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross\-Compilation Options for more information\&.
-.RE
-.PP
-\-g
-.RS 4
+.TP
+-extdirs \fIdirectories\fR
+.br
+Overrides the location of the \f3ext\fR directory\&. The directories variable is a colon-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
+
+If you are cross-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross-Compilation Options for more information\&.
+.TP
+-g
+.br
 Generates all debugging information, including local variables\&. By default, only line number and source file information is generated\&.
-.RE
-.PP
-\-g:none
-.RS 4
+.TP
+-g:none
+.br
 Does not generate any debugging information\&.
-.RE
-.PP
-\-g:[\fIkeyword list\fR]
-.RS 4
+.TP
+-g:[\fIkeyword list\fR]
+.br
 Generates only some kinds of debugging information, specified by a comma separated list of keywords\&. Valid keywords are:
-.PP
+.RS     
+.TP     
 source
-.RS 4
 Source file debugging information\&.
-.RE
-.PP
+.TP     
 lines
-.RS 4
 Line number debugging information\&.
-.RE
-.PP
+.TP     
 vars
-.RS 4
 Local variable debugging information\&.
-.RE
-.RE
-.PP
-\-help
-.RS 4
+.RE     
+
+.TP
+-help
+.br
 Prints a synopsis of standard options\&.
-.RE
-.PP
-\-implicit:[\fIclass, none\fR]
-.RS 4
-Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use
-\fB\-implicit:class\fR\&. To suppress class file generation, use
-\fB\-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the
-\fB\-implicit\fR
-option is set explicitly\&. See Searching for Types\&.
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Passes
-\fBoption\fR
-to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example,
-\fB\-J\-Xms48m\fR
-sets the startup memory to 48 MB\&. See
-java(1)\&.
-.sp
-\fBNote:\fR
-The
-\fICLASSPATH\fR,
-\fB\-classpath\fR,
-\fB\-bootclasspath\fR, and
-\fB\-extdirs\fR
-options do not specify the classes used to run
-\fBjavac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the
-\fB\-J\fR
-option to pass options through to the underlying Java launcher\&.
-.RE
-.PP
-\-nowarn
-.RS 4
-Disables warning messages\&. This option operates the same as the
-\fB\-Xlint:none\fR
-option\&.
-.RE
-.PP
-\-parameters
-.RS 4
-Stores formal parameter names of constructors and methods in the generated class file so that the method
-\fBjava\&.lang\&.reflect\&.Executable\&.getParameters\fR
-from the Reflection API can retrieve them\&.
-.RE
-.PP
-\-proc: [\fInone\fR, \fIonly\fR]
-.RS 4
-Controls whether annotation processing and compilation are done\&.
-\fB\-proc:none\fR
-means that compilation takes place without annotation processing\&.
-\fB\-proc:only\fR
-means that only annotation processing is done, without any subsequent compilation\&.
-.RE
-.PP
-\-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
-.RS 4
+.TP
+-implicit:[\fIclass, none\fR]
+.br
+Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use \f3-implicit:class\fR\&. To suppress class file generation, use \f3-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the \f3-implicit\fR option is set explicitly\&. See Searching for Types\&.
+.TP
+-J\fIoption\fR
+.br
+Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
+
+\fINote:\fR The \fICLASSPATH\fR, \f3-classpath\fR, \f3-bootclasspath\fR, and \f3-extdirs\fR options do not specify the classes used to run \f3javac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the \f3-J\fR option to pass options through to the underlying \f3\fRJava launcher\&.
+.TP
+-nowarn
+.br
+Disables warning messages\&. This option operates the same as the \f3-Xlint:none\fR option\&.
+.TP
+-parameters
+.br
+Stores formal parameter names of constructors and methods in the generated class file so that the method \f3java\&.lang\&.reflect\&.Executable\&.getParameters\fR from the Reflection API can retrieve them\&.
+.TP
+-proc: [\fInone\fR, \fIonly\fR]
+.br
+Controls whether annotation processing and compilation are done\&. \f3-proc:none\fR means that compilation takes place without annotation processing\&. \f3-proc:only\fR means that only annotation processing is done, without any subsequent compilation\&.
+.TP
+-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
+.br
 Names of the annotation processors to run\&. This bypasses the default discovery process\&.
-.RE
-.PP
-\-processorpath \fIpath\fR
-.RS 4
+.TP
+-processorpath \fIpath\fR
+.br
 Specifies where to find annotation processors\&. If this option is not used, then the class path is searched for processors\&.
-.RE
-.PP
-\-s \fIdir\fR
-.RS 4
-Specifies the directory where to place the generated source files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-s /home/mysrc\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the source file is put in
-\fB/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
-.RE
-.PP
-\-source \fIrelease\fR
-.RS 4
-Specifies the version of source code accepted\&. The following values for
-\fBrelease\fR
-are allowed:
-.PP
+.TP
+-s \fIdir\fR
+.br
+Specifies the directory where to place the generated source files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-s /home/mysrc\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the source file is put in \f3/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
+.TP
+-source \fIrelease\fR
+.br
+Specifies the version of source code accepted\&. The following values for \f3release\fR are allowed:
+.RS     
+.TP     
 1\&.3
-.RS 4
 The compiler does not support assertions, generics, or other language features introduced after Java SE 1\&.3\&.
-.RE
-.PP
+.TP     
 1\&.4
-.RS 4
 The compiler accepts code containing assertions, which were introduced in Java SE 1\&.4\&.
-.RE
-.PP
+.TP     
 1\&.5
-.RS 4
 The compiler accepts code containing generics and other language features introduced in Java SE 5\&.
-.RE
-.PP
+.TP     
 5
-.RS 4
 Synonym for 1\&.5\&.
-.RE
-.PP
+.TP     
 1\&.6
-.RS 4
 No language changes were introduced in Java SE 6\&. However, encoding errors in source files are now reported as errors instead of warnings as in earlier releases of Java Platform, Standard Edition\&.
-.RE
-.PP
+.TP     
 6
-.RS 4
 Synonym for 1\&.6\&.
-.RE
-.PP
+.TP     
 1\&.7
-.RS 4
 The compiler accepts code with features introduced in Java SE 7\&.
-.RE
-.PP
+.TP     
 7
-.RS 4
 Synonym for 1\&.7\&.
-.RE
-.PP
+.TP     
 1\&.8
-.RS 4
 This is the default value\&. The compiler accepts code with features introduced in Java SE 8\&.
-.RE
-.PP
+.TP     
 8
-.RS 4
 Synonym for 1\&.8\&.
-.RE
-.RE
-.PP
-\-sourcepath \fIsourcepath\fR
-.RS 4
+.RE     
+
+.TP
+-sourcepath \fIsourcepath\fR
+.br
 Specifies the source code path to search for class or interface definitions\&. As with the user class path, source path entries are separated by colons (:) on Oracle Solaris and semicolons on Windows and can be directories, JAR archives, or ZIP archives\&. If packages are used, then the local path name within the directory or archive must reflect the package name\&.
-.sp
-\fBNote:\fR
-Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
-.RE
-.PP
-\-verbose
-.RS 4
+
+\fINote:\fR Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
+.TP
+-verbose
+.br
 Uses verbose output, which includes information about each class loaded and each source file compiled\&.
-.RE
-.PP
-\-version
-.RS 4
+.TP
+-version
+.br
 Prints release information\&.
-.RE
-.PP
-\-werror
-.RS 4
+.TP
+-werror
+.br
 Terminates compilation when warnings occur\&.
-.RE
-.PP
-\-X
-.RS 4
+.TP
+-X
+.br
 Displays information about nonstandard options and exits\&.
-.RE
-.SS "Cross\-Compilation Options"
-.PP
-By default, classes are compiled against the bootstrap and extension classes of the platform that
-\fBjavac\fR
-shipped with\&. But
-\fBjavac\fR
-also supports cross\-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the
-\fB\-bootclasspath\fR
-and
-\fB\-extdirs\fR
-options when cross\-compiling\&.
-.PP
-\-target \fIversion\fR
-.RS 4
+.SS CROSS-COMPILATION\ OPTIONS    
+By default, classes are compiled against the bootstrap and extension classes of the platform that \f3javac\fR shipped with\&. But \f3javac\fR also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the \f3-bootclasspath\fR and \f3-extdirs\fR options when cross-compiling\&.
+.TP
+-target \fIversion\fR
+.br
 Generates class files that target a specified release of the virtual machine\&. Class files will run on the specified target and on later releases, but not on earlier releases of the JVM\&. Valid targets are 1\&.1, 1\&.2, 1\&.3, 1\&.4, 1\&.5 (also 5), 1\&.6 (also 6), 1\&.7 (also 7), and 1\&.8 (also 8)\&.
-.sp
-The default for the
-\fB\-target\fR
-option depends on the value of the
-\fB\-source\fR
-option:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is not specified, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.2, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.3, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.5, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.6, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.7, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For all other values of the
-\fB\-source\fR
-option, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option\&.
-.RE
-.RE
+
+The default for the \f3-target\fR option depends on the value of the \f3-source\fR option:
+.RS     
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is not specified, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.2, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.3, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.5, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.6, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.7, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+For all other values of the \f3-source\fR option, the value of the \f3-target\fR option is the value of the \f3-source\fR option\&.
+.RE     
+
+.TP
+-bootclasspath \fIbootclasspath\fR
+.br
+Cross-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
+.SS COMPACT\ PROFILE\ OPTION    
+Beginning with JDK 8, the \f3javac\fR compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
 .PP
-\-bootclasspath \fIbootclasspath\fR
-.RS 4
-Cross\-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
-.RE
-.SS "Compact Profile Option"
-.PP
-Beginning with JDK 8, the
-\fBjavac\fR
-compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
-.PP
-The supported profile values are
-\fBcompact1\fR,
-\fBcompact2\fR, and
-\fBcompact3\fR\&. These are additive layers\&. Each higher\-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
-.PP
-\-profile
-.RS 4
+The supported profile values are \f3compact1\fR, \f3compact2\fR, and \f3compact3\fR\&. These are additive layers\&. Each higher-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
+.TP
+-profile
+.br
 When using compact profiles, this option specifies the profile name when compiling\&. For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-profile compact1 Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3javac \-profile compact1 Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 javac does not compile source code that uses any Java SE APIs that is not in the specified profile\&. Here is an example of the error message that results from attempting to compile such source code:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBcd jdk1\&.8\&.0/bin\fR
-\fB\&./javac \-profile compact1 Paint\&.java\fR
-\fBPaint\&.java:5: error: Applet is not available in profile \*(Aqcompact1\*(Aq\fR
-\fBimport java\&.applet\&.Applet;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-In this example, you can correct the error by modifying the source to not use the
-\fBApplet\fR
-class\&. You could also correct the error by compiling without the \-profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the
-\fBApplet\fR
-class\&.)
-.sp
-An alternative way to compile with compact profiles is to use the
-\fB\-bootclasspath\fR
-option to specify a path to an
-\fBrt\&.jar\fR
-file that specifies a profile\*(Aqs image\&. Using the
-\fB\-profile\fR
-option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross\-compiling\&.
-.RE
-.SS "Nonstandard Options"
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+.sp     
+.nf     
+\f3cd jdk1\&.8\&.0/bin\fP
+.fi     
+.nf     
+\f3\&./javac \-profile compact1 Paint\&.java\fP
+.fi     
+.nf     
+\f3Paint\&.java:5: error: Applet is not available in profile \&'compact1\&'\fP
+.fi     
+.nf     
+\f3import java\&.applet\&.Applet;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+In this example, you can correct the error by modifying the source to not use the \f3Applet\fR class\&. You could also correct the error by compiling without the -profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the \f3Applet\fR class\&.)
+
+An alternative way to compile with compact profiles is to use the \f3-bootclasspath\fR option to specify a path to an \f3rt\&.jar\fR file that specifies a profile\&'s image\&. Using the \f3-profile\fR option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross-compiling\&.
+.SS NONSTANDARD\ OPTIONS    
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Adds a suffix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Adds a prefix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/:\fIpath\fR
+.br
 Overrides the location of the bootstrap class files\&.
-.RE
-.PP
-\-Xdoclint:[\-]\fIgroup\fR [\fI/access\fR]
-.RS 4
-Enables or disables specific groups of checks, where
-\fIgroup\fR
-is one of the following values:
-\fBaccessibility\fR,
-\fBsyntax\fR,
-\fBreference\fR,
-\fBhtml\fR
-or
-\fBmissing\fR\&. For more information about these groups of checks see the
-\fB\-Xdoclint\fR
-option of the
-\fBjavadoc\fR
-command\&. The
-\fB\-Xdoclint\fR
-option is disabled by default in the
-\fBjavac\fR
-command\&.
-.sp
-The variable
-\fIaccess\fR
-specifies the minimum visibility level of classes and members that the
-\fB\-Xdoclint\fR
-option checks\&. It can have one of the following values (in order of most to least visible) :
-\fBpublic\fR,
-\fBprotected\fR,
-\fBpackage\fR
-and
-\fBprivate\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all/protected\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-Xdoclint:[-]\fIgroup\fR [\fI/access\fR]
+.br
+Enables or disables specific groups of checks, where \fIgroup\fR is one of the following values: \f3accessibility\fR, \f3syntax\fR, \f3reference\fR, \f3html\fR or \f3missing\fR\&. For more information about these groups of checks see the \f3-Xdoclint\fR option of the \f3javadoc\fR command\&. The \f3-Xdoclint\fR option is disabled by default in the \f3javac\fR command\&.
+
+The variable \fIaccess\fR specifies the minimum visibility level of classes and members that the \f3-Xdoclint\fR option checks\&. It can have one of the following values (in order of most to least visible) : \f3public\fR, \f3protected\fR, \f3package\fR and \f3private\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
+.sp     
+.nf     
+\f3\-Xdoclint:all/protected\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following option enables all groups of checks for all access levels, except it will not check for HTML errors for classes and members that have access level package and higher (which includes package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all,\-html/package\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xdoclint:none
-.RS 4
+.sp     
+.nf     
+\f3\-Xdoclint:all,\-html/package\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xdoclint:none
+.br
 Disables all groups of checks\&.
-.RE
-.PP
-\-Xdoclint:all[\fI/access\fR]
-.RS 4
+.TP
+-Xdoclint:all[\fI/access\fR]
+.br
 Enables all groups of checks\&.
-.RE
-.PP
-\-Xlint
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:all
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:none
-.RS 4
+.TP
+-Xlint
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:all
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:none
+.br
 Disables all warnings\&.
-.RE
-.PP
-\-Xlint:\fIname\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option for a list of warnings you can disable with this option\&.
-.RE
-.PP
-\-Xlint:\fI\-name\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option with the
-\fB\-Xlint\fR
-option to get a list of warnings that you can disable with this option\&.
-.RE
-.PP
-\-Xmaxerrs \fInumber\fR
-.RS 4
+.TP
+-Xlint:\fIname\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option for a list of warnings you can disable with this option\&.
+.TP
+-Xlint:\fI-name\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option with the \f3-Xlint\fR option to get a list of warnings that you can disable with this option\&.
+.TP
+-Xmaxerrs \fInumber\fR
+.br
 Sets the maximum number of errors to print\&.
-.RE
-.PP
-\-Xmaxwarns \fInumber\fR
-.RS 4
+.TP
+-Xmaxwarns \fInumber\fR
+.br
 Sets the maximum number of warnings to print\&.
-.RE
-.PP
-\-Xstdout \fIfilename\fR
-.RS 4
-Sends compiler messages to the named file\&. By default, compiler messages go to
-\fBSystem\&.err\fR\&.
-.RE
-.PP
-\-Xprefer:[\fInewer,source\fR]
-.RS 4
-Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the
-\fB\-Xprefer:newer\fR
-option is used, then it reads the newer of the source or class file for a type (default)\&. If the
-\fB\-Xprefer:source\fR
-option is used, then it reads the source file\&. Use \-\fBXprefer:source\fR
-when you want to be sure that any annotation processors can access annotations declared with a retention policy of
-\fBSOURCE\fR\&.
-.RE
-.PP
-\-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
-.RS 4
-Control whether javac generates
-\fBpackage\-info\&.class\fR
-files from package\-info\&.java files\&. Possible mode arguments for this option include the following\&.
-.PP
+.TP
+-Xstdout \fIfilename\fR
+.br
+Sends compiler messages to the named file\&. By default, compiler messages go to \f3System\&.err\fR\&.
+.TP
+-Xprefer:[\fInewer,source\fR]
+.br
+Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the \f3-Xprefer:newer\fR option is used, then it reads the newer of the source or class file for a type (default)\&. If the \f3-Xprefer:source\fR option is used, then it reads the source file\&. Use -\f3Xprefer:source\fR when you want to be sure that any annotation processors can access annotations declared with a retention policy of \f3SOURCE\fR\&.
+.TP
+-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
+.br
+Control whether javac generates \f3package-info\&.class\fR files from package-info\&.java files\&. Possible mode arguments for this option include the following\&.
+.RS     
+.TP     
 always
-.RS 4
-Always generate a
-\fBpackage\-info\&.class\fR
-file for every
-\fBpackage\-info\&.java\fR
-file\&. This option may be useful if you use a build system such as Ant, which checks that each
-\fB\&.java\fR
-file has a corresponding
-\fB\&.class\fR
-file\&.
-.RE
-.PP
+Always generate a \f3package-info\&.class\fR file for every \f3package-info\&.java\fR file\&. This option may be useful if you use a build system such as Ant, which checks that each \f3\&.java\fR file has a corresponding \f3\&.class\fR file\&.
+.TP     
 legacy
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations\&. Don\*(Aqt generate a
-\fBpackage\-info\&.class\fR
-file if package\-info\&.java only contains comments\&.
-.sp
-\fBNote:\fR
-A
-\fBpackage\-info\&.class\fR
-file might be generated but be empty if all the annotations in the package\-info\&.java file have
-\fBRetentionPolicy\&.SOURCE\fR\&.
-.RE
-.PP
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations\&. Don\&'t generate a \f3package-info\&.class\fR file if package-info\&.java only contains comments\&.
+
+\fINote:\fR A \f3package-info\&.class\fR file might be generated but be empty if all the annotations in the package-info\&.java file have \f3RetentionPolicy\&.SOURCE\fR\&.
+.TP     
 nonempty
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations with
-\fBRetentionPolicy\&.CLASS\fR
-or
-\fBRetentionPolicy\&.RUNTIME\fR\&.
-.RE
-.RE
-.PP
-\-Xprint
-.RS 4
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations with \f3RetentionPolicy\&.CLASS\fR or \f3RetentionPolicy\&.RUNTIME\fR\&.
+.RE     
+
+.TP
+-Xprint
+.br
 Prints a textual representation of specified types for debugging purposes\&. Perform neither annotation processing nor compilation\&. The format of the output could change\&.
-.RE
-.PP
-\-XprintProcessorInfo
-.RS 4
+.TP
+-XprintProcessorInfo
+.br
 Prints information about which annotations a processor is asked to process\&.
-.RE
-.PP
-\-XprintRounds
-.RS 4
+.TP
+-XprintRounds
+.br
 Prints information about initial and subsequent annotation processing rounds\&.
-.RE
-.SH "ENABLE OR DISABLE WARNINGS WITH THE -XLINT OPTION"
-.PP
-Enable warning
-\fIname\fR
-with the
-\fB\-Xlint:name\fR
-option, where
-\fBname\fR
-is one of the following warning names\&. Note that you can disable a warning with the
-\fB\-Xlint:\-name:\fR
-option\&.
-.PP
+.SH ENABLE\ OR\ DISABLE\ WARNINGS\ WITH\ THE\ -XLINT\ OPTION    
+Enable warning \fIname\fR with the \f3-Xlint:name\fR option, where \f3name\fR is one of the following warning names\&. Note that you can disable a warning with the \f3-Xlint:-name:\fR option\&.
+.TP     
 cast
-.RS 4
 Warns about unnecessary and redundant casts, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBString s = (String) "Hello!"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3String s = (String) "Hello!"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 classfile
-.RS 4
 Warns about issues related to class file contents\&.
-.RE
-.PP
+.TP     
 deprecation
-.RS 4
 Warns about the use of deprecated items, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava\&.util\&.Date myDate = new java\&.util\&.Date();\fR
-\fBint currentDay = myDate\&.getDay();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The method
-\fBjava\&.util\&.Date\&.getDay\fR
-has been deprecated since JDK 1\&.1
-.RE
-.PP
-dep\-ann
-.RS 4
-Warns about items that are documented with an
-\fB@deprecated\fR
-Javadoc comment, but do not have a
-\fB@Deprecated\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB/**\fR
-\fB  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fR
-\fB  */\fR
-\fBpublic static void deprecatedMethood() { }\fR
-\fBpublic static void newMethod() { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3java\&.util\&.Date myDate = new java\&.util\&.Date();\fP
+.fi     
+.nf     
+\f3int currentDay = myDate\&.getDay();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The method \f3java\&.util\&.Date\&.getDay\fR has been deprecated since JDK 1\&.1
+.TP     
+dep-ann
+Warns about items that are documented with an \f3@deprecated\fR Javadoc comment, but do not have a \f3@Deprecated\fR annotation, for example:
+.sp     
+.nf     
+\f3/**\fP
+.fi     
+.nf     
+\f3  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fP
+.fi     
+.nf     
+\f3  */\fP
+.fi     
+.nf     
+\f3public static void deprecatedMethood() { }\fP
+.fi     
+.nf     
+\f3public static void newMethod() { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 divzero
-.RS 4
 Warns about division by the constant integer 0, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBint divideByZero = 42 / 0;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3int divideByZero = 42 / 0;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 empty
-.RS 4
-Warns about empty statements after
-\fBif \fRstatements, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass E {\fR
-\fB    void m() {\fR
-\fB         if (true) ;\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about empty statements after \f3if\fRstatements, for example:
+.sp     
+.nf     
+\f3class E {\fP
+.fi     
+.nf     
+\f3    void m() {\fP
+.fi     
+.nf     
+\f3         if (true) ;\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 fallthrough
-.RS 4
-Checks the switch blocks for fall\-through cases and provides a warning message for any that are found\&. Fall\-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBswitch (x) {\fR
-\fBcase 1:\fR
-\fB  System\&.out\&.println("1");\fR
-\fB  // No break statement here\&.\fR
-\fBcase 2:\fR
-\fB  System\&.out\&.println("2");\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the
-\fB\-Xlint:fallthrough\fR
-option was used when compiling this code, then the compiler emits a warning about possible fall\-through into case, with the line number of the case in question\&.
-.RE
-.PP
+Checks the switch blocks for fall-through cases and provides a warning message for any that are found\&. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
+.sp     
+.nf     
+\f3switch (x) {\fP
+.fi     
+.nf     
+\f3case 1:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("1");\fP
+.fi     
+.nf     
+\f3  // No break statement here\&.\fP
+.fi     
+.nf     
+\f3case 2:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("2");\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the \f3-Xlint:fallthrough\fR option was used when compiling this code, then the compiler emits a warning about possible fall-through into case, with the line number of the case in question\&.
+.TP     
 finally
-.RS 4
-Warns about
-\fBfinally\fR
-clauses that cannot complete normally, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int m() {\fR
-\fB  try {\fR
-\fB     throw new NullPointerException();\fR
-\fB  }  catch (NullPointerException(); {\fR
-\fB     System\&.err\&.println("Caught NullPointerException\&.");\fR
-\fB     return 1;\fR
-\fB   } finally {\fR
-\fB     return 0;\fR
-\fB   }\fR
-\fB  }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The compiler generates a warning for the
-\fBfinally\fR
-block in this example\&. When the
-\fBint\fR
-method is called, it returns a value of 0\&. A
-\fBfinally\fR
-block executes when the
-\fBtry\fR
-block exits\&. In this example, when control is transferred to the
-\fBcatch\fR
-block, the
-\fBint\fR
-method exits\&. However, the
-\fBfinally\fR
-block must execute, so it is executed, even though control was transferred outside the method\&.
-.RE
-.PP
+Warns about \f3finally\fR clauses that cannot complete normally, for example:
+.sp     
+.nf     
+\f3public static int m() {\fP
+.fi     
+.nf     
+\f3  try {\fP
+.fi     
+.nf     
+\f3     throw new NullPointerException();\fP
+.fi     
+.nf     
+\f3  }  catch (NullPointerException(); {\fP
+.fi     
+.nf     
+\f3     System\&.err\&.println("Caught NullPointerException\&.");\fP
+.fi     
+.nf     
+\f3     return 1;\fP
+.fi     
+.nf     
+\f3   } finally {\fP
+.fi     
+.nf     
+\f3     return 0;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The compiler generates a warning for the \f3finally\fR block in this example\&. When the \f3int\fR method is called, it returns a value of 0\&. A \f3finally\fR block executes when the \f3try\fR block exits\&. In this example, when control is transferred to the \f3catch\fR block, the \f3int\fR method exits\&. However, the \f3finally\fR block must execute, so it is executed, even though control was transferred outside the method\&.
+.TP     
 options
-.RS 4
-Warns about issues that related to the use of command\-line options\&. See Cross\-Compilation Options\&.
-.RE
-.PP
+Warns about issues that related to the use of command-line options\&. See Cross-Compilation Options\&.
+.TP     
 overrides
-.RS 4
 Warns about issues regarding method overrides\&. For example, consider the following two classes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ClassWithVarargsMethod {\fR
-\fB  void varargsMethod(String\&.\&.\&. s) { }\fR
-\fB}\fR
- 
-\fBpublic class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fR
-\fB   @Override\fR
-\fB   void varargsMethod(String[] s) { }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3public class ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3  void varargsMethod(String\&.\&.\&. s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3   @Override\fP
+.fi     
+.nf     
+\f3   void varargsMethod(String[] s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates a warning similar to the following:\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fR
-\fBoverrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fR
-\fBmethod is missing \*(Aq\&.\&.\&.\*(Aq\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a
-\fBvarargs\fR
-method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. In the method
-\fBClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBString\&.\&.\&. s\fR
-to the formal parameter
-\fBString[] s\fR, an array, which matches the formal parameter of the method
-\fBClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fP
+.fi     
+.nf     
+\f3overrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fP
+.fi     
+.nf     
+\f3method is missing \&'\&.\&.\&.\&'\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a \f3varargs\fR method, it translates the \f3varargs\fR formal parameter into an array\&. In the method \f3ClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the \f3varargs\fR formal parameter \f3String\&.\&.\&. s\fR to the formal parameter \f3String[] s\fR, an array, which matches the formal parameter of the method \f3ClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
+.TP     
 path
-.RS 4
-Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the
-\fB@SuppressWarnings\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the \f3@SuppressWarnings\fR annotation, for example:
+.sp     
+.nf     
+\f3javac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 processing
-.RS 4
 Warn about issues regarding annotation processing\&. The compiler generates this warning when you have a class that has an annotation, and you use an annotation processor that cannot handle that type of exception\&. For example, the following is a simple annotation processor:
-.sp
-\fBSource file AnnocProc\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBimport java\&.util\&.*;\fR
-\fBimport javax\&.annotation\&.processing\&.*;\fR
-\fBimport javax\&.lang\&.model\&.*;\fR
-\fBimport\&.javaz\&.lang\&.model\&.element\&.*;\fR
- 
-\fB@SupportedAnnotationTypes("NotAnno")\fR
-\fBpublic class AnnoProc extends AbstractProcessor {\fR
-\fB  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fR
-\fB     return true;\fR
-\fB  }\fR
- 
-\fB  public SourceVersion getSupportedSourceVersion() {\fR
-\fB     return SourceVersion\&.latest();\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBSource file AnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB@interface Anno { }\fR
-\fB \fR
-\fB@Anno\fR
-\fBclass AnnosWithoutProcessors { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following commands compile the annotation processor
-\fBAnnoProc\fR, then run this annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac AnnoProc\&.java\fR
-\fBjavac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler runs the annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR, it generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [processing] No processor claimed any of these annotations: Anno\fR
-\fB \fR
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can rename the annotation defined and used in the class
-\fBAnnosWithoutProcessors\fR
-from
-\fBAnno\fR
-to
-\fBNotAnno\fR\&.
-.RE
-.PP
+
+\fISource file AnnocProc\&.java\fR:
+.sp     
+.nf     
+\f3import java\&.util\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.annotation\&.processing\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.lang\&.model\&.*;\fP
+.fi     
+.nf     
+\f3import\&.javaz\&.lang\&.model\&.element\&.*;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@SupportedAnnotationTypes("NotAnno")\fP
+.fi     
+.nf     
+\f3public class AnnoProc extends AbstractProcessor {\fP
+.fi     
+.nf     
+\f3  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fP
+.fi     
+.nf     
+\f3     return true;\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3  public SourceVersion getSupportedSourceVersion() {\fP
+.fi     
+.nf     
+\f3     return SourceVersion\&.latest();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fISource file AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3@interface Anno { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@Anno\fP
+.fi     
+.nf     
+\f3class AnnosWithoutProcessors { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following commands compile the annotation processor \f3AnnoProc\fR, then run this annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3javac AnnoProc\&.java\fP
+.fi     
+.nf     
+\f3javac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler runs the annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR, it generates the following warning:
+.sp     
+.nf     
+\f3warning: [processing] No processor claimed any of these annotations: Anno\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can rename the annotation defined and used in the class \f3AnnosWithoutProcessors\fR from \f3Anno\fR to \f3NotAnno\fR\&.
+.TP     
 rawtypes
-.RS 4
-Warns about unchecked operations on raw types\&. The following statement generates a
-\fBrawtypes\fR
-warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example does not generate a
-\fBrawtypes\fR
-warning
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List<?> l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBList\fR
-is a raw type\&. However,
-\fBList<?>\fR
-is an unbounded wildcard parameterized type\&. Because
-\fBList\fR
-is a parameterized interface, always specify its type argument\&. In this example, the
-\fBList\fR
-formal argument is specified with an unbounded wildcard (\fB?\fR) as its formal type parameter, which means that the
-\fBcountElements\fR
-method can accept any instantiation of the
-\fBList\fR
-interface\&.
-.RE
-.PP
+Warns about unchecked operations on raw types\&. The following statement generates a \f3rawtypes\fR warning:
+.sp     
+.nf     
+\f3void countElements(List l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example does not generate a \f3rawtypes\fR warning
+.sp     
+.nf     
+\f3void countElements(List<?> l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\f3List\fR is a raw type\&. However, \f3List<?>\fR is an unbounded wildcard parameterized type\&. Because \f3List\fR is a parameterized interface, always specify its type argument\&. In this example, the \f3List\fR formal argument is specified with an unbounded wildcard (\f3?\fR) as its formal type parameter, which means that the \f3countElements\fR method can accept any instantiation of the \f3List\fR interface\&.
+.TP     
 Serial
-.RS 4
-Warns about missing
-\fBserialVersionUID\fR
-definitions on serializable classes, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class PersistentTime implements Serializable\fR
-\fB{\fR
-\fB  private Date time;\fR
-\fB \fR
-\fB   public PersistentTime() {\fR
-\fB     time = Calendar\&.getInstance()\&.getTime();\fR
-\fB   }\fR
-\fB \fR
-\fB   public Date getTime() {\fR
-\fB     return time;\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Warns about missing \f3serialVersionUID\fR definitions on serializable classes, for example:
+.sp     
+.nf     
+\f3public class PersistentTime implements Serializable\fP
+.fi     
+.nf     
+\f3{\fP
+.fi     
+.nf     
+\f3  private Date time;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public PersistentTime() {\fP
+.fi     
+.nf     
+\f3     time = Calendar\&.getInstance()\&.getTime();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public Date getTime() {\fP
+.fi     
+.nf     
+\f3     return time;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [serial] serializable class PersistentTime has no definition of\fR
-\fBserialVersionUID\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If a serializable class does not explicitly declare a field named
-\fBserialVersionUID\fR, then the serialization runtime environment calculates a default
-\fBserialVersionUID\fR
-value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare
-\fBserialVersionUID\fR
-values because the default process of computing
-\fBserialVersionUID\fR
-vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected
-\fBInvalidClassExceptions\fR
-during deserialization\&. To guarantee a consistent
-\fBserialVersionUID\fR
-value across different Java compiler implementations, a serializable class must declare an explicit
-\fBserialVersionUID\fR
-value\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [serial] serializable class PersistentTime has no definition of\fP
+.fi     
+.nf     
+\f3serialVersionUID\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If a serializable class does not explicitly declare a field named \f3serialVersionUID\fR, then the serialization runtime environment calculates a default \f3serialVersionUID\fR value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare \f3serialVersionUID\fR values because the default process of computing \f3serialVersionUID\fR vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected \f3InvalidClassExceptions\fR during deserialization\&. To guarantee a consistent \f3serialVersionUID\fR value across different Java compiler implementations, a serializable class must declare an explicit \f3serialVersionUID\fR value\&.
+.TP     
 static
-.RS 4
 Warns about issues relating to the use of statics, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass XLintStatic {\fR
-\fB    static void m1() { }\fR
-\fB    void m2() { this\&.m1(); }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3class XLintStatic {\fP
+.fi     
+.nf     
+\f3    static void m1() { }\fP
+.fi     
+.nf     
+\f3    void m2() { this\&.m1(); }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [static] static method should be qualified by type name, \fR
-\fBXLintStatic, instead of by an expression\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can call the
-\fBstatic\fR
-method
-\fBm1\fR
-as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBXLintStatic\&.m1();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Alternately, you can remove the
-\fBstatic\fR
-keyword from the declaration of the method
-\fBm1\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [static] static method should be qualified by type name, \fP
+.fi     
+.nf     
+\f3XLintStatic, instead of by an expression\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can call the \f3static\fR method \f3m1\fR as follows:
+.sp     
+.nf     
+\f3XLintStatic\&.m1();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Alternately, you can remove the \f3static\fR keyword from the declaration of the method \f3m1\fR\&.
+.TP     
 try
-.RS 4
-Warns about issues relating to use of
-\fBtry\fR
-blocks, including try\-with\-resources statements\&. For example, a warning is generated for the following statement because the resource
-\fBac\fR
-declared in the
-\fBtry\fR
-block is not used:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBtry ( AutoCloseable ac = getResource() ) {    // do nothing}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about issues relating to use of \f3try\fR blocks, including try-with-resources statements\&. For example, a warning is generated for the following statement because the resource \f3ac\fR declared in the \f3try\fR block is not used:
+.sp     
+.nf     
+\f3try ( AutoCloseable ac = getResource() ) {    // do nothing}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 unchecked
-.RS 4
 Gives more detail for unchecked conversion warnings that are mandated by the Java Language Specification, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBList l = new ArrayList<Number>();\fR
-\fBList<String> ls = l;       // unchecked warning\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-During type erasure, the types
-\fBArrayList<Number>\fR
-and
-\fBList<String>\fR
-become
-\fBArrayList\fR
-and
-\fBList\fR, respectively\&.
-.sp
-The
-\fBls\fR
-command has the parameterized type
-\fBList<String>\fR\&. When the
-\fBList\fR
-referenced by
-\fBl\fR
-is assigned to
-\fBls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether
-\fBl\fR
-refers to a
-\fBList<String>\fR
-type\&. In this case,
-\fBl\fR
-does not refer to a
-\fBList<String>\fR
-type\&. As a result, heap pollution occurs\&.
-.sp
-A heap pollution situation occurs when the
-\fBList\fR
-object
-\fBl\fR, whose static type is
-\fBList<Number>\fR, is assigned to another
-\fBList\fR
-object,
-\fBls\fR, that has a different static type,
-\fBList<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure,
-\fBList<Number>\fR
-and
-\fBList<String>\fR
-both become
-\fBList\fR\&. Consequently, the compiler allows the assignment of the object
-\fBl\fR\fB,\fR
-which has a raw type of
-\fBList\fR, to the object
-\fBls\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3List l = new ArrayList<Number>();\fP
+.fi     
+.nf     
+\f3List<String> ls = l;       // unchecked warning\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+During type erasure, the types \f3ArrayList<Number>\fR and \f3List<String>\fR become \f3ArrayList\fR and \f3List\fR, respectively\&.
+
+The \f3ls\fR command has the parameterized type \f3List<String>\fR\&. When the \f3List\fR referenced by \f3l\fR is assigned to \f3ls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether \f3l\fR refers to a \f3List<String>\fR type\&. In this case, \f3l\fR does not refer to a \f3List<String>\fR type\&. As a result, heap pollution occurs\&.
+
+A heap pollution situation occurs when the \f3List\fR object \f3l\fR, whose static type is \f3List<Number>\fR, is assigned to another \f3List\fR object, \f3ls\fR, that has a different static type, \f3List<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure, \f3List<Number>\fR and \f3List<String>\fR both become \f3List\fR\&. Consequently, the compiler allows the assignment of the object \f3l\fR\f3,\fR which has a raw type of \f3List\fR, to the object \f3ls\fR\&.
+.TP     
 varargs
-.RS 4
-Warns about unsafe usages of variable arguments (\fBvarargs\fR) methods, in particular, those that contain non\-reifiable arguments, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ArrayBuilder {\fR
-\fB  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fR
-\fB    for (T x : elements) {\fR
-\fB      listArg\&.add(x);\fR
-\fB    }\fR
-\fB  }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBNote:\fR
-A non\-reifiable type is a type whose type information is not fully available at runtime\&.
-.sp
-The compiler generates the following warning for the definition of the method
-\fBArrayBuilder\&.addToList\fR
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [varargs] Possible heap pollution from parameterized vararg type T\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a varargs method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method
-\fBArrayBuilder\&.addToList\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBT\&.\&.\&.\fR
-elements to the formal parameter
-\fBT[]\fR
-elements, an array\&. However, because of type erasure, the compiler converts the
-\fBvarargs\fR
-formal parameter to
-\fBObject[]\fR
-elements\&. Consequently, there is a possibility of heap pollution\&.
-.RE
-.SH "COMMAND-LINE ARGUMENT FILES"
+Warns about unsafe usages of variable arguments (\f3varargs\fR) methods, in particular, those that contain non-reifiable arguments, for example:
+.sp     
+.nf     
+\f3public class ArrayBuilder {\fP
+.fi     
+.nf     
+\f3  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fP
+.fi     
+.nf     
+\f3    for (T x : elements) {\fP
+.fi     
+.nf     
+\f3      listArg\&.add(x);\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fINote:\fR A non-reifiable type is a type whose type information is not fully available at runtime\&.
+
+The compiler generates the following warning for the definition of the method \f3ArrayBuilder\&.addToList\fR
+.sp     
+.nf     
+\f3warning: [varargs] Possible heap pollution from parameterized vararg type T\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a varargs method, it translates the \f3varargs\fR formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method \f3ArrayBuilder\&.addToList\fR, the compiler translates the \f3varargs\fR formal parameter \f3T\&.\&.\&.\fR elements to the formal parameter \f3T[]\fR elements, an array\&. However, because of type erasure, the compiler converts the \f3varargs\fR formal parameter to \f3Object[]\fR elements\&. Consequently, there is a possibility of heap pollution\&.
+.SH COMMAND-LINE\ ARGUMENT\ FILES    
+To shorten or simplify the \f3javac\fR command, you can specify one or more files that contain arguments to the \f3javac\fR command (except \f3-J\fR options)\&. This enables you to create \f3javac\fR commands of any length on any operating system\&.
 .PP
-To shorten or simplify the
-\fBjavac\fR
-command, you can specify one or more files that contain arguments to the
-\fBjavac\fR
-command (except
-\fB\-J\fR
-options)\&. This enables you to create
-\fBjavac\fR
-commands of any length on any operating system\&.
+An argument file can include \f3javac\fR options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
 .PP
-An argument file can include
-\fBjavac\fR
-options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
+File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying \f3*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The \f3-J\fR options are not supported because they are passed to the launcher, which does not support argument files\&.
 .PP
-File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying
-\fB*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The
-\fB\-J\fR
-options are not supported because they are passed to the launcher, which does not support argument files\&.
+When executing the \f3javac\fR command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the \f3javac\fR command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
 .PP
-When executing the
-\fBjavac\fR
-command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the
-\fBjavac\fR
-command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
+\f3Example 1 Single Argument File\fR
 .PP
-\fBExample 1\fR
-.br
-Single Argument File
-.RS 4
-You could use a single argument file named
-\fBargfile\fR
-to hold all
-\fBjavac\fR
-arguments:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @argfile\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+You could use a single argument file named \f3argfile\fR to hold all \f3javac\fR arguments:
+.sp     
+.nf     
+\f3javac @argfile\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 This argument file could contain the contents of both files shown in Example 2
-.RE
 .PP
-\fBExample 2\fR
-.br
-Two Argument Files
-.RS 4
-You can create two argument files: one for the
-\fBjavac\fR
-options and the other for the source file names\&. Note that the following lists have no line\-continuation characters\&.
-.sp
+\f3Example 2 Two Argument Files\fR
+.PP
+You can create two argument files: one for the \f3javac\fR options and the other for the source file names\&. Note that the following lists have no line-continuation characters\&.
+.PP
 Create a file named options that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-d classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-g\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-d classes\fP
+.fi     
+.nf     
+\f3\-g\fP
+.fi     
+.nf     
+\f3\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Create a file named classes that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBMyClass1\&.java\fR
-\fBMyClass2\&.java\fR
-\fBMyClass3\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Then, run the
-\fBjavac\fR
-command as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @options @classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3MyClass1\&.java\fP
+.fi     
+.nf     
+\f3MyClass2\&.java\fP
+.fi     
+.nf     
+\f3MyClass3\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Then, run the \f3javac\fR command as follows:
+.sp     
+.nf     
+\f3javac @options @classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Argument Files with Paths\fR
 .PP
-\fBExample 3\fR
-.br
-Argument Files with Paths
-.RS 4
-The argument files can have paths, but any file names inside the files are relative to the current working directory (not
-\fBpath1\fR
-or
-\fBpath2\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @path1/options @path2/classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "ANNOTATION PROCESSING"
+The argument files can have paths, but any file names inside the files are relative to the current working directory (not \f3path1\fR or \f3path2\fR):
+.sp     
+.nf     
+\f3javac @path1/options @path2/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH ANNOTATION\ PROCESSING    
+The \f3javac\fR command provides direct support for annotation processing, superseding the need for the separate annotation processing command, \f3apt\fR\&.
 .PP
-The
-\fBjavac\fR
-command provides direct support for annotation processing, superseding the need for the separate annotation processing command,
-\fBapt\fR\&.
-.PP
-The API for annotation processors is defined in the
-\fBjavax\&.annotation\&.processing\fR
-and j\fBavax\&.lang\&.model\fR
-packages and subpackages\&.
-.SS "How Annotation Processing Works"
-.PP
-Unless annotation processing is disabled with the
-\fB\-proc:none\fR
-option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the
-\fB\-processorpath\fR
-option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider\-configuration files named
-\fBMETA\-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the
-\fB\-processor\fR
-option\&.
+The API for annotation processors is defined in the \f3javax\&.annotation\&.processing\fR and j\f3avax\&.lang\&.model\fR packages and subpackages\&.
+.SS HOW\ ANNOTATION\ PROCESSING\ WORKS    
+Unless annotation processing is disabled with the \f3-proc:none\fR option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the \f3-processorpath\fR option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider-configuration files named \f3META-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the \f3-processor\fR option\&.
 .PP
 After scanning the source files and classes on the command line to determine what annotations are present, the compiler queries the processors to determine what annotations they process\&. When a match is found, the processor is called\&. A processor can claim the annotations it processes, in which case no further attempt is made to find any processors for those annotations\&. After all of the annotations are claimed, the compiler does not search for additional processors\&.
 .PP
 If any processors generate new source files, then another round of annotation processing occurs: Any newly generated source files are scanned, and the annotations processed as before\&. Any processors called on previous rounds are also called on all subsequent rounds\&. This continues until no new source files are generated\&.
 .PP
-After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the
-\fB\-proc:only\fR
-option is used, the compiler compiles the original and all generated source files\&.
-.SS "Implicitly Loaded Source Files"
-.PP
-To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The
-\fB\-implicit\fR
-option provides a way to suppress the warning\&.
-.SH "SEARCHING FOR TYPES"
-.PP
+After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the \f3-proc:only\fR option is used, the compiler compiles the original and all generated source files\&.
+.SS IMPLICITLY\ LOADED\ SOURCE\ FILES    
+To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The \f3-implicit\fR option provides a way to suppress the warning\&.
+.SH SEARCHING\ FOR\ TYPES    
 To compile a source file, the compiler often needs information about a type, but the type definition is not in the source files specified on the command line\&. The compiler needs type information for every class or interface used, extended, or implemented in the source file\&. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance\&.
 .PP
-For example, when you create a subclass
-\fBjava\&.applet\&.Applet\fR, you are also using the ancestor classes of
-\fBApplet\fR:
-\fBjava\&.awt\&.Panel\fR,
-\fBjava\&.awt\&.Container\fR,
-\fBjava\&.awt\&.Component\fR, and
-\fBjava\&.lang\&.Object\fR\&.
+For example, when you create a subclass \f3java\&.applet\&.Applet\fR, you are also using the ancestor classes of \f3Applet\fR: \f3java\&.awt\&.Panel\fR, \f3java\&.awt\&.Container\fR, \f3java\&.awt\&.Component\fR, and \f3java\&.lang\&.Object\fR\&.
 .PP
-When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the
-\fBCLASSPATH\fR
-environment variable or by using the
-\fB\-classpath\fR
-option\&.
+When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the \f3CLASSPATH\fR environment variable or by using the \f3-classpath\fR option\&.
 .PP
-If you set the
-\fB\-sourcepath\fR
-option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
+If you set the \f3-sourcepath\fR option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
 .PP
-You can specify different bootstrap or extension classes with the
-\fB\-bootclasspath\fR
-and the
-\fB\-extdirs\fR
-options\&. See Cross\-Compilation Options\&.
+You can specify different bootstrap or extension classes with the \f3-bootclasspath\fR and the \f3-extdirs\fR options\&. See Cross-Compilation Options\&.
 .PP
-A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the
-\fB\-Xprefer\fR
-option to instruct the compiler which to use\&. If
-\fBnewer\fR
-is specified, then the compiler uses the newer of the two files\&. If
-\fBsource\fR
-is specified, the compiler uses the source file\&. The default is
-\fBnewer\fR\&.
+A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the \f3-Xprefer\fR option to instruct the compiler which to use\&. If \f3newer\fR is specified, then the compiler uses the newer of the two files\&. If \f3source\fR is specified, the compiler uses the source file\&. The default is \f3newer\fR\&.
 .PP
-If a type search finds a source file for a required type, either by itself, or as a result of the setting for the
-\fB\-Xprefer\fR
-option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the
-\fB\-implicit\fR
-option to specify the behavior\&. If
-\fBnone\fR
-is specified, then no class files are generated for the source file\&. If
-\fBclass\fR
-is specified, then class files are generated for the source file\&.
+If a type search finds a source file for a required type, either by itself, or as a result of the setting for the \f3-Xprefer\fR option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the \f3-implicit\fR option to specify the behavior\&. If \f3none\fR is specified, then no class files are generated for the source file\&. If \f3class\fR is specified, then class files are generated for the source file\&.
 .PP
-The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no
-\fB\-implicit\fR
-option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the
-\fB\-implicit\fR
-option to specify whether or not class files should be generated for such source files\&.
-.SH "PROGRAMMATIC INTERFACE"
+The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no \f3-implicit\fR option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the \f3-implicit\fR option to specify whether or not class files should be generated for such source files\&.
+.SH PROGRAMMATIC\ INTERFACE    
+The \f3javac\fR command supports the new Java Compiler API defined by the classes and interfaces in the \f3javax\&.tools\fR package\&.
+.SS EXAMPLE    
+To compile as though providing command-line arguments, use the following syntax:
+.sp     
+.nf     
+\f3JavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The example writes diagnostics to the standard output stream and returns the exit code that \f3javac\fR would give when called from the command line\&.
 .PP
-The
-\fBjavac\fR
-command supports the new Java Compiler API defined by the classes and interfaces in the
-\fBjavax\&.tools\fR
-package\&.
-.SS "Example"
+You can use other methods in the \f3javax\&.tools\&.JavaCompiler\fR interface to handle diagnostics, control where files are read from and written to, and more\&.
+.SS OLD\ INTERFACE    
+\fINote:\fR This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
 .PP
-To compile as though providing command\-line arguments, use the following syntax:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBJavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The \f3com\&.sun\&.tools\&.javac\&.Main\fR class provides two static methods to call the compiler from a program:
+.sp     
+.nf     
+\f3public static int compile(String[] args);\fP
+.fi     
+.nf     
+\f3public static int compile(String[] args, PrintWriter out);\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3args\fR parameter represents any of the command-line arguments that would typically be passed to the compiler\&.
 .PP
-The example writes diagnostics to the standard output stream and returns the exit code that
-\fBjavac\fR
-would give when called from the command line\&.
+The \f3out\fR parameter indicates where the compiler diagnostic output is directed\&.
 .PP
-You can use other methods in the
-\fBjavax\&.tools\&.JavaCompiler\fR
-interface to handle diagnostics, control where files are read from and written to, and more\&.
-.SS "Old Interface"
+The \f3return\fR value is equivalent to the \f3exit\fR value from \f3javac\fR\&.
 .PP
-\fBNote:\fR
-This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
+\fINote:\fR All other classes and methods found in a package with names that start with \f3com\&.sun\&.tools\&.javac\fR (subpackages of \f3com\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
+.SH EXAMPLES    
+\f3Example 1 Compile a Simple Program\fR
 .PP
-The
-\fBcom\&.sun\&.tools\&.javac\&.Main\fR
-class provides two static methods to call the compiler from a program:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int compile(String[] args);\fR
-\fBpublic static int compile(String[] args, PrintWriter out);\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This example shows how to compile the \f3Hello\&.java\fR source file in the greetings directory\&. The class defined in \f3Hello\&.java\fR is called \f3greetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the \f3-d\fR option\&.
 .PP
-The
-\fBargs\fR
-parameter represents any of the command\-line arguments that would typically be passed to the compiler\&.
-.PP
-The
-\fBout\fR
-parameter indicates where the compiler diagnostic output is directed\&.
-.PP
-The
-\fBreturn\fR
-value is equivalent to the
-\fBexit\fR
-value from
-\fBjavac\fR\&.
-.PP
-\fBNote:\fR
-All other classes and methods found in a package with names that start with
-\fBcom\&.sun\&.tools\&.javac\fR
-(subpackages of
-\fBcom\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
-.SH "EXAMPLES"
-.PP
-\fBExample 1\fR
-.br
-Compile a Simple Program
-.RS 4
-This example shows how to compile the
-\fBHello\&.java\fR
-source file in the greetings directory\&. The class defined in
-\fBHello\&.java\fR
-is called
-\fBgreetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.sp
-The source code in
-\fBHello\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpackage greetings;\fR
-\fB \fR
-\fBpublic class Hello {\fR
-\fB    public static void main(String[] args) {\fR
-\fB        for (int i=0; i < args\&.length; i++) {\fR
-\fB            System\&.out\&.println("Hello " + args[i]);\fR
-\fB        }\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The source code in \f3Hello\&.java\fR:
+.sp     
+.nf     
+\f3package greetings;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class Hello {\fP
+.fi     
+.nf     
+\f3    public static void main(String[] args) {\fP
+.fi     
+.nf     
+\f3        for (int i=0; i < args\&.length; i++) {\fP
+.fi     
+.nf     
+\f3            System\&.out\&.println("Hello " + args[i]);\fP
+.fi     
+.nf     
+\f3        }\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Compile greetings\&.Hello:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac greetings/Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Run
-\fBgreetings\&.Hello\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava greetings\&.Hello World Universe Everyone\fR
-\fBHello World\fR
-\fBHello Universe\fR
-\fBHello Everyone\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3javac greetings/Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Run \f3greetings\&.Hello\fR:
+.sp     
+.nf     
+\f3java greetings\&.Hello World Universe Everyone\fP
+.fi     
+.nf     
+\f3Hello World\fP
+.fi     
+.nf     
+\f3Hello Universe\fP
+.fi     
+.nf     
+\f3Hello Everyone\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Compile Multiple Source Files\fR
 .PP
-\fBExample 2\fR
-.br
-Compile Multiple Source Files
-.RS 4
-This example compiles the
-\fBAloha\&.java\fR,
-\fBGutenTag\&.java\fR,
-\fBHello\&.java\fR, and
-\fBHi\&.java\fR
-source files in the
-\fBgreetings\fR
-package\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB% javac greetings/*\&.java\fR
-\fB% ls greetings\fR
-\fBAloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fR
-\fBAloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+This example compiles the \f3Aloha\&.java\fR, \f3GutenTag\&.java\fR, \f3Hello\&.java\fR, and \f3Hi\&.java\fR source files in the \f3greetings\fR package\&.
+.sp     
+.nf     
+\f3% javac greetings/*\&.java\fP
+.fi     
+.nf     
+\f3% ls greetings\fP
+.fi     
+.nf     
+\f3Aloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fP
+.fi     
+.nf     
+\f3Aloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Specify a User Class Path\fR
 .PP
-\fBExample 3\fR
-.br
-Specify a User Class Path
-.RS 4
 After changing one of the source files in the previous example, recompile it:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpwd\fR
-\fB/examples\fR
-\fBjavac greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Because
-\fBgreetings\&.Hi\fR
-refers to other classes in the
-\fBgreetings\fR
-package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting
-\fBCLASSPATH\fR\&. This example uses the
-\fB\-classpath\fR
-option\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you change
-\fBgreetings\&.Hi\fR
-to use a banner utility, then that utility also needs to be accessible through the user class path\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples:/lib/Banners\&.jar \e\fR
-\fB            /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To execute a class in the
-\fBgreetings\fR
-package, the program needs access to the
-\fBgreetings\fR
-package, and to the classes that the
-\fBgreetings\fR
-classes use\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3pwd\fP
+.fi     
+.nf     
+\f3/examples\fP
+.fi     
+.nf     
+\f3javac greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Because \f3greetings\&.Hi\fR refers to other classes in the \f3greetings\fR package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting \f3CLASSPATH\fR\&. This example uses the \f3-classpath\fR option\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If you change \f3greetings\&.Hi\fR to use a banner utility, then that utility also needs to be accessible through the user class path\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples:/lib/Banners\&.jar \e\fP
+.fi     
+.nf     
+\f3            /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+To execute a class in the \f3greetings\fR package, the program needs access to the \f3greetings\fR package, and to the classes that the \f3greetings\fR classes use\&.
+.sp     
+.nf     
+\f3java \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 4 Separate Source Files and Class Files\fR
 .PP
-\fBExample 4\fR
-.br
-Separate Source Files and Class Files
-.RS 4
-The following example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fR
-\fB\-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile
-\fBOldCode\&.java\fR\&. The option
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option; in this example, you can omit the
-\fB\-target\fR
-option\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \fR
-\fB\-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The following example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fP
+.fi     
+.nf     
+\f3\-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile \f3OldCode\&.java\fR\&. The option \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the \f3-target\fR option is the value of the \f3-source\fR option; in this example, you can omit the \f3-target\fR option\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \fP
+.fi     
+.nf     
+\f3\-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules (in this example, it uses version 1\&.7 of the Java programming language) combined with the new bootstrap classes, which can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&.
-.RE
 .PP
-\fBExample 5\fR
-.br
-Cross Compile
-.RS 4
-This example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fR
-\fB            \-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The\fB \-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. In most cases, the value of the
-\fB\-target\fR
-is the value of
-\fB\-source\fR\&. In this example, the
-\fB\-target\fR
-option is omitted\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+\f3Example 5 Cross Compile\fR
+.PP
+This example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fP
+.fi     
+.nf     
+\f3            \-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The\f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules combined with the new bootstrap classes\&. This combination can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&. In this example, the compiler uses release 1\&.7 of the Java programming language\&.
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 java(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javadoc(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/linux/doc/man/javadoc.1 b/src/linux/doc/man/javadoc.1
index b48535a..f4b342b 100644
--- a/src/linux/doc/man/javadoc.1
+++ b/src/linux/doc/man/javadoc.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: javadoc.1
 .\"
 .if n .pl 99999
-.TH javadoc 1 "10 May 2011" "JDK 8" "Basic Tools"
+.TH javadoc 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -209,7 +209,7 @@
 \f3package java\&.lang\&.applet;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -251,7 +251,7 @@
 \f3initialize, start, and stop the applet\&. \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3@since 1\&.0 \fP
@@ -266,7 +266,7 @@
 \f3</HTML>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3package\&.html\fR file is a typical HTML file and does not include a package declaration\&. The content of the package comment file is written in HTML with one exception\&. The documentation comment should not include the comment separators \f3/**\fR and \f3*/\fR or leading asterisks\&. When writing the comment, make the first sentence a summary about the package, and do not put a title or any other text between the \f3<body>\fR tag and the first sentence\&. You can include package tags\&. All block tags must appear after the main description\&. If you add an \f3@see\fR tag in a package comment file, then it must have a fully qualified name\&.
@@ -334,7 +334,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS TEST\ AND\ TEMPLATE\ FILES    
@@ -350,7 +350,7 @@
 \f3com/package1/test\-files/\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 If your test files contain documentation comments, then you can set up a separate run of the \f3javadoc\fR command to produce test file documentation by passing in their test source file names with wild cards, such as \f3com/package1/test-files/*\&.java\fR\&.
@@ -560,7 +560,7 @@
 \f3implements Serializable\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The declaration for the \f3Boolean\&.valueOf\fR method is:
@@ -569,7 +569,7 @@
 \f3public static Boolean valueOf(String s)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command can include the modifiers \f3public\fR, \f3protected\fR, \f3private\fR, \f3abstract\fR, \f3final\fR, \f3static\fR, \f3transient\fR, and \f3volatile\fR, but not \f3synchronized\fR or \f3native\fR\&. The \f3synchronized\fR and \f3native\fR modifiers are considered implementation detail and not part of the API specification\&.
@@ -593,7 +593,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To save space you can put a comment on one line:
@@ -602,7 +602,7 @@
 \f3/** This comment takes up only one line\&. */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -623,19 +623,19 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3import com\&.example;   // MISTAKE \- Important not to put import statement here\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class Whatever{ }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -657,7 +657,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -676,7 +676,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -700,7 +700,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -730,7 +730,7 @@
 \f3public int x, y;      // Avoid this \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command generates the following documentation from the previous code:
@@ -739,7 +739,7 @@
 \f3public int x\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -748,7 +748,7 @@
 \f3public int y\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -872,7 +872,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -899,11 +899,10 @@
 .TP 0.2i    
 \(bu
 In the text arguments of the \f3@return\fR, \f3@param,\fR and \f3@throws\fR tags of a method\&. In this case, the tag text is copied from the corresponding tag up the hierarchy\&.
-.RE
-.RS
-See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
+.RE     
 
-.RE
+
+See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
 .TP     
 {@link \fIpackage\&.class#member label\fR}
 Introduced in JDK 1\&.2
@@ -920,7 +919,7 @@
 \f3Use the {@link #getComponentAt(int, int) getComponentAt} method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -931,7 +930,7 @@
 \f3Use the <a href="Component\&.html#getComponentAt(int, int)">getComponentAt</a> method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -942,7 +941,7 @@
 \f3Use the getComponentAt method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -982,7 +981,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1014,7 +1013,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1071,7 +1070,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1091,7 +1090,7 @@
 \f3</dl>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1128,7 +1127,7 @@
 \f3@see #constructor(Type argname, Type argname,\&.\&.\&.) \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing another class in the current or imported packages\fR\fP
@@ -1155,7 +1154,7 @@
 \f3@see Class \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing an element in another package (fully qualified)\fR\fP
@@ -1185,7 +1184,7 @@
 \f3@see package\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3\fRNotes about the previous listing:
@@ -1215,7 +1214,7 @@
 Any enclosing classes and interfaces searching the closest first\&.
 .TP 0.4i    
 3\&.
-Any superclasses and superonterfaces, searching the closest first\&.
+Any superclasses and superinterfaces, searching the closest first\&.
 .TP 0.4i    
 4\&.
 The current package\&.
@@ -1307,7 +1306,7 @@
 \f3@see "The Java Programming Language"    //  "The Java Programming Language" \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \fINote:\fR You can extend the \f3@se\fR\f3e\fR tag to link to classes not being documented with the \f3-link\fR option\&.
@@ -1317,7 +1316,7 @@
 
 Used in the documentation comment for a default serializable field\&. See Documenting Serializable Fields and Data for a Class at http://docs\&.oracle\&.com/javase/8/docs/platform/serialization/spec/serial-arch\&.html#5251
 
-See also Oracle\(cqs Criteria for Including Classes in the Serialilzed Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
+See also Oracle\(cqs Criteria for Including Classes in the Serialized Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
 
 An optional \f3field-description\fR should explain the meaning of the field and list the acceptable values\&. When needed, the description can span multiple lines\&. The standard doclet adds this information to the serialized form page\&. See Cross-Reference Pages\&.
 
@@ -1331,13 +1330,12 @@
 .TP 0.2i    
 \(bu
 A private or package-private class that implements \f3Serializable\fR is excluded unless that class (or its package) is marked with the \f3@serial include\fR tag\&.
-.RE
-.RS
+.RE     
+
+
 For example, the \f3javax\&.swing\fR package is marked with the \f3@serial\fR\f3exclude\fR tag in package\&.html or package-info\&.java\&. The public class \f3java\&.security\&.BasicPermission\fR is marked with the \f3@serial exclude\fR tag\&. The package-private class \f3java\&.util\&.PropertyPermissionCollection\fR is marked with the \f3@serial include\fR tag\&.
 
 The \f3@serial\fR tag at the class level overrides the \f3@serial\fR tag at the package level\&.
-
-.RE
 .TP     
 @serialData \fIdata-description\fR
 Introduced in JDK 1\&.2
@@ -1387,7 +1385,7 @@
 \f3public static final String SCRIPT_START = "<script>"\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1407,7 +1405,7 @@
 \f3public String evalScript(String script) {}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1494,7 +1492,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS FIELD\ TAGS    
@@ -1523,7 +1521,7 @@
 \f3    int x = 1263732;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS CONSTRUCTOR\ AND\ METHOD\ TAGS    
@@ -1578,7 +1576,7 @@
 \f3    }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH OPTIONS    
@@ -1592,7 +1590,7 @@
 .PP
 The options are:
 .PP
--1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
+-1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -javafx ||-keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
 .PP
 The following options are the core Javadoc options that are available to all doclets\&. The standard doclet provides the rest of the doclets: \f3-bootclasspath\fR, \f3-breakiterator\fR, \f3-classpath\fR, \f3-doclet\fR, \f3-docletpath\fR, \f3-encoding\fR, -\f3exclude\fR, \f3-extdirs\fR, \f3-help\fR, \f3-locale\fR, \f3-\fR\f3overview\fR, \f3-package\fR, \f3-private\fR, \f3-protected\fR, \f3-public\fR, \f3-quiet\fR, \f3-source\fR, \f3-sourcepath\fR, \f3-subpackages\fR, and \f3-verbose\fR\&.
 .SS JAVADOC\ OPTIONS    
@@ -1635,12 +1633,11 @@
 .TP 0.2i    
 \(bu
 \f3-Xdoclint all,\fR\fI-group\fR : enable all except \fIgroup\fR checks
-.RE
-.RS
+.RE     
+
+
 The variable \fIgroup\fR has one of the following values:
 .RS     
-
-.RE
 .TP 0.2i    
 \(bu
 \f3accessibility\fR : Checks for the issues to be detected by an accessibility checker (for example, no caption or summary attributes specified in a \f3<table>\fR tag)\&.
@@ -1656,8 +1653,9 @@
 .TP 0.2i    
 \(bu
 \f3syntax\fR : Checks for low level issues like unescaped angle brackets (\f3<\fR and \f3>\fR) and ampersands (\f3&\fR) and invalid Javadoc tags\&.
-.RE
-.RS
+.RE     
+
+
 You can specify the \f3-Xdoclint\fR option multiple times to enable the option to check errors and warnings in multiple categories\&. Alternatively, you can specify multiple error and warning categories by using the preceding options\&. For example, use either of the following commands to check for the HTML, syntax, and accessibility issues in the file \fIfilename\fR\&.
 .sp     
 .nf     
@@ -1667,7 +1665,7 @@
 \f3javadoc \-Xdoclint:html,syntax,accessibility \fIfilename\fR\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1675,8 +1673,6 @@
 \fINote:\fR The \f3javadoc\fR command does not guarantee the completeness of these checks\&. In particular, it is not a full HTML compliance checker\&. The goal of the -\f3Xdoclint\fR option is to enable the \f3javadoc\fR command to report majority of common errors\&.
 
 The \f3javadoc\fR command does not attempt to fix invalid input, it just reports it\&.
-
-.RE
 .TP
 -public
 .br
@@ -1740,7 +1736,7 @@
 \f3javadoc \-sourcepath /home/user/src/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1755,7 +1751,7 @@
 \f3javadoc \-sourcepath /home/user1/src:/home/user2/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1766,13 +1762,13 @@
 
 If you omit \f3-sourcepath\fR, then the \f3javadoc\fR command uses \f3-classpath\fR to find the source files and class files (for backward compatibility)\&. If you want to search for source and class files in separate paths, then use both \f3-sourcepath\fR and \f3-classpath\fR\&.
 
-For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/libthen you would use the following command:
+For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/lib, then you would use the following command:
 .sp     
 .nf     
 \f3javadoc \-sourcepath /home/user/lib \-classpath /home/user/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1795,7 +1791,7 @@
 \f3javadoc \-d docs \-sourcepath /home/user/src  \-subpackages java:javax\&.swing \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1813,7 +1809,7 @@
 \f3    java\&.net:java\&.lang\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1846,11 +1842,10 @@
 .TP 0.2i    
 \(bu
 Breakiterator sentence-break algorithm\&. Stops at a period, question mark, or exclamation point followed by a space when the next word starts with a capital letter\&. This is meant to handle most abbreviations (such as "The serial no\&. is valid", but will not handle "Mr\&. Smith")\&. The \f3-breakiterator\fR option does not stop at HTML tags or sentences that begin with numbers or symbols\&. The algorithm stops at the last period in \&.\&./filename, even when embedded in an HTML tag\&.
-.RE
-.RS
-In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
+.RE     
 
-.RE
+
+In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
 .TP
 -locale \fIlanguage_country_variant\fR
 .br
@@ -1885,7 +1880,21 @@
 \f3Java HotSpot(TM) 64\-Bit Server VM (build 23\&.5\-b02, mixed mode)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-javafx
+.br
+Generates HTML documentation using the JavaFX extensions to the standard doclet\&. The generated documentation includes a Property Summary section in addition to the other summary sections generated by the standard Java doclet\&. The listed properties are linked to the sections for the getter and setter methods of each property\&.
+
+If there are no documentation comments written explicitly for getter and setter methods, the documentation comments from the property method are automatically copied to the generated documentation for these methods\&. This option also adds a new \f3@defaultValue\fR tag that allows documenting the default value for a property\&.
+
+Example:
+.sp     
+.nf     
+\f3javadoc \-javafx MyClass\&.java \-d testdir\fP
 .fi     
 .sp     
 
@@ -1957,7 +1966,7 @@
 \f3\-link <directory>/<directory>/\&.\&.\&./<name>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1982,7 +1991,7 @@
 \f3javadoc \-link http://docs\&.oracle\&.com/javase/8/docs/api/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The command generates documentation for the package \f3com\&.mypackage\fR with links to the Java SE packages\&. The generated documentation contains links to the \f3Object\fR class, for example, in the class \f3trees\fR\&. Other options, such as the \f3-sourcepath\fR and \f3-d\fR options, are not shown\&.
@@ -2044,7 +2053,7 @@
 \f3and so on \&.\&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When \f3javadoc\fR is run without the \f3-link\fR option and encounters a name that belongs to an externally referenced class, it prints the name with no link\&. However, when the \f3-link\fR option is used, the \f3javadoc\fR command searches the package-list file at the specified \fIextdocURL\fR location for that package name\&. When it finds the package name, it prefixes the name with \fIextdocURL\fR\&.
@@ -2094,7 +2103,7 @@
 \f3javadoc \-linkoffline http://docs\&.oracle\&.com/javase/8/docs/api/ \&.  com\&.mypackage \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2118,7 +2127,7 @@
 \f3packagelistLoc2 \&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2133,7 +2142,7 @@
 \f3javadoc \-d update \-linkoffline \&. html com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When the \f3javadoc\fR command completes, copy these generated class pages in update/com/package (not the overview or index) to the original files in html/com/package\&.
@@ -2150,7 +2159,7 @@
 \f3public class Button extends Component implements Accessible\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2161,7 +2170,7 @@
 \f3public String getLabel()\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2176,8 +2185,9 @@
 .TP 0.2i    
 \(bu
 The \f3packagepattern\fR value can be any package name at the start of any package name followed by an asterisk (*)\&. The asterisk is the only wildcard allowed and means match any characters\&. Multiple patterns can be included in a group by separating them with colons (:)\&. If you use an asterisk in a pattern or pattern list, then the pattern list must be inside quotation marks, such as \f3"java\&.lang*:java\&.util"\fR\&.
-.RE
-.RS
+.RE     
+
+
 When you do not supply a \f3-group\fR option, all packages are placed in one group with the heading \fIPackages\fR and appropriate subheadings\&. If the subheadings do not include all documented packages (all groups), then the remaining packages appear in a separate group with the subheading Other Packages\&.
 
 For example, the following \f3javadoc\fR command separates the three documented packages into \fICore\fR, \fIExtension\fR, and \fIOther Packages\fR\&. The trailing dot (\&.) does not appear in \f3java\&.lang*\fR\&. Including the dot, such as \f3java\&.lang\&.*\fR omits the\f3java\&.lang\fR package\&.
@@ -2192,7 +2202,7 @@
 \f3        java\&.lang java\&.lang\&.reflect java\&.util javax\&.servlet java\&.new\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2212,8 +2222,6 @@
 \fIOther Packages\fR
 
 \f3java\&.new\fR
-
-.RE
 .TP
 -nodeprecated
 .br
@@ -2251,7 +2259,7 @@
 \f3javadoc \-helpfile /home/user/myhelp\&.html java\&.awt\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2264,7 +2272,7 @@
 \f3javadoc \-stylesheet file /home/user/mystylesheet\&.css com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2283,7 +2291,7 @@
 \f3<META http\-equiv="Content\-Type" content="text/html; charset=ISO\-8859\-1">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2296,7 +2304,7 @@
 .br
 Specifies the encoding of the generated HTML files\&. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets at http://www\&.iana\&.org/assignments/character-sets
 
-If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding"iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
+If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding "iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
 .TP
 -keywords
 .br
@@ -2315,7 +2323,7 @@
 \f3<META NAME="keywords" CONTENT="charAt()">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2360,7 +2368,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2390,7 +2398,7 @@
 \f3\-tag example:X\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2433,7 +2441,7 @@
 \f3\-tag see\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2523,7 +2531,7 @@
 \f3\-sourcepath /java/pubs/ws/1\&.7\&.0/src/share/classes\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Create a file named packages that contains:
@@ -2538,7 +2546,7 @@
 \f3com\&.mypackage3\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:
@@ -2547,7 +2555,7 @@
 \f3javadoc @options @packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Argument Files with Paths\fR
@@ -2558,7 +2566,7 @@
 \f3javadoc @path1/options @path2/packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Option Arguments\fR
@@ -2581,7 +2589,7 @@
 \f3    Other names may be trademarks of their respective owners\&.</font>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:\f3javadoc -bottom @bottom @packages\fR\&.
@@ -2616,7 +2624,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src \-subpackages java \-exclude\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to Root and Run Explicit Packages\fR
@@ -2630,7 +2638,7 @@
 \f3javadoc \-d /home/html java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To also traverse down other package trees, append their names to the \f3-subpackages\fR argument, such as j\f3ava:javax:org\&.xml\&.sax\fR\&.
@@ -2643,7 +2651,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Run from Any Directory on Explicit Packages in Multiple Trees\fR
@@ -2654,7 +2662,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src1:/home/src2 java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The result is that all cases generate HTML-formatted documentation for the \f3public\fR and \f3protected\fR classes and interfaces in packages j\f3ava\&.awt\fR and \f3java\&.awt\&.even\fRt and save the HTML files in the specified destination directory\&. Because two or more packages are being generated, the document has three HTML frames: one for the list of packages, another for the list of classes, and the third for the main class pages\&.
@@ -2676,7 +2684,7 @@
 \f3javadoc \-d /home/html Button\&.java Canvas\&.java Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to the Root Directory of the Package\fR
@@ -2690,7 +2698,7 @@
 \f3javadoc \-d /home/html java/awt/Button\&.java java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Document Files from Any Directory\fR
@@ -2704,7 +2712,7 @@
 \f3/home/src/java/awt/Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2720,7 +2728,7 @@
 \f3/home/src/java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS REAL-WORLD\ EXAMPLES    
@@ -2784,7 +2792,7 @@
 \f3@packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2802,7 +2810,7 @@
 \f3import javax\&.tools\&.ToolProvider;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class JavaAccessSample{\fP
@@ -2838,7 +2846,7 @@
 \f3 }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The first three arguments of the \f3run\fR method specify input, standard output, and standard error streams\&. \f3Null\fR is the default value for \f3System\&.in\fR, \f3System\&.out\fR, and \f3System\&.err\fR, respectively\&.
@@ -2891,7 +2899,7 @@
 \f3        java\&.applet\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3WINDOWTITLE = \&'Java\(tm SE 7 API Specification\&'\fP
@@ -2927,7 +2935,7 @@
 \f3SRCDIR = \&'/java/jdk/1\&.7\&.0/src/share/classes\&'\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS NOTES    
diff --git a/src/linux/doc/man/jjs.1 b/src/linux/doc/man/jjs.1
index 47b5602..f223cf8 100644
--- a/src/linux/doc/man/jjs.1
+++ b/src/linux/doc/man/jjs.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: jjs.1
 .\"
 .if n .pl 99999
-.TH jjs 1 "21 November 2013" "JDK 8" "Basic Tools"
+.TH jjs 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -82,7 +82,7 @@
 \f3\-css=1k\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -91,7 +91,7 @@
 .br
 Compiles the script without running it\&.
 .TP
--cp \fIpath\fR , --classpath \fIpath\fR
+-cp \fIpath\fR , -classpath \fIpath\fR
 .br
 Specifies the path to the supporting class files To set multiple paths, the option can be repeated, or you can separate each path with a colon (:)\&.
 .TP
@@ -112,7 +112,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -133,7 +133,7 @@
 .TP
 -doe, --dump-on-error
 .br
-Provides a full stack trace when an arror occurs\&. By default, only a brief error message is printed\&.
+Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&.
 .TP
 --early-lvalue-error
 .br
@@ -180,13 +180,17 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
 
 This option can be repeated to pass multiple \f3java\fR command options\&.
 .TP
+--language=[es5]
+.br
+Specifies the ECMAScript language version\&. The default version is ES5\&.
+.TP
 --lazy-compilation
 .br
 Enables lazy code generation strategies (that is, the entire script is not compiled at once)\&. This option is experimental\&.
@@ -202,12 +206,13 @@
 .nf     
 \f3\-\-log=fields:finest,codegen:info\fP
 .fi     
-.nf     
-\f3\fR
-.fi     
 .sp     
 
 .TP
+--optimistic-types=[true|false]
+.br
+Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&.
+.TP
 --package=\fIname\fR
 .br
 Specifies the package to which generated class files are added\&.
@@ -302,7 +307,7 @@
 \f3jjs script\&.js\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Running Nashorn in Interactive Mode\fR
@@ -323,7 +328,7 @@
 \f3>>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Passing Arguments to Nashorn\fR
@@ -341,7 +346,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH SEE\ ALSO    
diff --git a/src/linux/doc/man/jstat.1 b/src/linux/doc/man/jstat.1
index 405df26..b8ec74b 100644
--- a/src/linux/doc/man/jstat.1
+++ b/src/linux/doc/man/jstat.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Monitoring Tools
 .\"     Title: jstat.1
 .\"
 .if n .pl 99999
-.TH jstat 1 "10 May 2011" "JDK 8" "Monitoring Tools"
+.TH jstat 1 "03 March 2015" "JDK 8" "Monitoring Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -101,7 +101,7 @@
 The communications protocol\&. If the \fIprotocol\fR value is omitted and a host name is not specified, then the default protocol is a platform-specific optimized local protocol\&. If the \fIprotocol\fR value is omitted and a host name is specified, then the default protocol is \f3rmi\fR\&.
 .TP     
 \fIlvmid\fR
-The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on UNIX platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
+The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on Solaris, Linux, and OS X platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
 .TP     
 \fIhostname\fR
 A hostname or IP address that indicates the target host\&. If the \fIhostname\fR value is omitted, then the target host is the local host\&.
@@ -154,7 +154,7 @@
 
 \f3gcnewcapacity\fR: Displays statistics about the sizes of the new generations and its corresponding spaces\&.
 
-\f3gcold\fR: Displays statistics about the behavior of the old generation and Metaspace Statistics\&.
+\f3gcold\fR: Displays statistics about the behavior of the old generation and metaspace statistics\&.
 
 \f3gcoldcapacity\fR: Displays statistics about the sizes of the old generation\&.
 
@@ -170,7 +170,7 @@
 .TP
 -t
 .br
-Display sa timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
+Displays a timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
 .TP
 -J\fIjavaOption\fR
 .br
@@ -184,7 +184,7 @@
 
 \f3Loaded\fR: Number of classes loaded\&.
 
-\f3Bytes\fR: Number of KBs loaded\&.
+\f3Bytes\fR: Number of kBs loaded\&.
 
 \f3Unloaded\fR: Number of classes unloaded\&.
 
@@ -212,25 +212,29 @@
 .br
 Garbage-collected heap statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3OU\fR: Old space utilization (KB)\&.
+\f3OU\fR: Old space utilization (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metacspace utilization (KB)\&.
+\f3MU\fR: Metacspace utilization (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3CCSU\fR: Compressed class space used (kB)\&.
 
 \f3YGC\fR: Number of young generation garbage collection events\&.
 
@@ -246,67 +250,71 @@
 .br
 Memory pool generation and space capacities\&.
 
-\f3NGCMN\fR: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3YGC\fR: Number of Young generation GC Events\&.
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3YGC\fR: Number of young generation GC events\&.
+
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gccause \fIoption\fR
 .br
 This option displays the same summary of garbage collection statistics as the \f3-gcutil\fR option, but includes the causes of the last garbage collection event and (when applicable) the current garbage collection event\&. In addition to the columns listed for \f3-gcutil\fR, this option adds the following columns\&.
 
-Garbage collection statistics, including garbage collection Events\&.
+\f3LGCC\fR: Cause of last garbage collection
 
-\f3LGCC\fR: Cause of last garbage collection\&.
-
-\f3GCC\fR: Cause of current garbage collection\&.
+\f3GCC\fR: Cause of current garbage collection
 .TP
 -gcnew \fIoption\fR
 .br
 New generation statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
 \f3TT\fR: Tenuring threshold\&.
 
 \f3MTT\fR: Maximum tenuring threshold\&.
 
-\f3DSS\fR: Desired survivor size (KB)\&.
+\f3DSS\fR: Desired survivor size (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -316,39 +324,43 @@
 .br
 New generation space size statistics\&.
 
-NGCMN: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0CMX\fR: Maximum survivor space 0 capacity (KB)\&.
+\f3S0CMX\fR: Maximum survivor space 0 capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1CMX\fR: Maximum survivor space 1 capacity (KB)\&.
+\f3S1CMX\fR: Maximum survivor space 1 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3ECMX\fR: Maximum eden space capacity (KB)\&.
+\f3ECMX\fR: Maximum eden space capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gcold \fIoption\fR
 .br
-old and permanent generation statistics\&.
+Old and permanent generation statistics\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metaspace utilization (KB)\&.
+\f3MU\fR: Metaspace utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
 
-\f3OU\fR: old space utilization (KB)\&.
+\f3CCSU\fR: Compressed class space used (kB)\&.
+
+\f3OC\fR: Current old space capacity (kB)\&.
+
+\f3OU\fR: Old space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -362,13 +374,13 @@
 .br
 Old generation statistics\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -382,11 +394,15 @@
 .br
 Permanent generation statistics\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
+
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
+
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -410,6 +426,8 @@
 
 \f3M\fR: Metaspace utilization as a percentage of the space\&'s current capacity\&.
 
+\f3CCS\fR: Compressed class space utilization as a percentage\&.
+
 \f3YGC\fR: Number of young generation GC events\&.
 
 \f3YGCT\fR: Young generation garbage collection time\&.
@@ -430,47 +448,44 @@
 
 \f3Type\fR: Compilation type of the most recently compiled method\&.
 
-\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintComplation\fR option\&.
+\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintCompilation\fR option\&.
 .SH EXAMPLES    
 This section presents some examples of monitoring a local JVM with an \fIlvmid\fR of 21891\&.
 .SS THE\ GCUTIL\ OPTION    
 This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified by the -\f3gcutil\fR option\&.
 .PP
-The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.001 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 9\&.49% to 9\&.51%\&. Before the collection, the survivor space was 12\&.44% utilized, but after this collection it is only 7\&.74% utilized\&.
+The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.078 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 66\&.80% to 68\&.19%\&. Before the collection, the survivor space was 97\&.02% utilized, but after this collection it is 91\&.03% utilized\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 21891 250 7\fP
 .fi     
 .nf     
-\f3  S0     S1     E      O      M       YGC    YGCT    FGC    FGCT     GCT\fP
+\f3  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   \fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  70\&.31  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  86\&.23  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  96\&.53  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00   1\&.98  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  15\&.82  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
-.fi     
-.nf     
-\f3\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .sp     
 .SS REPEAT\ THE\ COLUMN\ HEADER\ STRING    
-This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcutil\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
+This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcnew\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
 .PP
 In addition to showing the repeating header string, this example shows that between the second and third samples, a young GC occurred\&. Its duration was 0\&.001 seconds\&. The collection found enough active data that the survivor space 0 utilization (S0U) would have exceeded the desired survivor Size (DSS)\&. As a result, objects were promoted to the old generation (not visible in this output), and the tenuring threshold (TT) was lowered from 31 to 2\&.
 .PP
@@ -516,7 +531,7 @@
 .SS INCLUDE\ A\ TIME\ STAMP\ FOR\ EACH\ SAMPLE    
 This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals\&. The \f3-t\fR option is used to generate a time stamp for each sample in the first column\&.
 .PP
-The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown to from 11,696 KB to 13820 KB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 KB (OGCMX), so it still has room to expand\&.
+The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown from 11,696 kB to 13,820 kB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 kB (OGCMX), so it still has room to expand\&.
 .sp     
 .nf     
 \f3Timestamp      OGCMN    OGCMX     OGC       OC       YGC   FGC    FGCT    GCT\fP
@@ -537,7 +552,7 @@
 .SS MONITOR\ INSTRUMENTATION\ FOR\ A\ REMOTE\ JVM    
 This example attaches to lvmid 40496 on the system named remote\&.domain using the \f3-gcutil\fR option, with samples taken every second indefinitely\&.
 .PP
-The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the rmiregistry on \f3remote\&.domain\fR that is bound to the default rmiregistry port (port 1099)\&.
+The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the \f3rmiregistry\fR command on \f3remote\&.domain\fR that is bound to the default port of the \f3rmiregistry\fR command (port 1099)\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 40496@remote\&.domain 1000\fP
diff --git a/src/linux/doc/man/keytool.1 b/src/linux/doc/man/keytool.1
index 7275889..5a89779 100644
--- a/src/linux/doc/man/keytool.1
+++ b/src/linux/doc/man/keytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 6 August 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: keytool.1
 .\"
 .if n .pl 99999
-.TH keytool 1 "6 August 2013" "JDK 8" "Security Tools"
+.TH keytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -185,10 +185,16 @@
 .TP 0.2i    
 \(bu
 Items in italics (option values) represent the actual values that must be supplied\&. For example, here is the format of the \f3-printcert\fR command:
+.sp     
+.nf     
+\f3keytool \-printcert {\-file \fIcert_file\fR} {\-v}\fP
+.fi     
+.sp     
 
-\f3keytool -printcert {-file cert_file} {-v}\fR
 
-When you specify a \f3-printcert\fR command, replace \f3cert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
+
+
+When you specify a \f3-printcert\fR command, replace \fIcert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
 .TP 0.2i    
 \(bu
 Option values must be put in quotation marks when they contain a blank (space)\&.
@@ -385,10 +391,39 @@
 .PP
 \fINote:\fR Users should be aware that some combinations of extensions (and other certificate fields) may not conform to the Internet standard\&. See Certificate Conformance Warning\&.
 .SH COMMANDS    
-.TP
+.TP     
 -gencert
-.br
-\f3{-rfc} {-infile infile} {-outfile outfile} {-alias alias} {-sigalg sigalg} {-dname dname} {-startdate startdate {-ext ext}* {-validity valDays} [-keypass keypass] {-keystore keystore} [-storepass storepass] {-storetype storetype} {-providername provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-rfc} {\-infile \fIinfile\fR} {\-outfile \fIoutfile\fR} {\-alias \fIalias\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-dname \fIdname\fR} {\-startdate \fIstartdate\fR {\-ext \fIext\fR}* {\-validity \fIvalDays\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-providername \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a certificate as a response to a certificate request file (which can be created by the \f3keytool\fR\f3-certreq\fR command)\&. The command reads the request from \fIinfile\fR (if omitted, from the standard input), signs it using alias\&'s private key, and outputs the X\&.509 certificate into \fIoutfile\fR (if omitted, to the standard output)\&. When\f3-rfc\fR is specified, the output format is Base64-encoded PEM; otherwise, a binary DER is created\&.
 
@@ -459,10 +494,39 @@
 .fi     
 .sp     
 
-.TP
+.TP     
 -genkeypair
-.br
-\f3{-alias alias} {-keyalg keyalg} {-keysize keysize} {-sigalg sigalg} [-dname dname] [-keypass keypass] {-startdate value} {-ext ext}* {-validity valDays} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-dname \fIdname\fR] [\-keypass \fIkeypass\fR] {\-startdate \fIvalue\fR} {\-ext \fIext\fR}*\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-validity \fIvalDays\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a key pair (a public key and associated private key)\&. Wraps the public key into an X\&.509 v3 self-signed certificate, which is stored as a single-element certificate chain\&. This certificate chain and the private key are stored in a new keystore entry identified by alias\&.
 
@@ -510,18 +574,61 @@
 The value of \f3valDays\fR specifies the number of days (starting at the date specified by \f3-startdate\fR, or the current date when \f3-startdate\fR is not specified) for which the certificate should be considered valid\&.
 
 This command was named \f3-genkey\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-genkeypair\fR, is preferred going forward\&.
-.TP
+.TP     
 -genseckey
-.br
-\f3-genseckey {-alias alias} {-keyalg keyalg} {-keysize keysize} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} [\-keypass \fIkeypass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a secret key and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&.
 
 The value of \f3keyalg\fR specifies the algorithm to be used to generate the secret key, and the value of \f3keysize\fR specifies the size of the key to be generated\&. The \f3keypass\fR value is a password that protects the secret key\&. If no password is provided, then the user is prompted for it\&. If you press the Return key at the prompt, then the key password is set to the same password that is used for the \f3keystore\fR\&. The \f3keypass\fR value must be at least 6 characters\&.
-.TP
+.TP     
 -importcert
-.br
-\f3-importcert {-alias alias} {-file cert_file} [-keypass keypass] {-noprompt} {-trustcacerts} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} [\-keypass \fIkeypass\fR] {\-noprompt} {\-trustcacerts}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate or certificate chain (where the latter is supplied in a PKCS#7 formatted reply or a sequence of X\&.509 certificates) from the file \f3cert_file\fR, and stores it in the \f3keystore\fR entry identified by \f3alias\fR\&. If no file is specified, then the certificate or certificate chain is read from \f3stdin\fR\&.
 
@@ -530,16 +637,74 @@
 You import a certificate for two reasons: To add it to the list of trusted certificates, and to import a certificate reply received from a certificate authority (CA) as the result of submitting a Certificate Signing Request to that CA (see the \f3-certreq\fR option in Commands)\&.
 
 Which type of import is intended is indicated by the value of the \f3-alias\fR option\&. If the alias does not point to a key entry, then the \f3keytool\fR command assumes you are adding a trusted certificate entry\&. In this case, the alias should not already exist in the keystore\&. If the alias does already exist, then the \f3keytool\fR command outputs an error because there is already a trusted certificate for that alias, and does not import the certificate\&. If the alias points to a key entry, then the \f3keytool\fR command assumes you are importing a certificate reply\&.
-.TP
+.TP     
 -importpassword
-.br
-\f3{-alias alias} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a passphrase and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&. The passphrase may be supplied via the standard input stream; otherwise the user is prompted for it\&. \f3keypass\fR is a password used to protect the imported passphrase\&. If no password is provided, the user is prompted for it\&. If you press the Return key at the prompt, the key password is set to the same password as that used for the \f3keystore\fR\&. \f3keypass\fR must be at least 6 characters long\&.
-.TP
+.TP     
 -importkeystore
-.br
-\f3{-srcstoretype srcstoretype} {-deststoretype deststoretype} [-srcstorepass srcstorepass] [-deststorepass deststorepass] {-srcprotected} {-destprotected} {-srcalias srcalias {-destalias destalias} [-srckeypass srckeypass] } [-destkeypass destkeypass] {-noprompt} {-srcProviderName src_provider_name} {-destProviderName dest_provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-srcstoretype \fIsrcstoretype\fR} {\-deststoretype \fIdeststoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-srcstorepass \fIsrcstorepass\fR] [\-deststorepass \fIdeststorepass\fR] {\-srcprotected}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-destprotected} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcalias \fIsrcalias\fR {\-destalias \fIdestalias\fR} [\-srckeypass \fIsrckeypass\fR]} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-destkeypass \fIdestkeypass\fR] {\-noprompt}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcProviderName \fIsrc_provider_name\fR} {\-destProviderName \fIdest_provider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a single entry or all entries from a source keystore to a destination keystore\&.
 
@@ -550,16 +715,44 @@
 If the destination alias already exists in the destination keystore, then the user is prompted to either overwrite the entry or to create a new entry under a different alias name\&.
 
 If the \f3-noprompt\fR option is provided, then the user is not prompted for a new destination alias\&. Existing entries are overwritten with the destination alias name\&. Entries that cannot be imported are skipped and a warning is displayed\&.
-.TP
+.TP     
 -printcertreq
-.br
-\f3{-file file}\fR
+.sp     
+.nf     
+\f3{\-file \fIfile\fR}\fP
+.fi     
+.sp     
+
 
 Prints the content of a PKCS #10 format certificate request, which can be generated by the \f3keytool\fR\f3-certreq\fR command\&. The command reads the request from file\&. If there is no file, then the request is read from the standard input\&.
-.TP
+.TP     
 -certreq
-.br
-\f3{-alias alias} {-dname dname} {-sigalg sigalg} {-file certreq_file} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-dname \fIdname\fR} {\-sigalg \fIsigalg\fR} {\-file \fIcertreq_file\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a Certificate Signing Request (CSR) using the PKCS #10 format\&.
 
@@ -572,10 +765,29 @@
 The CSR is stored in the file certreq_file\&. If no file is specified, then the CSR is output to \f3stdout\fR\&.
 
 Use the \f3importcert\fR command to import the response from the CA\&.
-.TP
+.TP     
 -exportcert
-.br
-\f3{-alias alias} {-file cert_file} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-rfc} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-rfc} {\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads from the keystore the certificate associated with \fIalias\fR and stores it in the cert_file file\&. When no file is specified, the certificate is output to \f3stdout\fR\&.
 
@@ -584,20 +796,48 @@
 If \f3alias\fR refers to a trusted certificate, then that certificate is output\&. Otherwise, \f3alias\fR refers to a key entry with an associated certificate chain\&. In that case, the first certificate in the chain is returned\&. This certificate authenticates the public key of the entity addressed by \f3alias\fR\&.
 
 This command was named \f3-export\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-exportcert\fR, is preferred going forward\&.
-.TP
+.TP     
 -list
-.br
-\f3{-alias alias} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v | -rfc} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v | \-rfc} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Prints to \f3stdout\fR the contents of the keystore entry identified by \f3alias\fR\&. If no \f3alias\fR is specified, then the contents of the entire keystore are printed\&.
 
 This command by default prints the SHA1 fingerprint of a certificate\&. If the \f3-v\fR option is specified, then the certificate is printed in human-readable format, with additional information such as the owner, issuer, serial number, and any extensions\&. If the \f3-rfc\fR option is specified, then the certificate contents are printed using the printable encoding format, as defined by the Internet RFC 1421 Certificate Encoding Standard\&.
 
 You cannot specify both \f3-v\fR and \f3-rfc\fR\&.
-.TP
+.TP     
 -printcert
-.br
-\f3{-file cert_file | -sslserver host[:port]} {-jarfile JAR_file {-rfc} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-file \fIcert_file\fR | \-sslserver \fIhost\fR[:\fIport\fR]} {\-jarfile \fIJAR_file\fR {\-rfc} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate from the file cert_file, the SSL server located at host:port, or the signed JAR file \f3JAR_file\fR (with the \f3-jarfile\fR option and prints its contents in a human-readable format\&. When no port is specified, the standard HTTPS port 443 is assumed\&. Note that \f3-sslserver\fR and -file options cannot be provided at the same time\&. Otherwise, an error is reported\&. If neither option is specified, then the certificate is read from \f3stdin\fR\&.
 
@@ -608,40 +848,120 @@
 If the SSL server is behind a firewall, then the \f3-J-Dhttps\&.proxyHost=proxyhost\fR and \f3-J-Dhttps\&.proxyPort=proxyport\fR options can be specified on the command line for proxy tunneling\&. See Java Secure Socket Extension (JSSE) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide\&.html
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -printcrl
-.br
-\f3-file crl_ {-v}\fR
+.sp     
+.nf     
+\f3\-file \fIcrl_\fR {\-v}\fP
+.fi     
+.sp     
+
 
 Reads the Certificate Revocation List (CRL) from the file \f3crl_\fR\&. A CRL is a list of digital certificates that were revoked by the CA that issued them\&. The CA generates the \f3crl_\fR file\&.
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -storepasswd
-.br
-\f3[-new new_storepass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-new \fInew_storepass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password used to protect the integrity of the keystore contents\&. The new password is \f3new_storepass\fR, which must be at least 6 characters\&.
-.TP
+.TP     
 -keypasswd
-.br
-\f3{-alias alias} [-keypass old_keypass] [-new new_keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIold_keypass\fR] [\-new \fInew_keypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password under which the private/secret key identified by \f3alias\fR is protected, from \f3old_keypass\fR to \f3new_keypass\fR, which must be at least 6 characters\&.
 
 If the \f3-keypass\fR option is not provided at the command line, and the key password is different from the keystore password, then the user is prompted for it\&.
 
 If the \f3-new\fR option is not provided at the command line, then the user is prompted for it
-.TP
+.TP     
 -delete
-.br
-\f3[-alias alias] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-alias \fIalias\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}  \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Deletes from the keystore the entry identified by \f3alias\fR\&. The user is prompted for the alias, when no alias is provided at the command line\&.
-.TP
+.TP     
 -changealias
-.br
-\f3{-alias alias} [-destalias destalias] [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-destalias \fIdestalias\fR] [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Move an existing keystore entry from the specified \f3alias\fR to a new alias, \f3destalias\fR\&. If no destination alias is provided, then the command prompts for one\&. If the original entry is protected with an entry password, then the password can be supplied with the \f3-keypass\fR option\&. If no key password is provided, then the \f3storepass\fR (if provided) is attempted first\&. If the attempt fails, then the user is prompted for a password\&.
 .TP
diff --git a/src/linux/doc/man/policytool.1 b/src/linux/doc/man/policytool.1
index a82f7be..c7fb46b 100644
--- a/src/linux/doc/man/policytool.1
+++ b/src/linux/doc/man/policytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: policytool.1
 .\"
 .if n .pl 99999
-.TH policytool 1 "21 November 2013" "JDK 8" "Security Tools"
+.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -80,7 +80,7 @@
 Run the \f3policytool\fR command and load the specified file:
 .sp     
 .nf     
-\f3policytool\-file mypolicyfile\fP
+\f3policytool \-file \fImypolicyfile\fR\fP
 .fi     
 .nf     
 \f3\fP
diff --git a/src/macosx/classes/com/apple/laf/AquaImageFactory.java b/src/macosx/classes/com/apple/laf/AquaImageFactory.java
index 8fbc4c0..d194863 100644
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java
+++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java
@@ -46,10 +46,8 @@
 import com.apple.laf.AquaIcon.SystemIcon;
 import com.apple.laf.AquaUtils.RecyclableObject;
 import com.apple.laf.AquaUtils.RecyclableSingleton;
-import java.util.Arrays;
-import java.util.List;
-import sun.awt.image.MultiResolutionBufferedImage;
 import sun.awt.image.MultiResolutionImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 public class AquaImageFactory {
     public static IconUIResource getConfirmImageIcon() {
@@ -107,9 +105,9 @@
     private static final int kAlertIconSize = 64;
     static IconUIResource getAppIconCompositedOn(final Image background) {
 
-        if (background instanceof MultiResolutionBufferedImage) {
+        if (background instanceof MultiResolutionCachedImage) {
             int width = background.getWidth(null);
-            Image mrIconImage = ((MultiResolutionBufferedImage) background).map(
+            Image mrIconImage = ((MultiResolutionCachedImage) background).map(
                     rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width));
             return new IconUIResource(new ImageIcon(mrIconImage));
         }
@@ -287,21 +285,7 @@
     private static Image getNSIcon(String imageName) {
         Image icon = Toolkit.getDefaultToolkit()
                 .getImage("NSImage://" + imageName);
-
-        if (icon instanceof MultiResolutionImage) {
-            return icon;
-        }
-
-        int w = icon.getWidth(null);
-        int h = icon.getHeight(null);
-
-        Dimension[] sizes = new Dimension[]{
-            new Dimension(w, h), new Dimension(2 * w, 2 * h)
-        };
-
-        return new MultiResolutionBufferedImage(icon, sizes, (width, height) ->
-                AquaUtils.getCImageCreator().createImageFromName(
-                        imageName, width, height));
+        return icon;
     }
 
     public static class NineSliceMetrics {
diff --git a/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java b/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java
index c884e6d..36e703e 100644
--- a/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java
+++ b/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java
@@ -26,11 +26,14 @@
 package com.apple.laf;
 
 import java.awt.*;
+import java.security.AccessController;
 
 import javax.swing.*;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicMenuBarUI;
 
+import sun.lwawt.macosx.LWCToolkit;
+import sun.security.action.GetBooleanAction;
 import sun.security.action.GetPropertyAction;
 
 // MenuBar implementation for Mac L&F
@@ -131,28 +134,20 @@
     ScreenMenuBar fScreenMenuBar;
     boolean useScreenMenuBar = getScreenMenuBarProperty();
 
-    private static String getPrivSysProp(final String propName) {
-        return java.security.AccessController.doPrivileged(new GetPropertyAction(propName));
-    }
-
     static boolean getScreenMenuBarProperty() {
-        final String props[] = new String[]{""};
-
-        boolean useScreenMenuBar = false;
-        try {
-            props[0] = getPrivSysProp(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
-
-            if (props[0] != null && props[0].equals("true")) useScreenMenuBar = true;
-            else {
-                props[0] = getPrivSysProp(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar");
-
-                if (props[0] != null && props[0].equals("true")) {
-                    System.err.println(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar has been deprecated. Please switch to " + AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
-                    useScreenMenuBar = true;
-                }
-            }
-        } catch(final Throwable t) { };
-
-        return useScreenMenuBar;
+        // Do not allow AWT to set the screen menu bar if it's embedded in another UI toolkit
+        if (LWCToolkit.isEmbedded()) return false;
+        if (AccessController.doPrivileged(
+                new GetBooleanAction(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar"))) {
+            return true;
+        }
+        if (AccessController.doPrivileged(
+                new GetBooleanAction(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar"))) {
+                System.err.println(AquaLookAndFeel.sOldPropertyPrefix +
+                        "useScreenMenuBar has been deprecated. Please switch to " +
+                        AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
+                return true;
+        }
+        return false;
     }
 }
diff --git a/src/macosx/classes/com/apple/laf/AquaPainter.java b/src/macosx/classes/com/apple/laf/AquaPainter.java
index ee4fcba..a2ebaf1 100644
--- a/src/macosx/classes/com/apple/laf/AquaPainter.java
+++ b/src/macosx/classes/com/apple/laf/AquaPainter.java
@@ -174,11 +174,7 @@
                                                         bounds, controlState);
             Image img = cache.getImage(key);
             if (img == null) {
-
-                Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
-                                              control, controlState);
-
-                img = new MultiResolutionBufferedImage(baseImage,
+                img = new MultiResolutionCachedImage(imgW, imgH,
                         (rvWidth, rvHeight) -> createImage(imgX, imgY,
                          rvWidth, rvHeight, bounds, control, controlState));
 
diff --git a/src/macosx/classes/com/apple/laf/AquaUtils.java b/src/macosx/classes/com/apple/laf/AquaUtils.java
index a20897f..078435b 100644
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java
@@ -48,7 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 final class AquaUtils {
 
@@ -124,8 +124,8 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
-        return (image instanceof MultiResolutionBufferedImage)
-                ? ((MultiResolutionBufferedImage) image).map(
+        return (image instanceof MultiResolutionCachedImage)
+                ? ((MultiResolutionCachedImage) image).map(
                         rv -> generateLightenedImage(rv, filter))
                 : generateLightenedImage(image, filter);
     }
diff --git a/src/macosx/classes/sun/font/CFontManager.java b/src/macosx/classes/sun/font/CFontManager.java
index 6d8cbbb..f589efc 100644
--- a/src/macosx/classes/sun/font/CFontManager.java
+++ b/src/macosx/classes/sun/font/CFontManager.java
@@ -43,7 +43,7 @@
 import sun.misc.ThreadGroupUtils;
 import sun.lwawt.macosx.*;
 
-public class CFontManager extends SunFontManager {
+public final class CFontManager extends SunFontManager {
     private FontConfigManager fcManager = null;
     private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
 
@@ -61,20 +61,14 @@
         return new CFontConfiguration(this, preferLocaleFonts, preferPropFonts);
     }
 
-    private static String[] defaultPlatformFont = null;
-
     /*
      * Returns an array of two strings. The first element is the
      * name of the font. The second element is the file name.
      */
     @Override
-    public synchronized String[] getDefaultPlatformFont() {
-        if (defaultPlatformFont == null) {
-            defaultPlatformFont = new String[2];
-            defaultPlatformFont[0] = "Lucida Grande";
-            defaultPlatformFont[1] = "/System/Library/Fonts/LucidaGrande.ttc";
-        }
-        return defaultPlatformFont;
+    protected String[] getDefaultPlatformFont() {
+        return new String[]{"Lucida Grande",
+                            "/System/Library/Fonts/LucidaGrande.ttc"};
     }
 
     // This is a way to register any kind of Font2D, not just files and composites.
diff --git a/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java b/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java
index 624be6b..4491b7c 100644
--- a/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java
+++ b/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java
@@ -94,10 +94,12 @@
 
     @Override
     public void addDropTarget(DropTarget dt) {
+        getLwTarget().addDropTarget(dt);
     }
 
     @Override
     public void removeDropTarget(DropTarget dt) {
+        getLwTarget().removeDropTarget(dt);
     }
 
     @Override
diff --git a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index 5251cb6..1b6f14a 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -37,7 +37,8 @@
 
     private CPlatformResponder responder;
     private static final Object classLock = new Object();
-    private static volatile CEmbeddedFrame focusedWindow;
+    private static volatile CEmbeddedFrame globalFocusedWindow;
+    private CEmbeddedFrame browserWindowFocusedApplet;
     private boolean parentWindowActive = true;
 
     public CEmbeddedFrame() {
@@ -110,10 +111,10 @@
         synchronized (classLock) {
             // In some cases an applet may not receive the focus lost event
             // from the parent window (see 8012330)
-            focusedWindow = (focused) ? this
-                    : ((focusedWindow == this) ? null : focusedWindow);
+            globalFocusedWindow = (focused) ? this
+                    : ((globalFocusedWindow == this) ? null : globalFocusedWindow);
         }
-        if (focusedWindow == this) {
+        if (globalFocusedWindow == this) {
             // see bug 8010925
             // we can't put this to handleWindowFocusEvent because
             // it won't be invoced if focuse is moved to a html element
@@ -144,9 +145,23 @@
     // non-focused applet. This method can be called from different threads.
     public void handleWindowFocusEvent(boolean parentWindowActive) {
         this.parentWindowActive = parentWindowActive;
+        // If several applets are running in different browser's windows, it is necessary to
+        // detect the switching between the parent windows and update globalFocusedWindow accordingly.
+        synchronized (classLock) {
+            if (!parentWindowActive) {
+                this.browserWindowFocusedApplet = globalFocusedWindow;
+            }
+            if (parentWindowActive && globalFocusedWindow != this && isParentWindowChanged()) {
+                // It looks like we have switched to another browser window, let's restore focus to
+                // the previously focused applet in this window. If no applets were focused in the
+                // window, we will set focus to the first applet in the window.
+                globalFocusedWindow = (this.browserWindowFocusedApplet != null) ? this.browserWindowFocusedApplet
+                        : this;
+            }
+        }
         // ignore focus "lost" native request as it may mistakenly
         // deactivate active window (see 8001161)
-        if (focusedWindow == this && parentWindowActive) {
+        if (globalFocusedWindow == this && parentWindowActive) {
             responder.handleWindowFocusEvent(parentWindowActive, null);
         }
     }
@@ -154,4 +169,10 @@
     public boolean isParentWindowActive() {
         return parentWindowActive;
     }
+
+    private boolean isParentWindowChanged() {
+        // If globalFocusedWindow is located at inactive parent window or null, we have swithed to
+        // another window.
+        return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true;
+    }
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CImage.java b/src/macosx/classes/sun/lwawt/macosx/CImage.java
index 7b0c826..0cbd570 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CImage.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CImage.java
@@ -32,7 +32,7 @@
 import java.util.Arrays;
 import java.util.List;
 import sun.awt.image.MultiResolutionImage;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -60,41 +60,41 @@
         // This is used to create a CImage with an NSImage pointer. It MUST be a CFRetained
         // NSImage, and the CImage takes ownership of the non-GC retain. If callers need the
         // NSImage themselves, they MUST call retain on the NSImage themselves.
-        public BufferedImage createImageUsingNativeSize(final long image) {
+        public Image createImageUsingNativeSize(final long image) {
             if (image == 0) return null;
             final Dimension2D size = nativeGetNSImageSize(image);
-            return createBufferedImage(image, size.getWidth(), size.getHeight());
+            return createImage(image, size.getWidth(), size.getHeight());
         }
 
         // the width and height passed in as a parameter could differ than the width and the height of the NSImage (image), in that case, the image will be scaled
-        BufferedImage createBufferedImage(long image, double width, double height) {
+        Image createImage(long image, double width, double height) {
             if (image == 0) throw new Error("Unable to instantiate CImage with null native image reference.");
             return createImageWithSize(image, width, height);
         }
 
-        public BufferedImage createImageWithSize(final long image, final double width, final double height) {
+        public Image createImageWithSize(final long image, final double width, final double height) {
             final CImage img = new CImage(image);
             img.resize(width, height);
             return img.toImage();
         }
 
         // This is used to create a CImage that represents the icon of the given file.
-        public BufferedImage createImageOfFile(final String file, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
+        public Image createImageOfFile(final String file, final int width, final int height) {
+            return createImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
         }
 
-        public BufferedImage createImageFromFile(final String file, final double width, final double height) {
+        public Image createImageFromFile(final String file, final double width, final double height) {
             final long image = nativeCreateNSImageFromFileContents(file);
             nativeSetNSImageSize(image, width, height);
-            return createBufferedImage(image, width, height);
+            return createImage(image, width, height);
         }
 
-        public BufferedImage createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
+        public Image createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
+            return createImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
         }
 
         public Image createImageFromName(final String name, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromImageName(name), width, height);
+            return createImage(nativeCreateNSImageFromImageName(name), width, height);
         }
 
         public Image createImageFromName(final String name) {
@@ -213,7 +213,7 @@
     }
 
     /** @return A MultiResolution image created from nsImagePtr, or null. */
-    private BufferedImage toImage() {
+    private Image toImage() {
         if (ptr == 0) return null;
 
         final Dimension2D size = nativeGetNSImageSize(ptr);
@@ -224,11 +224,11 @@
                 = nativeGetNSImageRepresentationSizes(ptr,
                         size.getWidth(), size.getHeight());
 
-        BufferedImage baseImage = toImage(w, h, w, h);
-
-        return sizes == null || sizes.length < 2 ? baseImage
-                : new MultiResolutionBufferedImage(baseImage, sizes,
-                        (width, height) -> toImage(w, h, width, height));
+        return sizes == null || sizes.length < 2 ?
+                new MultiResolutionCachedImage(w, h, (width, height)
+                        -> toImage(w, h, width, height))
+                : new MultiResolutionCachedImage(w, h, sizes, (width, height)
+                        -> toImage(w, h, width, height));
     }
 
     private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index aa21535..a055acf 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -674,6 +674,13 @@
     @Override  // PlatformWindow
     public void toFront() {
         final long nsWindowPtr = getNSWindowPtr();
+        LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
+        Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+        if( w != null && w.getPeer() != null
+                && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
+                && !lwcToolkit.isApplicationActive()) {
+            lwcToolkit.activateApplicationIgnoringOtherApps();
+        }
         updateFocusabilityForAutoRequestFocus(false);
         nativePushNSWindowToFront(nsWindowPtr);
         updateFocusabilityForAutoRequestFocus(true);
diff --git a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
index e0e07f0..f13a01c 100644
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
@@ -538,9 +538,9 @@
             return super.getImage(filename);
         }
 
-        String fileneame2x = getScaledImageName(filename);
-        return (imageExists(fileneame2x))
-                ? getImageWithResolutionVariant(filename, fileneame2x)
+        String filename2x = getScaledImageName(filename);
+        return (imageExists(filename2x))
+                ? getImageWithResolutionVariant(filename, filename2x)
                 : super.getImage(filename);
     }
 
@@ -686,6 +686,11 @@
     @Override
     public DragSourceContextPeer createDragSourceContextPeer(
             DragGestureEvent dge) throws InvalidDnDOperationException {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
+        if (f != null) {
+            return f.createDragSourceContextPeer(dge);
+        }
+
         return CDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
@@ -693,6 +698,11 @@
     public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
             Class<T> abstractRecognizerClass, DragSource ds, Component c,
             int srcActions, DragGestureListener dgl) {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(c);
+        if (f != null) {
+            return f.createDragGestureRecognizer(abstractRecognizerClass, ds, c, srcActions, dgl);
+        }
+
         DragGestureRecognizer dgr = null;
 
         // Create a new mouse drag gesture recognizer if we have a class match:
@@ -784,6 +794,18 @@
      */
     native boolean isApplicationActive();
 
+    /**
+     * Returns true if AWT toolkit is embedded, false otherwise.
+     *
+     * @return true if AWT toolkit is embedded, false otherwise
+     */
+    public static native boolean isEmbedded();
+
+    /*
+     * Activates application ignoring other apps.
+     */
+    public native void activateApplicationIgnoringOtherApps();
+
     /************************
      * Native methods section
      ************************/
@@ -891,6 +913,9 @@
     }
 
     private static boolean isValidPath(String path) {
-        return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");
+        return path != null &&
+                !path.isEmpty() &&
+                !path.endsWith("/") &&
+                !path.endsWith(".");
     }
 }
diff --git a/src/macosx/native/apple/security/KeystoreImpl.m b/src/macosx/native/apple/security/KeystoreImpl.m
index 1e26771..30cff2e 100644
--- a/src/macosx/native/apple/security/KeystoreImpl.m
+++ b/src/macosx/native/apple/security/KeystoreImpl.m
@@ -299,11 +299,21 @@
 
             // Make a java array of certificate data from the chain.
             jclass byteArrayClass = (*env)->FindClass(env, "[B");
+            if (byteArrayClass == NULL) {
+                goto errOut;
+            }
             jobjectArray javaCertArray = (*env)->NewObjectArray(env, certCount, byteArrayClass, NULL);
+            // Cleanup first then check for a NULL return code
             (*env)->DeleteLocalRef(env, byteArrayClass);
+            if (javaCertArray == NULL) {
+                goto errOut;
+            }
 
             // And, make an array of the certificate refs.
             jlongArray certRefArray = (*env)->NewLongArray(env, certCount);
+            if (certRefArray == NULL) {
+                goto errOut;
+            }
 
             SecCertificateRef currCertRef = NULL;
 
@@ -318,6 +328,9 @@
                 bzero(&currCertData, sizeof(CSSM_DATA));
                 err = SecCertificateGetData(currCertRef, &currCertData);
                 jbyteArray encodedCertData = (*env)->NewByteArray(env, currCertData.Length);
+                if (encodedCertData == NULL) {
+                    goto errOut;
+                }
                 (*env)->SetByteArrayRegion(env, encodedCertData, 0, currCertData.Length, (jbyte *)currCertData.Data);
                 (*env)->SetObjectArrayElement(env, javaCertArray, i, encodedCertData);
                 jlong certRefElement = ptr_to_jlong(currCertRef);
@@ -330,6 +343,9 @@
 
             // Find the label.  It's a 'blob', but we interpret as characters.
             jstring alias = getLabelFromItem(env, (SecKeychainItemRef)certificate);
+            if (alias == NULL) {
+                goto errOut;
+            }
 
             // Find the creation date.
             jlong creationDate = getModDateFromItem(env, (SecKeychainItemRef)certificate);
@@ -340,6 +356,7 @@
         }
     } while (searchResult == noErr);
 
+errOut:
     if (identitySearch != NULL) {
         CFRelease(identitySearch);
     }
@@ -362,10 +379,16 @@
             CSSM_DATA currCertificate;
             err = SecCertificateGetData(certRef, &currCertificate);
             jbyteArray certData = (*env)->NewByteArray(env, currCertificate.Length);
+            if (certData == NULL) {
+                goto errOut;
+            }
             (*env)->SetByteArrayRegion(env, certData, 0, currCertificate.Length, (jbyte *)currCertificate.Data);
 
             // Find the label.  It's a 'blob', but we interpret as characters.
             jstring alias = getLabelFromItem(env, theItem);
+            if (alias == NULL) {
+                goto errOut;
+            }
 
             // Find the creation date.
             jlong creationDate = getModDateFromItem(env, theItem);
@@ -376,6 +399,7 @@
         }
     } while (searchResult == noErr);
 
+errOut:
     if (keychainItemSearch != NULL) {
         CFRelease(keychainItemSearch);
     }
@@ -404,6 +428,9 @@
 
         if (passwordLen > 0) {
             passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL);
+            if (passwordChars == NULL) {
+                goto errOut;
+            }
             passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
         }
     }
@@ -423,9 +450,13 @@
     if (err == noErr) {
         CFIndex size = CFDataGetLength(exportedData);
         returnValue = (*env)->NewByteArray(env, size);
+        if (returnValue == NULL) {
+            goto errOut;
+        }
         (*env)->SetByteArrayRegion(env, returnValue, 0, size, (jbyte *)CFDataGetBytePtr(exportedData));
     }
 
+errOut:
     if (exportedData) CFRelease(exportedData);
     if (passwordStrRef) CFRelease(passwordStrRef);
 
@@ -466,6 +497,9 @@
 
     jsize dataSize = (*env)->GetArrayLength(env, rawDataObj);
     jbyte *rawData = (*env)->GetByteArrayElements(env, rawDataObj, NULL);
+    if (rawData == NULL) {
+        goto errOut;
+    }
 
     CFDataRef cfDataToImport = CFDataCreate(kCFAllocatorDefault, (UInt8 *)rawData, dataSize);
     CFArrayRef createdItems = NULL;
@@ -522,6 +556,8 @@
         CFRelease(createdItems);
     }
 
+errOut: ;
+
 JNF_COCOA_EXIT(env);
 
     return returnValue;
diff --git a/src/macosx/native/java/util/MacOSXPreferencesFile.m b/src/macosx/native/java/util/MacOSXPreferencesFile.m
index e2212fc..f25f868 100644
--- a/src/macosx/native/java/util/MacOSXPreferencesFile.m
+++ b/src/macosx/native/java/util/MacOSXPreferencesFile.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,6 +71,8 @@
     static jclass exceptionClass = NULL;
     jclass c;
 
+    (*env)->ExceptionClear(env);  // If an exception is pending, clear it before
+                                  // calling FindClass() and/or ThrowNew().
     if (exceptionClass) {
         c = exceptionClass;
     } else {
@@ -534,8 +536,13 @@
 (JNIEnv *env, jobject klass, jobject jpath,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFDictionaryRef node = NULL;
@@ -579,8 +586,13 @@
 (JNIEnv *env, jobject klass, jobject jpath,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFStringRef parentName;
@@ -647,9 +659,17 @@
  jobject jname, jlong juser, jlong jhost)
 {
     // like addNode, but can put a three-level-deep dict into the root file
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef child = toCF(env, jchild);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef child = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        child = toCF(env, jchild);
+    }
+    if (child != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFMutableDictionaryRef parent;
@@ -693,9 +713,17 @@
 (JNIEnv *env, jobject klass, jobject jpath, jobject jchild,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef child = toCF(env, jchild);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef child = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        child = toCF(env, jchild);
+    }
+    if (child != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFDictionaryRef constParent;
@@ -734,10 +762,21 @@
 (JNIEnv *env, jobject klass, jobject jpath, jobject jkey, jobject jvalue,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef key = toCF(env, jkey);
-    CFStringRef value = toCF(env, jvalue);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef key = NULL;
+    CFStringRef value = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        key = toCF(env, jkey);
+    }
+    if (key != NULL) {
+        value = toCF(env, jvalue);
+    }
+    if (value != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFMutableDictionaryRef node = NULL;
@@ -771,9 +810,17 @@
 (JNIEnv *env, jobject klass, jobject jpath, jobject jkey,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef key = toCF(env, jkey);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef key = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        key = toCF(env, jkey);
+    }
+    if (key != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFDictionaryRef constNode;
@@ -812,9 +859,17 @@
 (JNIEnv *env, jobject klass, jobject jpath, jobject jkey,
  jobject jname, jlong juser, jlong jhost)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef key = toCF(env, jkey);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef key = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        key = toCF(env, jkey);
+    }
+    if (key != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFPropertyListRef value;
@@ -914,8 +969,13 @@
                                 jobject jname, jlong juser, jlong jhost,
                                 Boolean allowSlash)
 {
-    CFStringRef path = toCF(env, jpath);
-    CFStringRef name = toCF(env, jname);
+    CFStringRef path = NULL;
+    CFStringRef name = NULL;
+
+    path = toCF(env, jpath);
+    if (path != NULL) {
+        name = toCF(env, jname);
+    }
     CFStringRef user = (CFStringRef)jlong_to_ptr(juser);
     CFStringRef host = (CFStringRef)jlong_to_ptr(jhost);
     CFDictionaryRef node;
diff --git a/src/macosx/native/sun/awt/JavaComponentAccessibility.m b/src/macosx/native/sun/awt/JavaComponentAccessibility.m
index d24bfde..ffea40f 100644
--- a/src/macosx/native/sun/awt/JavaComponentAccessibility.m
+++ b/src/macosx/native/sun/awt/JavaComponentAccessibility.m
@@ -1122,7 +1122,10 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     id value = nil;
 
+    NSWindow* hostWindow = [[self->fView window] retain];
     jobject focused = JNFCallStaticObjectMethod(env, jm_getFocusOwner, fComponent); // AWT_THREADING Safe (AWTRunLoop)
+    [hostWindow release];
+    
     if (focused != NULL) {
         if (JNFIsInstanceOf(env, focused, &sjc_Accessible)) {
             value = [JavaComponentAccessibility createWithAccessible:focused withEnv:env withView:fView];
diff --git a/src/macosx/native/sun/awt/LWCToolkit.m b/src/macosx/native/sun/awt/LWCToolkit.m
index 1d20e23..3dd759a 100644
--- a/src/macosx/native/sun/awt/LWCToolkit.m
+++ b/src/macosx/native/sun/awt/LWCToolkit.m
@@ -413,6 +413,23 @@
     return active;
 }
 
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    activateApplicationIgnoringOtherApps
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplicationIgnoringOtherApps
+(JNIEnv *env, jclass clazz)
+{
+    JNF_COCOA_ENTER(env);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        if(![NSApp isActive]){
+            [NSApp activateIgnoringOtherApps:YES];
+        }
+    }];
+    JNF_COCOA_EXIT(env);
+}
+
 
 /*
  * Class:     sun_awt_SunToolkit
@@ -452,3 +469,14 @@
 
 }
 
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    isEmbedded
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_isEmbedded
+(JNIEnv *env, jclass klass) {
+    return [ThreadUtilities isAWTEmbedded] ? JNI_TRUE : JNI_FALSE;
+}
+
diff --git a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
index 40f380b..0eaf688 100644
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
@@ -45,6 +45,7 @@
 #include <dlfcn.h>
 
 #include <sizecalc.h>
+#import "ThreadUtilities.h"
 
 static NSScreen* SplashNSScreen()
 {
@@ -125,6 +126,43 @@
     return buf;
 }
 
+char* SplashGetScaledImageName(const char* jar, const char* file,
+                               float *scaleFactor) {
+    NSAutoreleasePool *pool = [NSAutoreleasePool new];
+    *scaleFactor = 1;
+    char* scaledFile = nil;
+    __block float screenScaleFactor = 1;
+
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+        screenScaleFactor = [SplashNSScreen() backingScaleFactor];
+    }];
+
+    if (screenScaleFactor > 1) {
+        NSString *fileName = [NSString stringWithUTF8String: file];
+        NSUInteger length = [fileName length];
+        NSRange range = [fileName rangeOfString: @"."
+                                        options:NSBackwardsSearch];
+        NSUInteger dotIndex = range.location;
+        NSString *fileName2x = nil;
+        
+        if (dotIndex == NSNotFound) {
+            fileName2x = [fileName stringByAppendingString: @"@2x"];
+        } else {
+            fileName2x = [fileName substringToIndex: dotIndex];
+            fileName2x = [fileName2x stringByAppendingString: @"@2x"];
+            fileName2x = [fileName2x stringByAppendingString:
+                          [fileName substringFromIndex: dotIndex]];
+        }
+        
+        if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
+                    fileExistsAtPath: fileName2x])){
+            *scaleFactor = 2;
+            scaledFile = strdup([fileName2x UTF8String]);
+        }
+    }
+    [pool drain];
+    return scaledFile;
+}
 
 void
 SplashInitPlatform(Splash * splash) {
@@ -132,7 +170,7 @@
 
     splash->maskRequired = 0;
 
-
+    
     //TODO: the following is too much of a hack but should work in 90% cases.
     //      besides we don't use device-dependant drawing, so probably
     //      that's very fine indeed
@@ -218,7 +256,15 @@
         [image setBackgroundColor: [NSColor clearColor]];
 
         [image addRepresentation: rep];
-
+        float scaleFactor = splash->scaleFactor;
+        if (scaleFactor > 0 && scaleFactor != 1) {
+            [image setScalesWhenResized:YES];
+            NSSize size = [image size];
+            size.width /= scaleFactor;
+            size.height /= scaleFactor;
+            [image setSize: size];
+        }
+        
         NSImageView * view = [[NSImageView alloc] init];
 
         [view setImage: image];
diff --git a/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c b/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
index 845fd7f..9e1f2d5 100644
--- a/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
+++ b/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
@@ -24,6 +24,7 @@
  */
 
 #include "sun_util_locale_provider_HostLocaleProviderAdapterImpl.h"
+#include "jni_util.h"
 #include <CoreFoundation/CoreFoundation.h>
 #include <stdio.h>
 
@@ -63,6 +64,10 @@
     localeString = getMacOSXLocale(posixCat);
     if (localeString == NULL) {
         localeString = getPosixLocale(posixCat);
+        if (localeString == NULL) {
+            JNU_ThrowOutOfMemoryError(env, NULL);
+            return NULL;
+        }
     }
     ret = (*env)->NewStringUTF(env, localeString);
     free(localeString);
@@ -127,6 +132,7 @@
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getAmPmStrings
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray ampms) {
     CFLocaleRef cflocale = CFLocaleCopyCurrent();
+    jstring tmp_string;
     if (cflocale != NULL) {
         CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
                                                   cflocale,
@@ -138,13 +144,21 @@
             if (amStr != NULL) {
                 CFStringGetCString(amStr, buf, BUFLEN, kCFStringEncodingUTF8);
                 CFRelease(amStr);
-                (*env)->SetObjectArrayElement(env, ampms, 0, (*env)->NewStringUTF(env, buf));
+                tmp_string = (*env)->NewStringUTF(env, buf);
+                if (tmp_string != NULL) {
+                    (*env)->SetObjectArrayElement(env, ampms, 0, tmp_string);
+                }
             }
-            CFStringRef pmStr = CFDateFormatterCopyProperty(df, kCFDateFormatterPMSymbol);
-            if (pmStr != NULL) {
-                CFStringGetCString(pmStr, buf, BUFLEN, kCFStringEncodingUTF8);
-                CFRelease(pmStr);
-                (*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewStringUTF(env, buf));
+            if (!(*env)->ExceptionCheck(env)){
+                CFStringRef pmStr = CFDateFormatterCopyProperty(df, kCFDateFormatterPMSymbol);
+                if (pmStr != NULL) {
+                    CFStringGetCString(pmStr, buf, BUFLEN, kCFStringEncodingUTF8);
+                    CFRelease(pmStr);
+                    tmp_string = (*env)->NewStringUTF(env, buf);
+                    if (tmp_string != NULL) {
+                        (*env)->SetObjectArrayElement(env, ampms, 1, tmp_string);
+                    }
+                }
             }
             CFRelease(df);
         }
@@ -647,10 +661,16 @@
 
 static void copyArrayElements(JNIEnv *env, CFArrayRef cfarray, jobjectArray jarray, CFIndex sindex, int dindex, int count) {
     char buf[BUFLEN];
+    jstring tmp_string;
 
     for (; count > 0; sindex++, dindex++, count--) {
         CFStringGetCString(CFArrayGetValueAtIndex(cfarray, sindex), buf, BUFLEN, kCFStringEncodingUTF8);
-        (*env)->SetObjectArrayElement(env, jarray, dindex, (*env)->NewStringUTF(env, buf));
+        tmp_string = (*env)->NewStringUTF(env, buf);
+        if (tmp_string != NULL) {
+            (*env)->SetObjectArrayElement(env, jarray, dindex, tmp_string);
+        } else {
+            break;
+        }
     }
 }
 
diff --git a/src/share/back/InterfaceTypeImpl.c b/src/share/back/InterfaceTypeImpl.c
new file mode 100644
index 0000000..f25d353
--- /dev/null
+++ b/src/share/back/InterfaceTypeImpl.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * 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 "util.h"
+#include "InterfaceTypeImpl.h"
+#include "inStream.h"
+#include "outStream.h"
+
+static jboolean
+invokeStatic(PacketInputStream *in, PacketOutputStream *out)
+{
+    return sharedInvoke(in, out);
+}
+
+void *InterfaceType_Cmds[] = { (void *)0x1
+    , (void *)invokeStatic
+};
diff --git a/src/share/back/InterfaceTypeImpl.h b/src/share/back/InterfaceTypeImpl.h
new file mode 100644
index 0000000..ff29000
--- /dev/null
+++ b/src/share/back/InterfaceTypeImpl.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+extern void *InterfaceType_Cmds[];
diff --git a/src/share/back/VirtualMachineImpl.c b/src/share/back/VirtualMachineImpl.c
index 34c4a17..e856392 100644
--- a/src/share/back/VirtualMachineImpl.c
+++ b/src/share/back/VirtualMachineImpl.c
@@ -36,7 +36,7 @@
 
 static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";
 static int majorVersion = 1;  /* JDWP major version */
-static int minorVersion = 6;  /* JDWP minor version */
+static int minorVersion = 8;  /* JDWP minor version */
 
 static jboolean
 version(PacketInputStream *in, PacketOutputStream *out)
diff --git a/src/share/back/debugDispatch.c b/src/share/back/debugDispatch.c
index 1b1c782..e9e8c0e 100644
--- a/src/share/back/debugDispatch.c
+++ b/src/share/back/debugDispatch.c
@@ -29,6 +29,7 @@
 #include "VirtualMachineImpl.h"
 #include "ReferenceTypeImpl.h"
 #include "ClassTypeImpl.h"
+#include "InterfaceTypeImpl.h"
 #include "ArrayTypeImpl.h"
 #include "FieldImpl.h"
 #include "MethodImpl.h"
@@ -67,6 +68,7 @@
     l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;
     l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;
+    l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;
 
     l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;
diff --git a/src/share/back/util.c b/src/share/back/util.c
index a043201..84f9b6e 100644
--- a/src/share/back/util.c
+++ b/src/share/back/util.c
@@ -591,6 +591,8 @@
         invokeType = INVOKE_CONSTRUCTOR;
     } else if (inStream_command(in) == JDWP_COMMAND(ClassType, InvokeMethod)) {
         invokeType = INVOKE_STATIC;
+    } else if (inStream_command(in) == JDWP_COMMAND(InterfaceType, InvokeMethod)) {
+        invokeType = INVOKE_STATIC;
     } else if (inStream_command(in) == JDWP_COMMAND(ObjectReference, InvokeMethod)) {
         invokeType = INVOKE_INSTANCE;
     } else {
diff --git a/src/share/bin/java.c b/src/share/bin/java.c
index ed45f08..4b16e8b 100644
--- a/src/share/bin/java.c
+++ b/src/share/bin/java.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
  */
 static void SetClassPath(const char *s);
 static void SelectVersion(int argc, char **argv, char **main_class);
+static void SetJvmEnvironment(int argc, char **argv);
 static jboolean ParseArguments(int *pargc, char ***pargv,
                                int *pmode, char **pwhat,
                                int *pret, const char *jrepath);
@@ -238,6 +239,10 @@
                                jvmpath, sizeof(jvmpath),
                                jvmcfg,  sizeof(jvmcfg));
 
+    if (!IsJavaArgs()) {
+        SetJvmEnvironment(argc,argv);
+    }
+
     ifn.CreateJavaVM = 0;
     ifn.GetDefaultJavaVMInitArgs = 0;
 
@@ -633,6 +638,67 @@
     return jvmtype;
 }
 
+/*
+ * static void SetJvmEnvironment(int argc, char **argv);
+ *   Is called just before the JVM is loaded.  We can set env variables
+ *   that are consumed by the JVM.  This function is non-destructive,
+ *   leaving the arg list intact.  The first use is for the JVM flag
+ *   -XX:NativeMemoryTracking=value.
+ */
+static void
+SetJvmEnvironment(int argc, char **argv) {
+
+    static const char*  NMT_Env_Name    = "NMT_LEVEL_";
+
+    int i;
+    for (i = 0; i < argc; i++) {
+        /*
+         * The following case checks for "-XX:NativeMemoryTracking=value".
+         * If value is non null, an environmental variable set to this value
+         * will be created to be used by the JVM.
+         * The argument is passed to the JVM, which will check validity.
+         * The JVM is responsible for removing the env variable.
+         */
+        char *arg = argv[i];
+        if (JLI_StrCCmp(arg, "-XX:NativeMemoryTracking=") == 0) {
+            int retval;
+            // get what follows this parameter, include "="
+            size_t pnlen = JLI_StrLen("-XX:NativeMemoryTracking=");
+            if (JLI_StrLen(arg) > pnlen) {
+                char* value = arg + pnlen;
+                size_t pbuflen = pnlen + JLI_StrLen(value) + 10; // 10 max pid digits
+
+                /*
+                 * ensures that malloc successful
+                 * DONT JLI_MemFree() pbuf.  JLI_PutEnv() uses system call
+                 *   that could store the address.
+                 */
+                char * pbuf = (char*)JLI_MemAlloc(pbuflen);
+
+                JLI_Snprintf(pbuf, pbuflen, "%s%d=%s", NMT_Env_Name, JLI_GetPid(), value);
+                retval = JLI_PutEnv(pbuf);
+                if (JLI_IsTraceLauncher()) {
+                    char* envName;
+                    char* envBuf;
+
+                    // ensures that malloc successful
+                    envName = (char*)JLI_MemAlloc(pbuflen);
+                    JLI_Snprintf(envName, pbuflen, "%s%d", NMT_Env_Name, JLI_GetPid());
+
+                    printf("TRACER_MARKER: NativeMemoryTracking: env var is %s\n",envName);
+                    printf("TRACER_MARKER: NativeMemoryTracking: putenv arg %s\n",pbuf);
+                    envBuf = getenv(envName);
+                    printf("TRACER_MARKER: NativeMemoryTracking: got value %s\n",envBuf);
+                    free(envName);
+                }
+
+            }
+
+        }
+
+    }
+}
+
 /* copied from HotSpot function "atomll()" */
 static int
 parse_size(const char *s, jlong *result) {
@@ -1182,11 +1248,13 @@
         (*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s);
         if (!(*env)->ExceptionOccurred(env)) {
             if (makePlatformStringMID == NULL) {
-                NULL_CHECK0(makePlatformStringMID = (*env)->GetStaticMethodID(env,
+                CHECK_JNI_RETURN_0(
+                    makePlatformStringMID = (*env)->GetStaticMethodID(env,
                         cls, "makePlatformString", "(Z[B)Ljava/lang/String;"));
             }
-            str = (*env)->CallStaticObjectMethod(env, cls,
-                    makePlatformStringMID, USE_STDERR, ary);
+            CHECK_JNI_RETURN_0(
+                str = (*env)->CallStaticObjectMethod(env, cls,
+                    makePlatformStringMID, USE_STDERR, ary));
             (*env)->DeleteLocalRef(env, ary);
             return str;
         }
@@ -1237,7 +1305,9 @@
                 "(ZILjava/lang/String;)Ljava/lang/Class;"));
 
     str = NewPlatformString(env, name);
-    result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
+    CHECK_JNI_RETURN_0(
+        result = (*env)->CallStaticObjectMethod(
+            env, cls, mid, USE_STDERR, mode, str));
 
     if (JLI_IsTraceLauncher()) {
         end   = CounterGet();
@@ -1804,20 +1874,48 @@
     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
     int data_size;
-    void *image_data;
+    void *image_data = NULL;
+    float scale_factor = 1;
+    char *scaled_splash_name = NULL;
+
+    if (file_name == NULL){
+        return;
+    }
+
+    scaled_splash_name = DoSplashGetScaledImageName(
+                        jar_name, file_name, &scale_factor);
     if (jar_name) {
-        image_data = JLI_JarUnpackFile(jar_name, file_name, &data_size);
+
+        if (scaled_splash_name) {
+            image_data = JLI_JarUnpackFile(
+                    jar_name, scaled_splash_name, &data_size);
+        }
+
+        if (!image_data) {
+            scale_factor = 1;
+            image_data = JLI_JarUnpackFile(
+                            jar_name, file_name, &data_size);
+        }
         if (image_data) {
             DoSplashInit();
+            DoSplashSetScaleFactor(scale_factor);
             DoSplashLoadMemory(image_data, data_size);
             JLI_MemFree(image_data);
         }
-    } else if (file_name) {
-        DoSplashInit();
-        DoSplashLoadFile(file_name);
     } else {
-        return;
+        DoSplashInit();
+        if (scaled_splash_name) {
+            DoSplashSetScaleFactor(scale_factor);
+            DoSplashLoadFile(scaled_splash_name);
+        } else {
+            DoSplashLoadFile(file_name);
+        }
     }
+
+    if (scaled_splash_name) {
+        JLI_MemFree(scaled_splash_name);
+    }
+
     DoSplashSetFileJarName(file_name, jar_name);
 
     /*
diff --git a/src/share/bin/java.h b/src/share/bin/java.h
index 83e97e6..43450d8 100644
--- a/src/share/bin/java.h
+++ b/src/share/bin/java.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,4 +256,47 @@
 #define NULL_CHECK(NC_check_pointer) \
     NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
 
+/*
+ * For JNI calls :
+ *  - check for thrown exceptions
+ *  - check for null return
+ *
+ *  JNI calls can return null and/or throw an exception.  Check for these.
+ *
+ *  : CHECK_JNI_RETURN_EXCEPTION()
+ *    return the specified RETURNVALUE if exception was generated
+ *  : CHECK_JNI_RETURN_0(JNISTATEMENT)        : check if JNISTATEMENT was successful, return 0 if not
+ *  : CHECK_JNI_RETURN_VOID(JNISTATEMENT)     : check if JNISTATEMENT was successful, return void if not
+ *  : CHECK_JNI_RETURN_VALUE(JNISTATEMENT,n)  : check if JNISTATEMENT was successful, return n if not
+ *
+ *  These macros need at least one parameter, the JNI statement [ JNISTATEMENT ].
+ *
+ *  E.G.: check the JNI statement, and specify a value to return if a failure was detected.
+ *
+ *      CHECK_JNI_RETURN_VALUE(str = (*env)->CallStaticObjectMethod(env, cls,
+ *                                               makePlatformStringMID, USE_STDERR, ary), -1);
+ */
+
+#define RETURNVOID return
+#define RETURN0 return 0
+#define RETURN(N) return (N)
+
+#define CHECK_JNI_RETURN_EXCEPTION(RETURNVALUE) \
+        if ((((*env)->ExceptionOccurred(env))!=NULL)) { \
+            RETURNVALUE; \
+        }
+
+#define CHECK_JNI_RETURN_0(JNISTATEMENT) \
+    CHECK_JNI_RETURN_EXCEPTION(RETURN0); \
+    NULL_CHECK0(JNISTATEMENT);
+
+#define CHECK_JNI_RETURN_VOID(JNISTATEMENT) \
+    CHECK_JNI_RETURN_EXCEPTION(RETURNVOID); \
+    NULL_CHECK(JNISTATEMENT);
+
+#define CHECK_JNI_RETURN_VALUE(JNISTATEMENT, NCRV_return_value) \
+    CHECK_JNI_RETURN_EXCEPTION(RETURN(NCRV_return_value)); \
+    NULL_CHECK_RETURN_VALUE(JNISTATEMENT, NCRV_return_value);
+
+
 #endif /* _JAVA_H_ */
diff --git a/src/share/bin/jli_util.h b/src/share/bin/jli_util.h
index d3c9f0f..5799722 100644
--- a/src/share/bin/jli_util.h
+++ b/src/share/bin/jli_util.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,17 +64,22 @@
 #ifdef _WIN32
 #include <windows.h>
 #include <io.h>
+#include <process.h>
 #define JLI_StrCaseCmp(p1, p2)          stricmp((p1), (p2))
 #define JLI_StrNCaseCmp(p1, p2, p3)     strnicmp((p1), (p2), (p3))
 int  JLI_Snprintf(char *buffer, size_t size, const char *format, ...);
 void JLI_CmdToArgs(char *cmdline);
 #define JLI_Lseek                       _lseeki64
+#define JLI_PutEnv                      _putenv
+#define JLI_GetPid                      _getpid
 #else  /* NIXES */
 #include <unistd.h>
 #include <strings.h>
 #define JLI_StrCaseCmp(p1, p2)          strcasecmp((p1), (p2))
 #define JLI_StrNCaseCmp(p1, p2, p3)     strncasecmp((p1), (p2), (p3))
 #define JLI_Snprintf                    snprintf
+#define JLI_PutEnv                      putenv
+#define JLI_GetPid                      getpid
 #ifdef __solaris__
 #define JLI_Lseek                       llseek
 #endif
diff --git a/src/share/bin/splashscreen.h b/src/share/bin/splashscreen.h
index da64bf6..3afd68c 100644
--- a/src/share/bin/splashscreen.h
+++ b/src/share/bin/splashscreen.h
@@ -29,3 +29,6 @@
 void    DoSplashInit(void);
 void    DoSplashClose(void);
 void    DoSplashSetFileJarName(const char* fileName, const char* jarName);
+void    DoSplashSetScaleFactor(float scaleFactor);
+char*   DoSplashGetScaledImageName(const char* jarName, const char* fileName,
+                                    float* scaleFactor);
diff --git a/src/share/bin/splashscreen_stubs.c b/src/share/bin/splashscreen_stubs.c
index 1ceee65..9c1f514 100644
--- a/src/share/bin/splashscreen_stubs.c
+++ b/src/share/bin/splashscreen_stubs.c
@@ -37,6 +37,9 @@
 typedef void (*SplashClose_t)(void);
 typedef void (*SplashSetFileJarName_t)(const char* fileName,
                                        const char* jarName);
+typedef void (*SplashSetScaleFactor_t)(float scaleFactor);
+typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
+                        const char* jarName, float* scaleFactor);
 
 /*
  * This macro invokes a function from the shared lib.
@@ -58,11 +61,11 @@
 #define INVOKEV(name) _INVOKE(name, ,;)
 
 int     DoSplashLoadMemory(void* pdata, int size) {
-    INVOKE(SplashLoadMemory,0)(pdata, size);
+    INVOKE(SplashLoadMemory, NULL)(pdata, size);
 }
 
 int     DoSplashLoadFile(const char* filename) {
-    INVOKE(SplashLoadFile,0)(filename);
+    INVOKE(SplashLoadFile, NULL)(filename);
 }
 
 void    DoSplashInit(void) {
@@ -76,3 +79,12 @@
 void    DoSplashSetFileJarName(const char* fileName, const char* jarName) {
     INVOKEV(SplashSetFileJarName)(fileName, jarName);
 }
+
+void    DoSplashSetScaleFactor(float scaleFactor) {
+    INVOKEV(SplashSetScaleFactor)(scaleFactor);
+}
+
+char*    DoSplashGetScaledImageName(const char* fileName, const char* jarName,
+                                    float* scaleFactor) {
+    INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
+}
\ No newline at end of file
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java b/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
index 8d3db22..7256970 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
@@ -1254,8 +1254,11 @@
             if (name.equals("IHDR")) {
                 IHDR_width = getIntAttribute(node, "width");
                 IHDR_height = getIntAttribute(node, "height");
-                IHDR_bitDepth = getEnumeratedAttribute(node, "bitDepth",
-                                                       IHDR_bitDepths);
+                IHDR_bitDepth =
+                        Integer.valueOf(IHDR_bitDepths[
+                                getEnumeratedAttribute(node,
+                                                    "bitDepth",
+                                                    IHDR_bitDepths)]);
                 IHDR_colorType = getEnumeratedAttribute(node, "colorType",
                                                         IHDR_colorTypeNames);
                 IHDR_compressionMethod =
diff --git a/src/share/classes/com/sun/jarsigner/ContentSigner.java b/src/share/classes/com/sun/jarsigner/ContentSigner.java
index 1a29bf7..0446ab4 100644
--- a/src/share/classes/com/sun/jarsigner/ContentSigner.java
+++ b/src/share/classes/com/sun/jarsigner/ContentSigner.java
@@ -37,6 +37,7 @@
  * @author Vincent Ryan
  */
 
+@jdk.Exported
 public abstract class ContentSigner {
 
     /**
diff --git a/src/share/classes/com/sun/jarsigner/package-info.java b/src/share/classes/com/sun/jarsigner/package-info.java
new file mode 100644
index 0000000..554d4c7
--- /dev/null
+++ b/src/share/classes/com/sun/jarsigner/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * This package comprises the interfaces and classes used to define the
+ * signing mechanism used by the <tt>jarsigner</tt> tool.
+ * <p>
+ * Clients may override the default signing mechanism of the <tt>jarsigner</tt>
+ * tool by supplying an alternative implementation of
+ * {@link com.sun.jarsigner.ContentSigner}.
+ */
+
+@jdk.Exported
+package com.sun.jarsigner;
diff --git a/src/share/classes/com/sun/jarsigner/package.html b/src/share/classes/com/sun/jarsigner/package.html
deleted file mode 100644
index b00d655..0000000
--- a/src/share/classes/com/sun/jarsigner/package.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html>
-<!--
- 
-Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-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.
--->
-  <head>
-    <title>Jarsigner Signing Mechanism Package</title>
-  </head>   
-  <body>
-This package comprises the interfaces and classes used to define the
-signing mechanism used by the <tt>jarsigner</tt> tool.
-<p>
-Clients may override the default signing mechanism of the <tt>jarsigner</tt>
-tool by supplying an alternative implementation of 
-{@link com.sun.jarsigner.ContentSigner}.
-  </body>
-</html>
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java b/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
index 8fec402..70edf60 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -130,11 +130,14 @@
                     //one second seems plausible value
                     duration = 1000;
                 } else {
-                     duration = XPStyle.getXP().getThemeTransitionDuration(
-                           c, part,
-                           normalizeState(oldState),
-                           normalizeState(newState),
-                           Prop.TRANSITIONDURATIONS);
+                    XPStyle xp = XPStyle.getXP();
+                    duration = (xp != null)
+                               ? xp.getThemeTransitionDuration(
+                                       c, part,
+                                       normalizeState(oldState),
+                                       normalizeState(newState),
+                                       Prop.TRANSITIONDURATIONS)
+                               : 1000;
                 }
                 controller.startAnimation(c, part, oldState, newState, duration);
             }
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
index 2656d1d..d708d00 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
 import static com.sun.java.swing.plaf.windows.TMSchema.State;
 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
+
 import sun.swing.DefaultLookup;
 import sun.swing.StringUIClientPropertyKey;
 
@@ -231,6 +232,9 @@
 
     private void paintXPComboBoxBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         State state = getXPComboBoxState(c);
         Skin skin = null;
         if (! comboBox.isEditable()
@@ -400,17 +404,18 @@
      * @return a button which represents the popup control
      */
     protected JButton createArrowButton() {
-        if (XPStyle.getXP() != null) {
-            return new XPComboBoxButton();
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null) {
+            return new XPComboBoxButton(xp);
         } else {
             return super.createArrowButton();
         }
     }
 
     private class XPComboBoxButton extends XPStyle.GlyphButton {
-        public XPComboBoxButton() {
+        public XPComboBoxButton(XPStyle xp) {
             super(null,
-                  (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+                  (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
                    ? Part.CP_DROPDOWNBUTTON
                    : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
                      ? Part.CP_DROPDOWNBUTTONLEFT
@@ -423,10 +428,11 @@
         protected State getState() {
             State rv;
             rv = super.getState();
+            XPStyle xp = XPStyle.getXP();
             if (rv != State.DISABLED
                 && comboBox != null && ! comboBox.isEditable()
-                && XPStyle.getXP().isSkinDefined(comboBox,
-                                                 Part.CP_DROPDOWNBUTTONRIGHT)) {
+                && xp != null && xp.isSkinDefined(comboBox,
+                                                  Part.CP_DROPDOWNBUTTONRIGHT)) {
                 /*
                  * for non editable ComboBoxes Vista seems to have the
                  * same glyph for all non DISABLED states
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
index 63eb27b..8e16806 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,6 +125,9 @@
     static void paintXPText(AbstractButton b, Part part, State state,
             Graphics g, int x, int y, String text, int mnemIndex) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Color textColor = b.getForeground();
 
         if (textColor instanceof UIResource) {
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
index 3bc26eb..90bdc92 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
@@ -613,8 +613,8 @@
 
     private static class MenuArrowIcon implements Icon, UIResource, Serializable {
         public void paintIcon(Component c, Graphics g, int x, int y) {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                XPStyle xp = XPStyle.getXP();
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
                 State state = State.NORMAL;
                 if (c instanceof JMenuItem) {
                     state = ((JMenuItem) c).getModel().isEnabled()
@@ -647,16 +647,18 @@
             }
         }
         public int getIconWidth() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getWidth();
             } else {
                 return 4;
             }
         }
         public int getIconHeight() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getHeight();
             } else {
                 return 8;
@@ -682,7 +684,8 @@
         }
 
         static int getIconWidth() {
-            return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
+            XPStyle xp = XPStyle.getXP();
+            return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
                 + 2 * OFFSET;
         }
 
@@ -745,12 +748,17 @@
                 Icon icon = getIcon();
                 int height = 0;
                 if (icon != null) {
-                    height = icon.getIconHeight() + 2 * OFFSET;
+                    height = icon.getIconHeight();
                 } else {
-                    Skin skin =
-                        XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
-                    height = skin.getHeight() + 2 * OFFSET;
+                    XPStyle xp = XPStyle.getXP();
+                    if (xp != null) {
+                        Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
+                        height = skin.getHeight();
+                    } else {
+                        height = 16;
+                    }
                 }
+                height +=  2 * OFFSET;
                 return height;
             }
 
@@ -798,14 +806,16 @@
                                   ? State.BULLETDISABLED
                                   : State.CHECKMARKDISABLED;
                         }
-                        Skin skin;
                         XPStyle xp = XPStyle.getXP();
-                        skin =  xp.getSkin(c, backgroundPart);
-                        skin.paintSkin(g, x, y,
-                            getIconWidth(), getIconHeight(), backgroundState);
-                        if (icon == null) {
-                            skin = xp.getSkin(c, part);
-                            skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                        if (xp != null) {
+                            Skin skin;
+                            skin =  xp.getSkin(c, backgroundPart);
+                            skin.paintSkin(g, x, y,
+                                getIconWidth(), getIconHeight(), backgroundState);
+                            if (icon == null) {
+                                skin = xp.getSkin(c, part);
+                                skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                            }
                         }
                     }
                 }
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
index d3ccff2..7ff9129 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,14 +85,15 @@
             }
         } else {
             buttonWidth += 2;
-            selectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.activeTitleGradient");
-            notSelectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.inactiveTitleGradient");
             Color activeBorderColor =
                     UIManager.getColor("InternalFrame.activeBorderColor");
             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
         }
+        // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
+        selectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.activeTitleGradient");
+        notSelectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.inactiveTitleGradient");
     }
 
     protected void uninstallListeners() {
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
index d063e23..66838fe 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
@@ -2399,8 +2399,9 @@
         }
 
         public Object getXPValue(UIDefaults table) {
-            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
-            if (extraMargin != null) {
+            XPStyle xp = XPStyle.getXP();
+            Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
+            if (xpBorder != null && extraMargin != null) {
                 return new BorderUIResource.
                         CompoundBorderUIResource(xpBorder, extraMargin);
             } else {
@@ -2416,7 +2417,8 @@
 
         public Object getXPValue(UIDefaults table) {
             XPColorValueKey key = (XPColorValueKey)xpValue;
-            return XPStyle.getXP().getColor(key.skin, key.prop, null);
+            XPStyle xp = XPStyle.getXP();
+            return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
         }
 
         private static class XPColorValueKey {
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
index c56b83b..b55a01c 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
@@ -155,8 +155,8 @@
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             Skin skin;
             skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
             int width = c.getWidth();
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
index cac7af5..dddbeeb 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,8 +108,9 @@
 
     static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
             Graphics g, JMenuItem menuItem, Color bgColor) {
-        assert isVistaPainting();
-        if (isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        assert isVistaPainting(xp);
+        if (isVistaPainting(xp)) {
             int menuWidth = menuItem.getWidth();
             int menuHeight = menuItem.getHeight();
             if (menuItem.isOpaque()) {
@@ -118,7 +119,6 @@
                 g.fillRect(0,0, menuWidth, menuHeight);
                 g.setColor(oldColor);
             }
-            XPStyle xp = XPStyle.getXP();
             Part part = menuItemUI.getPart(menuItem);
             Skin skin = xp.getSkin(menuItem, part);
             skin.paintSkin(g, 0 , 0,
@@ -170,8 +170,11 @@
      * is it possible that in some theme some Vista parts are not defined while
      * others are?
      */
-    static boolean isVistaPainting() {
-        XPStyle xp = XPStyle.getXP();
+    static boolean isVistaPainting(final XPStyle xp) {
         return xp != null && xp.isSkinDefined(null, Part.MP_POPUPITEM);
     }
+
+    static boolean isVistaPainting() {
+        return isVistaPainting(XPStyle.getXP());
+    }
 }
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
index 797aa5a..f040812 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,8 @@
 
     public void paint(Graphics g, JComponent c) {
         Dimension s = c.getSize();
-        if (WindowsMenuItemUI.isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             int x = 1;
             Component parent = c.getParent();
             if (parent instanceof JComponent) {
@@ -67,7 +68,7 @@
                     x += WindowsPopupMenuUI.getGutterWidth();
                 }
             }
-            Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
+            Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
             int skinHeight = skin.getHeight();
             int y = (s.height - skinHeight) / 2;
             skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
index 584641b..06dde67 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,8 +194,8 @@
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
             skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
             int textOffset = getTextOffset(c);
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
index ef5d176..45947fc 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -322,8 +322,9 @@
     private Rectangle getFullChunkBounds(Rectangle box) {
         boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
         XPStyle xp = XPStyle.getXP();
-        int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
-                            Prop.PROGRESSSPACESIZE, 0);
+        int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
+                                           null, Prop.PROGRESSSPACESIZE, 0)
+                               : 0;
 
         if (!vertical) {
             int chunksize = box.width+gap;
@@ -338,6 +339,9 @@
                                           boolean vertical,
                                           int bgwidth, int bgheight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
 
         // create a new graphics to keep drawing surface state
         Graphics2D gfx = (Graphics2D)g.create();
@@ -396,6 +400,9 @@
     private void paintXPBackground(Graphics g, boolean vertical,
                                    int barRectWidth, int barRectHeight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
         Skin skin = xp.getSkin(progressBar, part);
 
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
index dbfb7b8..1bae3f8 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -215,7 +215,6 @@
     }
 
     private Part getXPThumbPart() {
-        XPStyle xp = XPStyle.getXP();
         Part part;
         boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
         boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
index ccc6d03..c17328e 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,9 @@
 
     private void paintXPBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Skin skin = xp.getSkin(c, Part.EP_EDIT);
         State state = getXPState(c);
         skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
index 391f019..e667c05 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
@@ -90,9 +90,10 @@
             this.column = column;
             this.hasRollover = (column == getRolloverColumn());
             if (skin == null) {
-                skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
+                XPStyle xp = XPStyle.getXP();
+                skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
             }
-            Insets margins = skin.getContentMargin();
+            Insets margins = (skin != null) ? skin.getContentMargin() : null;
             Border border = null;
             int contentTop = 0;
             int contentLeft = 0;
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
index 7379533..72cf925 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
@@ -115,7 +115,7 @@
                 }
             }
         }
-        return xp;
+        return ThemeReader.isXPStyleEnabled() ? xp : null;
     }
 
     static boolean isVista() {
@@ -180,9 +180,10 @@
      * should probably be cached there instead of here.
      */
     Dimension getDimension(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
-                                       State.getValue(part, state),
-                                       prop.getValue());
+        Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+                                              State.getValue(part, state),
+                                              prop.getValue());
+        return (d != null) ? d : new Dimension();
     }
 
     /** Get a named <code>Point</code> (e.g. a location or an offset) value
@@ -199,11 +200,7 @@
         Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
                                               State.getValue(part, state),
                                               prop.getValue());
-        if (d != null) {
-            return new Point(d.width, d.height);
-        } else {
-            return null;
-        }
+        return (d != null) ? new Point(d.width, d.height) : new Point();
     }
 
     /** Get a named <code>Insets</code> value from the current style
@@ -217,9 +214,10 @@
      * The return value is already cached in those places.
      */
     Insets getMargin(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
-                                           State.getValue(part, state),
-                                           prop.getValue());
+        Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+                                                    State.getValue(part, state),
+                                                    prop.getValue());
+        return (insets != null) ? insets : new Insets(0, 0, 0, 0);
     }
 
 
@@ -505,16 +503,17 @@
             int boundingWidth = 100;
             int boundingHeight = 100;
 
-            return ThemeReader.getThemeBackgroundContentMargins(
+            Insets insets = ThemeReader.getThemeBackgroundContentMargins(
                 part.getControlName(null), part.getValue(),
                 0, boundingWidth, boundingHeight);
+            return (insets != null) ? insets : new Insets(0, 0, 0, 0);
         }
 
         private int getWidth(State state) {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.width;
+            return (size != null) ? size.width : 0;
         }
 
         int getWidth() {
@@ -525,7 +524,7 @@
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.height;
+            return (size != null) ? size.height : 0;
         }
 
         int getHeight() {
@@ -582,6 +581,9 @@
          * @param state which state to paint
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             if (ThemeReader.isGetThemeTransitionDurationDefined()
                   && component instanceof JComponent
                   && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -607,6 +609,9 @@
          * @param state which state to paint
          */
         void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
         }
 
@@ -625,6 +630,9 @@
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
                 boolean borderFill) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
                     state, Prop.BGTYPE))) {
                 return;
@@ -679,7 +687,7 @@
 
         public GlyphButton(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             setBorder(null);
             setContentAreaFilled(false);
             setMinimumSize(new Dimension(5, 5));
@@ -704,13 +712,16 @@
         }
 
         public void paintComponent(Graphics g) {
+            if (XPStyle.getXP() == null || skin == null) {
+                return;
+            }
             Dimension d = getSize();
             skin.paintSkin(g, 0, 0, d.width, d.height, getState());
         }
 
         public void setPart(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             revalidate();
             repaint();
         }
diff --git a/src/share/classes/com/sun/jdi/ClassType.java b/src/share/classes/com/sun/jdi/ClassType.java
index 919f3ab..296f2e7 100644
--- a/src/share/classes/com/sun/jdi/ClassType.java
+++ b/src/share/classes/com/sun/jdi/ClassType.java
@@ -103,7 +103,7 @@
      * <p>
      * Object values must be assignment compatible with the field type
      * (This implies that the field type must be loaded through the
-     * enclosing class's class loader). Primitive values must be
+     * enclosing class' class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
      * See JLS section 5.2 for more information on assignment
@@ -153,7 +153,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -216,7 +216,7 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this class or a superclass, if the size of the argument list
-     * does not match the number of declared arguemnts for the method, or
+     * does not match the number of declared arguments for the method, or
      * if the method is an initializer, constructor or static intializer.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
@@ -230,7 +230,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
@@ -267,7 +267,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -335,7 +335,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
diff --git a/src/share/classes/com/sun/jdi/InterfaceType.java b/src/share/classes/com/sun/jdi/InterfaceType.java
index 3b2790a..9436e48 100644
--- a/src/share/classes/com/sun/jdi/InterfaceType.java
+++ b/src/share/classes/com/sun/jdi/InterfaceType.java
@@ -79,4 +79,123 @@
      * If none exist, returns a zero length List.
      */
     List<ClassType> implementors();
+
+    /**
+     * Invokes the specified static {@link Method} in the
+     * target VM. The
+     * specified method must be defined in this interface.
+     * The method must be a static method
+     * but not a static initializer.
+     * <p>
+     * The method invocation will occur in the specified thread.
+     * Method invocation can occur only if the specified thread
+     * has been suspended by an event which occurred in that thread.
+     * Method invocation is not supported
+     * when the target VM has been suspended through
+     * {@link VirtualMachine#suspend} or when the specified thread
+     * is suspended through {@link ThreadReference#suspend}.
+     * <p>
+     * The specified method is invoked with the arguments in the specified
+     * argument list.  The method invocation is synchronous; this method
+     * does not return until the invoked method returns in the target VM.
+     * If the invoked method throws an exception, this method will throw
+     * an {@link InvocationException} which contains a mirror to the exception
+     * object thrown.
+     * <p>
+     * Object arguments must be assignment compatible with the argument type
+     * (This implies that the argument type must be loaded through the
+     * enclosing class' class loader). Primitive arguments must be
+     * either assignment compatible with the argument type or must be
+     * convertible to the argument type without loss of information.
+     * If the method being called accepts a variable number of arguments,
+     * then the last argument type is an array of some component type.
+     * The argument in the matching position can be omitted, or can be null,
+     * an array of the same component type, or an argument of the
+     * component type followed by any number of other arguments of the same
+     * type. If the argument is omitted, then a 0 length array of the
+     * component type is passed.  The component type can be a primitive type.
+     * Autoboxing is not supported.
+     *
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for more information on assignment compatibility.
+     * <p>
+     * By default, all threads in the target VM are resumed while
+     * the method is being invoked if they were previously
+     * suspended by an event or by {@link VirtualMachine#suspend} or
+     * {@link ThreadReference#suspend}. This is done to prevent the deadlocks
+     * that will occur if any of the threads own monitors
+     * that will be needed by the invoked method.
+     * Note, however, that this implicit resume acts exactly like
+     * {@link ThreadReference#resume}, so if the thread's suspend
+     * count is greater than 1, it will remain in a suspended state
+     * during the invocation and thus a deadlock could still occur.
+     * By default, when the invocation completes,
+     * all threads in the target VM are suspended, regardless their state
+     * before the invocation.
+     * It is possible that
+     * breakpoints or other events might occur during the invocation.
+     * This can cause deadlocks as described above. It can also cause a deadlock
+     * if invokeMethod is called from the client's event handler thread.  In this
+     * case, this thread will be waiting for the invokeMethod to complete and
+     * won't read the EventSet that comes in for the new event.  If this
+     * new EventSet is SUSPEND_ALL, then a deadlock will occur because no
+     * one will resume the EventSet.  To avoid this, all EventRequests should
+     * be disabled before doing the invokeMethod, or the invokeMethod should
+     * not be done from the client's event handler thread.
+     * <p>
+     * The resumption of other threads during the invocation can be prevented
+     * by specifying the {@link #INVOKE_SINGLE_THREADED}
+     * bit flag in the <code>options</code> argument; however,
+     * there is no protection against or recovery from the deadlocks
+     * described above, so this option should be used with great caution.
+     * Only the specified thread will be resumed (as described for all
+     * threads above). Upon completion of a single threaded invoke, the invoking thread
+     * will be suspended once again. Note that any threads started during
+     * the single threaded invocation will not be suspended when the
+     * invocation completes.
+     * <p>
+     * If the target VM is disconnected during the invoke (for example, through
+     * {@link VirtualMachine#dispose}) the method invocation continues.
+     *
+     * @param thread the thread in which to invoke.
+     * @param method the {@link Method} to invoke.
+     * @param arguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this interface, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class' class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     *
+     * @since 1.8
+     */
+    default Value invokeMethod(ThreadReference thread, Method method,
+                       List<? extends Value> arguments, int options)
+            throws InvalidTypeException,
+            ClassNotLoadedException,
+            IncompatibleThreadStateException,
+            InvocationException {
+        throw new UnsupportedOperationException();
+    }
 }
diff --git a/src/share/classes/com/sun/jdi/Method.java b/src/share/classes/com/sun/jdi/Method.java
index 19b13e0..eb81b05 100644
--- a/src/share/classes/com/sun/jdi/Method.java
+++ b/src/share/classes/com/sun/jdi/Method.java
@@ -138,6 +138,18 @@
     boolean isAbstract();
 
     /**
+     * Determine if this method is a default method
+     *
+     * @return <code>true</code> if the method is declared default;
+     * false otherwise
+     *
+     * @since 1.8
+     */
+    default boolean isDefault() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
      * Determine if this method is synchronized.
      *
      * @return <code>true</code> if the method is declared synchronized;
diff --git a/src/share/classes/com/sun/jdi/ObjectReference.java b/src/share/classes/com/sun/jdi/ObjectReference.java
index 797d5ad..b6bf5a3 100644
--- a/src/share/classes/com/sun/jdi/ObjectReference.java
+++ b/src/share/classes/com/sun/jdi/ObjectReference.java
@@ -194,10 +194,10 @@
      * {@link #INVOKE_NONVIRTUAL} bit flag in the <code>options</code>
      * argument. If this flag is set, the specified method is invoked
      * whether or not it is overridden for this object's runtime type.
-     * The method, in this case, must not belong to an interface and
-     * must not be abstract. This option is useful for performing method
-     * invocations like those done with the <code>super</code> keyword in
-     * the Java programming language.
+     * The method, in this case, must have an implementation, either in a class
+     * or an interface. This option is useful for performing method invocations
+     * like those done with the <code>super</code> keyword in the Java programming
+     * language.
      * <p>
      * By default, all threads in the target VM are resumed while
      * the method is being invoked if they were previously
@@ -246,10 +246,10 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this object's class, if the size of the argument list
-     * does not match the number of declared arguemnts for the method,
+     * does not match the number of declared arguments for the method,
      * if the method is a constructor or static intializer, or
      * if {@link #INVOKE_NONVIRTUAL} is specified and the method is
-     * either abstract or an interface member.
+     * either abstract or a non-default interface member.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
      * type.
diff --git a/src/share/classes/com/sun/jndi/ldap/Connection.java b/src/share/classes/com/sun/jndi/ldap/Connection.java
index d41c944..c5a957c 100644
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java
@@ -111,6 +111,7 @@
 
     private static final boolean debug = false;
     private static final int dump = 0; // > 0 r, > 1 rw
+    public static final long DEFAULT_READ_TIMEOUT_MILLIS = 15 * 1000; // 15 second timeout;
 
 
     final private Thread worker;    // Initialized in constructor
@@ -460,7 +461,7 @@
                             // available
                             ldr.wait(readTimeout);
                         } else {
-                            ldr.wait(15 * 1000); // 15 second timeout
+                            ldr.wait(DEFAULT_READ_TIMEOUT_MILLIS);
                         }
                         waited = true;
                     } else {
diff --git a/src/share/classes/com/sun/media/sound/JDK13Services.java b/src/share/classes/com/sun/media/sound/JDK13Services.java
index 9f19a87..f463e11 100644
--- a/src/share/classes/com/sun/media/sound/JDK13Services.java
+++ b/src/share/classes/com/sun/media/sound/JDK13Services.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package com.sun.media.sound;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -176,11 +178,11 @@
                 && !Sequencer.class.equals(typeClass)) {
             return null;
         }
-        String value;
-        String propertyName = typeClass.getName();
-        value = JSSecurityManager.getProperty(propertyName);
+        String name = typeClass.getName();
+        String value = AccessController.doPrivileged(
+                (PrivilegedAction<String>) () -> System.getProperty(name));
         if (value == null) {
-            value = getProperties().getProperty(propertyName);
+            value = getProperties().getProperty(name);
         }
         if ("".equals(value)) {
             value = null;
diff --git a/src/share/classes/com/sun/media/sound/JSSecurityManager.java b/src/share/classes/com/sun/media/sound/JSSecurityManager.java
index 60549a7..6614b08 100644
--- a/src/share/classes/com/sun/media/sound/JSSecurityManager.java
+++ b/src/share/classes/com/sun/media/sound/JSSecurityManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,33 +73,6 @@
         }
     }
 
-    static String getProperty(final String propertyName) {
-        String propertyValue;
-        if (hasSecurityManager()) {
-            if(Printer.debug) Printer.debug("using JDK 1.2 security to get property");
-            try{
-                PrivilegedAction<String> action = new PrivilegedAction<String>() {
-                        public String run() {
-                            try {
-                                return System.getProperty(propertyName);
-                            } catch (Throwable t) {
-                                return null;
-                            }
-                        }
-                    };
-                propertyValue = AccessController.doPrivileged(action);
-            } catch( Exception e ) {
-                if(Printer.debug) Printer.debug("not using JDK 1.2 security to get properties");
-                propertyValue = System.getProperty(propertyName);
-            }
-        } else {
-            if(Printer.debug) Printer.debug("not using JDK 1.2 security to get properties");
-            propertyValue = System.getProperty(propertyName);
-        }
-        return propertyValue;
-    }
-
-
     /** Load properties from a file.
         This method tries to load properties from the filename give into
         the passed properties object.
diff --git a/src/share/classes/com/sun/media/sound/Platform.java b/src/share/classes/com/sun/media/sound/Platform.java
index 766e485..493aa7e 100644
--- a/src/share/classes/com/sun/media/sound/Platform.java
+++ b/src/share/classes/com/sun/media/sound/Platform.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,17 +74,6 @@
     // intel is little-endian.  sparc is big-endian.
     private static boolean bigEndian;
 
-    // this is the value of the "java.home" system property.  i am looking it up here
-    // for use when trying to load the soundbank, just so
-    // that all the privileged code is localized in this file....
-    private static String javahome;
-
-    // this is the value of the "java.class.path" system property
-    private static String classpath;
-
-
-
-
     static {
         if(Printer.trace)Printer.trace(">> Platform.java: static");
 
@@ -129,26 +118,6 @@
         return signed8;
     }
 
-
-    /**
-     * Obtain javahome.
-     * $$kk: 04.16.99: this is *bad*!!
-     */
-    static String getJavahome() {
-
-        return javahome;
-    }
-
-    /**
-     * Obtain classpath.
-     * $$jb: 04.21.99: this is *bad* too!!
-     */
-    static String getClasspath() {
-
-        return classpath;
-    }
-
-
     // PRIVATE METHODS
 
     /**
@@ -157,21 +126,13 @@
     private static void loadLibraries() {
         if(Printer.trace)Printer.trace(">>Platform.loadLibraries");
 
-        try {
-            // load the main library
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                @Override
-                public Void run() {
-                    System.loadLibrary(libNameMain);
-                    return null;
-                }
-            });
-            // just for the heck of it...
-            loadedLibs |= LIB_MAIN;
-        } catch (SecurityException e) {
-            if(Printer.err)Printer.err("Security exception loading main native library.  JavaSound requires access to these resources.");
-            throw(e);
-        }
+        // load the main library
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            System.loadLibrary(libNameMain);
+            return null;
+        });
+        // just for the heck of it...
+        loadedLibs |= LIB_MAIN;
 
         // now try to load extra libs. They are defined at compile time in the Makefile
         // with the define EXTRA_SOUND_JNI_LIBS
@@ -181,12 +142,9 @@
         while (st.hasMoreTokens()) {
             final String lib = st.nextToken();
             try {
-                AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                    @Override
-                    public Void run() {
-                        System.loadLibrary(lib);
-                        return null;
-                    }
+                AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                    System.loadLibrary(lib);
+                    return null;
                 });
 
                 if (lib.equals(libNameALSA)) {
@@ -239,7 +197,5 @@
         // $$fb 2002-03-06: implement check for endianness in native. Facilitates porting !
         bigEndian = nIsBigEndian();
         signed8 = nIsSigned8(); // Solaris on Sparc: signed, all others unsigned
-        javahome = JSSecurityManager.getProperty("java.home");
-        classpath = JSSecurityManager.getProperty("java.class.path");
     }
 }
diff --git a/src/share/classes/com/sun/media/sound/RIFFReader.java b/src/share/classes/com/sun/media/sound/RIFFReader.java
index 7969a5d..c307738 100644
--- a/src/share/classes/com/sun/media/sound/RIFFReader.java
+++ b/src/share/classes/com/sun/media/sound/RIFFReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,21 +39,20 @@
     private long filepointer = 0;
     private final String fourcc;
     private String riff_type = null;
-    private long ckSize = 0;
+    private long ckSize = Integer.MAX_VALUE;
     private InputStream stream;
-    private long avail;
+    private long avail = Integer.MAX_VALUE;
     private RIFFReader lastiterator = null;
 
     public RIFFReader(InputStream stream) throws IOException {
 
-        if (stream instanceof RIFFReader)
-            root = ((RIFFReader)stream).root;
-        else
+        if (stream instanceof RIFFReader) {
+            root = ((RIFFReader) stream).root;
+        } else {
             root = this;
+        }
 
         this.stream = stream;
-        avail = Integer.MAX_VALUE;
-        ckSize = Integer.MAX_VALUE;
 
         // Check for RIFF null paddings,
         int b;
@@ -76,10 +75,12 @@
         readFully(fourcc, 1, 3);
         this.fourcc = new String(fourcc, "ascii");
         ckSize = readUnsignedInt();
-
-        avail = this.ckSize;
+        avail = ckSize;
 
         if (getFormat().equals("RIFF") || getFormat().equals("LIST")) {
+            if (avail > Integer.MAX_VALUE) {
+                throw new RIFFInvalidDataException("Chunk size too big");
+            }
             byte[] format = new byte[4];
             readFully(format);
             this.riff_type = new String(format, "ascii");
@@ -118,19 +119,23 @@
     }
 
     public int read() throws IOException {
-        if (avail == 0)
+        if (avail == 0) {
             return -1;
+        }
         int b = stream.read();
-        if (b == -1)
+        if (b == -1) {
+            avail = 0;
             return -1;
+        }
         avail--;
         filepointer++;
         return b;
     }
 
     public int read(byte[] b, int offset, int len) throws IOException {
-        if (avail == 0)
+        if (avail == 0) {
             return -1;
+        }
         if (len > avail) {
             int rlen = stream.read(b, offset, (int)avail);
             if (rlen != -1)
@@ -139,8 +144,10 @@
             return rlen;
         } else {
             int ret = stream.read(b, offset, len);
-            if (ret == -1)
+            if (ret == -1) {
+                avail = 0;
                 return -1;
+            }
             avail -= ret;
             filepointer += ret;
             return ret;
@@ -191,8 +198,10 @@
             return len;
         } else {
             long ret = stream.skip(n);
-            if (ret == -1)
+            if (ret == -1) {
+                avail = 0;
                 return -1;
+            }
             avail -= ret;
             filepointer += ret;
             return ret;
@@ -210,8 +219,13 @@
     }
 
     // Read ASCII chars from stream
-    public String readString(int len) throws IOException {
-        byte[] buff = new byte[len];
+    public String readString(final int len) throws IOException {
+        final byte[] buff;
+        try {
+            buff = new byte[len];
+        } catch (final OutOfMemoryError oom) {
+            throw new IOException("Length too big", oom);
+        }
         readFully(buff);
         for (int i = 0; i < buff.length; i++) {
             if (buff[i] == 0) {
diff --git a/src/share/classes/com/sun/media/sound/SF2Soundbank.java b/src/share/classes/com/sun/media/sound/SF2Soundbank.java
index 688ba1d..041c8aa 100644
--- a/src/share/classes/com/sun/media/sound/SF2Soundbank.java
+++ b/src/share/classes/com/sun/media/sound/SF2Soundbank.java
@@ -276,6 +276,9 @@
                     count--;
                 }
 
+                if (presets_bagNdx.isEmpty()) {
+                    throw new RIFFInvalidDataException();
+                }
                 int offset = presets_bagNdx.get(0);
                 // Offset should be 0 (but just case)
                 for (int i = 0; i < offset; i++) {
@@ -360,6 +363,9 @@
                     count--;
                 }
 
+                if (instruments_bagNdx.isEmpty()) {
+                    throw new RIFFInvalidDataException();
+                }
                 int offset = instruments_bagNdx.get(0);
                 // Offset should be 0 (but just case)
                 for (int i = 0; i < offset; i++) {
@@ -401,6 +407,9 @@
                     modulator.amount = chunk.readShort();
                     modulator.amountSourceOperator = chunk.readUnsignedShort();
                     modulator.transportOperator = chunk.readUnsignedShort();
+                    if (i < 0 || i >= instruments_splits_gen.size()) {
+                        throw new RIFFInvalidDataException();
+                    }
                     SF2LayerRegion split = instruments_splits_gen.get(i);
                     if (split != null)
                         split.modulators.add(modulator);
@@ -424,7 +433,8 @@
                     sample.name = chunk.readString(20);
                     long start = chunk.readUnsignedInt();
                     long end = chunk.readUnsignedInt();
-                    sample.data = sampleData.subbuffer(start * 2, end * 2, true);
+                    if (sampleData != null)
+                        sample.data = sampleData.subbuffer(start * 2, end * 2, true);
                     if (sampleData24 != null)
                         sample.data24 = sampleData24.subbuffer(start, end, true);
                     /*
@@ -462,6 +472,9 @@
                     int sampleid = split.generators.get(
                             SF2LayerRegion.GENERATOR_SAMPLEID);
                     split.generators.remove(SF2LayerRegion.GENERATOR_SAMPLEID);
+                    if (sampleid < 0 || sampleid >= samples.size()) {
+                        throw new RIFFInvalidDataException();
+                    }
                     split.sample = samples.get(sampleid);
                 } else {
                     globalsplit = split;
@@ -488,6 +501,9 @@
                     int instrumentid = split.generators.get(
                             SF2InstrumentRegion.GENERATOR_INSTRUMENT);
                     split.generators.remove(SF2LayerRegion.GENERATOR_INSTRUMENT);
+                    if (instrumentid < 0 || instrumentid >= layers.size()) {
+                        throw new RIFFInvalidDataException();
+                    }
                     split.layer = layers.get(instrumentid);
                 } else {
                     globalsplit = split;
diff --git a/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java b/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
index 48ae72f..5089a87 100644
--- a/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
+++ b/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.File;
@@ -39,14 +40,14 @@
 import javax.sound.midi.Sequence;
 import javax.sound.midi.Track;
 import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFileFormat.Type;
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.sampled.AudioFileFormat.Type;
 import javax.sound.sampled.spi.AudioFileReader;
 
 /**
- * MIDI File Audio Renderer/Reader
+ * MIDI File Audio Renderer/Reader.
  *
  * @author Karl Helgason
  */
@@ -109,6 +110,9 @@
                 if (divtype == Sequence.PPQ) {
                     if (((MetaMessage) msg).getType() == 0x51) {
                         byte[] data = ((MetaMessage) msg).getData();
+                        if (data.length < 3) {
+                            throw new UnsupportedAudioFileException();
+                        }
                         mpq = ((data[0] & 0xff) << 16)
                                 | ((data[1] & 0xff) << 8) | (data[2] & 0xff);
                     }
diff --git a/src/share/classes/com/sun/media/sound/SoftSynthesizer.java b/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
index 01a64c2..9b1ff67 100644
--- a/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
+++ b/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -732,31 +733,28 @@
                  * Save generated soundbank to disk for faster future use.
                  */
                 OutputStream out = AccessController
-                        .doPrivileged(new PrivilegedAction<OutputStream>() {
-                            public OutputStream run() {
-                                try {
-                                    File userhome = new File(System
-                                            .getProperty("user.home"),
-                                            ".gervill");
-                                    if (!userhome.exists())
-                                        userhome.mkdirs();
-                                    File emg_soundbank_file = new File(
-                                            userhome, "soundbank-emg.sf2");
-                                    if (emg_soundbank_file.exists())
-                                        return null;
-                                    return new FileOutputStream(
-                                            emg_soundbank_file);
-                                } catch (IOException e) {
-                                } catch (SecurityException e) {
+                        .doPrivileged((PrivilegedAction<OutputStream>) () -> {
+                            try {
+                                File userhome = new File(System
+                                        .getProperty("user.home"), ".gervill");
+                                if (!userhome.exists()) {
+                                    userhome.mkdirs();
                                 }
-                                return null;
+                                File emg_soundbank_file = new File(
+                                        userhome, "soundbank-emg.sf2");
+                                if (emg_soundbank_file.exists()) {
+                                    return null;
+                                }
+                                return new FileOutputStream(emg_soundbank_file);
+                            } catch (final FileNotFoundException ignored) {
                             }
+                            return null;
                         });
                 if (out != null) {
                     try {
                         ((SF2Soundbank) defaultSoundBank).save(out);
                         out.close();
-                    } catch (IOException e) {
+                    } catch (final IOException ignored) {
                     }
                 }
             }
@@ -846,26 +844,24 @@
 
     private Properties getStoredProperties() {
         return AccessController
-                .doPrivileged(new PrivilegedAction<Properties>() {
-                    public Properties run() {
-                        Properties p = new Properties();
-                        String notePath = "/com/sun/media/sound/softsynthesizer";
-                        try {
-                            Preferences prefroot = Preferences.userRoot();
-                            if (prefroot.nodeExists(notePath)) {
-                                Preferences prefs = prefroot.node(notePath);
-                                String[] prefs_keys = prefs.keys();
-                                for (String prefs_key : prefs_keys) {
-                                    String val = prefs.get(prefs_key, null);
-                                    if (val != null)
-                                        p.setProperty(prefs_key, val);
+                .doPrivileged((PrivilegedAction<Properties>) () -> {
+                    Properties p = new Properties();
+                    String notePath = "/com/sun/media/sound/softsynthesizer";
+                    try {
+                        Preferences prefroot = Preferences.userRoot();
+                        if (prefroot.nodeExists(notePath)) {
+                            Preferences prefs = prefroot.node(notePath);
+                            String[] prefs_keys = prefs.keys();
+                            for (String prefs_key : prefs_keys) {
+                                String val = prefs.get(prefs_key, null);
+                                if (val != null) {
+                                    p.setProperty(prefs_key, val);
                                 }
                             }
-                        } catch (BackingStoreException e) {
-                        } catch (SecurityException e) {
                         }
-                        return p;
+                    } catch (final BackingStoreException ignored) {
                     }
+                    return p;
                 });
     }
 
@@ -1044,7 +1040,6 @@
             return;
         }
         synchronized (control_mutex) {
-            Throwable causeException = null;
             try {
                 if (line != null) {
                     // can throw IllegalArgumentException
@@ -1117,24 +1112,17 @@
                     weakstream.sourceDataLine = sourceDataLine;
                 }
 
-            } catch (LineUnavailableException e) {
-                causeException = e;
-            } catch (IllegalArgumentException e) {
-                causeException = e;
-            } catch (SecurityException e) {
-                causeException = e;
-            }
-
-            if (causeException != null) {
-                if (isOpen())
+            } catch (final LineUnavailableException | SecurityException
+                    | IllegalArgumentException e) {
+                if (isOpen()) {
                     close();
+                }
                 // am: need MidiUnavailableException(Throwable) ctor!
                 MidiUnavailableException ex = new MidiUnavailableException(
                         "Can not open line");
-                ex.initCause(causeException);
+                ex.initCause(e);
                 throw ex;
             }
-
         }
     }
 
diff --git a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
index 1dbd72a..fd96039 100644
--- a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
+++ b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,27 +25,25 @@
 
 package com.sun.media.sound;
 
+import java.io.BufferedInputStream;
 import java.io.DataInputStream;
+import java.io.EOFException;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.InputStream;
 import java.io.IOException;
-import java.io.EOFException;
-import java.io.BufferedInputStream;
+import java.io.InputStream;
 import java.net.URL;
 
-import javax.sound.midi.MidiFileFormat;
 import javax.sound.midi.InvalidMidiDataException;
 import javax.sound.midi.MetaMessage;
 import javax.sound.midi.MidiEvent;
+import javax.sound.midi.MidiFileFormat;
 import javax.sound.midi.MidiMessage;
 import javax.sound.midi.Sequence;
 import javax.sound.midi.SysexMessage;
 import javax.sound.midi.Track;
 import javax.sound.midi.spi.MidiFileReader;
 
-
-
 /**
  * MIDI file reader.
  *
@@ -53,19 +51,23 @@
  * @author Jan Borgersen
  * @author Florian Bomers
  */
-
 public final class StandardMidiFileReader extends MidiFileReader {
 
     private static final int MThd_MAGIC = 0x4d546864;  // 'MThd'
 
     private static final int bisBufferSize = 1024; // buffer size in buffered input streams
 
-    public MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException {
+    public MidiFileFormat getMidiFileFormat(InputStream stream)
+            throws InvalidMidiDataException, IOException {
         return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
     }
 
-    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat() returns format having invalid length
-    private MidiFileFormat getMidiFileFormatFromStream(InputStream stream, int fileLength, SMFParser smfParser) throws InvalidMidiDataException, IOException {
+    // $$fb 2002-04-17: part of fix for 4635286: MidiSystem.getMidiFileFormat()
+    // returns format having invalid length
+    private MidiFileFormat getMidiFileFormatFromStream(InputStream stream,
+                                                       int fileLength,
+                                                       SMFParser smfParser)
+            throws InvalidMidiDataException, IOException{
         int maxReadLength = 16;
         int duration = MidiFileFormat.UNKNOWN_LENGTH;
         DataInputStream dis;
@@ -230,7 +232,7 @@
 //=============================================================================================================
 
 /**
- * State variables during parsing of a MIDI file
+ * State variables during parsing of a MIDI file.
  */
 final class SMFParser {
     private static final int MTrk_MAGIC = 0x4d54726b;  // 'MTrk'
@@ -297,7 +299,11 @@
             }
         }
         // now read track in a byte array
-        trackData = new byte[trackLength];
+        try {
+            trackData = new byte[trackLength];
+        } catch (final OutOfMemoryError oom) {
+            throw new IOException("Track length too big", oom);
+        }
         try {
             // $$fb 2003-08-20: fix for 4910986: MIDI file parser breaks up on http connection
             stream.readFully(trackData);
@@ -386,8 +392,13 @@
                         // meta
                         int metaType = readUnsigned();
                         int metaLength = (int) readVarInt();
+                        final byte[] metaData;
+                        try {
+                            metaData = new byte[metaLength];
+                        } catch (final OutOfMemoryError oom) {
+                            throw new IOException("Meta length too big", oom);
+                        }
 
-                        byte[] metaData = new byte[metaLength];
                         read(metaData);
 
                         MetaMessage metaMessage = new MetaMessage();
@@ -413,5 +424,4 @@
             throw new EOFException("invalid MIDI file");
         }
     }
-
 }
diff --git a/src/share/classes/com/sun/security/ntlm/Client.java b/src/share/classes/com/sun/security/ntlm/Client.java
index ba3e90c..9aacd43 100644
--- a/src/share/classes/com/sun/security/ntlm/Client.java
+++ b/src/share/classes/com/sun/security/ntlm/Client.java
@@ -46,7 +46,7 @@
     final private String hostname;
     final private String username;
 
-    private String domain;    // might be updated by Type 2 msg
+    private String domain;
     private byte[] pw1, pw2;
 
     /**
@@ -82,7 +82,7 @@
         }
         this.hostname = hostname;
         this.username = username;
-        this.domain = domain;
+        this.domain = domain == null ? "" : domain;
         this.pw1 = getP1(password);
         this.pw2 = getP2(password);
         debug("NTLM Client: (h,u,t,version(v)) = (%s,%s,%s,%s(%s))\n",
@@ -95,19 +95,13 @@
      */
     public byte[] type1() {
         Writer p = new Writer(1, 32);
-        int flags = 0x8203;
-        if (hostname != null) {
-            flags |= 0x2000;
-        }
-        if (domain != null) {
-            flags |= 0x1000;
-        }
+        // Negotiate always sign, Negotiate NTLM,
+        // Request Target, Negotiate OEM, Negotiate unicode
+        int flags = 0x8207;
         if (v != Version.NTLM) {
             flags |= 0x80000;
         }
         p.writeInt(12, flags);
-        p.writeSecurityBuffer(24, hostname, false);
-        p.writeSecurityBuffer(16, domain, false);
         debug("NTLM Client: Type 1 created\n");
         debug(p.getBytes());
         return p.getBytes();
@@ -133,13 +127,10 @@
         byte[] challenge = r.readBytes(24, 8);
         int inputFlags = r.readInt(20);
         boolean unicode = (inputFlags & 1) == 1;
-        String domainFromServer = r.readSecurityBuffer(12, unicode);
-        if (domainFromServer != null) {
-            domain = domainFromServer;
-        }
-        if (domain == null) {
-            domain = "";
-        }
+
+        // IE uses domainFromServer to generate an alist if server has not
+        // provided one. Firefox/WebKit do not. Neither do we.
+        //String domainFromServer = r.readSecurityBuffer(12, unicode);
 
         int flags = 0x88200 | (inputFlags & 3);
         Writer p = new Writer(3, 64);
@@ -163,7 +154,9 @@
             if (writeLM) lm = calcV2(nthash,
                     username.toUpperCase(Locale.US)+domain, nonce, challenge);
             if (writeNTLM) {
-                byte[] alist = type2.length > 48 ?
+                // Some client create a alist even if server does not send
+                // one: (i16)2 (i16)len target_in_unicode (i16)0 (i16) 0
+                byte[] alist = ((inputFlags & 0x800000) != 0) ?
                     r.readSecurityBuffer(40) : new byte[0];
                 byte[] blob = new byte[32+alist.length];
                 System.arraycopy(new byte[]{1,1,0,0,0,0,0,0}, 0, blob, 0, 8);
diff --git a/src/share/classes/com/sun/security/ntlm/Server.java b/src/share/classes/com/sun/security/ntlm/Server.java
index 0593b2e..adec1a3 100644
--- a/src/share/classes/com/sun/security/ntlm/Server.java
+++ b/src/share/classes/com/sun/security/ntlm/Server.java
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -92,7 +93,9 @@
         debug("NTLM Server: Type 1 received\n");
         if (type1 != null) debug(type1);
         Writer p = new Writer(2, 32);
-        int flags = 0x80205;
+        // Negotiate NTLM2 Key, Target Type Domain,
+        // Negotiate NTLM, Request Target, Negotiate unicode
+        int flags = 0x90205;
         p.writeSecurityBuffer(12, domain, true);
         p.writeInt(20, flags);
         p.writeBytes(24, nonce);
@@ -127,8 +130,9 @@
                     "Wrong domain: " + incomingDomain +
                     " vs " + domain); // Needed?
         }*/
+
         boolean verified = false;
-        char[] password = getPassword(domain, username);
+        char[] password = getPassword(incomingDomain, username);
         if (password == null) {
             throw new NTLMException(NTLMException.USER_UNKNOWN,
                     "Unknown user");
@@ -179,6 +183,8 @@
                 }
             }
             if (incomingNTLM.length > 0) {
+                // We didn't sent alist in type2(), so there
+                // is nothing to check here.
                 byte[] clientBlob = Arrays.copyOfRange(
                         incomingNTLM, 16, incomingNTLM.length);
                 byte[] ntlmresponse = calcV2(nthash,
diff --git a/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java b/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java
index dbb1d61..2cf561c 100644
--- a/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java
+++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java
@@ -160,9 +160,17 @@
             }
         }
         try {
+            String name = ncb.getName();
+            if (name == null) {
+                name = authzid;
+            }
+            String domain = dcb.getText();
+            if (domain == null) {
+                domain = serverName;
+            }
             client = new Client(version, hostname,
-                    ncb.getName(),
-                    dcb.getText(),
+                    name,
+                    domain,
                     pcb.getPassword());
         } catch (NTLMException ne) {
             throw new SaslException(
diff --git a/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java b/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java
index 9589abd..c1a8eb6 100644
--- a/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java
+++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java
@@ -141,8 +141,10 @@
             server = new Server(version, domain) {
                 public char[] getPassword(String ntdomain, String username) {
                     try {
-                        RealmCallback rcb = new RealmCallback(
-                                "Domain: ", ntdomain);
+                        RealmCallback rcb =
+                                (ntdomain == null || ntdomain.isEmpty())
+                                    ? new RealmCallback("Domain: ")
+                                    : new RealmCallback("Domain: ", ntdomain);
                         NameCallback ncb = new NameCallback(
                                 "Name: ", username);
                         PasswordCallback pcb = new PasswordCallback(
diff --git a/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
new file mode 100644
index 0000000..7f676ee
--- /dev/null
+++ b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.attach;
+
+import java.io.IOException;
+
+/**
+ * Exception type to signal that an attach operation failed in the target VM.
+ *
+ * <p> This exception can be thrown by the various operations of
+ * {@link com.sun.tools.attach.VirtualMachine} when the operation
+ * fails in the target VM. If there is a communication error,
+ * a regular IOException will be thrown.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public class AttachOperationFailedException extends IOException {
+
+    private static final long serialVersionUID = 2140308168167478043L;
+
+    /**
+     * Constructs an <code>AttachOperationFailedException</code> with
+     * the specified detail message.
+     *
+     * @param   s   the detail message.
+     */
+    public AttachOperationFailedException(String message) {
+        super(message);
+    }
+}
diff --git a/src/share/classes/com/sun/tools/attach/VirtualMachine.java b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
index 1bea751..d5e934a 100644
--- a/src/share/classes/com/sun/tools/attach/VirtualMachine.java
+++ b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,16 +76,10 @@
  *      // attach to target VM
  *      VirtualMachine vm = VirtualMachine.attach("2177");
  *
- *      // get system properties in target VM
- *      Properties props = vm.getSystemProperties();
- *
- *      // construct path to management agent
- *      String home = props.getProperty("java.home");
- *      String agent = home + File.separator + "lib" + File.separator
- *          + "management-agent.jar";
- *
- *      // load agent into target VM
- *      vm.loadAgent(agent, "com.sun.management.jmxremote.port=5000");
+ *      // start management agent
+ *      Properties props = new Properties();
+ *      props.put("com.sun.management.jmxremote.port", "5000");
+ *      vm.startManagementAgent(props);
  *
  *      // detach
  *      vm.detach();
@@ -93,9 +87,9 @@
  * </pre>
  *
  * <p> In this example we attach to a Java virtual machine that is identified by
- * the process identifier <code>2177</code>. The system properties from the target
- * VM are then used to construct the path to a <i>management agent</i> which is then
- * loaded into the target VM. Once loaded the client detaches from the target VM. </p>
+ * the process identifier <code>2177</code>. Then the JMX management agent is
+ * started in the target process using the supplied arguments. Finally, the
+ * client detaches from the target VM. </p>
  *
  * <p> A VirtualMachine is safe for use by multiple concurrent threads. </p>
  *
@@ -564,8 +558,15 @@
      *
      * @return  The system properties
      *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
      * @throws  IOException
-     *          If an I/O error occurs
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
      *
      * @see     java.lang.System#getProperties
      * @see     #loadAgentLibrary
@@ -591,12 +592,81 @@
      *
      * @return       The agent properties
      *
+     * @throws       AttachOperationFailedException
+     *               If the target virtual machine is unable to complete the
+     *               attach operation. A more specific error message will be
+     *               given by {@link AttachOperationFailedException#getMessage()}.
+     *
      * @throws       IOException
-     *               If an I/O error occurs
+     *               If an I/O error occurs, a communication error for example,
+     *               that cannot be identified as an error to indicate that the
+     *               operation failed in the target VM.
      */
     public abstract Properties getAgentProperties() throws IOException;
 
     /**
+     * Starts the JMX management agent in the target virtual machine.
+     *
+     * <p> The configuration properties are the same as those specified on
+     * the command line when starting the JMX management agent. In the same
+     * way as on the command line, you need to specify at least the
+     * {@code com.sun.management.jmxremote.port} property.
+     *
+     * <p> See the online documentation for <a
+     * href="../../../../../../../../technotes/guides/management/agent.html">
+     * Monitoring and Management Using JMX Technology</a> for further details.
+     *
+     * @param   agentProperties
+     *          A Properties object containing the configuration properties
+     *          for the agent.
+     *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
+     * @throws  IOException
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
+     *
+     * @throws  IllegalArgumentException
+     *          If keys or values in agentProperties are invalid.
+     *
+     * @throws  NullPointerException
+     *          If agentProperties is null.
+     *
+     * @since   1.8
+     */
+    public abstract void startManagementAgent(Properties agentProperties) throws IOException;
+
+    /**
+     * Starts the local JMX management agent in the target virtual machine.
+     *
+     * <p> See the online documentation for <a
+     * href="../../../../../../../../technotes/guides/management/agent.html">
+     * Monitoring and Management Using JMX Technology</a> for further details.
+     *
+     * @return  The String representation of the local connector's service address.
+     *          The value can be parsed by the
+     *          {@link javax.management.remote.JMXServiceURL#JMXServiceURL(String)}
+     *          constructor.
+     *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
+     * @throws  IOException
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
+     *
+     * @since   1.8
+     */
+    public abstract String startLocalManagementAgent() throws IOException;
+
+    /**
      * Returns a hash-code value for this VirtualMachine. The hash
      * code is based upon the VirtualMachine's components, and satifies
      * the general contract of the {@link java.lang.Object#hashCode()
diff --git a/src/share/classes/com/sun/tools/example/debug/expr/LValue.java b/src/share/classes/com/sun/tools/example/debug/expr/LValue.java
index 97794c5..1737137 100644
--- a/src/share/classes/com/sun/tools/example/debug/expr/LValue.java
+++ b/src/share/classes/com/sun/tools/example/debug/expr/LValue.java
@@ -559,6 +559,9 @@
             } else if (refType instanceof ClassType) {
                 ClassType clazz = (ClassType)refType;
                 return jdiValue = clazz.invokeMethod(thread, matchingMethod, methodArguments, 0);
+            } else if (refType instanceof InterfaceType) {
+                InterfaceType iface = (InterfaceType)refType;
+                return jdiValue = iface.invokeMethod(thread, matchingMethod, methodArguments, 0);
             } else {
                 throw new InvalidTypeException("Cannot invoke static method on " +
                                          refType.name());
diff --git a/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java
index 4116c5e..0c83e4d 100644
--- a/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 public class ArrayTypeImpl extends ReferenceTypeImpl
     implements ArrayType
@@ -61,7 +62,8 @@
         return findType(componentSignature());
     }
 
-    void addVisibleMethods(Map<String, Method> map) {
+    @Override
+    void addVisibleMethods(Map<String, Method> map, Set<InterfaceType> seenInterfaces) {
         // arrays don't have methods
     }
 
diff --git a/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java
index 2b2c0ee..b815d1a 100644
--- a/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java
@@ -29,9 +29,27 @@
 
 import java.util.*;
 
-public class ClassTypeImpl extends ReferenceTypeImpl
+final public class ClassTypeImpl extends InvokableTypeImpl
     implements ClassType
 {
+    private static class IResult implements InvocationResult {
+        final private JDWP.ClassType.InvokeMethod rslt;
+
+        public IResult(JDWP.ClassType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+    }
+
     private boolean cachedSuperclass = false;
     private ClassType superclass = null;
     private int lastLine = -1;
@@ -65,6 +83,7 @@
         return superclass;
     }
 
+    @Override
     public List<InterfaceType> interfaces()  {
         if (interfaces == null) {
             interfaces = getInterfaces();
@@ -72,26 +91,9 @@
         return interfaces;
     }
 
-    void addInterfaces(List<InterfaceType> list) {
-        List<InterfaceType> immediate = interfaces();
-        list.addAll(interfaces());
-
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-
-        ClassTypeImpl superclass = (ClassTypeImpl)superclass();
-        if (superclass != null) {
-            superclass.addInterfaces(list);
-        }
-    }
-
-    public List<InterfaceType> allInterfaces()  {
-        List<InterfaceType> all = new ArrayList<InterfaceType>();
-        addInterfaces(all);
-        return all;
+    @Override
+    public List<InterfaceType> allInterfaces() {
+        return getAllInterfaces();
     }
 
     public List<ClassType> subclasses() {
@@ -159,28 +161,6 @@
         }
     }
 
-    PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
-                                   final MethodImpl method,
-                                   final ValueImpl[] args,
-                                   final int options) {
-        CommandSender sender =
-            new CommandSender() {
-                public PacketStream send() {
-                    return JDWP.ClassType.InvokeMethod.enqueueCommand(
-                                          vm, ClassTypeImpl.this, thread,
-                                          method.ref(), args, options);
-                }
-        };
-
-        PacketStream stream;
-        if ((options & INVOKE_SINGLE_THREADED) != 0) {
-            stream = thread.sendResumingCommand(sender);
-        } else {
-            stream = vm.sendResumingCommand(sender);
-        }
-        return stream;
-    }
-
     PacketStream sendNewInstanceCommand(final ThreadReferenceImpl thread,
                                    final MethodImpl method,
                                    final ValueImpl[] args,
@@ -203,52 +183,6 @@
         return stream;
     }
 
-    public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
-                              List<? extends Value> origArguments, int options)
-                                   throws InvalidTypeException,
-                                          ClassNotLoadedException,
-                                          IncompatibleThreadStateException,
-                                          InvocationException {
-        validateMirror(threadIntf);
-        validateMirror(methodIntf);
-        validateMirrorsOrNulls(origArguments);
-
-        MethodImpl method = (MethodImpl)methodIntf;
-        ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
-
-        validateMethodInvocation(method);
-
-        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
-
-        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
-        JDWP.ClassType.InvokeMethod ret;
-        try {
-            PacketStream stream =
-                sendInvokeCommand(thread, method, args, options);
-            ret = JDWP.ClassType.InvokeMethod.waitForReply(vm, stream);
-        } catch (JDWPException exc) {
-            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
-                throw new IncompatibleThreadStateException();
-            } else {
-                throw exc.toJDIException();
-            }
-        }
-
-        /*
-         * There is an implict VM-wide suspend at the conclusion
-         * of a normal (non-single-threaded) method invoke
-         */
-        if ((options & INVOKE_SINGLE_THREADED) == 0) {
-            vm.notifySuspend();
-        }
-
-        if (ret.exception != null) {
-            throw new InvocationException(ret.exception);
-        } else {
-            return ret.returnValue;
-        }
-    }
-
     public ObjectReference newInstance(ThreadReference threadIntf,
                                        Method methodIntf,
                                        List<? extends Value> origArguments,
@@ -311,58 +245,6 @@
        return method;
    }
 
-   public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        ClassType clazz = superclass();
-        while (clazz != null) {
-            list.addAll(clazz.methods());
-            clazz = clazz.superclass();
-        }
-
-        /*
-         * Avoid duplicate checking on each method by iterating through
-         * duplicate-free allInterfaces() rather than recursing
-         */
-        for (InterfaceType interfaze : allInterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<ReferenceType> inheritedTypes() {
-        List<ReferenceType> inherited = new ArrayList<ReferenceType>();
-        if (superclass() != null) {
-            inherited.add(0, (ReferenceType)superclass()); /* insert at front */
-        }
-        for (ReferenceType rt : interfaces()) {
-            inherited.add(rt);
-        }
-        return inherited;
-    }
-
-    void validateMethodInvocation(Method method)
-                                   throws InvalidTypeException,
-                                          InvocationException {
-        /*
-         * Method must be in this class or a superclass.
-         */
-        ReferenceTypeImpl declType = (ReferenceTypeImpl)method.declaringType();
-        if (!declType.isAssignableFrom(this)) {
-            throw new IllegalArgumentException("Invalid method");
-        }
-
-        /*
-         * Method must be a static and not a static initializer
-         */
-        if (!method.isStatic()) {
-            throw new IllegalArgumentException("Cannot invoke instance method on a class type");
-        } else if (method.isStaticInitializer()) {
-            throw new IllegalArgumentException("Cannot invoke static initializer");
-        }
-    }
-
     void validateConstructorInvocation(Method method)
                                    throws InvalidTypeException,
                                           InvocationException {
@@ -382,47 +264,33 @@
         }
     }
 
-    void addVisibleMethods(Map<String, Method> methodMap) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        Iterator<InterfaceType> iter = interfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addVisibleMethods(methodMap);
-        }
-
-        ClassTypeImpl clazz = (ClassTypeImpl)superclass();
-        if (clazz != null) {
-            clazz.addVisibleMethods(methodMap);
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-        ClassTypeImpl superclazz = (ClassTypeImpl)superclass();
-        if (this.equals(type)) {
-            return true;
-        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
-            return true;
-        } else {
-            List<InterfaceType> interfaces = interfaces();
-            Iterator<InterfaceType> iter = interfaces.iterator();
-            while (iter.hasNext()) {
-                InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-                if (interfaze.isAssignableTo(type)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
 
     public String toString() {
        return "class " + name() + " (" + loaderString() + ")";
     }
+
+    @Override
+    CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                        MethodImpl method,
+                                        ValueImpl[] args,
+                                        int options) {
+        return () ->
+            JDWP.ClassType.InvokeMethod.enqueueCommand(vm,
+                                                       ClassTypeImpl.this,
+                                                       thread,
+                                                       method.ref(),
+                                                       args,
+                                                       options);
+    }
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.ClassType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // Method must be in this class or a superclass.
+        return ((ReferenceTypeImpl)method.declaringType()).isAssignableFrom(this);
+    }
 }
diff --git a/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java b/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java
index 8fa7670..da7e55a 100644
--- a/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java
@@ -29,13 +29,31 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
 import java.util.Collections;
+import java.util.Set;
 import java.lang.ref.SoftReference;
 
-public class InterfaceTypeImpl extends ReferenceTypeImpl
-                               implements InterfaceType {
+final public class InterfaceTypeImpl extends InvokableTypeImpl
+                                     implements InterfaceType {
+
+    private static class IResult implements InvocationResult {
+        final private JDWP.InterfaceType.InvokeMethod rslt;
+
+        public IResult(JDWP.InterfaceType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+
+    }
 
     private SoftReference<List<InterfaceType>> superinterfacesRef = null;
 
@@ -80,98 +98,6 @@
         return implementors;
     }
 
-    void addVisibleMethods(Map<String, Method> methodMap) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        for (InterfaceType interfaze : superinterfaces()) {
-            ((InterfaceTypeImpl)interfaze).addVisibleMethods(methodMap);
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        /*
-         * It's more efficient if don't do this
-         * recursively.
-         */
-        for (InterfaceType interfaze : allSuperinterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<InterfaceType> allSuperinterfaces() {
-        ArrayList<InterfaceType> list = new ArrayList<InterfaceType>();
-        addSuperinterfaces(list);
-        return list;
-    }
-
-    void addSuperinterfaces(List<InterfaceType> list) {
-        /*
-         * This code is a little strange because it
-         * builds the list with a more suitable order than the
-         * depth-first approach a normal recursive solution would
-         * take. Instead, all direct superinterfaces precede all
-         * indirect ones.
-         */
-
-        /*
-         * Get a list of direct superinterfaces that's not already in the
-         * list being built.
-         */
-        List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = iter.next();
-            if (list.contains(interfaze)) {
-                iter.remove();
-            }
-        }
-
-        /*
-         * Add all new direct superinterfaces
-         */
-        list.addAll(immediate);
-
-        /*
-         * Recurse for all new direct superinterfaces.
-         */
-        iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-
-        // Exact match?
-        if (this.equals(type)) {
-            return true;
-        } else {
-            // Try superinterfaces.
-            for (InterfaceType interfaze : superinterfaces()) {
-                if (((InterfaceTypeImpl)interfaze).isAssignableTo(type)) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-    }
-
-    List<InterfaceType> inheritedTypes() {
-        return superinterfaces();
-    }
-
     public boolean isInitialized() {
         return isPrepared();
     }
@@ -179,4 +105,39 @@
     public String toString() {
        return "interface " + name() + " (" + loaderString() + ")";
     }
-}
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.InterfaceType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    CommandSender getInvokeMethodSender(final ThreadReferenceImpl thread,
+                                        final MethodImpl method,
+                                        final ValueImpl[] args,
+                                        final int options) {
+        return () ->
+            JDWP.InterfaceType.InvokeMethod.enqueueCommand(vm,
+                                                           InterfaceTypeImpl.this,
+                                                           thread,
+                                                           method.ref(),
+                                                           args,
+                                                           options);
+    }
+
+    @Override
+    ClassType superclass() {
+        return null;
+    }
+
+    @Override
+    List<InterfaceType> interfaces() {
+        return superinterfaces();
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // method must be directly in this interface
+        return this.equals(method.declaringType());
+    }
+}
\ No newline at end of file
diff --git a/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java b/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java
new file mode 100644
index 0000000..61a2330
--- /dev/null
+++ b/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdi;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A supertype for ReferenceTypes allowing method invocations
+ */
+abstract class InvokableTypeImpl extends ReferenceTypeImpl {
+    /**
+     * The invocation result wrapper
+     * It is necessary because both ClassType and InterfaceType
+     * use their own type to represent the invocation result
+     */
+    static interface InvocationResult {
+        ObjectReferenceImpl getException();
+        ValueImpl getResult();
+    }
+
+    InvokableTypeImpl(VirtualMachine aVm, long aRef) {
+        super(aVm, aRef);
+    }
+
+    /**
+     * Method invocation support.
+     * Shared by ClassType and InterfaceType
+     * @param threadIntf the thread in which to invoke.
+     * @param methodIntf method the {@link Method} to invoke.
+     * @param origArguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this type, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class's class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     */
+    final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
+                                    List<? extends Value> origArguments, int options)
+                                        throws InvalidTypeException,
+                                               ClassNotLoadedException,
+                                               IncompatibleThreadStateException,
+                                               InvocationException {
+        validateMirror(threadIntf);
+        validateMirror(methodIntf);
+        validateMirrorsOrNulls(origArguments);
+        MethodImpl method = (MethodImpl) methodIntf;
+        ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf;
+        validateMethodInvocation(method);
+        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
+        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
+        InvocationResult ret;
+        try {
+            PacketStream stream = sendInvokeCommand(thread, method, args, options);
+            ret = waitForReply(stream);
+        } catch (JDWPException exc) {
+            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
+                throw new IncompatibleThreadStateException();
+            } else {
+                throw exc.toJDIException();
+            }
+        }
+        /*
+         * There is an implict VM-wide suspend at the conclusion
+         * of a normal (non-single-threaded) method invoke
+         */
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) {
+            vm.notifySuspend();
+        }
+        if (ret.getException() != null) {
+            throw new InvocationException(ret.getException());
+        } else {
+            return ret.getResult();
+        }
+    }
+
+    @Override
+    boolean isAssignableTo(ReferenceType type) {
+        ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
+        if (this.equals(type)) {
+            return true;
+        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
+            return true;
+        } else {
+            List<InterfaceType> interfaces = interfaces();
+            Iterator<InterfaceType> iter = interfaces.iterator();
+            while (iter.hasNext()) {
+                InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+                if (interfaze.isAssignableTo(type)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    @Override
+    final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
+        /*
+         * Add methods from
+         * parent types first, so that the methods in this class will
+         * overwrite them in the hash table
+         */
+        Iterator<InterfaceType> iter = interfaces().iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
+        }
+        ClassTypeImpl clazz = (ClassTypeImpl) superclass();
+        if (clazz != null) {
+            clazz.addVisibleMethods(methodMap, seenInterfaces);
+        }
+        addToMethodMap(methodMap, methods());
+    }
+
+    final void addInterfaces(List<InterfaceType> list) {
+        List<InterfaceType> immediate = interfaces();
+        list.addAll(interfaces());
+        Iterator<InterfaceType> iter = immediate.iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            interfaze.addInterfaces(list);
+        }
+        ClassTypeImpl superclass = (ClassTypeImpl) superclass();
+        if (superclass != null) {
+            superclass.addInterfaces(list);
+        }
+    }
+
+    /**
+     * Returns all the implemented interfaces recursively
+     * @return A list of all the implemented interfaces (recursively)
+     */
+    final List<InterfaceType> getAllInterfaces() {
+        List<InterfaceType> all = new ArrayList<>();
+        addInterfaces(all);
+        return all;
+    }
+
+    /**
+     * Shared implementation of {@linkplain ClassType#allMethods()} and
+     * {@linkplain InterfaceType#allMethods()}
+     * @return A list of all methods (recursively)
+     */
+    public final List<Method> allMethods() {
+        ArrayList<Method> list = new ArrayList<>(methods());
+        ClassType clazz = superclass();
+        while (clazz != null) {
+            list.addAll(clazz.methods());
+            clazz = clazz.superclass();
+        }
+        /*
+         * Avoid duplicate checking on each method by iterating through
+         * duplicate-free allInterfaces() rather than recursing
+         */
+        for (InterfaceType interfaze : getAllInterfaces()) {
+            list.addAll(interfaze.methods());
+        }
+        return list;
+    }
+
+    @Override
+    final List<ReferenceType> inheritedTypes() {
+        List<ReferenceType> inherited = new ArrayList<>();
+        if (superclass() != null) {
+            inherited.add(0, superclass()); /* insert at front */
+        }
+        for (ReferenceType rt : interfaces()) {
+            inherited.add(rt);
+        }
+        return inherited;
+    }
+
+    private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
+                                           final MethodImpl method,
+                                           final ValueImpl[] args,
+                                           final int options) {
+        CommandSender sender = getInvokeMethodSender(thread, method, args, options);
+        PacketStream stream;
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {
+            stream = thread.sendResumingCommand(sender);
+        } else {
+            stream = vm.sendResumingCommand(sender);
+        }
+        return stream;
+    }
+
+    private void validateMethodInvocation(Method method)
+                                            throws InvalidTypeException,
+                                                   InvocationException {
+        if (!canInvoke(method)) {
+            throw new IllegalArgumentException("Invalid method");
+        }
+        /*
+         * Method must be a static and not a static initializer
+         */
+        if (!method.isStatic()) {
+            throw new IllegalArgumentException("Cannot invoke instance method on a class/interface type");
+        } else if (method.isStaticInitializer()) {
+            throw new IllegalArgumentException("Cannot invoke static initializer");
+        }
+    }
+
+    /**
+     * A subclass will provide specific {@linkplain CommandSender}
+     * @param thread the current invocation thread
+     * @param method the method to invoke
+     * @param args the arguments to pass to the method
+     * @param options the integer bit flag options
+     * @return the specific {@literal CommandSender} instance
+     */
+    abstract CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                                 MethodImpl method,
+                                                 ValueImpl[] args,
+                                                 int options);
+
+    /**
+     * Waits for the reply to the last sent command
+     * @param stream the stream to listen for the reply on
+     * @return the {@linkplain InvocationResult} instance
+     * @throws JDWPException when something goes wrong in JDWP
+     */
+    abstract InvocationResult waitForReply(PacketStream stream) throws JDWPException;
+
+    /**
+     * Get the {@linkplain ReferenceType} superclass
+     * @return the superclass or null
+     */
+    abstract ClassType superclass();
+
+    /**
+     * Get the implemented/extended interfaces
+     * @return the list of implemented/extended interfaces
+     */
+    abstract List<InterfaceType> interfaces();
+
+    /**
+     * Checks the provided method whether it can be invoked
+     * @param method the method to check
+     * @return {@code TRUE} if the implementation knows how to invoke the method,
+     *         {@code FALSE} otherwise
+     */
+    abstract boolean canInvoke(Method method);
+}
diff --git a/src/share/classes/com/sun/tools/jdi/MethodImpl.java b/src/share/classes/com/sun/tools/jdi/MethodImpl.java
index f63ad68..1d93f4c 100644
--- a/src/share/classes/com/sun/tools/jdi/MethodImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/MethodImpl.java
@@ -187,6 +187,13 @@
         return isModifierSet(VMModifiers.ABSTRACT);
     }
 
+    public boolean isDefault() {
+        return !isModifierSet(VMModifiers.ABSTRACT) &&
+               !isModifierSet(VMModifiers.STATIC) &&
+               !isModifierSet(VMModifiers.PRIVATE) &&
+               declaringType() instanceof InterfaceType;
+    }
+
     public boolean isSynchronized() {
         return isModifierSet(VMModifiers.SYNCHRONIZED);
     }
diff --git a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
index 2b1b058..1d5a6c9 100644
--- a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
@@ -277,7 +277,6 @@
     void validateMethodInvocation(Method method, int options)
                                          throws InvalidTypeException,
                                          InvocationException {
-
         /*
          * Method must be in this object's class, a superclass, or
          * implemented interface
@@ -287,6 +286,19 @@
             throw new IllegalArgumentException("Invalid method");
         }
 
+        if (declType instanceof ClassTypeImpl) {
+            validateClassMethodInvocation(method, options);
+        } else if (declType instanceof InterfaceTypeImpl) {
+            validateIfaceMethodInvocation(method, options);
+        } else {
+            throw new InvalidTypeException();
+        }
+    }
+
+    void validateClassMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+
         ClassTypeImpl clazz = invokableReferenceType(method);
 
         /*
@@ -300,9 +312,7 @@
          * For nonvirtual invokes, method must have a body
          */
         if ((options & INVOKE_NONVIRTUAL) != 0) {
-            if (method.declaringType() instanceof InterfaceType) {
-                throw new IllegalArgumentException("Interface method");
-            } else if (method.isAbstract()) {
+            if (method.isAbstract()) {
                 throw new IllegalArgumentException("Abstract method");
             }
         }
@@ -324,7 +334,7 @@
              */
             Method invoker = clazz.concreteMethodByName(method.name(),
                                                         method.signature());
-            //  isAssignableFrom check above guarantees non-null
+            //  invoker is supposed to be non-null under normal circumstances
             invokedClass = (ClassTypeImpl)invoker.declaringType();
         }
         /* The above code is left over from previous versions.
@@ -332,6 +342,17 @@
          */
     }
 
+    void validateIfaceMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+        /*
+         * Only default methods allowed for nonvirtual invokes
+         */
+        if (!method.isDefault()) {
+            throw new IllegalArgumentException("Not a default method");
+        }
+    }
+
     PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
                                    final ClassTypeImpl refType,
                                    final MethodImpl method,
@@ -370,7 +391,10 @@
         ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
 
         if (method.isStatic()) {
-            if (referenceType() instanceof ClassType) {
+            if (referenceType() instanceof InterfaceType) {
+                InterfaceType type = (InterfaceType)referenceType();
+                return type.invokeMethod(thread, method, origArguments, options);
+            } else if (referenceType() instanceof ClassType) {
                 ClassType type = (ClassType)referenceType();
                 return type.invokeMethod(thread, method, origArguments, options);
             } else {
diff --git a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java
index 29da75d..be98d5e 100644
--- a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java
@@ -511,7 +511,7 @@
             methodMap.put(method.name().concat(method.signature()), method);
         }
 
-    abstract void addVisibleMethods(Map<String, Method> methodMap);
+    abstract void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces);
 
     public List<Method> visibleMethods() {
         /*
@@ -520,7 +520,7 @@
          * concatenation of name and signature.
          */
         Map<String, Method> map = new HashMap<String, Method>();
-        addVisibleMethods(map);
+        addVisibleMethods(map, new HashSet<InterfaceType>());
 
         /*
          * ... but the hash map destroys order. Methods should be
diff --git a/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java b/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java
index e41b295..3704b41 100644
--- a/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java
+++ b/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java
@@ -48,7 +48,7 @@
     private ResourceBundle messages = null;
     private int vmSequenceNumber = 0;
     private static final int majorVersion = 1;
-    private static final int minorVersion = 6;
+    private static final int minorVersion = 8;
 
     private static final Object lock = new Object();
     private static VirtualMachineManagerImpl vmm;
diff --git a/src/share/classes/java/awt/Container.java b/src/share/classes/java/awt/Container.java
index deca54f..9158211 100644
--- a/src/share/classes/java/awt/Container.java
+++ b/src/share/classes/java/awt/Container.java
@@ -3687,7 +3687,7 @@
     private void writeObject(ObjectOutputStream s) throws IOException {
         ObjectOutputStream.PutField f = s.putFields();
         f.put("ncomponents", component.size());
-        f.put("component", getComponentsSync());
+        f.put("component", component.toArray(EMPTY_ARRAY));
         f.put("layoutMgr", layoutMgr);
         f.put("dispatcher", dispatcher);
         f.put("maxSize", maxSize);
diff --git a/src/share/classes/java/awt/SplashScreen.java b/src/share/classes/java/awt/SplashScreen.java
index a1d4b6f..9ec5625 100644
--- a/src/share/classes/java/awt/SplashScreen.java
+++ b/src/share/classes/java/awt/SplashScreen.java
@@ -245,7 +245,14 @@
     public Rectangle getBounds() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             checkVisible();
-            return _getBounds(splashPtr);
+            float scale = _getScaleFactor(splashPtr);
+            Rectangle bounds = _getBounds(splashPtr);
+            assert scale > 0;
+            if (scale > 0 && scale != 1) {
+                bounds.setSize((int) (bounds.getWidth() / scale),
+                        (int) (bounds.getWidth() / scale));
+            }
+            return bounds;
         }
     }
 
@@ -287,10 +294,19 @@
     public Graphics2D createGraphics() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             if (image==null) {
-                Dimension dim = getSize();
-                image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
+                // get unscaled splash image size
+                Dimension dim = _getBounds(splashPtr).getSize();
+                image = new BufferedImage(dim.width, dim.height,
+                        BufferedImage.TYPE_INT_ARGB);
             }
-            return image.createGraphics();
+            float scale = _getScaleFactor(splashPtr);
+            Graphics2D g = image.createGraphics();
+            assert (scale > 0);
+            if (scale <= 0) {
+                scale = 1;
+            }
+            g.scale(scale, scale);
+            return g;
         }
     }
 
@@ -401,5 +417,6 @@
     private native static String _getImageFileName(long splashPtr);
     private native static String _getImageJarName(long SplashPtr);
     private native static boolean _setImageData(long SplashPtr, byte[] data);
+    private native static float _getScaleFactor(long SplashPtr);
 
 };
diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java
index 13779fd..1052a20 100644
--- a/src/share/classes/java/awt/Window.java
+++ b/src/share/classes/java/awt/Window.java
@@ -2247,7 +2247,18 @@
             }
             firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop);
         }
-        for (WeakReference<Window> ref : ownedWindowList) {
+        setOwnedWindowsAlwaysOnTop(alwaysOnTop);
+    }
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private void setOwnedWindowsAlwaysOnTop(boolean alwaysOnTop) {
+        WeakReference<Window>[] ownedWindowArray;
+        synchronized (ownedWindowList) {
+            ownedWindowArray = new WeakReference[ownedWindowList.size()];
+            ownedWindowList.copyInto(ownedWindowArray);
+        }
+
+        for (WeakReference<Window> ref : ownedWindowArray) {
             Window window = ref.get();
             if (window != null) {
                 try {
diff --git a/src/share/classes/java/io/FileInputStream.java b/src/share/classes/java/io/FileInputStream.java
index cc6710e..47d13a9 100644
--- a/src/share/classes/java/io/FileInputStream.java
+++ b/src/share/classes/java/io/FileInputStream.java
@@ -184,7 +184,16 @@
      * Opens the specified file for reading.
      * @param name the name of the file
      */
-    private native void open(String name) throws FileNotFoundException;
+    private native void open0(String name) throws FileNotFoundException;
+
+    // wrap native call to allow instrumentation
+    /**
+     * Opens the specified file for reading.
+     * @param name the name of the file
+     */
+    private void open(String name) throws FileNotFoundException {
+        open0(name);
+    }
 
     /**
      * Reads a byte of data from this input stream. This method blocks
diff --git a/src/share/classes/java/io/FileOutputStream.java b/src/share/classes/java/io/FileOutputStream.java
index 8377261..7d2cb8f 100644
--- a/src/share/classes/java/io/FileOutputStream.java
+++ b/src/share/classes/java/io/FileOutputStream.java
@@ -256,9 +256,20 @@
      * @param name name of file to be opened
      * @param append whether the file is to be opened in append mode
      */
-    private native void open(String name, boolean append)
+    private native void open0(String name, boolean append)
         throws FileNotFoundException;
 
+    // wrap native call to allow instrumentation
+    /**
+     * Opens a file, with the specified name, for overwriting or appending.
+     * @param name name of file to be opened
+     * @param append whether the file is to be opened in append mode
+     */
+    private void open(String name, boolean append)
+        throws FileNotFoundException {
+        open0(name, append);
+    }
+
     /**
      * Writes the specified byte to this file output stream.
      *
diff --git a/src/share/classes/java/io/RandomAccessFile.java b/src/share/classes/java/io/RandomAccessFile.java
index 58d8c89..ccf979b 100644
--- a/src/share/classes/java/io/RandomAccessFile.java
+++ b/src/share/classes/java/io/RandomAccessFile.java
@@ -296,9 +296,26 @@
      * @param mode the mode flags, a combination of the O_ constants
      *             defined above
      */
-    private native void open(String name, int mode)
+    private native void open0(String name, int mode)
         throws FileNotFoundException;
 
+    // wrap native call to allow instrumentation
+    /**
+     * Opens a file and returns the file descriptor.  The file is
+     * opened in read-write mode if the O_RDWR bit in {@code mode}
+     * is true, else the file is opened as read-only.
+     * If the {@code name} refers to a directory, an IOException
+     * is thrown.
+     *
+     * @param name the name of the file
+     * @param mode the mode flags, a combination of the O_ constants
+     *             defined above
+     */
+    private void open(String name, int mode)
+        throws FileNotFoundException {
+        open0(name, mode);
+    }
+
     // 'Read' primitives
 
     /**
diff --git a/src/share/classes/java/io/SequenceInputStream.java b/src/share/classes/java/io/SequenceInputStream.java
index 1a28584..01da7f6 100644
--- a/src/share/classes/java/io/SequenceInputStream.java
+++ b/src/share/classes/java/io/SequenceInputStream.java
@@ -135,7 +135,7 @@
      * @since   JDK1.1
      */
     public int available() throws IOException {
-        if(in == null) {
+        if (in == null) {
             return 0; // no way to signal EOF from available()
         }
         return in.available();
@@ -160,15 +160,14 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public int read() throws IOException {
-        if (in == null) {
-            return -1;
-        }
-        int c = in.read();
-        if (c == -1) {
+        while (in != null) {
+            int c = in.read();
+            if (c != -1) {
+                return c;
+            }
             nextStream();
-            return read();
         }
-        return c;
+        return -1;
     }
 
     /**
@@ -204,13 +203,14 @@
         } else if (len == 0) {
             return 0;
         }
-
-        int n = in.read(b, off, len);
-        if (n <= 0) {
+        do {
+            int n = in.read(b, off, len);
+            if (n > 0) {
+                return n;
+            }
             nextStream();
-            return read(b, off, len);
-        }
-        return n;
+        } while (in != null);
+        return -1;
     }
 
     /**
diff --git a/src/share/classes/java/lang/Class.java b/src/share/classes/java/lang/Class.java
index d4c36bc..43c8c0e 100644
--- a/src/share/classes/java/lang/Class.java
+++ b/src/share/classes/java/lang/Class.java
@@ -130,11 +130,15 @@
     }
 
     /*
-     * Constructor. Only the Java Virtual Machine creates Class
-     * objects.
+     * Private constructor. Only the Java Virtual Machine creates Class objects.
+     * This constructor is not used and prevents the default constructor being
+     * generated.
      */
-    private Class() {}
-
+    private Class(ClassLoader loader) {
+        // Initialize final field for classLoader.  The initialization value of non-null
+        // prevents future JIT optimizations from assuming this final field is null.
+        classLoader = loader;
+    }
 
     /**
      * Converts the object to a string. The string representation is the
@@ -682,8 +686,10 @@
     }
 
     // Package-private to allow ClassLoader access
-    native ClassLoader getClassLoader0();
+    ClassLoader getClassLoader0() { return classLoader; }
 
+    // Initialized in JVM not by private constructor
+    private final ClassLoader classLoader;
 
     /**
      * Returns an array of {@code TypeVariable} objects that represent the
diff --git a/src/share/classes/java/lang/String.java b/src/share/classes/java/lang/String.java
index ce7d8f7..483d1c6 100644
--- a/src/share/classes/java/lang/String.java
+++ b/src/share/classes/java/lang/String.java
@@ -1045,8 +1045,9 @@
             }
         }
         // Argument is a String
-        if (cs.equals(this))
-            return true;
+        if (cs instanceof String) {
+            return equals(cs);
+        }
         // Argument is a generic CharSequence
         char v1[] = value;
         int n = v1.length;
diff --git a/src/share/classes/java/lang/invoke/BoundMethodHandle.java b/src/share/classes/java/lang/invoke/BoundMethodHandle.java
index fda6be2..74f53e4 100644
--- a/src/share/classes/java/lang/invoke/BoundMethodHandle.java
+++ b/src/share/classes/java/lang/invoke/BoundMethodHandle.java
@@ -26,11 +26,10 @@
 package java.lang.invoke;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.basicTypes;
-import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 
-import java.lang.invoke.LambdaForm.Name;
 import java.lang.invoke.LambdaForm.NamedFunction;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
@@ -51,89 +50,93 @@
  *
  * All bound arguments are encapsulated in dedicated species.
  */
-/* non-public */ abstract class BoundMethodHandle extends MethodHandle {
+/*non-public*/ abstract class BoundMethodHandle extends MethodHandle {
 
-    /* non-public */ BoundMethodHandle(MethodType type, LambdaForm form) {
+    /*non-public*/ BoundMethodHandle(MethodType type, LambdaForm form) {
         super(type, form);
+        assert(speciesData() == speciesData(form));
     }
 
     //
     // BMH API and internals
     //
 
-    static MethodHandle bindSingle(MethodType type, LambdaForm form, char xtype, Object x) {
+    static BoundMethodHandle bindSingle(MethodType type, LambdaForm form, BasicType xtype, Object x) {
         // for some type signatures, there exist pre-defined concrete BMH classes
         try {
             switch (xtype) {
-            case 'L':
-                if (true)  return bindSingle(type, form, x);  // Use known fast path.
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('L').constructor[0].invokeBasic(type, form, x);
-            case 'I':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('I').constructor[0].invokeBasic(type, form, ValueConversions.widenSubword(x));
-            case 'J':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('J').constructor[0].invokeBasic(type, form, (long) x);
-            case 'F':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('F').constructor[0].invokeBasic(type, form, (float) x);
-            case 'D':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('D').constructor[0].invokeBasic(type, form, (double) x);
-            default : throw new InternalError("unexpected xtype: " + xtype);
+            case L_TYPE:
+                return bindSingle(type, form, x);  // Use known fast path.
+            case I_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(I_TYPE).constructor().invokeBasic(type, form, ValueConversions.widenSubword(x));
+            case J_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(J_TYPE).constructor().invokeBasic(type, form, (long) x);
+            case F_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(F_TYPE).constructor().invokeBasic(type, form, (float) x);
+            case D_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(D_TYPE).constructor().invokeBasic(type, form, (double) x);
+            default : throw newInternalError("unexpected xtype: " + xtype);
             }
         } catch (Throwable t) {
             throw newInternalError(t);
         }
     }
 
-    static MethodHandle bindSingle(MethodType type, LambdaForm form, Object x) {
-            return new Species_L(type, form, x);
+    /*non-public*/
+    LambdaFormEditor editor() {
+        return form.editor();
     }
 
-    MethodHandle cloneExtend(MethodType type, LambdaForm form, char xtype, Object x) {
-        try {
-            switch (xtype) {
-            case 'L': return cloneExtendL(type, form, x);
-            case 'I': return cloneExtendI(type, form, ValueConversions.widenSubword(x));
-            case 'J': return cloneExtendJ(type, form, (long) x);
-            case 'F': return cloneExtendF(type, form, (float) x);
-            case 'D': return cloneExtendD(type, form, (double) x);
-            }
-        } catch (Throwable t) {
-            throw newInternalError(t);
+    static BoundMethodHandle bindSingle(MethodType type, LambdaForm form, Object x) {
+        return Species_L.make(type, form, x);
+    }
+
+    @Override // there is a default binder in the super class, for 'L' types only
+    /*non-public*/
+    BoundMethodHandle bindArgumentL(int pos, Object value) {
+        return editor().bindArgumentL(this, pos, value);
+    }
+    /*non-public*/
+    BoundMethodHandle bindArgumentI(int pos, int value) {
+        return editor().bindArgumentI(this, pos, value);
+    }
+    /*non-public*/
+    BoundMethodHandle bindArgumentJ(int pos, long value) {
+        return editor().bindArgumentJ(this, pos, value);
+    }
+    /*non-public*/
+    BoundMethodHandle bindArgumentF(int pos, float value) {
+        return editor().bindArgumentF(this, pos, value);
+    }
+    /*non-public*/
+    BoundMethodHandle bindArgumentD(int pos, double value) {
+        return editor().bindArgumentD(this, pos, value);
+    }
+
+    @Override
+    BoundMethodHandle rebind() {
+        if (!tooComplex()) {
+            return this;
         }
-        throw new InternalError("unexpected type: " + xtype);
+        return makeReinvoker(this);
     }
 
-    @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
-        MethodType type = type().dropParameterTypes(pos, pos+1);
-        LambdaForm form = internalForm().bind(1+pos, speciesData());
-        return cloneExtend(type, form, basicType, value);
+    private boolean tooComplex() {
+        return (fieldCount() > FIELD_COUNT_THRESHOLD ||
+                form.expressionCount() > FORM_EXPRESSION_THRESHOLD);
     }
+    private static final int FIELD_COUNT_THRESHOLD = 12;      // largest convenient BMH field count
+    private static final int FORM_EXPRESSION_THRESHOLD = 24;  // largest convenient BMH expression count
 
-    @Override
-    MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
-        LambdaForm form = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos+drops));
-        try {
-             return clone(srcType, form);
-         } catch (Throwable t) {
-             throw newInternalError(t);
-         }
-    }
-
-    @Override
-    MethodHandle permuteArguments(MethodType newType, int[] reorder) {
-        try {
-             return clone(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList())));
-         } catch (Throwable t) {
-             throw newInternalError(t);
-         }
-    }
-
-    static final String EXTENSION_TYPES = "LIJFD";
-    static final byte INDEX_L = 0, INDEX_I = 1, INDEX_J = 2, INDEX_F = 3, INDEX_D = 4;
-    static byte extensionIndex(char type) {
-        int i = EXTENSION_TYPES.indexOf(type);
-        if (i < 0)  throw new InternalError();
-        return (byte) i;
+    /**
+     * A reinvoker MH has this form:
+     * {@code lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }}
+     */
+    static BoundMethodHandle makeReinvoker(MethodHandle target) {
+        LambdaForm form = DelegatingMethodHandle.makeReinvokerForm(
+                target, MethodTypeForm.LF_REBIND,
+                Species_L.SPECIES_DATA, Species_L.SPECIES_DATA.getterFunction(0));
+        return Species_L.make(target.type(), form, target);
     }
 
     /**
@@ -142,9 +145,22 @@
      */
     /*non-public*/ abstract SpeciesData speciesData();
 
+    /*non-public*/ static SpeciesData speciesData(LambdaForm form) {
+        Object c = form.names[0].constraint;
+        if (c instanceof SpeciesData)
+            return (SpeciesData) c;
+        // if there is no BMH constraint, then use the null constraint
+        return SpeciesData.EMPTY;
+    }
+
+    /**
+     * Return the number of fields in this BMH.  Equivalent to speciesData().fieldCount().
+     */
+    /*non-public*/ abstract int fieldCount();
+
     @Override
-    final Object internalProperties() {
-        return "/BMH="+internalValues();
+    Object internalProperties() {
+        return "\n& BMH="+internalValues();
     }
 
     @Override
@@ -159,42 +175,28 @@
     /*non-public*/ final Object arg(int i) {
         try {
             switch (speciesData().fieldType(i)) {
-            case 'L': return argL(i);
-            case 'I': return argI(i);
-            case 'F': return argF(i);
-            case 'D': return argD(i);
-            case 'J': return argJ(i);
+            case L_TYPE: return          speciesData().getters[i].invokeBasic(this);
+            case I_TYPE: return (int)    speciesData().getters[i].invokeBasic(this);
+            case J_TYPE: return (long)   speciesData().getters[i].invokeBasic(this);
+            case F_TYPE: return (float)  speciesData().getters[i].invokeBasic(this);
+            case D_TYPE: return (double) speciesData().getters[i].invokeBasic(this);
             }
         } catch (Throwable ex) {
             throw newInternalError(ex);
         }
-        throw new InternalError("unexpected type: " + speciesData().types+"."+i);
+        throw new InternalError("unexpected type: " + speciesData().typeChars+"."+i);
     }
-    /*non-public*/ final Object argL(int i) throws Throwable { return          speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final int    argI(int i) throws Throwable { return (int)    speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final float  argF(int i) throws Throwable { return (float)  speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final double argD(int i) throws Throwable { return (double) speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final long   argJ(int i) throws Throwable { return (long)   speciesData().getters[i].invokeBasic(this); }
 
     //
     // cloning API
     //
 
-    /*non-public*/ abstract BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int    narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long   narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float  narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable;
-
-    // The following is a grossly irregular hack:
-    @Override MethodHandle reinvokerTarget() {
-        try {
-            return (MethodHandle) argL(0);
-        } catch (Throwable ex) {
-            throw newInternalError(ex);
-        }
-    }
+    /*non-public*/ abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int    narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long   narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float  narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg);
 
     //
     // concrete BMH classes required to close bootstrap loops
@@ -203,150 +205,110 @@
     private  // make it private to force users to access the enclosing class first
     static final class Species_L extends BoundMethodHandle {
         final Object argL0;
-        /*non-public*/ Species_L(MethodType mt, LambdaForm lf, Object argL0) {
+        private Species_L(MethodType mt, LambdaForm lf, Object argL0) {
             super(mt, lf);
             this.argL0 = argL0;
         }
-        // The following is a grossly irregular hack:
-        @Override MethodHandle reinvokerTarget() { return (MethodHandle) argL0; }
         @Override
         /*non-public*/ SpeciesData speciesData() {
             return SPECIES_DATA;
         }
-        /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
         @Override
-        /*non-public*/ final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
+        /*non-public*/ int fieldCount() {
+            return 1;
+        }
+        /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
+        /*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
             return new Species_L(mt, lf, argL0);
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
+            return new Species_L(mt, lf, argL0);
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(L_TYPE).constructor().invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(I_TYPE).constructor().invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(J_TYPE).constructor().invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(F_TYPE).constructor().invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
+        }
+        @Override
+        /*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(D_TYPE).constructor().invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
     }
 
-/*
-    static final class Species_LL extends BoundMethodHandle {
-        final Object argL0;
-        final Object argL1;
-        public Species_LL(MethodType mt, LambdaForm lf, Object argL0, Object argL1) {
-            super(mt, lf);
-            this.argL0 = argL0;
-            this.argL1 = argL1;
-        }
-        @Override
-        public SpeciesData speciesData() {
-            return SPECIES_DATA;
-        }
-        public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LL", Species_LL.class);
-        @Override
-        public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
-            return new Species_LL(mt, lf, argL0, argL1);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-    }
-
-    static final class Species_JL extends BoundMethodHandle {
-        final long argJ0;
-        final Object argL1;
-        public Species_JL(MethodType mt, LambdaForm lf, long argJ0, Object argL1) {
-            super(mt, lf);
-            this.argJ0 = argJ0;
-            this.argL1 = argL1;
-        }
-        @Override
-        public SpeciesData speciesData() {
-            return SPECIES_DATA;
-        }
-        public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("JL", Species_JL.class);
-        @Override public final long   argJ0() { return argJ0; }
-        @Override public final Object argL1() { return argL1; }
-        @Override
-        public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
-            return new Species_JL(mt, lf, argJ0, argL1);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-    }
-*/
-
     //
     // BMH species meta-data
     //
 
     /**
-     * Meta-data wrapper for concrete BMH classes.
+     * Meta-data wrapper for concrete BMH types.
+     * Each BMH type corresponds to a given sequence of basic field types (LIJFD).
+     * The fields are immutable; their values are fully specified at object construction.
+     * Each BMH type supplies an array of getter functions which may be used in lambda forms.
+     * A BMH is constructed by cloning a shorter BMH and adding one or more new field values.
+     * The shortest possible BMH has zero fields; its class is SimpleMethodHandle.
+     * BMH species are not interrelated by subtyping, even though it would appear that
+     * a shorter BMH could serve as a supertype of a longer one which extends it.
      */
     static class SpeciesData {
-        final String                             types;
-        final Class<? extends BoundMethodHandle> clazz;
+        private final String                             typeChars;
+        private final BasicType[]                        typeCodes;
+        private final Class<? extends BoundMethodHandle> clazz;
         // Bootstrapping requires circular relations MH -> BMH -> SpeciesData -> MH
         // Therefore, we need a non-final link in the chain.  Use array elements.
-        final MethodHandle[]                     constructor;
-        final MethodHandle[]                     getters;
-        final SpeciesData[]                      extensions;
+        @Stable private final MethodHandle[]             constructor;
+        @Stable private final MethodHandle[]             getters;
+        @Stable private final NamedFunction[]            nominalGetters;
+        @Stable private final SpeciesData[]              extensions;
 
         /*non-public*/ int fieldCount() {
-            return types.length();
+            return typeCodes.length;
         }
-        /*non-public*/ char fieldType(int i) {
-            return types.charAt(i);
+        /*non-public*/ BasicType fieldType(int i) {
+            return typeCodes[i];
         }
-
+        /*non-public*/ char fieldTypeChar(int i) {
+            return typeChars.charAt(i);
+        }
+        Object fieldSignature() {
+            return typeChars;
+        }
+        public Class<? extends BoundMethodHandle> fieldHolder() {
+            return clazz;
+        }
         public String toString() {
-            return "SpeciesData["+(isPlaceholder() ? "<placeholder>" : clazz.getSimpleName())+":"+types+"]";
+            return "SpeciesData<"+fieldSignature()+">";
         }
 
         /**
@@ -354,45 +316,59 @@
          * represents a MH bound to a generic invoker, which in turn forwards to the corresponding
          * getter.
          */
-        Name getterName(Name mhName, int i) {
-            MethodHandle mh = getters[i];
-            assert(mh != null) : this+"."+i;
-            return new Name(mh, mhName);
+        NamedFunction getterFunction(int i) {
+            NamedFunction nf = nominalGetters[i];
+            assert(nf.memberDeclaringClassOrNull() == fieldHolder());
+            assert(nf.returnType() == fieldType(i));
+            return nf;
         }
 
-        NamedFunction getterFunction(int i) {
-            return new NamedFunction(getters[i]);
+        NamedFunction[] getterFunctions() {
+            return nominalGetters;
+        }
+
+        MethodHandle[] getterHandles() { return getters; }
+
+        MethodHandle constructor() {
+            return constructor[0];
         }
 
         static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class);
 
         private SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
-            this.types = types;
+            this.typeChars = types;
+            this.typeCodes = basicTypes(types);
             this.clazz = clazz;
             if (!INIT_DONE) {
-                this.constructor = new MethodHandle[1];
+                this.constructor = new MethodHandle[1];  // only one ctor
                 this.getters = new MethodHandle[types.length()];
+                this.nominalGetters = new NamedFunction[types.length()];
             } else {
                 this.constructor = Factory.makeCtors(clazz, types, null);
                 this.getters = Factory.makeGetters(clazz, types, null);
+                this.nominalGetters = Factory.makeNominalGetters(types, null, this.getters);
             }
-            this.extensions = new SpeciesData[EXTENSION_TYPES.length()];
+            this.extensions = new SpeciesData[ARG_TYPE_LIMIT];
         }
 
         private void initForBootstrap() {
             assert(!INIT_DONE);
-            if (constructor[0] == null) {
+            if (constructor() == null) {
+                String types = typeChars;
                 Factory.makeCtors(clazz, types, this.constructor);
                 Factory.makeGetters(clazz, types, this.getters);
+                Factory.makeNominalGetters(types, this.nominalGetters, this.getters);
             }
         }
 
-        private SpeciesData(String types) {
+        private SpeciesData(String typeChars) {
             // Placeholder only.
-            this.types = types;
+            this.typeChars = typeChars;
+            this.typeCodes = basicTypes(typeChars);
             this.clazz = null;
             this.constructor = null;
             this.getters = null;
+            this.nominalGetters = null;
             this.extensions = null;
         }
         private boolean isPlaceholder() { return clazz == null; }
@@ -401,18 +377,15 @@
         static { CACHE.put("", EMPTY); }  // make bootstrap predictable
         private static final boolean INIT_DONE;  // set after <clinit> finishes...
 
-        SpeciesData extendWithType(char type) {
-            int i = extensionIndex(type);
-            SpeciesData d = extensions[i];
-            if (d != null)  return d;
-            extensions[i] = d = get(types+type);
-            return d;
+        SpeciesData extendWith(byte type) {
+            return extendWith(BasicType.basicType(type));
         }
 
-        SpeciesData extendWithIndex(byte index) {
-            SpeciesData d = extensions[index];
+        SpeciesData extendWith(BasicType type) {
+            int ord = type.ordinal();
+            SpeciesData d = extensions[ord];
             if (d != null)  return d;
-            extensions[index] = d = get(types+EXTENSION_TYPES.charAt(index));
+            extensions[ord] = d = get(typeChars+type.basicTypeChar());
             return d;
         }
 
@@ -456,8 +429,6 @@
         static {
             // pre-fill the BMH speciesdata cache with BMH's inner classes
             final Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
-            SpeciesData d0 = BoundMethodHandle.SPECIES_DATA;  // trigger class init
-            assert(d0 == null || d0 == lookupCache("")) : d0;
             try {
                 for (Class<?> c : rootCls.getDeclaredClasses()) {
                     if (rootCls.isAssignableFrom(c)) {
@@ -465,7 +436,7 @@
                         SpeciesData d = Factory.speciesDataFromConcreteBMHClass(cbmh);
                         assert(d != null) : cbmh.getName();
                         assert(d.clazz == cbmh);
-                        assert(d == lookupCache(d.types));
+                        assert(d == lookupCache(d.typeChars));
                     }
                 }
             } catch (Throwable e) {
@@ -516,11 +487,10 @@
         static final String BMHSPECIES_DATA_GFC_SIG = "(" + JLS_SIG + JLC_SIG + ")" + SPECIES_DATA_SIG;
         static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG;
         static final String VOID_SIG   = "()V";
+        static final String INT_SIG    = "()I";
 
         static final String SIG_INCIPIT = "(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
 
-        static final Class<?>[] TYPES = new Class<?>[] { Object.class, int.class, long.class, float.class, double.class };
-
         static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
 
         /**
@@ -551,31 +521,35 @@
          *     final Object argL0;
          *     final Object argL1;
          *     final int argI2;
-         *     Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
+         *     private Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
          *         super(mt, lf);
          *         this.argL0 = argL0;
          *         this.argL1 = argL1;
          *         this.argI2 = argI2;
          *     }
          *     final SpeciesData speciesData() { return SPECIES_DATA; }
+         *     final int fieldCount() { return 3; }
          *     static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
-         *     final BoundMethodHandle clone(MethodType mt, LambdaForm lf) {
-         *         return SPECIES_DATA.constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2);
+         *     static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
+         *         return new Species_LLI(mt, lf, argL0, argL1, argI2);
          *     }
-         *     final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
+         *         return new Species_LLI(mt, lf, argL0, argL1, argI2);
          *     }
-         *     final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
+         *         return SPECIES_DATA.extendWith(L_TYPE).constructor().invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
+         *         return SPECIES_DATA.extendWith(I_TYPE).constructor().invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
+         *         return SPECIES_DATA.extendWith(J_TYPE).constructor().invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
+         *         return SPECIES_DATA.extendWith(F_TYPE).constructor().invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     }
+         *     public final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
+         *         return SPECIES_DATA.extendWith(D_TYPE).constructor().invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
          * }
          * </pre>
@@ -586,8 +560,9 @@
         static Class<? extends BoundMethodHandle> generateConcreteBMHClass(String types) {
             final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
 
-            final String className  = SPECIES_PREFIX_PATH + types;
-            final String sourceFile = SPECIES_PREFIX_NAME + types;
+            String shortTypes = LambdaForm.shortenSignature(types);
+            final String className  = SPECIES_PREFIX_PATH + shortTypes;
+            final String sourceFile = SPECIES_PREFIX_NAME + shortTypes;
             final int NOT_ACC_PUBLIC = 0;  // not ACC_PUBLIC
             cw.visit(V1_6, NOT_ACC_PUBLIC + ACC_FINAL + ACC_SUPER, className, null, BMH, null);
             cw.visitSource(sourceFile, null);
@@ -606,13 +581,13 @@
             MethodVisitor mv;
 
             // emit constructor
-            mv = cw.visitMethod(NOT_ACC_PUBLIC, "<init>", makeSignature(types, true), null, null);
+            mv = cw.visitMethod(ACC_PRIVATE, "<init>", makeSignature(types, true), null, null);
             mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitVarInsn(ALOAD, 1);
-            mv.visitVarInsn(ALOAD, 2);
+            mv.visitVarInsn(ALOAD, 0); // this
+            mv.visitVarInsn(ALOAD, 1); // type
+            mv.visitVarInsn(ALOAD, 2); // form
 
-            mv.visitMethodInsn(INVOKESPECIAL, BMH, "<init>", makeSignature("", true));
+            mv.visitMethodInsn(INVOKESPECIAL, BMH, "<init>", makeSignature("", true), false);
 
             for (int i = 0, j = 0; i < types.length(); ++i, ++j) {
                 // i counts the arguments, j counts corresponding argument slots
@@ -629,16 +604,6 @@
             mv.visitMaxs(0, 0);
             mv.visitEnd();
 
-            // emit implementation of reinvokerTarget()
-            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "reinvokerTarget", "()" + MH_SIG, null, null);
-            mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitFieldInsn(GETFIELD, className, "argL0", JLO_SIG);
-            mv.visitTypeInsn(CHECKCAST, MH);
-            mv.visitInsn(ARETURN);
-            mv.visitMaxs(0, 0);
-            mv.visitEnd();
-
             // emit implementation of speciesData()
             mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "speciesData", MYSPECIES_DATA_SIG, null, null);
             mv.visitCode();
@@ -647,51 +612,83 @@
             mv.visitMaxs(0, 0);
             mv.visitEnd();
 
-            // emit clone()
-            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "clone", makeSignature("", false), null, E_THROWABLE);
+            // emit implementation of fieldCount()
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "fieldCount", INT_SIG, null, null);
             mv.visitCode();
-            // return speciesData().constructor[0].invokeBasic(mt, lf, argL0, ...)
-            // obtain constructor
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
-            mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG);
-            mv.visitInsn(ICONST_0);
-            mv.visitInsn(AALOAD);
+            int fc = types.length();
+            if (fc <= (ICONST_5 - ICONST_0)) {
+                mv.visitInsn(ICONST_0 + fc);
+            } else {
+                mv.visitIntInsn(SIPUSH, fc);
+            }
+            mv.visitInsn(IRETURN);
+            mv.visitMaxs(0, 0);
+            mv.visitEnd();
+            // emit make()  ...factory method wrapping constructor
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_STATIC, "make", makeSignature(types, false), null, null);
+            mv.visitCode();
+            // make instance
+            mv.visitTypeInsn(NEW, className);
+            mv.visitInsn(DUP);
+            // load mt, lf
+            mv.visitVarInsn(ALOAD, 0);  // type
+            mv.visitVarInsn(ALOAD, 1);  // form
+            // load factory method arguments
+            for (int i = 0, j = 0; i < types.length(); ++i, ++j) {
+                // i counts the arguments, j counts corresponding argument slots
+                char t = types.charAt(i);
+                mv.visitVarInsn(typeLoadOp(t), j + 2); // parameters start at 3
+                if (t == 'J' || t == 'D') {
+                    ++j; // adjust argument register access
+                }
+            }
+
+            // finally, invoke the constructor and return
+            mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", makeSignature(types, true), false);
+            mv.visitInsn(ARETURN);
+            mv.visitMaxs(0, 0);
+            mv.visitEnd();
+
+            // emit copyWith()
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWith", makeSignature("", false), null, null);
+            mv.visitCode();
+            // make instance
+            mv.visitTypeInsn(NEW, className);
+            mv.visitInsn(DUP);
             // load mt, lf
             mv.visitVarInsn(ALOAD, 1);
             mv.visitVarInsn(ALOAD, 2);
             // put fields on the stack
             emitPushFields(types, className, mv);
             // finally, invoke the constructor and return
-            mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types, false));
+            mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", makeSignature(types, true), false);
             mv.visitInsn(ARETURN);
             mv.visitMaxs(0, 0);
             mv.visitEnd();
 
-            // for each type, emit cloneExtendT()
-            for (Class<?> c : TYPES) {
-                char t = Wrapper.basicTypeChar(c);
-                mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "cloneExtend" + t, makeSignature(String.valueOf(t), false), null, E_THROWABLE);
+            // for each type, emit copyWithExtendT()
+            for (BasicType type : BasicType.ARG_TYPES) {
+                int ord = type.ordinal();
+                char btChar = type.basicTypeChar();
+                mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWithExtend" + btChar, makeSignature(String.valueOf(btChar), false), null, E_THROWABLE);
                 mv.visitCode();
-                // return SPECIES_DATA.extendWithIndex(extensionIndex(t)).constructor[0].invokeBasic(mt, lf, argL0, ..., narg)
+                // return SPECIES_DATA.extendWith(t).constructor().invokeBasic(mt, lf, argL0, ..., narg)
                 // obtain constructor
                 mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
-                int iconstInsn = ICONST_0 + extensionIndex(t);
+                int iconstInsn = ICONST_0 + ord;
                 assert(iconstInsn <= ICONST_5);
                 mv.visitInsn(iconstInsn);
-                mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWithIndex", BMHSPECIES_DATA_EWI_SIG);
-                mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG);
-                mv.visitInsn(ICONST_0);
-                mv.visitInsn(AALOAD);
+                mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWith", BMHSPECIES_DATA_EWI_SIG, false);
+                mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "constructor", "()" + MH_SIG, false);
                 // load mt, lf
                 mv.visitVarInsn(ALOAD, 1);
                 mv.visitVarInsn(ALOAD, 2);
                 // put fields on the stack
                 emitPushFields(types, className, mv);
                 // put narg on stack
-                mv.visitVarInsn(typeLoadOp(t), 3);
+                mv.visitVarInsn(typeLoadOp(btChar), 3);
                 // finally, invoke the constructor and return
-                mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + t, false));
+                mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + btChar, false), false);
                 mv.visitInsn(ARETURN);
                 mv.visitMaxs(0, 0);
                 mv.visitEnd();
@@ -702,7 +699,7 @@
             mv.visitCode();
             mv.visitLdcInsn(types);
             mv.visitLdcInsn(Type.getObjectType(className));
-            mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG);
+            mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG, false);
             mv.visitFieldInsn(PUTSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
             mv.visitInsn(RETURN);
             mv.visitMaxs(0, 0);
@@ -730,7 +727,7 @@
             case 'J': return LLOAD;
             case 'F': return FLOAD;
             case 'D': return DLOAD;
-            default : throw new InternalError("unrecognized type " + t);
+            default : throw newInternalError("unrecognized type " + t);
             }
         }
 
@@ -771,10 +768,19 @@
 
         static MethodHandle[] makeCtors(Class<? extends BoundMethodHandle> cbmh, String types, MethodHandle mhs[]) {
             if (mhs == null)  mhs = new MethodHandle[1];
+            if (types.equals(""))  return mhs;  // hack for empty BMH species
             mhs[0] = makeCbmhCtor(cbmh, types);
             return mhs;
         }
 
+        static NamedFunction[] makeNominalGetters(String types, NamedFunction[] nfs, MethodHandle[] getters) {
+            if (nfs == null)  nfs = new NamedFunction[types.length()];
+            for (int i = 0; i < nfs.length; ++i) {
+                nfs[i] = new NamedFunction(getters[i]);
+            }
+            return nfs;
+        }
+
         //
         // Auxiliary methods.
         //
@@ -808,52 +814,11 @@
 
         static MethodHandle makeCbmhCtor(Class<? extends BoundMethodHandle> cbmh, String types) {
             try {
-                return linkConstructor(LOOKUP.findConstructor(cbmh, MethodType.fromMethodDescriptorString(makeSignature(types, true), null)));
+                return LOOKUP.findStatic(cbmh, "make", MethodType.fromMethodDescriptorString(makeSignature(types, false), null));
             } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) {
                 throw newInternalError(e);
             }
         }
-
-        /**
-         * Wrap a constructor call in a {@link LambdaForm}.
-         *
-         * If constructors ({@code <init>} methods) are called in LFs, problems might arise if the LFs
-         * are turned into bytecode, because the call to the allocator is routed through an MH, and the
-         * verifier cannot find a {@code NEW} instruction preceding the {@code INVOKESPECIAL} to
-         * {@code <init>}. To avoid this, we add an indirection by invoking {@code <init>} through
-         * {@link MethodHandle#linkToSpecial}.
-         *
-         * The last {@link LambdaForm.Name Name} in the argument's form is expected to be the {@code void}
-         * result of the {@code <init>} invocation. This entry is replaced.
-         */
-        private static MethodHandle linkConstructor(MethodHandle cmh) {
-            final LambdaForm lf = cmh.form;
-            final int initNameIndex = lf.names.length - 1;
-            final Name initName = lf.names[initNameIndex];
-            final MemberName ctorMN = initName.function.member;
-            final MethodType ctorMT = ctorMN.getInvocationType();
-
-            // obtain function member (call target)
-            // linker method type replaces initial parameter (BMH species) with BMH to avoid naming a species (anonymous class!)
-            final MethodType linkerMT = ctorMT.changeParameterType(0, BoundMethodHandle.class).appendParameterTypes(MemberName.class);
-            MemberName linkerMN = new MemberName(MethodHandle.class, "linkToSpecial", linkerMT, REF_invokeStatic);
-            try {
-                linkerMN = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linkerMN, null, NoSuchMethodException.class);
-                assert(linkerMN.isStatic());
-            } catch (ReflectiveOperationException ex) {
-                throw newInternalError(ex);
-            }
-            // extend arguments array
-            Object[] newArgs = Arrays.copyOf(initName.arguments, initName.arguments.length + 1);
-            newArgs[newArgs.length - 1] = ctorMN;
-            // replace function
-            final NamedFunction nf = new NamedFunction(linkerMN);
-            final Name linkedCtor = new Name(nf, newArgs);
-            linkedCtor.initIndex(initNameIndex);
-            lf.names[initNameIndex] = linkedCtor;
-            return cmh;
-        }
-
     }
 
     private static final Lookup LOOKUP = Lookup.IMPL_LOOKUP;
diff --git a/src/share/classes/java/lang/invoke/CallSite.java b/src/share/classes/java/lang/invoke/CallSite.java
index 949364b..10ac1c0 100644
--- a/src/share/classes/java/lang/invoke/CallSite.java
+++ b/src/share/classes/java/lang/invoke/CallSite.java
@@ -102,7 +102,7 @@
      */
     /*package-private*/
     CallSite(MethodType type) {
-        target = type.invokers().uninitializedCallSite();
+        target = makeUninitializedCallSite(type);
     }
 
     /**
@@ -211,27 +211,40 @@
     public abstract MethodHandle dynamicInvoker();
 
     /*non-public*/ MethodHandle makeDynamicInvoker() {
-        MethodHandle getTarget = GET_TARGET.bindReceiver(this);
+        MethodHandle getTarget = GET_TARGET.bindArgumentL(0, this);
         MethodHandle invoker = MethodHandles.exactInvoker(this.type());
         return MethodHandles.foldArguments(invoker, getTarget);
     }
 
     private static final MethodHandle GET_TARGET;
+    private static final MethodHandle THROW_UCS;
     static {
         try {
             GET_TARGET = IMPL_LOOKUP.
                 findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
+            THROW_UCS = IMPL_LOOKUP.
+                findStatic(CallSite.class, "uninitializedCallSite", MethodType.methodType(Object.class, Object[].class));
         } catch (ReflectiveOperationException e) {
             throw newInternalError(e);
         }
     }
 
     /** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
-    /*package-private*/
-    static Empty uninitializedCallSite() {
+    private static Object uninitializedCallSite(Object... ignore) {
         throw new IllegalStateException("uninitialized call site");
     }
 
+    private MethodHandle makeUninitializedCallSite(MethodType targetType) {
+        MethodType basicType = targetType.basicType();
+        MethodHandle invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_UNINIT_CS);
+        if (invoker == null) {
+            invoker = THROW_UCS.asType(basicType);
+            invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_UNINIT_CS, invoker);
+        }
+        // unchecked view is OK since no values will be received or returned
+        return invoker.viewAsType(targetType, false);
+    }
+
     // unsafe stuff:
     private static final long TARGET_OFFSET;
     static {
@@ -319,7 +332,7 @@
                 throw new ClassCastException("bootstrap method failed to produce a CallSite");
             }
             if (!site.getTarget().type().equals(type))
-                throw new WrongMethodTypeException("wrong type: "+site.getTarget());
+                throw wrongTargetType(site.getTarget(), type);
         } catch (Throwable ex) {
             BootstrapMethodError bex;
             if (ex instanceof BootstrapMethodError)
diff --git a/src/share/classes/java/lang/invoke/DelegatingMethodHandle.java b/src/share/classes/java/lang/invoke/DelegatingMethodHandle.java
new file mode 100644
index 0000000..63ba8fe
--- /dev/null
+++ b/src/share/classes/java/lang/invoke/DelegatingMethodHandle.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.invoke;
+
+import java.util.Arrays;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * A method handle whose invocation behavior is determined by a target.
+ * The delegating MH itself can hold extra "intentions" beyond the simple behavior.
+ * @author jrose
+ */
+/*non-public*/
+abstract class DelegatingMethodHandle extends MethodHandle {
+    protected DelegatingMethodHandle(MethodHandle target) {
+        this(target.type(), target);
+    }
+
+    protected DelegatingMethodHandle(MethodType type, MethodHandle target) {
+        super(type, chooseDelegatingForm(target));
+    }
+
+    /** Define this to extract the delegated target which supplies the invocation behavior. */
+    abstract protected MethodHandle getTarget();
+
+    @Override
+    abstract MethodHandle asTypeUncached(MethodType newType);
+
+    @Override
+    MemberName internalMemberName() {
+        return getTarget().internalMemberName();
+    }
+
+    @Override
+    boolean isInvokeSpecial() {
+        return getTarget().isInvokeSpecial();
+    }
+
+    @Override
+    Class<?> internalCallerClass() {
+        return getTarget().internalCallerClass();
+    }
+
+    @Override
+    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+        // FIXME: rethink 'copyWith' protocol; it is too low-level for use on all MHs
+        throw newIllegalArgumentException("do not use this");
+    }
+
+    @Override
+    String internalProperties() {
+        return "\n& Class="+getClass().getSimpleName()+
+               "\n& Target="+getTarget().debugString();
+    }
+
+    @Override
+    BoundMethodHandle rebind() {
+        return getTarget().rebind();
+    }
+
+    private static LambdaForm chooseDelegatingForm(MethodHandle target) {
+        if (target instanceof SimpleMethodHandle)
+            return target.internalForm();  // no need for an indirection
+        return makeReinvokerForm(target, MethodTypeForm.LF_DELEGATE, DelegatingMethodHandle.class, NF_getTarget);
+    }
+
+    /** Create a LF which simply reinvokes a target of the given basic type. */
+    static LambdaForm makeReinvokerForm(MethodHandle target,
+                                        int whichCache,
+                                        Object constraint,
+                                        NamedFunction getTargetFn) {
+        MethodType mtype = target.type().basicType();
+        boolean customized = (whichCache < 0 ||
+                mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY);
+        LambdaForm form;
+        if (!customized) {
+            form = mtype.form().cachedLambdaForm(whichCache);
+            if (form != null)  return form;
+        }
+        final int THIS_DMH    = 0;
+        final int ARG_BASE    = 1;
+        final int ARG_LIMIT   = ARG_BASE + mtype.parameterCount();
+        int nameCursor = ARG_LIMIT;
+        final int NEXT_MH     = customized ? -1 : nameCursor++;
+        final int REINVOKE    = nameCursor++;
+        LambdaForm.Name[] names = LambdaForm.arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
+        assert(names.length == nameCursor);
+        names[THIS_DMH] = names[THIS_DMH].withConstraint(constraint);
+        Object[] targetArgs;
+        if (customized) {
+            targetArgs = Arrays.copyOfRange(names, ARG_BASE, ARG_LIMIT, Object[].class);
+            names[REINVOKE] = new LambdaForm.Name(target, targetArgs);  // the invoker is the target itself
+        } else {
+            names[NEXT_MH] = new LambdaForm.Name(getTargetFn, names[THIS_DMH]);
+            targetArgs = Arrays.copyOfRange(names, THIS_DMH, ARG_LIMIT, Object[].class);
+            targetArgs[0] = names[NEXT_MH];  // overwrite this MH with next MH
+            names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs);
+        }
+        String debugString;
+        switch(whichCache) {
+            case MethodTypeForm.LF_REBIND:   debugString = "BMH.reinvoke"; break;
+            case MethodTypeForm.LF_DELEGATE: debugString = "MH.delegate";  break;
+            default:                         debugString = "MH.reinvoke";  break;
+        }
+        form = new LambdaForm(debugString, ARG_LIMIT, names);
+        if (!customized) {
+            form = mtype.form().setCachedLambdaForm(whichCache, form);
+        }
+        return form;
+    }
+
+    private static final NamedFunction NF_getTarget;
+    static {
+        try {
+            NF_getTarget = new NamedFunction(DelegatingMethodHandle.class
+                                             .getDeclaredMethod("getTarget"));
+        } catch (ReflectiveOperationException ex) {
+            throw newInternalError(ex);
+        }
+    }
+}
diff --git a/src/share/classes/java/lang/invoke/DirectMethodHandle.java b/src/share/classes/java/lang/invoke/DirectMethodHandle.java
index 9c05451..e9d2526 100644
--- a/src/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/src/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -31,6 +31,7 @@
 import sun.invoke.util.VerifyAccess;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodTypeForm.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import java.lang.ref.WeakReference;
@@ -58,6 +59,7 @@
             MemberName m = new MemberName(Object.class, member.getName(), member.getMethodType(), member.getReferenceKind());
             m = MemberName.getFactory().resolveOrNull(m.getReferenceKind(), m, null);
             if (m != null && m.isPublic()) {
+                assert(member.getReferenceKind() == m.getReferenceKind());  // else this.form is wrong
                 member = m;
             }
         }
@@ -125,65 +127,30 @@
     }
 
     @Override
+    BoundMethodHandle rebind() {
+        return BoundMethodHandle.makeReinvoker(this);
+    }
+
+    @Override
     MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+        assert(this.getClass() == DirectMethodHandle.class);  // must override in subclasses
         return new DirectMethodHandle(mt, lf, member);
     }
 
     @Override
     String internalProperties() {
-        return "/DMH="+member.toString();
+        return "\n& DMH.MN="+internalMemberName();
     }
 
     //// Implementation methods.
     @Override
-    MethodHandle viewAsType(MethodType newType) {
-        return new DirectMethodHandle(newType, form, member);
-    }
-    @Override
     @ForceInline
     MemberName internalMemberName() {
         return member;
     }
 
-    @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
-        // If the member needs dispatching, do so.
-        if (pos == 0 && basicType == 'L') {
-            DirectMethodHandle concrete = maybeRebind(value);
-            if (concrete != null)
-                return concrete.bindReceiver(value);
-        }
-        return super.bindArgument(pos, basicType, value);
-    }
-
-    @Override
-    MethodHandle bindReceiver(Object receiver) {
-        // If the member needs dispatching, do so.
-        DirectMethodHandle concrete = maybeRebind(receiver);
-        if (concrete != null)
-            return concrete.bindReceiver(receiver);
-        return super.bindReceiver(receiver);
-    }
-
     private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory();
 
-    private DirectMethodHandle maybeRebind(Object receiver) {
-        if (receiver != null) {
-            switch (member.getReferenceKind()) {
-            case REF_invokeInterface:
-            case REF_invokeVirtual:
-                // Pre-dispatch the member.
-                Class<?> concreteClass = receiver.getClass();
-                MemberName concrete = new MemberName(concreteClass, member.getName(), member.getMethodType(), REF_invokeSpecial);
-                concrete = IMPL_NAMES.resolveOrNull(REF_invokeSpecial, concrete, concreteClass);
-                if (concrete != null)
-                    return new DirectMethodHandle(type(), preparedLambdaForm(concrete), concrete);
-                break;
-            }
-        }
-        return null;
-    }
-
     /**
      * Create a LF which can invoke the given method.
      * Cache and share this structure among all methods with
@@ -264,9 +231,10 @@
         } else {
             names[GET_MEMBER] = new Name(Lazy.NF_internalMemberName, names[DMH_THIS]);
         }
+        assert(findDirectMethodHandle(names[GET_MEMBER]) == names[DMH_THIS]);
         Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, GET_MEMBER+1, Object[].class);
         assert(outArgs[outArgs.length-1] == names[GET_MEMBER]);  // look, shifted args!
-        int result = LambdaForm.LAST_RESULT;
+        int result = LAST_RESULT;
         if (doesAlloc) {
             assert(outArgs[outArgs.length-2] == names[NEW_OBJ]);  // got to move this one
             System.arraycopy(outArgs, 0, outArgs, 1, outArgs.length-2);
@@ -274,13 +242,23 @@
             result = NEW_OBJ;
         }
         names[LINKER_CALL] = new Name(linker, outArgs);
-        lambdaName += "_" + LambdaForm.basicTypeSignature(mtype);
+        lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
         LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
         // This is a tricky bit of code.  Don't send it through the LF interpreter.
         lform.compileToBytecode();
         return lform;
     }
 
+    static Object findDirectMethodHandle(Name name) {
+        if (name.function == Lazy.NF_internalMemberName ||
+            name.function == Lazy.NF_internalMemberNameEnsureInit ||
+            name.function == Lazy.NF_constructorMethod) {
+            assert(name.arguments.length == 1);
+            return name.arguments[0];
+        }
+        return null;
+    }
+
     private static void maybeCompile(LambdaForm lform, MemberName m) {
         if (VerifyAccess.isSamePackage(m.getDeclaringClass(), MethodHandle.class))
             // Help along bootstrapping...
@@ -393,8 +371,8 @@
             return true;
         }
         @Override
-        MethodHandle viewAsType(MethodType newType) {
-            return new Special(newType, form, member);
+        MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+            return new Special(mt, lf, member);
         }
     }
 
@@ -411,8 +389,8 @@
             assert(initMethod.isResolved());
         }
         @Override
-        MethodHandle viewAsType(MethodType newType) {
-            return new Constructor(newType, form, member, initMethod, instanceClass);
+        MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+            return new Constructor(mt, lf, member, initMethod, instanceClass);
         }
     }
 
@@ -441,8 +419,8 @@
             return fieldType.cast(obj);
         }
         @Override
-        MethodHandle viewAsType(MethodType newType) {
-            return new Accessor(newType, form, member, fieldOffset);
+        MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+            return new Accessor(mt, lf, member, fieldOffset);
         }
     }
 
@@ -484,8 +462,8 @@
             return fieldType.cast(obj);
         }
         @Override
-        MethodHandle viewAsType(MethodType newType) {
-            return new StaticAccessor(newType, form, member, staticBase, staticOffset);
+        MethodHandle copyWith(MethodType mt, LambdaForm lf) {
+            return new StaticAccessor(mt, lf, member, staticBase, staticOffset);
         }
     }
 
diff --git a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
index 2fc8618..752c097 100644
--- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
+++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
@@ -193,10 +193,10 @@
     CallSite buildCallSite() throws LambdaConversionException {
         final Class<?> innerClass = spinInnerClass();
         if (invokedType.parameterCount() == 0) {
-            final Constructor[] ctrs = AccessController.doPrivileged(
-                    new PrivilegedAction<Constructor[]>() {
+            final Constructor<?>[] ctrs = AccessController.doPrivileged(
+                    new PrivilegedAction<Constructor<?>[]>() {
                 @Override
-                public Constructor[] run() {
+                public Constructor<?>[] run() {
                     Constructor<?>[] ctrs = innerClass.getDeclaredConstructors();
                     if (ctrs.length == 1) {
                         // The lambda implementing inner class constructor is private, set
@@ -338,7 +338,7 @@
             m.visitVarInsn(getLoadOpcode(argType), varIndex);
             varIndex += getParameterSize(argType);
         }
-        m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString());
+        m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString(), false);
         m.visitInsn(ARETURN);
         m.visitMaxs(-1, -1);
         m.visitEnd();
@@ -354,7 +354,7 @@
         ctor.visitCode();
         ctor.visitVarInsn(ALOAD, 0);
         ctor.visitMethodInsn(INVOKESPECIAL, JAVA_LANG_OBJECT, NAME_CTOR,
-                             METHOD_DESCRIPTOR_VOID);
+                             METHOD_DESCRIPTOR_VOID, false);
         int parameterCount = invokedType.parameterCount();
         for (int i = 0, lvIndex = 0; i < parameterCount; i++) {
             ctor.visitVarInsn(ALOAD, 0);
@@ -402,7 +402,7 @@
             mv.visitInsn(AASTORE);
         }
         mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR,
-                DESCR_CTOR_SERIALIZED_LAMBDA);
+                DESCR_CTOR_SERIALIZED_LAMBDA, false);
         mv.visitInsn(ARETURN);
         // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
         mv.visitMaxs(-1, -1);
@@ -421,7 +421,7 @@
         mv.visitInsn(DUP);
         mv.visitLdcInsn("Non-serializable lambda");
         mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR,
-                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION);
+                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION, false);
         mv.visitInsn(ATHROW);
         mv.visitMaxs(-1, -1);
         mv.visitEnd();
@@ -434,7 +434,7 @@
         mv.visitInsn(DUP);
         mv.visitLdcInsn("Non-serializable lambda");
         mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR,
-                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION);
+                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION, false);
         mv.visitInsn(ATHROW);
         mv.visitMaxs(-1, -1);
         mv.visitEnd();
diff --git a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index 55260ee..cdbbebc 100644
--- a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -25,20 +25,20 @@
 
 package java.lang.invoke;
 
-import sun.invoke.util.VerifyAccess;
-import java.lang.invoke.LambdaForm.Name;
-
-import sun.invoke.util.Wrapper;
-
 import java.io.*;
 import java.util.*;
+import java.lang.reflect.Modifier;
 
 import jdk.internal.org.objectweb.asm.*;
 
-import java.lang.reflect.*;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
+
+import sun.invoke.util.VerifyAccess;
 import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
 import sun.reflect.misc.ReflectUtil;
 
 /**
@@ -62,7 +62,7 @@
     private static final String CLL_SIG = "(L" + CLS + ";L" + OBJ + ";)L" + OBJ + ";";
 
     /** Name of its super class*/
-    private static final String superName = LF;
+    private static final String superName = OBJ;
 
     /** Name of new class */
     private final String className;
@@ -73,7 +73,11 @@
     private final LambdaForm lambdaForm;
     private final String     invokerName;
     private final MethodType invokerType;
-    private final int[] localsMap;
+
+    /** Info about local variables in compiled lambda form */
+    private final int[]       localsMap;    // index
+    private final BasicType[] localTypes;   // basic type
+    private final Class<?>[]  localClasses; // type
 
     /** ASM bytecode generation. */
     private ClassWriter cw;
@@ -82,6 +86,7 @@
     private static final MemberName.Factory MEMBERNAME_FACTORY = MemberName.getFactory();
     private static final Class<?> HOST_CLASS = LambdaForm.class;
 
+    /** Main constructor; other constructors delegate to this one. */
     private InvokerBytecodeGenerator(LambdaForm lambdaForm, int localsMapSize,
                                      String className, String invokerName, MethodType invokerType) {
         if (invokerName.contains(".")) {
@@ -92,23 +97,31 @@
         if (DUMP_CLASS_FILES) {
             className = makeDumpableClassName(className);
         }
-        this.className  = superName + "$" + className;
+        this.className  = LF + "$" + className;
         this.sourceFile = "LambdaForm$" + className;
         this.lambdaForm = lambdaForm;
         this.invokerName = invokerName;
         this.invokerType = invokerType;
-        this.localsMap = new int[localsMapSize];
+        this.localsMap = new int[localsMapSize+1];
+        // last entry of localsMap is count of allocated local slots
+        this.localTypes = new BasicType[localsMapSize+1];
+        this.localClasses = new Class<?>[localsMapSize+1];
     }
 
+    /** For generating LambdaForm interpreter entry points. */
     private InvokerBytecodeGenerator(String className, String invokerName, MethodType invokerType) {
         this(null, invokerType.parameterCount(),
              className, invokerName, invokerType);
         // Create an array to map name indexes to locals indexes.
+        localTypes[localTypes.length - 1] = V_TYPE;
         for (int i = 0; i < localsMap.length; i++) {
             localsMap[i] = invokerType.parameterSlotCount() - invokerType.parameterSlotDepth(i);
+            if (i < invokerType.parameterCount())
+                localTypes[i] = basicType(invokerType.parameterType(i));
         }
     }
 
+    /** For generating customized code for a single LambdaForm. */
     private InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
         this(form, form.names.length,
              className, form.debugName, invokerType);
@@ -116,7 +129,11 @@
         Name[] names = form.names;
         for (int i = 0, index = 0; i < localsMap.length; i++) {
             localsMap[i] = index;
-            index += Wrapper.forBasicType(names[i].type).stackSlots();
+            if (i < names.length) {
+                BasicType type = names[i].type();
+                index += type.basicTypeSlots();
+                localTypes[i] = type;
+            }
         }
     }
 
@@ -147,7 +164,6 @@
 
     static void maybeDump(final String className, final byte[] classFile) {
         if (DUMP_CLASS_FILES) {
-            System.out.println("dump: " + className);
             java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Void>() {
                 public Void run() {
@@ -155,6 +171,7 @@
                         String dumpName = className;
                         //dumpName = dumpName.replace('/', '-');
                         File dumpFile = new File(DUMP_CLASS_FILES_DIR, dumpName+".class");
+                        System.out.println("dump: " + dumpFile);
                         dumpFile.getParentFile().mkdirs();
                         FileOutputStream file = new FileOutputStream(dumpFile);
                         file.write(classFile);
@@ -203,7 +220,7 @@
 
     String constantPlaceholder(Object arg) {
         String cpPlaceholder = "CONSTANT_PLACEHOLDER_" + cph++;
-        if (DUMP_CLASS_FILES) cpPlaceholder += " <<" + arg.toString() + ">>";  // debugging aid
+        if (DUMP_CLASS_FILES) cpPlaceholder += " <<" + debugString(arg) + ">>";  // debugging aid
         if (cpPatches.containsKey(cpPlaceholder)) {
             throw new InternalError("observed CP placeholder twice: " + cpPlaceholder);
         }
@@ -224,6 +241,17 @@
         return res;
     }
 
+    private static String debugString(Object arg) {
+        if (arg instanceof MethodHandle) {
+            MethodHandle mh = (MethodHandle) arg;
+            MemberName member = mh.internalMemberName();
+            if (member != null)
+                return member.toString();
+            return mh.debugString();
+        }
+        return arg.toString();
+    }
+
     /**
      * Extract the number of constant pool entries from a given class file.
      *
@@ -359,118 +387,212 @@
     /*
      * NOTE: These load/store methods use the localsMap to find the correct index!
      */
-    private void emitLoadInsn(char type, int index) {
-        int opcode;
-        switch (type) {
-        case 'I':  opcode = Opcodes.ILOAD;  break;
-        case 'J':  opcode = Opcodes.LLOAD;  break;
-        case 'F':  opcode = Opcodes.FLOAD;  break;
-        case 'D':  opcode = Opcodes.DLOAD;  break;
-        case 'L':  opcode = Opcodes.ALOAD;  break;
-        default:
-            throw new InternalError("unknown type: " + type);
-        }
+    private void emitLoadInsn(BasicType type, int index) {
+        int opcode = loadInsnOpcode(type);
         mv.visitVarInsn(opcode, localsMap[index]);
     }
-    private void emitAloadInsn(int index) {
-        emitLoadInsn('L', index);
-    }
 
-    private void emitStoreInsn(char type, int index) {
-        int opcode;
+    private int loadInsnOpcode(BasicType type) throws InternalError {
         switch (type) {
-        case 'I':  opcode = Opcodes.ISTORE;  break;
-        case 'J':  opcode = Opcodes.LSTORE;  break;
-        case 'F':  opcode = Opcodes.FSTORE;  break;
-        case 'D':  opcode = Opcodes.DSTORE;  break;
-        case 'L':  opcode = Opcodes.ASTORE;  break;
-        default:
-            throw new InternalError("unknown type: " + type);
+            case I_TYPE: return Opcodes.ILOAD;
+            case J_TYPE: return Opcodes.LLOAD;
+            case F_TYPE: return Opcodes.FLOAD;
+            case D_TYPE: return Opcodes.DLOAD;
+            case L_TYPE: return Opcodes.ALOAD;
+            default:
+                throw new InternalError("unknown type: " + type);
         }
+    }
+    private void emitAloadInsn(int index) {
+        emitLoadInsn(L_TYPE, index);
+    }
+
+    private void emitStoreInsn(BasicType type, int index) {
+        int opcode = storeInsnOpcode(type);
         mv.visitVarInsn(opcode, localsMap[index]);
     }
+
+    private int storeInsnOpcode(BasicType type) throws InternalError {
+        switch (type) {
+            case I_TYPE: return Opcodes.ISTORE;
+            case J_TYPE: return Opcodes.LSTORE;
+            case F_TYPE: return Opcodes.FSTORE;
+            case D_TYPE: return Opcodes.DSTORE;
+            case L_TYPE: return Opcodes.ASTORE;
+            default:
+                throw new InternalError("unknown type: " + type);
+        }
+    }
     private void emitAstoreInsn(int index) {
-        emitStoreInsn('L', index);
+        emitStoreInsn(L_TYPE, index);
+    }
+
+    private byte arrayTypeCode(Wrapper elementType) {
+        switch (elementType) {
+            case BOOLEAN: return Opcodes.T_BOOLEAN;
+            case BYTE:    return Opcodes.T_BYTE;
+            case CHAR:    return Opcodes.T_CHAR;
+            case SHORT:   return Opcodes.T_SHORT;
+            case INT:     return Opcodes.T_INT;
+            case LONG:    return Opcodes.T_LONG;
+            case FLOAT:   return Opcodes.T_FLOAT;
+            case DOUBLE:  return Opcodes.T_DOUBLE;
+            case OBJECT:  return 0; // in place of Opcodes.T_OBJECT
+            default:      throw new InternalError();
+        }
+    }
+
+    private int arrayInsnOpcode(byte tcode, int aaop) throws InternalError {
+        assert(aaop == Opcodes.AASTORE || aaop == Opcodes.AALOAD);
+        int xas;
+        switch (tcode) {
+            case Opcodes.T_BOOLEAN: xas = Opcodes.BASTORE; break;
+            case Opcodes.T_BYTE:    xas = Opcodes.BASTORE; break;
+            case Opcodes.T_CHAR:    xas = Opcodes.CASTORE; break;
+            case Opcodes.T_SHORT:   xas = Opcodes.SASTORE; break;
+            case Opcodes.T_INT:     xas = Opcodes.IASTORE; break;
+            case Opcodes.T_LONG:    xas = Opcodes.LASTORE; break;
+            case Opcodes.T_FLOAT:   xas = Opcodes.FASTORE; break;
+            case Opcodes.T_DOUBLE:  xas = Opcodes.DASTORE; break;
+            case 0:                 xas = Opcodes.AASTORE; break;
+            default:      throw new InternalError();
+        }
+        return xas - Opcodes.AASTORE + aaop;
+    }
+
+
+    private void freeFrameLocal(int oldFrameLocal) {
+        int i = indexForFrameLocal(oldFrameLocal);
+        if (i < 0)  return;
+        BasicType type = localTypes[i];
+        int newFrameLocal = makeLocalTemp(type);
+        mv.visitVarInsn(loadInsnOpcode(type), oldFrameLocal);
+        mv.visitVarInsn(storeInsnOpcode(type), newFrameLocal);
+        assert(localsMap[i] == oldFrameLocal);
+        localsMap[i] = newFrameLocal;
+        assert(indexForFrameLocal(oldFrameLocal) < 0);
+    }
+    private int indexForFrameLocal(int frameLocal) {
+        for (int i = 0; i < localsMap.length; i++) {
+            if (localsMap[i] == frameLocal && localTypes[i] != V_TYPE)
+                return i;
+        }
+        return -1;
+    }
+    private int makeLocalTemp(BasicType type) {
+        int frameLocal = localsMap[localsMap.length - 1];
+        localsMap[localsMap.length - 1] = frameLocal + type.basicTypeSlots();
+        return frameLocal;
     }
 
     /**
      * Emit a boxing call.
      *
-     * @param type primitive type class to box.
+     * @param wrapper primitive type class to box.
      */
-    private void emitBoxing(Class<?> type) {
-        Wrapper wrapper = Wrapper.forPrimitiveType(type);
+    private void emitBoxing(Wrapper wrapper) {
         String owner = "java/lang/" + wrapper.wrapperType().getSimpleName();
         String name  = "valueOf";
         String desc  = "(" + wrapper.basicTypeChar() + ")L" + owner + ";";
-        mv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, name, desc);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, name, desc, false);
     }
 
     /**
      * Emit an unboxing call (plus preceding checkcast).
      *
-     * @param type wrapper type class to unbox.
+     * @param wrapper wrapper type class to unbox.
      */
-    private void emitUnboxing(Class<?> type) {
-        Wrapper wrapper = Wrapper.forWrapperType(type);
+    private void emitUnboxing(Wrapper wrapper) {
         String owner = "java/lang/" + wrapper.wrapperType().getSimpleName();
         String name  = wrapper.primitiveSimpleName() + "Value";
         String desc  = "()" + wrapper.basicTypeChar();
-        mv.visitTypeInsn(Opcodes.CHECKCAST, owner);
-        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, owner, name, desc);
+        emitReferenceCast(wrapper.wrapperType(), null);
+        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, owner, name, desc, false);
     }
 
     /**
-     * Emit an implicit conversion.
+     * Emit an implicit conversion for an argument which must be of the given pclass.
+     * This is usually a no-op, except when pclass is a subword type or a reference other than Object or an interface.
      *
      * @param ptype type of value present on stack
      * @param pclass type of value required on stack
+     * @param arg compile-time representation of value on stack (Node, constant) or null if none
      */
-    private void emitImplicitConversion(char ptype, Class<?> pclass) {
+    private void emitImplicitConversion(BasicType ptype, Class<?> pclass, Object arg) {
+        assert(basicType(pclass) == ptype);  // boxing/unboxing handled by caller
+        if (pclass == ptype.basicTypeClass() && ptype != L_TYPE)
+            return;   // nothing to do
         switch (ptype) {
-        case 'L':
-            if (VerifyType.isNullConversion(Object.class, pclass))
+            case L_TYPE:
+                if (VerifyType.isNullConversion(Object.class, pclass, false)) {
+                    if (PROFILE_LEVEL > 0)
+                        emitReferenceCast(Object.class, arg);
+                    return;
+                }
+                emitReferenceCast(pclass, arg);
                 return;
-            if (isStaticallyNameable(pclass)) {
-                mv.visitTypeInsn(Opcodes.CHECKCAST, getInternalName(pclass));
-            } else {
-                mv.visitLdcInsn(constantPlaceholder(pclass));
-                mv.visitTypeInsn(Opcodes.CHECKCAST, CLS);
-                mv.visitInsn(Opcodes.SWAP);
-                mv.visitMethodInsn(Opcodes.INVOKESTATIC, MHI, "castReference", CLL_SIG);
-                if (pclass.isArray())
-                    mv.visitTypeInsn(Opcodes.CHECKCAST, OBJARY);
-            }
-            return;
-        case 'I':
-            if (!VerifyType.isNullConversion(int.class, pclass))
-                emitPrimCast(ptype, Wrapper.basicTypeChar(pclass));
-            return;
-        case 'J':
-            assert(pclass == long.class);
-            return;
-        case 'F':
-            assert(pclass == float.class);
-            return;
-        case 'D':
-            assert(pclass == double.class);
-            return;
+            case I_TYPE:
+                if (!VerifyType.isNullConversion(int.class, pclass, false))
+                    emitPrimCast(ptype.basicTypeWrapper(), Wrapper.forPrimitiveType(pclass));
+                return;
         }
-        throw new InternalError("bad implicit conversion: tc="+ptype+": "+pclass);
+        throw newInternalError("bad implicit conversion: tc="+ptype+": "+pclass);
+    }
+
+    /** Update localClasses type map.  Return true if the information is already present. */
+    private boolean assertStaticType(Class<?> cls, Name n) {
+        int local = n.index();
+        Class<?> aclass = localClasses[local];
+        if (aclass != null && (aclass == cls || cls.isAssignableFrom(aclass))) {
+            return true;  // type info is already present
+        } else if (aclass == null || aclass.isAssignableFrom(cls)) {
+            localClasses[local] = cls;  // type info can be improved
+        }
+        return false;
+    }
+
+    private void emitReferenceCast(Class<?> cls, Object arg) {
+        Name writeBack = null;  // local to write back result
+        if (arg instanceof Name) {
+            Name n = (Name) arg;
+            if (assertStaticType(cls, n))
+                return;  // this cast was already performed
+            if (lambdaForm.useCount(n) > 1) {
+                // This guy gets used more than once.
+                writeBack = n;
+            }
+        }
+        if (isStaticallyNameable(cls)) {
+            String sig = getInternalName(cls);
+            mv.visitTypeInsn(Opcodes.CHECKCAST, sig);
+        } else {
+            mv.visitLdcInsn(constantPlaceholder(cls));
+            mv.visitTypeInsn(Opcodes.CHECKCAST, CLS);
+            mv.visitInsn(Opcodes.SWAP);
+            mv.visitMethodInsn(Opcodes.INVOKESTATIC, MHI, "castReference", CLL_SIG, false);
+            if (Object[].class.isAssignableFrom(cls))
+                mv.visitTypeInsn(Opcodes.CHECKCAST, OBJARY);
+            else if (PROFILE_LEVEL > 0)
+                mv.visitTypeInsn(Opcodes.CHECKCAST, OBJ);
+        }
+        if (writeBack != null) {
+            mv.visitInsn(Opcodes.DUP);
+            emitAstoreInsn(writeBack.index());
+        }
     }
 
     /**
      * Emits an actual return instruction conforming to the given return type.
      */
-    private void emitReturnInsn(Class<?> type) {
+    private void emitReturnInsn(BasicType type) {
         int opcode;
-        switch (Wrapper.basicTypeChar(type)) {
-        case 'I':  opcode = Opcodes.IRETURN;  break;
-        case 'J':  opcode = Opcodes.LRETURN;  break;
-        case 'F':  opcode = Opcodes.FRETURN;  break;
-        case 'D':  opcode = Opcodes.DRETURN;  break;
-        case 'L':  opcode = Opcodes.ARETURN;  break;
-        case 'V':  opcode = Opcodes.RETURN;   break;
+        switch (type) {
+        case I_TYPE:  opcode = Opcodes.IRETURN;  break;
+        case J_TYPE:  opcode = Opcodes.LRETURN;  break;
+        case F_TYPE:  opcode = Opcodes.FRETURN;  break;
+        case D_TYPE:  opcode = Opcodes.DRETURN;  break;
+        case L_TYPE:  opcode = Opcodes.ARETURN;  break;
+        case V_TYPE:  opcode = Opcodes.RETURN;   break;
         default:
             throw new InternalError("unknown return type: " + type);
         }
@@ -478,7 +600,11 @@
     }
 
     private static String getInternalName(Class<?> c) {
-        assert(VerifyAccess.isTypeVisible(c, Object.class));
+        if (c == Object.class)             return OBJ;
+        else if (c == Object[].class)      return OBJARY;
+        else if (c == Class.class)         return CLS;
+        else if (c == MethodHandle.class)  return MH;
+        assert(VerifyAccess.isTypeVisible(c, Object.class)) : c.getName();
         return c.getName().replace('.', '/');
     }
 
@@ -507,39 +633,62 @@
 
         // iterate over the form's names, generating bytecode instructions for each
         // start iterating at the first name following the arguments
+        Name onStack = null;
         for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) {
             Name name = lambdaForm.names[i];
-            MemberName member = name.function.member();
 
-            if (isSelectAlternative(i)) {
-                emitSelectAlternative(name, lambdaForm.names[i + 1]);
-                i++;  // skip MH.invokeBasic of the selectAlternative result
-            } else if (isGuardWithCatch(i)) {
-                emitGuardWithCatch(i);
-                i = i+2; // Jump to the end of GWC idiom
-            } else if (isStaticallyInvocable(member)) {
+            emitStoreResult(onStack);
+            onStack = name;  // unless otherwise modified below
+            MethodHandleImpl.Intrinsic intr = name.function.intrinsicName();
+            switch (intr) {
+                case SELECT_ALTERNATIVE:
+                    assert isSelectAlternative(i);
+                    onStack = emitSelectAlternative(name, lambdaForm.names[i+1]);
+                    i++;  // skip MH.invokeBasic of the selectAlternative result
+                    continue;
+                case GUARD_WITH_CATCH:
+                    assert isGuardWithCatch(i);
+                    onStack = emitGuardWithCatch(i);
+                    i = i+2; // Jump to the end of GWC idiom
+                    continue;
+                case NEW_ARRAY:
+                    Class<?> rtype = name.function.methodType().returnType();
+                    if (isStaticallyNameable(rtype)) {
+                        emitNewArray(name);
+                        continue;
+                    }
+                    break;
+                case ARRAY_LOAD:
+                    emitArrayLoad(name);
+                    continue;
+                case ARRAY_STORE:
+                    emitArrayStore(name);
+                    continue;
+                case IDENTITY:
+                    assert(name.arguments.length == 1);
+                    emitPushArguments(name);
+                    continue;
+                case ZERO:
+                    assert(name.arguments.length == 0);
+                    emitConst(name.type.basicTypeWrapper().zero());
+                    continue;
+                case NONE:
+                    // no intrinsic associated
+                    break;
+                default:
+                    throw newInternalError("Unknown intrinsic: "+intr);
+            }
+
+            MemberName member = name.function.member();
+            if (isStaticallyInvocable(member)) {
                 emitStaticInvoke(member, name);
             } else {
                 emitInvoke(name);
             }
-
-            // Update cached form name's info in case an intrinsic spanning multiple names was encountered.
-            name = lambdaForm.names[i];
-            member = name.function.member();
-
-            // store the result from evaluating to the target name in a local if required
-            // (if this is the last value, i.e., the one that is going to be returned,
-            // avoid store/load/return and just return)
-            if (i == lambdaForm.names.length - 1 && i == lambdaForm.result) {
-                // return value - do nothing
-            } else if (name.type != 'V') {
-                // non-void: actually assign
-                emitStoreInsn(name.type, name.index());
-            }
         }
 
         // return statement
-        emitReturn();
+        emitReturn(onStack);
 
         classFileEpilogue();
         bogusMethod(lambdaForm);
@@ -549,33 +698,47 @@
         return classFile;
     }
 
+    void emitArrayLoad(Name name)  { emitArrayOp(name, Opcodes.AALOAD);  }
+    void emitArrayStore(Name name) { emitArrayOp(name, Opcodes.AASTORE); }
+
+    void emitArrayOp(Name name, int arrayOpcode) {
+        assert arrayOpcode == Opcodes.AALOAD || arrayOpcode == Opcodes.AASTORE;
+        Class<?> elementType = name.function.methodType().parameterType(0).getComponentType();
+        assert elementType != null;
+        emitPushArguments(name);
+        if (elementType.isPrimitive()) {
+            Wrapper w = Wrapper.forPrimitiveType(elementType);
+            arrayOpcode = arrayInsnOpcode(arrayTypeCode(w), arrayOpcode);
+        }
+        mv.visitInsn(arrayOpcode);
+    }
+
     /**
      * Emit an invoke for the given name.
      */
     void emitInvoke(Name name) {
+        assert(!isLinkerMethodInvoke(name));  // should use the static path for these
         if (true) {
             // push receiver
             MethodHandle target = name.function.resolvedHandle;
             assert(target != null) : name.exprString();
             mv.visitLdcInsn(constantPlaceholder(target));
-            mv.visitTypeInsn(Opcodes.CHECKCAST, MH);
+            emitReferenceCast(MethodHandle.class, target);
         } else {
             // load receiver
             emitAloadInsn(0);
-            mv.visitTypeInsn(Opcodes.CHECKCAST, MH);
+            emitReferenceCast(MethodHandle.class, null);
             mv.visitFieldInsn(Opcodes.GETFIELD, MH, "form", LF_SIG);
             mv.visitFieldInsn(Opcodes.GETFIELD, LF, "names", LFN_SIG);
             // TODO more to come
         }
 
         // push arguments
-        for (int i = 0; i < name.arguments.length; i++) {
-            emitPushArgument(name, i);
-        }
+        emitPushArguments(name);
 
         // invocation
         MethodType type = name.function.methodType();
-        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString());
+        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString(), false);
     }
 
     static private Class<?>[] STATICALLY_INVOCABLE_PACKAGES = {
@@ -586,6 +749,10 @@
         //MethodHandle.class already covered
     };
 
+    static boolean isStaticallyInvocable(Name name) {
+        return isStaticallyInvocable(name.function.member());
+    }
+
     static boolean isStaticallyInvocable(MemberName member) {
         if (member == null)  return false;
         if (member.isConstructor())  return false;
@@ -612,6 +779,8 @@
     }
 
     static boolean isStaticallyNameable(Class<?> cls) {
+        if (cls == Object.class)
+            return true;
         while (cls.isArray())
             cls = cls.getComponentType();
         if (cls.isPrimitive())
@@ -632,12 +801,17 @@
         return false;
     }
 
+    void emitStaticInvoke(Name name) {
+        emitStaticInvoke(name.function.member(), name);
+    }
+
     /**
      * Emit an invoke for the given name, using the MemberName directly.
      */
     void emitStaticInvoke(MemberName member, Name name) {
         assert(member.equals(name.function.member()));
-        String cname = getInternalName(member.getDeclaringClass());
+        Class<?> defc = member.getDeclaringClass();
+        String cname = getInternalName(defc);
         String mname = member.getName();
         String mtype;
         byte refKind = member.getReferenceKind();
@@ -654,9 +828,7 @@
         }
 
         // push arguments
-        for (int i = 0; i < name.arguments.length; i++) {
-            emitPushArgument(name, i);
-        }
+        emitPushArguments(name);
 
         // invocation
         if (member.isMethod()) {
@@ -667,6 +839,52 @@
             mtype = MethodType.toFieldDescriptorString(member.getFieldType());
             mv.visitFieldInsn(refKindOpcode(refKind), cname, mname, mtype);
         }
+        // Issue a type assertion for the result, so we can avoid casts later.
+        if (name.type == L_TYPE) {
+            Class<?> rtype = member.getInvocationType().returnType();
+            assert(!rtype.isPrimitive());
+            if (rtype != Object.class && !rtype.isInterface()) {
+                assertStaticType(rtype, name);
+            }
+        }
+    }
+
+    void emitNewArray(Name name) throws InternalError {
+        Class<?> rtype = name.function.methodType().returnType();
+        if (name.arguments.length == 0) {
+            // The array will be a constant.
+            Object emptyArray;
+            try {
+                emptyArray = name.function.resolvedHandle.invoke();
+            } catch (Throwable ex) {
+                throw newInternalError(ex);
+            }
+            assert(java.lang.reflect.Array.getLength(emptyArray) == 0);
+            assert(emptyArray.getClass() == rtype);  // exact typing
+            mv.visitLdcInsn(constantPlaceholder(emptyArray));
+            emitReferenceCast(rtype, emptyArray);
+            return;
+        }
+        Class<?> arrayElementType = rtype.getComponentType();
+        assert(arrayElementType != null);
+        emitIconstInsn(name.arguments.length);
+        int xas = Opcodes.AASTORE;
+        if (!arrayElementType.isPrimitive()) {
+            mv.visitTypeInsn(Opcodes.ANEWARRAY, getInternalName(arrayElementType));
+        } else {
+            byte tc = arrayTypeCode(Wrapper.forPrimitiveType(arrayElementType));
+            xas = arrayInsnOpcode(tc, xas);
+            mv.visitIntInsn(Opcodes.NEWARRAY, tc);
+        }
+        // store arguments
+        for (int i = 0; i < name.arguments.length; i++) {
+            mv.visitInsn(Opcodes.DUP);
+            emitIconstInsn(i);
+            emitPushArgument(name, i);
+            mv.visitInsn(xas);
+        }
+        // the array is left on the stack
+        assertStaticType(rtype, name);
     }
     int refKindOpcode(byte refKind) {
         switch (refKind) {
@@ -709,6 +927,21 @@
     }
 
     /**
+     * Check if MemberName is a call to MethodHandle.linkToStatic, etc.
+     */
+    private boolean isLinkerMethodInvoke(Name name) {
+        if (name.function == null)
+            return false;
+        if (name.arguments.length < 1)
+            return false;  // must have MH argument
+        MemberName member = name.function.member();
+        return member != null &&
+               member.getDeclaringClass() == MethodHandle.class &&
+               !member.isPublic() && member.isStatic() &&
+               member.getName().startsWith("linkTo");
+    }
+
+    /**
      * Check if i-th name is a call to MethodHandleImpl.selectAlternative.
      */
     private boolean isSelectAlternative(int pos) {
@@ -756,7 +989,9 @@
      *     t4:I=MethodHandle.invokeBasic(t3:L,a1:I);t4:I}
      * }</pre></blockquote>
      */
-    private void emitSelectAlternative(Name selectAlternativeName, Name invokeBasicName) {
+    private Name emitSelectAlternative(Name selectAlternativeName, Name invokeBasicName) {
+        assert isStaticallyInvocable(invokeBasicName);
+
         Name receiver = (Name) invokeBasicName.arguments[0];
 
         Label L_fallback = new Label();
@@ -764,15 +999,15 @@
 
         // load test result
         emitPushArgument(selectAlternativeName, 0);
-        mv.visitInsn(Opcodes.ICONST_1);
 
         // if_icmpne L_fallback
-        mv.visitJumpInsn(Opcodes.IF_ICMPNE, L_fallback);
+        mv.visitJumpInsn(Opcodes.IFEQ, L_fallback);
 
         // invoke selectAlternativeName.arguments[1]
+        Class<?>[] preForkClasses = localClasses.clone();
         emitPushArgument(selectAlternativeName, 1);  // get 2nd argument of selectAlternative
         emitAstoreInsn(receiver.index());  // store the MH in the receiver slot
-        emitInvoke(invokeBasicName);
+        emitStaticInvoke(invokeBasicName);
 
         // goto L_done
         mv.visitJumpInsn(Opcodes.GOTO, L_done);
@@ -781,12 +1016,17 @@
         mv.visitLabel(L_fallback);
 
         // invoke selectAlternativeName.arguments[2]
+        System.arraycopy(preForkClasses, 0, localClasses, 0, preForkClasses.length);
         emitPushArgument(selectAlternativeName, 2);  // get 3rd argument of selectAlternative
         emitAstoreInsn(receiver.index());  // store the MH in the receiver slot
-        emitInvoke(invokeBasicName);
+        emitStaticInvoke(invokeBasicName);
 
         // L_done:
         mv.visitLabel(L_done);
+        // for now do not bother to merge typestate; just reset to the dominator state
+        System.arraycopy(preForkClasses, 0, localClasses, 0, preForkClasses.length);
+
+        return invokeBasicName;  // return what's on stack
     }
 
     /**
@@ -809,7 +1049,7 @@
       *      return a3.invokeBasic(ex, a6, a7);
       *  }}
       */
-    private void emitGuardWithCatch(int pos) {
+    private Name emitGuardWithCatch(int pos) {
         Name args    = lambdaForm.names[pos];
         Name invoker = lambdaForm.names[pos+1];
         Name result  = lambdaForm.names[pos+2];
@@ -860,6 +1100,12 @@
         mv.visitInsn(Opcodes.ATHROW);
 
         mv.visitLabel(L_done);
+
+        return result;
+    }
+
+    private void emitPushArguments(Name args) {
+        emitPushArguments(args, 0);
     }
 
     private void emitPushArguments(Name args, int start) {
@@ -870,75 +1116,69 @@
 
     private void emitPushArgument(Name name, int paramIndex) {
         Object arg = name.arguments[paramIndex];
-        char ptype = name.function.parameterType(paramIndex);
-        MethodType mtype = name.function.methodType();
+        Class<?> ptype = name.function.methodType().parameterType(paramIndex);
+        emitPushArgument(ptype, arg);
+    }
+
+    private void emitPushArgument(Class<?> ptype, Object arg) {
+        BasicType bptype = basicType(ptype);
         if (arg instanceof Name) {
             Name n = (Name) arg;
             emitLoadInsn(n.type, n.index());
-            emitImplicitConversion(n.type, mtype.parameterType(paramIndex));
-        } else if ((arg == null || arg instanceof String) && ptype == 'L') {
+            emitImplicitConversion(n.type, ptype, n);
+        } else if ((arg == null || arg instanceof String) && bptype == L_TYPE) {
             emitConst(arg);
         } else {
-            if (Wrapper.isWrapperType(arg.getClass()) && ptype != 'L') {
+            if (Wrapper.isWrapperType(arg.getClass()) && bptype != L_TYPE) {
                 emitConst(arg);
             } else {
                 mv.visitLdcInsn(constantPlaceholder(arg));
-                emitImplicitConversion('L', mtype.parameterType(paramIndex));
+                emitImplicitConversion(L_TYPE, ptype, arg);
             }
         }
     }
 
     /**
+     * Store the name to its local, if necessary.
+     */
+    private void emitStoreResult(Name name) {
+        if (name != null && name.type != V_TYPE) {
+            // non-void: actually assign
+            emitStoreInsn(name.type, name.index());
+        }
+    }
+
+    /**
      * Emits a return statement from a LF invoker. If required, the result type is cast to the correct return type.
      */
-    private void emitReturn() {
+    private void emitReturn(Name onStack) {
         // return statement
-        if (lambdaForm.result == -1) {
+        Class<?> rclass = invokerType.returnType();
+        BasicType rtype = lambdaForm.returnType();
+        assert(rtype == basicType(rclass));  // must agree
+        if (rtype == V_TYPE) {
             // void
             mv.visitInsn(Opcodes.RETURN);
+            // it doesn't matter what rclass is; the JVM will discard any value
         } else {
             LambdaForm.Name rn = lambdaForm.names[lambdaForm.result];
-            char rtype = Wrapper.basicTypeChar(invokerType.returnType());
 
             // put return value on the stack if it is not already there
-            if (lambdaForm.result != lambdaForm.names.length - 1) {
-                emitLoadInsn(rn.type, lambdaForm.result);
+            if (rn != onStack) {
+                emitLoadInsn(rtype, lambdaForm.result);
             }
 
-            // potentially generate cast
-            // rtype is the return type of the invoker - generated code must conform to this
-            // rn.type is the type of the result Name in the LF
-            if (rtype != rn.type) {
-                // need cast
-                if (rtype == 'L') {
-                    // possibly cast the primitive to the correct type for boxing
-                    char boxedType = Wrapper.forWrapperType(invokerType.returnType()).basicTypeChar();
-                    if (boxedType != rn.type) {
-                        emitPrimCast(rn.type, boxedType);
-                    }
-                    // cast primitive to reference ("boxing")
-                    emitBoxing(invokerType.returnType());
-                } else {
-                    // to-primitive cast
-                    if (rn.type != 'L') {
-                        // prim-to-prim cast
-                        emitPrimCast(rn.type, rtype);
-                    } else {
-                        // ref-to-prim cast ("unboxing")
-                        throw new InternalError("no ref-to-prim (unboxing) casts supported right now");
-                    }
-                }
-            }
+            emitImplicitConversion(rtype, rclass, rn);
 
             // generate actual return statement
-            emitReturnInsn(invokerType.returnType());
+            emitReturnInsn(rtype);
         }
     }
 
     /**
      * Emit a type conversion bytecode casting from "from" to "to".
      */
-    private void emitPrimCast(char from, char to) {
+    private void emitPrimCast(Wrapper from, Wrapper to) {
         // Here's how.
         // -   indicates forbidden
         // <-> indicates implicit
@@ -955,17 +1195,15 @@
             // no cast required, should be dead code anyway
             return;
         }
-        Wrapper wfrom = Wrapper.forBasicType(from);
-        Wrapper wto   = Wrapper.forBasicType(to);
-        if (wfrom.isSubwordOrInt()) {
+        if (from.isSubwordOrInt()) {
             // cast from {byte,short,char,int} to anything
             emitI2X(to);
         } else {
             // cast from {long,float,double} to anything
-            if (wto.isSubwordOrInt()) {
+            if (to.isSubwordOrInt()) {
                 // cast to {byte,short,char,int}
                 emitX2I(from);
-                if (wto.bitWidth() < 32) {
+                if (to.bitWidth() < 32) {
                     // targets other than int require another conversion
                     emitI2X(to);
                 }
@@ -973,20 +1211,26 @@
                 // cast to {long,float,double} - this is verbose
                 boolean error = false;
                 switch (from) {
-                case 'J':
-                         if (to == 'F') { mv.visitInsn(Opcodes.L2F); }
-                    else if (to == 'D') { mv.visitInsn(Opcodes.L2D); }
-                    else error = true;
+                case LONG:
+                    switch (to) {
+                    case FLOAT:   mv.visitInsn(Opcodes.L2F);  break;
+                    case DOUBLE:  mv.visitInsn(Opcodes.L2D);  break;
+                    default:      error = true;               break;
+                    }
                     break;
-                case 'F':
-                         if (to == 'J') { mv.visitInsn(Opcodes.F2L); }
-                    else if (to == 'D') { mv.visitInsn(Opcodes.F2D); }
-                    else error = true;
+                case FLOAT:
+                    switch (to) {
+                    case LONG :   mv.visitInsn(Opcodes.F2L);  break;
+                    case DOUBLE:  mv.visitInsn(Opcodes.F2D);  break;
+                    default:      error = true;               break;
+                    }
                     break;
-                case 'D':
-                         if (to == 'J') { mv.visitInsn(Opcodes.D2L); }
-                    else if (to == 'F') { mv.visitInsn(Opcodes.D2F); }
-                    else error = true;
+                case DOUBLE:
+                    switch (to) {
+                    case LONG :   mv.visitInsn(Opcodes.D2L);  break;
+                    case FLOAT:   mv.visitInsn(Opcodes.D2F);  break;
+                    default:      error = true;               break;
+                    }
                     break;
                 default:
                     error = true;
@@ -999,16 +1243,16 @@
         }
     }
 
-    private void emitI2X(char type) {
+    private void emitI2X(Wrapper type) {
         switch (type) {
-        case 'B':  mv.visitInsn(Opcodes.I2B);  break;
-        case 'S':  mv.visitInsn(Opcodes.I2S);  break;
-        case 'C':  mv.visitInsn(Opcodes.I2C);  break;
-        case 'I':  /* naught */                break;
-        case 'J':  mv.visitInsn(Opcodes.I2L);  break;
-        case 'F':  mv.visitInsn(Opcodes.I2F);  break;
-        case 'D':  mv.visitInsn(Opcodes.I2D);  break;
-        case 'Z':
+        case BYTE:    mv.visitInsn(Opcodes.I2B);  break;
+        case SHORT:   mv.visitInsn(Opcodes.I2S);  break;
+        case CHAR:    mv.visitInsn(Opcodes.I2C);  break;
+        case INT:     /* naught */                break;
+        case LONG:    mv.visitInsn(Opcodes.I2L);  break;
+        case FLOAT:   mv.visitInsn(Opcodes.I2F);  break;
+        case DOUBLE:  mv.visitInsn(Opcodes.I2D);  break;
+        case BOOLEAN:
             // For compatibility with ValueConversions and explicitCastArguments:
             mv.visitInsn(Opcodes.ICONST_1);
             mv.visitInsn(Opcodes.IAND);
@@ -1017,39 +1261,24 @@
         }
     }
 
-    private void emitX2I(char type) {
+    private void emitX2I(Wrapper type) {
         switch (type) {
-        case 'J':  mv.visitInsn(Opcodes.L2I);  break;
-        case 'F':  mv.visitInsn(Opcodes.F2I);  break;
-        case 'D':  mv.visitInsn(Opcodes.D2I);  break;
-        default:   throw new InternalError("unknown type: " + type);
+        case LONG:    mv.visitInsn(Opcodes.L2I);  break;
+        case FLOAT:   mv.visitInsn(Opcodes.F2I);  break;
+        case DOUBLE:  mv.visitInsn(Opcodes.D2I);  break;
+        default:      throw new InternalError("unknown type: " + type);
         }
     }
 
-    private static String basicTypeCharSignature(String prefix, MethodType type) {
-        StringBuilder buf = new StringBuilder(prefix);
-        for (Class<?> ptype : type.parameterList())
-            buf.append(Wrapper.forBasicType(ptype).basicTypeChar());
-        buf.append('_').append(Wrapper.forBasicType(type.returnType()).basicTypeChar());
-        return buf.toString();
-    }
-
     /**
      * Generate bytecode for a LambdaForm.vmentry which calls interpretWithArguments.
      */
     static MemberName generateLambdaFormInterpreterEntryPoint(String sig) {
-        assert(LambdaForm.isValidSignature(sig));
-        //System.out.println("generateExactInvoker "+sig);
-        // compute method type
-        // first parameter and return type
-        char tret = LambdaForm.signatureReturn(sig);
-        MethodType type = MethodType.methodType(LambdaForm.typeClass(tret), MethodHandle.class);
-        // other parameter types
-        int arity = LambdaForm.signatureArity(sig);
-        for (int i = 1; i < arity; i++) {
-            type = type.appendParameterTypes(LambdaForm.typeClass(sig.charAt(i)));
-        }
-        InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", "interpret_"+tret, type);
+        assert(isValidSignature(sig));
+        String name = "interpret_"+signatureReturn(sig).basicTypeChar();
+        MethodType type = signatureType(sig);  // sig includes leading argument
+        type = type.changeParameterType(0, MethodHandle.class);
+        InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", name, type);
         return g.loadMethod(g.generateLambdaFormInterpreterEntryPointBytes());
     }
 
@@ -1071,10 +1300,10 @@
             Class<?> ptype = invokerType.parameterType(i);
             mv.visitInsn(Opcodes.DUP);
             emitIconstInsn(i);
-            emitLoadInsn(Wrapper.basicTypeChar(ptype), i);
+            emitLoadInsn(basicType(ptype), i);
             // box if primitive type
             if (ptype.isPrimitive()) {
-                emitBoxing(ptype);
+                emitBoxing(Wrapper.forPrimitiveType(ptype));
             }
             mv.visitInsn(Opcodes.AASTORE);
         }
@@ -1082,16 +1311,16 @@
         emitAloadInsn(0);
         mv.visitFieldInsn(Opcodes.GETFIELD, MH, "form", "Ljava/lang/invoke/LambdaForm;");
         mv.visitInsn(Opcodes.SWAP);  // swap form and array; avoid local variable
-        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, LF, "interpretWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;");
+        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, LF, "interpretWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;", false);
 
         // maybe unbox
         Class<?> rtype = invokerType.returnType();
         if (rtype.isPrimitive() && rtype != void.class) {
-            emitUnboxing(Wrapper.asWrapperType(rtype));
+            emitUnboxing(Wrapper.forPrimitiveType(rtype));
         }
 
         // return statement
-        emitReturnInsn(rtype);
+        emitReturnInsn(basicType(rtype));
 
         classFileEpilogue();
         bogusMethod(invokerType);
@@ -1105,14 +1334,12 @@
      * Generate bytecode for a NamedFunction invoker.
      */
     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
-        MethodType invokerType = LambdaForm.NamedFunction.INVOKER_METHOD_TYPE;
-        String invokerName = basicTypeCharSignature("invoke_", typeForm.erasedType());
+        MethodType invokerType = NamedFunction.INVOKER_METHOD_TYPE;
+        String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
     }
 
-    static int nfi = 0;
-
     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
         MethodType dstType = typeForm.erasedType();
         classFilePrologue();
@@ -1138,14 +1365,14 @@
                 Class<?> sptype = dstType.basicType().wrap().parameterType(i);
                 Wrapper dstWrapper = Wrapper.forBasicType(dptype);
                 Wrapper srcWrapper = dstWrapper.isSubwordOrInt() ? Wrapper.INT : dstWrapper;  // narrow subword from int
-                emitUnboxing(srcWrapper.wrapperType());
-                emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar());
+                emitUnboxing(srcWrapper);
+                emitPrimCast(srcWrapper, dstWrapper);
             }
         }
 
         // Invoke
         String targetDesc = dstType.basicType().toMethodDescriptorString();
-        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", targetDesc);
+        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", targetDesc, false);
 
         // Box primitive types
         Class<?> rtype = dstType.returnType();
@@ -1153,15 +1380,15 @@
             Wrapper srcWrapper = Wrapper.forBasicType(rtype);
             Wrapper dstWrapper = srcWrapper.isSubwordOrInt() ? Wrapper.INT : srcWrapper;  // widen subword to int
             // boolean casts not allowed
-            emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar());
-            emitBoxing(dstWrapper.primitiveType());
+            emitPrimCast(srcWrapper, dstWrapper);
+            emitBoxing(dstWrapper);
         }
 
         // If the return type is void we return a null reference.
         if (rtype == void.class) {
             mv.visitInsn(Opcodes.ACONST_NULL);
         }
-        emitReturnInsn(Object.class);  // NOTE: NamedFunction invokers always return a reference value.
+        emitReturnInsn(L_TYPE);  // NOTE: NamedFunction invokers always return a reference value.
 
         classFileEpilogue();
         bogusMethod(dstType);
diff --git a/src/share/classes/java/lang/invoke/Invokers.java b/src/share/classes/java/lang/invoke/Invokers.java
index b9c18b5..14aef1b 100644
--- a/src/share/classes/java/lang/invoke/Invokers.java
+++ b/src/share/classes/java/lang/invoke/Invokers.java
@@ -25,8 +25,9 @@
 
 package java.lang.invoke;
 
+import java.lang.reflect.Array;
 import java.util.Arrays;
-import sun.invoke.empty.Empty;
+
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
@@ -40,52 +41,63 @@
     // exact type (sans leading taget MH) for the outgoing call
     private final MethodType targetType;
 
-    // FIXME: Get rid of the invokers that are not useful.
-
-    // exact invoker for the outgoing call
-    private /*lazy*/ MethodHandle exactInvoker;
-    private /*lazy*/ MethodHandle basicInvoker;  // invokeBasic (unchecked exact)
-
-    // erased (partially untyped but with primitives) invoker for the outgoing call
-    // FIXME: get rid of
-    private /*lazy*/ MethodHandle erasedInvoker;
-    // FIXME: get rid of
-    /*lazy*/ MethodHandle erasedInvokerWithDrops;  // for InvokeGeneric
-
-    // general invoker for the outgoing call
-    private /*lazy*/ MethodHandle generalInvoker;
-
-    // general invoker for the outgoing call, uses varargs
-    private /*lazy*/ MethodHandle varargsInvoker;
-
-    // general invoker for the outgoing call; accepts a trailing Object[]
-    private final /*lazy*/ MethodHandle[] spreadInvokers;
-
-    // invoker for an unbound callsite
-    private /*lazy*/ MethodHandle uninitializedCallSite;
+    // Cached adapter information:
+    private final @Stable MethodHandle[] invokers = new MethodHandle[INV_LIMIT];
+    // Indexes into invokers:
+    static final int
+            INV_EXACT          =  0,  // MethodHandles.exactInvoker
+            INV_GENERIC        =  1,  // MethodHandles.invoker (generic invocation)
+            INV_BASIC          =  2,  // MethodHandles.basicInvoker
+            INV_LIMIT          =  3;
 
     /** Compute and cache information common to all collecting adapters
      *  that implement members of the erasure-family of the given erased type.
      */
     /*non-public*/ Invokers(MethodType targetType) {
         this.targetType = targetType;
-        this.spreadInvokers = new MethodHandle[targetType.parameterCount()+1];
     }
 
     /*non-public*/ MethodHandle exactInvoker() {
-        MethodHandle invoker = exactInvoker;
+        MethodHandle invoker = cachedInvoker(INV_EXACT);
         if (invoker != null)  return invoker;
         invoker = makeExactOrGeneralInvoker(true);
-        exactInvoker = invoker;
-        return invoker;
+        return setCachedInvoker(INV_EXACT, invoker);
     }
 
-    /*non-public*/ MethodHandle generalInvoker() {
-        MethodHandle invoker = generalInvoker;
+    /*non-public*/ MethodHandle genericInvoker() {
+        MethodHandle invoker = cachedInvoker(INV_GENERIC);
         if (invoker != null)  return invoker;
         invoker = makeExactOrGeneralInvoker(false);
-        generalInvoker = invoker;
-        return invoker;
+        return setCachedInvoker(INV_GENERIC, invoker);
+    }
+
+    /*non-public*/ MethodHandle basicInvoker() {
+        MethodHandle invoker = cachedInvoker(INV_BASIC);
+        if (invoker != null)  return invoker;
+        MethodType basicType = targetType.basicType();
+        if (basicType != targetType) {
+            // double cache; not used significantly
+            return setCachedInvoker(INV_BASIC, basicType.invokers().basicInvoker());
+        }
+        invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_BASIC_INV);
+        if (invoker == null) {
+            MemberName method = invokeBasicMethod(basicType);
+            invoker = DirectMethodHandle.make(method);
+            assert(checkInvoker(invoker));
+            invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_BASIC_INV, invoker);
+        }
+        return setCachedInvoker(INV_BASIC, invoker);
+    }
+
+    private MethodHandle cachedInvoker(int idx) {
+        return invokers[idx];
+    }
+
+    private synchronized MethodHandle setCachedInvoker(int idx, final MethodHandle invoker) {
+        // Simulate a CAS, to avoid racy duplication of results.
+        MethodHandle prev = invokers[idx];
+        if (prev != null)  return prev;
+        return invokers[idx] = invoker;
     }
 
     private MethodHandle makeExactOrGeneralInvoker(boolean isExact) {
@@ -95,7 +107,7 @@
         LambdaForm lform = invokeHandleForm(mtype, false, which);
         MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, mtype);
         String whichName = (isExact ? "invokeExact" : "invoke");
-        invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke(whichName, mtype));
+        invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke(whichName, mtype), false);
         assert(checkInvoker(invoker));
         maybeCompileToBytecode(invoker);
         return invoker;
@@ -110,21 +122,6 @@
         }
     }
 
-    /*non-public*/ MethodHandle basicInvoker() {
-        MethodHandle invoker = basicInvoker;
-        if (invoker != null)  return invoker;
-        MethodType basicType = targetType.basicType();
-        if (basicType != targetType) {
-            // double cache; not used significantly
-            return basicInvoker = basicType.invokers().basicInvoker();
-        }
-        MemberName method = invokeBasicMethod(basicType);
-        invoker = DirectMethodHandle.make(method);
-        assert(checkInvoker(invoker));
-        basicInvoker = invoker;
-        return invoker;
-    }
-
     // This next one is called from LambdaForm.NamedFunction.<init>.
     /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
         assert(basicType == basicType.basicType());
@@ -145,87 +142,42 @@
         return true;
     }
 
-    // FIXME: get rid of
-    /*non-public*/ MethodHandle erasedInvoker() {
-        MethodHandle xinvoker = exactInvoker();
-        MethodHandle invoker = erasedInvoker;
-        if (invoker != null)  return invoker;
-        MethodType erasedType = targetType.erase();
-        invoker = xinvoker.asType(erasedType.invokerType());
-        erasedInvoker = invoker;
-        return invoker;
-    }
-
+    /**
+     * Find or create an invoker which passes unchanged a given number of arguments
+     * and spreads the rest from a trailing array argument.
+     * The invoker target type is the post-spread type {@code (TYPEOF(uarg*), TYPEOF(sarg*))=>RT}.
+     * All the {@code sarg}s must have a common type {@code C}.  (If there are none, {@code Object} is assumed.}
+     * @param leadingArgCount the number of unchanged (non-spread) arguments
+     * @return {@code invoker.invokeExact(mh, uarg*, C[]{sarg*}) := (RT)mh.invoke(uarg*, sarg*)}
+     */
     /*non-public*/ MethodHandle spreadInvoker(int leadingArgCount) {
-        MethodHandle vaInvoker = spreadInvokers[leadingArgCount];
-        if (vaInvoker != null)  return vaInvoker;
         int spreadArgCount = targetType.parameterCount() - leadingArgCount;
-        MethodType spreadInvokerType = targetType
-            .replaceParameterTypes(leadingArgCount, targetType.parameterCount(), Object[].class);
-        if (targetType.parameterSlotCount() <= MethodType.MAX_MH_INVOKER_ARITY) {
-            // Factor sinvoker.invoke(mh, a) into ginvoker.asSpreader().invoke(mh, a)
-            // where ginvoker.invoke(mh, a*) => mh.invoke(a*).
-            MethodHandle genInvoker = generalInvoker();
-            vaInvoker = genInvoker.asSpreader(Object[].class, spreadArgCount);
-        } else {
-            // Cannot build a general invoker here of type ginvoker.invoke(mh, a*[254]).
-            // Instead, factor sinvoker.invoke(mh, a) into ainvoker.invoke(filter(mh), a)
-            // where filter(mh) == mh.asSpreader(Object[], spreadArgCount)
-            MethodHandle arrayInvoker = MethodHandles.exactInvoker(spreadInvokerType);
-            MethodHandle makeSpreader;
-            try {
-                makeSpreader = IMPL_LOOKUP
-                    .findVirtual(MethodHandle.class, "asSpreader",
-                        MethodType.methodType(MethodHandle.class, Class.class, int.class));
-            } catch (ReflectiveOperationException ex) {
-                throw newInternalError(ex);
-            }
-            makeSpreader = MethodHandles.insertArguments(makeSpreader, 1, Object[].class, spreadArgCount);
-            vaInvoker = MethodHandles.filterArgument(arrayInvoker, 0, makeSpreader);
+        MethodType postSpreadType = targetType;
+        Class<?> argArrayType = impliedRestargType(postSpreadType, leadingArgCount);
+        if (postSpreadType.parameterSlotCount() <= MethodType.MAX_MH_INVOKER_ARITY) {
+            return genericInvoker().asSpreader(argArrayType, spreadArgCount);
         }
-        assert(vaInvoker.type().equals(spreadInvokerType.invokerType()));
-        maybeCompileToBytecode(vaInvoker);
-        spreadInvokers[leadingArgCount] = vaInvoker;
-        return vaInvoker;
+        // Cannot build a generic invoker here of type ginvoker.invoke(mh, a*[254]).
+        // Instead, factor sinvoker.invoke(mh, a) into ainvoker.invoke(filter(mh), a)
+        // where filter(mh) == mh.asSpreader(Object[], spreadArgCount)
+        MethodType preSpreadType = postSpreadType
+            .replaceParameterTypes(leadingArgCount, postSpreadType.parameterCount(), argArrayType);
+        MethodHandle arrayInvoker = MethodHandles.invoker(preSpreadType);
+        MethodHandle makeSpreader = MethodHandles.insertArguments(Lazy.MH_asSpreader, 1, argArrayType, spreadArgCount);
+        return MethodHandles.filterArgument(arrayInvoker, 0, makeSpreader);
     }
 
-    /*non-public*/ MethodHandle varargsInvoker() {
-        MethodHandle vaInvoker = varargsInvoker;
-        if (vaInvoker != null)  return vaInvoker;
-        vaInvoker = spreadInvoker(0).asType(MethodType.genericMethodType(0, true).invokerType());
-        varargsInvoker = vaInvoker;
-        return vaInvoker;
-    }
-
-    private static MethodHandle THROW_UCS = null;
-
-    /*non-public*/ MethodHandle uninitializedCallSite() {
-        MethodHandle invoker = uninitializedCallSite;
-        if (invoker != null)  return invoker;
-        if (targetType.parameterCount() > 0) {
-            MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
-            Invokers invokers0 = type0.invokers();
-            invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
-                                                  0, targetType.parameterList());
-            assert(invoker.type().equals(targetType));
-            uninitializedCallSite = invoker;
-            return invoker;
+    private static Class<?> impliedRestargType(MethodType restargType, int fromPos) {
+        if (restargType.isGeneric())  return Object[].class;  // can be nothing else
+        int maxPos = restargType.parameterCount();
+        if (fromPos >= maxPos)  return Object[].class;  // reasonable default
+        Class<?> argType = restargType.parameterType(fromPos);
+        for (int i = fromPos+1; i < maxPos; i++) {
+            if (argType != restargType.parameterType(i))
+                throw newIllegalArgumentException("need homogeneous rest arguments", restargType);
         }
-        invoker = THROW_UCS;
-        if (invoker == null) {
-            try {
-                THROW_UCS = invoker = IMPL_LOOKUP
-                    .findStatic(CallSite.class, "uninitializedCallSite",
-                                MethodType.methodType(Empty.class));
-            } catch (ReflectiveOperationException ex) {
-                throw newInternalError(ex);
-            }
-        }
-        invoker = MethodHandles.explicitCastArguments(invoker, MethodType.methodType(targetType.returnType()));
-        invoker = invoker.dropArguments(targetType, 0, targetType.parameterCount());
-        assert(invoker.type().equals(targetType));
-        uninitializedCallSite = invoker;
-        return invoker;
+        if (argType == Object.class)  return Object[].class;
+        return Array.newInstance(argType, 0).getClass();
     }
 
     public String toString() {
@@ -308,7 +260,9 @@
                 : Arrays.asList(mtype, customized, which, nameCursor, names.length);
         if (MTYPE_ARG >= INARG_LIMIT) {
             assert(names[MTYPE_ARG] == null);
-            NamedFunction getter = BoundMethodHandle.getSpeciesData("L").getterFunction(0);
+            BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L();
+            names[THIS_MH] = names[THIS_MH].withConstraint(speciesData);
+            NamedFunction getter = speciesData.getterFunction(0);
             names[MTYPE_ARG] = new Name(getter, names[THIS_MH]);
             // else if isLinker, then MTYPE is passed in from the caller (e.g., the JVM)
         }
@@ -360,9 +314,6 @@
     Object checkGenericType(Object mhObj, Object expectedObj) {
         MethodHandle mh = (MethodHandle) mhObj;
         MethodType expected = (MethodType) expectedObj;
-        if (mh.type() == expected)  return mh;
-        MethodHandle atc = mh.asTypeCache;
-        if (atc != null && atc.type() == expected)  return atc;
         return mh.asType(expected);
         /* Maybe add more paths here.  Possible optimizations:
          * for (R)MH.invoke(a*),
@@ -436,27 +387,40 @@
     }
 
     // Local constant functions:
-    private static final NamedFunction NF_checkExactType;
-    private static final NamedFunction NF_checkGenericType;
-    private static final NamedFunction NF_asType;
-    private static final NamedFunction NF_getCallSiteTarget;
+    private static final NamedFunction
+        NF_checkExactType,
+        NF_checkGenericType,
+        NF_getCallSiteTarget;
     static {
         try {
-            NF_checkExactType = new NamedFunction(Invokers.class
-                    .getDeclaredMethod("checkExactType", Object.class, Object.class));
-            NF_checkGenericType = new NamedFunction(Invokers.class
-                    .getDeclaredMethod("checkGenericType", Object.class, Object.class));
-            NF_asType = new NamedFunction(MethodHandle.class
-                    .getDeclaredMethod("asType", MethodType.class));
-            NF_getCallSiteTarget = new NamedFunction(Invokers.class
-                    .getDeclaredMethod("getCallSiteTarget", Object.class));
-            NF_checkExactType.resolve();
-            NF_checkGenericType.resolve();
-            NF_getCallSiteTarget.resolve();
-            // bound
+            NamedFunction nfs[] = {
+                NF_checkExactType = new NamedFunction(Invokers.class
+                        .getDeclaredMethod("checkExactType", Object.class, Object.class)),
+                NF_checkGenericType = new NamedFunction(Invokers.class
+                        .getDeclaredMethod("checkGenericType", Object.class, Object.class)),
+                NF_getCallSiteTarget = new NamedFunction(Invokers.class
+                        .getDeclaredMethod("getCallSiteTarget", Object.class))
+            };
+            for (NamedFunction nf : nfs) {
+                // Each nf must be statically invocable or we get tied up in our bootstraps.
+                assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf.member)) : nf;
+                nf.resolve();
+            }
         } catch (ReflectiveOperationException ex) {
             throw newInternalError(ex);
         }
     }
 
+    private static class Lazy {
+        private static final MethodHandle MH_asSpreader;
+
+        static {
+            try {
+                MH_asSpreader = IMPL_LOOKUP.findVirtual(MethodHandle.class, "asSpreader",
+                        MethodType.methodType(MethodHandle.class, Class.class, int.class));
+            } catch (ReflectiveOperationException ex) {
+                throw newInternalError(ex);
+            }
+        }
+    }
 }
diff --git a/src/share/classes/java/lang/invoke/LambdaForm.java b/src/share/classes/java/lang/invoke/LambdaForm.java
index a8291e2..b830406 100644
--- a/src/share/classes/java/lang/invoke/LambdaForm.java
+++ b/src/share/classes/java/lang/invoke/LambdaForm.java
@@ -27,17 +27,16 @@
 
 import java.lang.annotation.*;
 import java.lang.reflect.Method;
-import java.util.Map;
 import java.util.List;
 import java.util.Arrays;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.concurrent.ConcurrentHashMap;
+
 import sun.invoke.util.Wrapper;
+import java.lang.reflect.Field;
+
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import java.lang.reflect.Field;
-import java.util.Objects;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
@@ -125,19 +124,136 @@
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
 
-    // Caches for common structural transforms:
-    LambdaForm[] bindCache;
+    Object transformCache;  // managed by LambdaFormEditor
 
     public static final int VOID_RESULT = -1, LAST_RESULT = -2;
 
+    enum BasicType {
+        L_TYPE('L', Object.class, Wrapper.OBJECT),  // all reference types
+        I_TYPE('I', int.class,    Wrapper.INT),
+        J_TYPE('J', long.class,   Wrapper.LONG),
+        F_TYPE('F', float.class,  Wrapper.FLOAT),
+        D_TYPE('D', double.class, Wrapper.DOUBLE),  // all primitive types
+        V_TYPE('V', void.class,   Wrapper.VOID);    // not valid in all contexts
+
+        static final BasicType[] ALL_TYPES = BasicType.values();
+        static final BasicType[] ARG_TYPES = Arrays.copyOf(ALL_TYPES, ALL_TYPES.length-1);
+
+        static final int ARG_TYPE_LIMIT = ARG_TYPES.length;
+        static final int TYPE_LIMIT = ALL_TYPES.length;
+
+        private final char btChar;
+        private final Class<?> btClass;
+        private final Wrapper btWrapper;
+
+        private BasicType(char btChar, Class<?> btClass, Wrapper wrapper) {
+            this.btChar = btChar;
+            this.btClass = btClass;
+            this.btWrapper = wrapper;
+        }
+
+        char basicTypeChar() {
+            return btChar;
+        }
+        Class<?> basicTypeClass() {
+            return btClass;
+        }
+        Wrapper basicTypeWrapper() {
+            return btWrapper;
+        }
+        int basicTypeSlots() {
+            return btWrapper.stackSlots();
+        }
+
+        static BasicType basicType(byte type) {
+            return ALL_TYPES[type];
+        }
+        static BasicType basicType(char type) {
+            switch (type) {
+                case 'L': return L_TYPE;
+                case 'I': return I_TYPE;
+                case 'J': return J_TYPE;
+                case 'F': return F_TYPE;
+                case 'D': return D_TYPE;
+                case 'V': return V_TYPE;
+                // all subword types are represented as ints
+                case 'Z':
+                case 'B':
+                case 'S':
+                case 'C':
+                    return I_TYPE;
+                default:
+                    throw newInternalError("Unknown type char: '"+type+"'");
+            }
+        }
+        static BasicType basicType(Wrapper type) {
+            char c = type.basicTypeChar();
+            return basicType(c);
+        }
+        static BasicType basicType(Class<?> type) {
+            if (!type.isPrimitive())  return L_TYPE;
+            return basicType(Wrapper.forPrimitiveType(type));
+        }
+
+        static char basicTypeChar(Class<?> type) {
+            return basicType(type).btChar;
+        }
+        static BasicType[] basicTypes(List<Class<?>> types) {
+            BasicType[] btypes = new BasicType[types.size()];
+            for (int i = 0; i < btypes.length; i++) {
+                btypes[i] = basicType(types.get(i));
+            }
+            return btypes;
+        }
+        static BasicType[] basicTypes(String types) {
+            BasicType[] btypes = new BasicType[types.length()];
+            for (int i = 0; i < btypes.length; i++) {
+                btypes[i] = basicType(types.charAt(i));
+            }
+            return btypes;
+        }
+        static byte[] basicTypesOrd(BasicType[] btypes) {
+            byte[] ords = new byte[btypes.length];
+            for (int i = 0; i < btypes.length; i++) {
+                ords[i] = (byte)btypes[i].ordinal();
+            }
+            return ords;
+        }
+        static boolean isBasicTypeChar(char c) {
+            return "LIJFDV".indexOf(c) >= 0;
+        }
+        static boolean isArgBasicTypeChar(char c) {
+            return "LIJFD".indexOf(c) >= 0;
+        }
+
+        static { assert(checkBasicType()); }
+        private static boolean checkBasicType() {
+            for (int i = 0; i < ARG_TYPE_LIMIT; i++) {
+                assert ARG_TYPES[i].ordinal() == i;
+                assert ARG_TYPES[i] == ALL_TYPES[i];
+            }
+            for (int i = 0; i < TYPE_LIMIT; i++) {
+                assert ALL_TYPES[i].ordinal() == i;
+            }
+            assert ALL_TYPES[TYPE_LIMIT - 1] == V_TYPE;
+            assert !Arrays.asList(ARG_TYPES).contains(V_TYPE);
+            return true;
+        }
+    }
+
     LambdaForm(String debugName,
                int arity, Name[] names, int result) {
         assert(namesOK(arity, names));
         this.arity = arity;
         this.result = fixResult(result, names);
         this.names = names.clone();
-        this.debugName = debugName;
-        normalize();
+        this.debugName = fixDebugName(debugName);
+        int maxOutArity = normalize();
+        if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
+            // Cannot use LF interpreter on very high arity expressions.
+            assert(maxOutArity <= MethodType.MAX_JVM_ARITY);
+            compileToBytecode();
+        }
     }
 
     LambdaForm(String debugName,
@@ -168,12 +284,12 @@
         // Called only from getPreparedForm.
         assert(isValidSignature(sig));
         this.arity = signatureArity(sig);
-        this.result = (signatureReturn(sig) == 'V' ? -1 : arity);
+        this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
         this.names = buildEmptyNames(arity, sig);
         this.debugName = "LF.zero";
         assert(nameRefsAreLegal());
         assert(isEmpty());
-        assert(sig.equals(basicTypeSignature()));
+        assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
     }
 
     private static Name[] buildEmptyNames(int arity, String basicTypeSignature) {
@@ -181,24 +297,55 @@
         int resultPos = arity + 1;  // skip '_'
         if (arity < 0 || basicTypeSignature.length() != resultPos+1)
             throw new IllegalArgumentException("bad arity for "+basicTypeSignature);
-        int numRes = (basicTypeSignature.charAt(resultPos) == 'V' ? 0 : 1);
+        int numRes = (basicType(basicTypeSignature.charAt(resultPos)) == V_TYPE ? 0 : 1);
         Name[] names = arguments(numRes, basicTypeSignature.substring(0, arity));
         for (int i = 0; i < numRes; i++) {
-            names[arity + i] = constantZero(arity + i, basicTypeSignature.charAt(resultPos + i));
+            Name zero = new Name(constantZero(basicType(basicTypeSignature.charAt(resultPos + i))));
+            names[arity + i] = zero.newIndex(arity + i);
         }
         return names;
     }
 
     private static int fixResult(int result, Name[] names) {
-        if (result >= 0) {
-            if (names[result].type == 'V')
-                return -1;
-        } else if (result == LAST_RESULT) {
-            return names.length - 1;
-        }
+        if (result == LAST_RESULT)
+            result = names.length - 1;  // might still be void
+        if (result >= 0 && names[result].type == V_TYPE)
+            result = VOID_RESULT;
         return result;
     }
 
+    private static String fixDebugName(String debugName) {
+        if (DEBUG_NAME_COUNTERS != null) {
+            int under = debugName.indexOf('_');
+            int length = debugName.length();
+            if (under < 0)  under = length;
+            String debugNameStem = debugName.substring(0, under);
+            Integer ctr;
+            synchronized (DEBUG_NAME_COUNTERS) {
+                ctr = DEBUG_NAME_COUNTERS.get(debugNameStem);
+                if (ctr == null)  ctr = 0;
+                DEBUG_NAME_COUNTERS.put(debugNameStem, ctr+1);
+            }
+            StringBuilder buf = new StringBuilder(debugNameStem);
+            buf.append('_');
+            int leadingZero = buf.length();
+            buf.append((int) ctr);
+            for (int i = buf.length() - leadingZero; i < 3; i++)
+                buf.insert(leadingZero, '0');
+            if (under < length) {
+                ++under;    // skip "_"
+                while (under < length && Character.isDigit(debugName.charAt(under))) {
+                    ++under;
+                }
+                if (under < length && debugName.charAt(under) == '_')  ++under;
+                if (under < length)
+                    buf.append('_').append(debugName, under, length);
+            }
+            return buf.toString();
+        }
+        return debugName;
+    }
+
     private static boolean namesOK(int arity, Name[] names) {
         for (int i = 0; i < names.length; i++) {
             Name n = names[i];
@@ -211,9 +358,12 @@
         return true;
     }
 
-    /** Renumber and/or replace params so that they are interned and canonically numbered. */
-    private void normalize() {
+    /** Renumber and/or replace params so that they are interned and canonically numbered.
+     *  @return maximum argument list length among the names (since we have to pass over them anyway)
+     */
+    private int normalize() {
         Name[] oldNames = null;
+        int maxOutArity = 0;
         int changesStart = 0;
         for (int i = 0; i < names.length; i++) {
             Name n = names[i];
@@ -224,6 +374,8 @@
                 }
                 names[i] = n.cloneWithIndex(i);
             }
+            if (n.arguments != null && maxOutArity < n.arguments.length)
+                maxOutArity = n.arguments.length;
         }
         if (oldNames != null) {
             int startFixing = arity;
@@ -250,6 +402,7 @@
             }
             assert(nameRefsAreLegal());
         }
+        return maxOutArity;
     }
 
     /**
@@ -261,7 +414,7 @@
      * This allows Name references to be freely reused to construct
      * fresh lambdas, without confusion.
      */
-    private boolean nameRefsAreLegal() {
+    boolean nameRefsAreLegal() {
         assert(arity >= 0 && arity <= names.length);
         assert(result >= -1 && result < names.length);
         // Do all names possess an index consistent with their local definition order?
@@ -294,16 +447,28 @@
     // }
 
     /** Report the return type. */
-    char returnType() {
-        if (result < 0)  return 'V';
+    BasicType returnType() {
+        if (result < 0)  return V_TYPE;
         Name n = names[result];
         return n.type;
     }
 
     /** Report the N-th argument type. */
-    char parameterType(int n) {
+    BasicType parameterType(int n) {
+        return parameter(n).type;
+    }
+
+    /** Report the N-th argument name. */
+    Name parameter(int n) {
         assert(n < arity);
-        return names[n].type;
+        Name param = names[n];
+        assert(param.isParam());
+        return param;
+    }
+
+    /** Report the N-th argument type constraint. */
+    Object parameterConstraint(int n) {
+        return parameter(n).constraint;
     }
 
     /** Report the arity. */
@@ -311,6 +476,11 @@
         return arity;
     }
 
+    /** Report the number of expressions (non-parameter names). */
+    int expressionCount() {
+        return names.length - arity;
+    }
+
     /** Return the method type corresponding to my basic type signature. */
     MethodType methodType() {
         return signatureType(basicTypeSignature());
@@ -319,15 +489,15 @@
     final String basicTypeSignature() {
         StringBuilder buf = new StringBuilder(arity() + 3);
         for (int i = 0, a = arity(); i < a; i++)
-            buf.append(parameterType(i));
-        return buf.append('_').append(returnType()).toString();
+            buf.append(parameterType(i).basicTypeChar());
+        return buf.append('_').append(returnType().basicTypeChar()).toString();
     }
     static int signatureArity(String sig) {
         assert(isValidSignature(sig));
         return sig.indexOf('_');
     }
-    static char signatureReturn(String sig) {
-        return sig.charAt(signatureArity(sig)+1);
+    static BasicType signatureReturn(String sig) {
+        return basicType(sig.charAt(signatureArity(sig) + 1));
     }
     static boolean isValidSignature(String sig) {
         int arity = sig.indexOf('_');
@@ -339,27 +509,15 @@
             char c = sig.charAt(i);
             if (c == 'V')
                 return (i == siglen - 1 && arity == siglen - 2);
-            if (ALL_TYPES.indexOf(c) < 0)  return false; // must be [LIJFD]
+            if (!isArgBasicTypeChar(c))  return false; // must be [LIJFD]
         }
         return true;  // [LIJFD]*_[LIJFDV]
     }
-    static Class<?> typeClass(char t) {
-        switch (t) {
-        case 'I': return int.class;
-        case 'J': return long.class;
-        case 'F': return float.class;
-        case 'D': return double.class;
-        case 'L': return Object.class;
-        case 'V': return void.class;
-        default: assert false;
-        }
-        return null;
-    }
     static MethodType signatureType(String sig) {
         Class<?>[] ptypes = new Class<?>[signatureArity(sig)];
         for (int i = 0; i < ptypes.length; i++)
-            ptypes[i] = typeClass(sig.charAt(i));
-        Class<?> rtype = typeClass(signatureReturn(sig));
+            ptypes[i] = basicType(sig.charAt(i)).btClass;
+        Class<?> rtype = signatureReturn(sig).btClass;
         return MethodType.methodType(rtype, ptypes);
     }
 
@@ -457,21 +615,12 @@
             isCompiled = true;
             return vmentry;
         } catch (Error | Exception ex) {
-            throw newInternalError("compileToBytecode", ex);
+            throw newInternalError(this.toString(), ex);
         }
     }
 
-    private static final ConcurrentHashMap<String,LambdaForm> PREPARED_FORMS;
-    static {
-        int   capacity   = 512;    // expect many distinct signatures over time
-        float loadFactor = 0.75f;  // normal default
-        int   writers    = 1;
-        PREPARED_FORMS = new ConcurrentHashMap<>(capacity, loadFactor, writers);
-    }
-
-    private static Map<String,LambdaForm> computeInitialPreparedForms() {
+    private static void computeInitialPreparedForms() {
         // Find all predefined invokers and associate them with canonical empty lambda forms.
-        HashMap<String,LambdaForm> forms = new HashMap<>();
         for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
             if (!m.isStatic() || !m.isPackage())  continue;
             MethodType mt = m.getMethodType();
@@ -482,13 +631,9 @@
                 assert(m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
                 LambdaForm form = new LambdaForm(sig);
                 form.vmentry = m;
-                form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_COUNTER, form);
-                // FIXME: get rid of PREPARED_FORMS; use MethodTypeForm cache only
-                forms.put(sig, form);
+                form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, form);
             }
         }
-        //System.out.println("computeInitialPreparedForms => "+forms);
-        return forms;
     }
 
     // Set this false to disable use of the interpret_L methods defined in this file.
@@ -522,13 +667,11 @@
     }
     private static LambdaForm getPreparedForm(String sig) {
         MethodType mtype = signatureType(sig);
-        //LambdaForm prep = PREPARED_FORMS.get(sig);
         LambdaForm prep =  mtype.form().cachedLambdaForm(MethodTypeForm.LF_INTERPRET);
         if (prep != null)  return prep;
         assert(isValidSignature(sig));
         prep = new LambdaForm(sig);
         prep.vmentry = InvokerBytecodeGenerator.generateLambdaFormInterpreterEntryPoint(sig);
-        //LambdaForm prep2 = PREPARED_FORMS.putIfAbsent(sig.intern(), prep);
         return mtype.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, prep);
     }
 
@@ -543,21 +686,21 @@
         assert(mt.parameterCount() == arity-1);
         for (int i = 0; i < av.length; i++) {
             Class<?> pt = (i == 0 ? MethodHandle.class : mt.parameterType(i-1));
-            assert(valueMatches(sig.charAt(i), pt, av[i]));
+            assert(valueMatches(basicType(sig.charAt(i)), pt, av[i]));
         }
         return true;
     }
-    private static boolean valueMatches(char tc, Class<?> type, Object x) {
+    private static boolean valueMatches(BasicType tc, Class<?> type, Object x) {
         // The following line is needed because (...)void method handles can use non-void invokers
-        if (type == void.class)  tc = 'V';   // can drop any kind of value
+        if (type == void.class)  tc = V_TYPE;   // can drop any kind of value
         assert tc == basicType(type) : tc + " == basicType(" + type + ")=" + basicType(type);
         switch (tc) {
-        case 'I': assert checkInt(type, x)   : "checkInt(" + type + "," + x +")";   break;
-        case 'J': assert x instanceof Long   : "instanceof Long: " + x;             break;
-        case 'F': assert x instanceof Float  : "instanceof Float: " + x;            break;
-        case 'D': assert x instanceof Double : "instanceof Double: " + x;           break;
-        case 'L': assert checkRef(type, x)   : "checkRef(" + type + "," + x + ")";  break;
-        case 'V': break;  // allow anything here; will be dropped
+        case I_TYPE: assert checkInt(type, x)   : "checkInt(" + type + "," + x +")";   break;
+        case J_TYPE: assert x instanceof Long   : "instanceof Long: " + x;             break;
+        case F_TYPE: assert x instanceof Float  : "instanceof Float: " + x;            break;
+        case D_TYPE: assert x instanceof Double : "instanceof Double: " + x;           break;
+        case L_TYPE: assert checkRef(type, x)   : "checkRef(" + type + "," + x + ")";  break;
+        case V_TYPE: break;  // allow anything here; will be dropped
         default:  assert(false);
         }
         return true;
@@ -584,10 +727,7 @@
     /** If the invocation count hits the threshold we spin bytecodes and call that subsequently. */
     private static final int COMPILE_THRESHOLD;
     static {
-        if (MethodHandleStatics.COMPILE_THRESHOLD != null)
-            COMPILE_THRESHOLD = MethodHandleStatics.COMPILE_THRESHOLD;
-        else
-            COMPILE_THRESHOLD = 30;  // default value
+        COMPILE_THRESHOLD = Math.max(-1, MethodHandleStatics.COMPILE_THRESHOLD);
     }
     private int invocationCounter = 0;
 
@@ -603,7 +743,9 @@
         for (int i = argumentValues.length; i < values.length; i++) {
             values[i] = interpretName(names[i], values);
         }
-        return (result < 0) ? null : values[result];
+        Object rv = (result < 0) ? null : values[result];
+        assert(resultCheck(argumentValues, rv));
+        return rv;
     }
 
     @Hidden
@@ -660,28 +802,6 @@
         return rval;
     }
 
-    //** This transform is applied (statically) to every name.function. */
-    /*
-    private static MethodHandle eraseSubwordTypes(MethodHandle mh) {
-        MethodType mt = mh.type();
-        if (mt.hasPrimitives()) {
-            mt = mt.changeReturnType(eraseSubwordType(mt.returnType()));
-            for (int i = 0; i < mt.parameterCount(); i++) {
-                mt = mt.changeParameterType(i, eraseSubwordType(mt.parameterType(i)));
-            }
-            mh = MethodHandles.explicitCastArguments(mh, mt);
-        }
-        return mh;
-    }
-    private static Class<?> eraseSubwordType(Class<?> type) {
-        if (!type.isPrimitive())  return type;
-        if (type == int.class)  return type;
-        Wrapper w = Wrapper.forPrimitiveType(type);
-        if (w.isSubwordOrInt())  return int.class;
-        return type;
-    }
-    */
-
     static void traceInterpreter(String event, Object obj, Object... args) {
         if (TRACE_INTERPRETER) {
             System.out.println("LFI: "+event+" "+(obj != null ? obj : "")+(args != null && args.length != 0 ? Arrays.asList(args) : ""));
@@ -694,8 +814,16 @@
         assert(argumentValues.length == arity) : arity+"!="+Arrays.asList(argumentValues)+".length";
         // also check that the leading (receiver) argument is somehow bound to this LF:
         assert(argumentValues[0] instanceof MethodHandle) : "not MH: " + argumentValues[0];
-        assert(((MethodHandle)argumentValues[0]).internalForm() == this);
+        MethodHandle mh = (MethodHandle) argumentValues[0];
+        assert(mh.internalForm() == this);
         // note:  argument #0 could also be an interface wrapper, in the future
+        argumentTypesMatch(basicTypeSignature(), argumentValues);
+        return true;
+    }
+    private boolean resultCheck(Object[] argumentValues, Object result) {
+        MethodHandle mh = (MethodHandle) argumentValues[0];
+        MethodType mt = mh.type();
+        assert(valueMatches(returnType(), mt.returnType(), result));
         return true;
     }
 
@@ -714,7 +842,7 @@
             if (i == arity)  buf.append(")=>{");
             Name n = names[i];
             if (i >= arity)  buf.append("\n    ");
-            buf.append(n);
+            buf.append(n.paramString());
             if (i < arity) {
                 if (i+1 < arity)  buf.append(",");
                 continue;
@@ -722,6 +850,7 @@
             buf.append("=").append(n.exprString());
             buf.append(";");
         }
+        if (arity == names.length)  buf.append(")=>{");
         buf.append(result < 0 ? "void" : names[result]).append("}");
         if (TRACE_INTERPRETER) {
             // Extra verbosity:
@@ -731,135 +860,19 @@
         return buf.toString();
     }
 
-    /**
-     * Apply immediate binding for a Name in this form indicated by its position relative to the form.
-     * The first parameter to a LambdaForm, a0:L, always represents the form's method handle, so 0 is not
-     * accepted as valid.
-     */
-    LambdaForm bindImmediate(int pos, char basicType, Object value) {
-        // must be an argument, and the types must match
-        assert pos > 0 && pos < arity && names[pos].type == basicType && Name.typesMatch(basicType, value);
-
-        int arity2 = arity - 1;
-        Name[] names2 = new Name[names.length - 1];
-        for (int r = 0, w = 0; r < names.length; ++r, ++w) { // (r)ead from names, (w)rite to names2
-            Name n = names[r];
-            if (n.isParam()) {
-                if (n.index == pos) {
-                    // do not copy over the argument that is to be replaced with a literal,
-                    // but adjust the write index
-                    --w;
-                } else {
-                    names2[w] = new Name(w, n.type);
-                }
-            } else {
-                Object[] arguments2 = new Object[n.arguments.length];
-                for (int i = 0; i < n.arguments.length; ++i) {
-                    Object arg = n.arguments[i];
-                    if (arg instanceof Name) {
-                        int ni = ((Name) arg).index;
-                        if (ni == pos) {
-                            arguments2[i] = value;
-                        } else if (ni < pos) {
-                            // replacement position not yet passed
-                            arguments2[i] = names2[ni];
-                        } else {
-                            // replacement position passed
-                            arguments2[i] = names2[ni - 1];
-                        }
-                    } else {
-                        arguments2[i] = arg;
-                    }
-                }
-                names2[w] = new Name(n.function, arguments2);
-                names2[w].initIndex(w);
-            }
-        }
-
-        int result2 = result == -1 ? -1 : result - 1;
-        return new LambdaForm(debugName, arity2, names2, result2);
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof LambdaForm && equals((LambdaForm)obj);
     }
-
-    LambdaForm bind(int namePos, BoundMethodHandle.SpeciesData oldData) {
-        Name name = names[namePos];
-        BoundMethodHandle.SpeciesData newData = oldData.extendWithType(name.type);
-        return bind(name, newData.getterName(names[0], oldData.fieldCount()), oldData, newData);
+    public boolean equals(LambdaForm that) {
+        if (this.result != that.result)  return false;
+        return Arrays.equals(this.names, that.names);
     }
-    LambdaForm bind(Name name, Name binding,
-                    BoundMethodHandle.SpeciesData oldData,
-                    BoundMethodHandle.SpeciesData newData) {
-        int pos = name.index;
-        assert(name.isParam());
-        assert(!binding.isParam());
-        assert(name.type == binding.type);
-        assert(0 <= pos && pos < arity && names[pos] == name);
-        assert(binding.function.memberDeclaringClassOrNull() == newData.clazz);
-        assert(oldData.getters.length == newData.getters.length-1);
-        if (bindCache != null) {
-            LambdaForm form = bindCache[pos];
-            if (form != null) {
-                assert(form.contains(binding)) : "form << " + form + " >> does not contain binding << " + binding + " >>";
-                return form;
-            }
-        } else {
-            bindCache = new LambdaForm[arity];
-        }
-        assert(nameRefsAreLegal());
-        int arity2 = arity-1;
-        Name[] names2 = names.clone();
-        names2[pos] = binding;  // we might move this in a moment
-
-        // The newly created LF will run with a different BMH.
-        // Switch over any pre-existing BMH field references to the new BMH class.
-        int firstOldRef = -1;
-        for (int i = 0; i < names2.length; i++) {
-            Name n = names[i];
-            if (n.function != null &&
-                n.function.memberDeclaringClassOrNull() == oldData.clazz) {
-                MethodHandle oldGetter = n.function.resolvedHandle;
-                MethodHandle newGetter = null;
-                for (int j = 0; j < oldData.getters.length; j++) {
-                    if (oldGetter == oldData.getters[j])
-                        newGetter =  newData.getters[j];
-                }
-                if (newGetter != null) {
-                    if (firstOldRef < 0)  firstOldRef = i;
-                    Name n2 = new Name(newGetter, n.arguments);
-                    names2[i] = n2;
-                }
-            }
-        }
-
-        // Walk over the new list of names once, in forward order.
-        // Replace references to 'name' with 'binding'.
-        // Replace data structure references to the old BMH species with the new.
-        // This might cause a ripple effect, but it will settle in one pass.
-        assert(firstOldRef < 0 || firstOldRef > pos);
-        for (int i = pos+1; i < names2.length; i++) {
-            if (i <= arity2)  continue;
-            names2[i] = names2[i].replaceNames(names, names2, pos, i);
-        }
-
-        //  (a0, a1, name=a2, a3, a4)  =>  (a0, a1, a3, a4, binding)
-        int insPos = pos;
-        for (; insPos+1 < names2.length; insPos++) {
-            Name n = names2[insPos+1];
-            if (n.isSiblingBindingBefore(binding)) {
-                names2[insPos] = n;
-            } else {
-                break;
-            }
-        }
-        names2[insPos] = binding;
-
-        // Since we moved some stuff, maybe update the result reference:
-        int result2 = result;
-        if (result2 == pos)
-            result2 = insPos;
-        else if (result2 > pos && result2 <= insPos)
-            result2 -= 1;
-
-        return bindCache[pos] = new LambdaForm(debugName, arity2, names2, result2);
+    public int hashCode() {
+        return result + 31 * Arrays.hashCode(names);
+    }
+    LambdaFormEditor editor() {
+        return LambdaFormEditor.lambdaFormEditor(this);
     }
 
     boolean contains(Name name) {
@@ -874,17 +887,17 @@
         return false;
     }
 
-    LambdaForm addArguments(int pos, char... types) {
-        assert(pos <= arity);
+    LambdaForm addArguments(int pos, BasicType... types) {
+        // names array has MH in slot 0; skip it.
+        int argpos = pos + 1;
+        assert(argpos <= arity);
         int length = names.length;
         int inTypes = types.length;
         Name[] names2 = Arrays.copyOf(names, length + inTypes);
         int arity2 = arity + inTypes;
         int result2 = result;
-        if (result2 >= arity)
+        if (result2 >= argpos)
             result2 += inTypes;
-        // names array has MH in slot 0; skip it.
-        int argpos = pos + 1;
         // Note:  The LF constructor will rename names2[argpos...].
         // Make space for new arguments (shift temporaries).
         System.arraycopy(names, argpos, names2, argpos + inTypes, length - argpos);
@@ -895,13 +908,10 @@
     }
 
     LambdaForm addArguments(int pos, List<Class<?>> types) {
-        char[] basicTypes = new char[types.size()];
-        for (int i = 0; i < basicTypes.length; i++)
-            basicTypes[i] = basicType(types.get(i));
-        return addArguments(pos, basicTypes);
+        return addArguments(pos, basicTypes(types));
     }
 
-    LambdaForm permuteArguments(int skip, int[] reorder, char[] types) {
+    LambdaForm permuteArguments(int skip, int[] reorder, BasicType[] types) {
         // Note:  When inArg = reorder[outArg], outArg is fed by a copy of inArg.
         // The types are the types of the new (incoming) arguments.
         int length = names.length;
@@ -960,7 +970,7 @@
         return new LambdaForm(debugName, arity2, names2, result2);
     }
 
-    static boolean permutedTypesMatch(int[] reorder, char[] types, Name[] names, int skip) {
+    static boolean permutedTypesMatch(int[] reorder, BasicType[] types, Name[] names, int skip) {
         int inTypes = types.length;
         int outArgs = reorder.length;
         for (int i = 0; i < outArgs; i++) {
@@ -980,8 +990,9 @@
         }
         NamedFunction(MemberName member, MethodHandle resolvedHandle) {
             this.member = member;
-            //resolvedHandle = eraseSubwordTypes(resolvedHandle);
             this.resolvedHandle = resolvedHandle;
+             // The following assert is almost always correct, but will fail for corner cases, such as PrivateInvokeTest.
+             //assert(!isInvokeBasic());
         }
         NamedFunction(MethodType basicInvokerType) {
             assert(basicInvokerType == basicInvokerType.basicType()) : basicInvokerType;
@@ -992,6 +1003,13 @@
                 // necessary to pass BigArityTest
                 this.member = Invokers.invokeBasicMethod(basicInvokerType);
             }
+            assert(isInvokeBasic());
+        }
+
+        private boolean isInvokeBasic() {
+            return member != null &&
+                   member.isMethodHandleInvoke() &&
+                   "invokeBasic".equals(member.getName());
         }
 
         // The next 3 constructors are used to break circular dependencies on MH.invokeStatic, etc.
@@ -1044,10 +1062,10 @@
                     String sig = m.getName().substring("invoke_".length());
                     int arity = LambdaForm.signatureArity(sig);
                     MethodType srcType = MethodType.genericMethodType(arity);
-                    if (LambdaForm.signatureReturn(sig) == 'V')
+                    if (LambdaForm.signatureReturn(sig) == V_TYPE)
                         srcType = srcType.changeReturnType(void.class);
                     MethodTypeForm typeForm = srcType.form();
-                    typeForm.namedFunctionInvoker = DirectMethodHandle.make(m);
+                    typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, DirectMethodHandle.make(m));
                 }
             }
         }
@@ -1057,85 +1075,104 @@
         /** void return type invokers. */
         @Hidden
         static Object invoke__V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 0);
+            assert(arityCheck(0, void.class, mh, a));
             mh.invokeBasic();
             return null;
         }
         @Hidden
         static Object invoke_L_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 1);
+            assert(arityCheck(1, void.class, mh, a));
             mh.invokeBasic(a[0]);
             return null;
         }
         @Hidden
         static Object invoke_LL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 2);
+            assert(arityCheck(2, void.class, mh, a));
             mh.invokeBasic(a[0], a[1]);
             return null;
         }
         @Hidden
         static Object invoke_LLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 3);
+            assert(arityCheck(3, void.class, mh, a));
             mh.invokeBasic(a[0], a[1], a[2]);
             return null;
         }
         @Hidden
         static Object invoke_LLLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 4);
+            assert(arityCheck(4, void.class, mh, a));
             mh.invokeBasic(a[0], a[1], a[2], a[3]);
             return null;
         }
         @Hidden
         static Object invoke_LLLLL_V(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 5);
+            assert(arityCheck(5, void.class, mh, a));
             mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
             return null;
         }
         /** Object return type invokers. */
         @Hidden
         static Object invoke__L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 0);
+            assert(arityCheck(0, mh, a));
             return mh.invokeBasic();
         }
         @Hidden
         static Object invoke_L_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 1);
+            assert(arityCheck(1, mh, a));
             return mh.invokeBasic(a[0]);
         }
         @Hidden
         static Object invoke_LL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 2);
+            assert(arityCheck(2, mh, a));
             return mh.invokeBasic(a[0], a[1]);
         }
         @Hidden
         static Object invoke_LLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 3);
+            assert(arityCheck(3, mh, a));
             return mh.invokeBasic(a[0], a[1], a[2]);
         }
         @Hidden
         static Object invoke_LLLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 4);
+            assert(arityCheck(4, mh, a));
             return mh.invokeBasic(a[0], a[1], a[2], a[3]);
         }
         @Hidden
         static Object invoke_LLLLL_L(MethodHandle mh, Object[] a) throws Throwable {
-            assert(a.length == 5);
+            assert(arityCheck(5, mh, a));
             return mh.invokeBasic(a[0], a[1], a[2], a[3], a[4]);
         }
+        private static boolean arityCheck(int arity, MethodHandle mh, Object[] a) {
+            return arityCheck(arity, Object.class, mh, a);
+        }
+        private static boolean arityCheck(int arity, Class<?> rtype, MethodHandle mh, Object[] a) {
+            assert(a.length == arity)
+                    : Arrays.asList(a.length, arity);
+            assert(mh.type().basicType() == MethodType.genericMethodType(arity).changeReturnType(rtype))
+                    : Arrays.asList(mh, rtype, arity);
+            MemberName member = mh.internalMemberName();
+            if (member != null && member.getName().equals("invokeBasic") && member.isMethodHandleInvoke()) {
+                assert(arity > 0);
+                assert(a[0] instanceof MethodHandle);
+                MethodHandle mh2 = (MethodHandle) a[0];
+                assert(mh2.type().basicType() == MethodType.genericMethodType(arity-1).changeReturnType(rtype))
+                        : Arrays.asList(member, mh2, rtype, arity);
+            }
+            return true;
+        }
 
         static final MethodType INVOKER_METHOD_TYPE =
             MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
 
         private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
-            MethodHandle mh = typeForm.namedFunctionInvoker;
+            typeForm = typeForm.basicType().form();  // normalize to basic type
+            MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
             if (mh != null)  return mh;
             MemberName invoker = InvokerBytecodeGenerator.generateNamedFunctionInvoker(typeForm);  // this could take a while
             mh = DirectMethodHandle.make(invoker);
-            MethodHandle mh2 = typeForm.namedFunctionInvoker;
+            MethodHandle mh2 = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
             if (mh2 != null)  return mh2;  // benign race
             if (!mh.type().equals(INVOKER_METHOD_TYPE))
-                throw new InternalError(mh.debugString());
-            return typeForm.namedFunctionInvoker = mh;
+                throw newInternalError(mh.debugString());
+            return typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, mh);
         }
 
         @Hidden
@@ -1193,11 +1230,6 @@
             return true;
         }
 
-        String basicTypeSignature() {
-            //return LambdaForm.basicTypeSignature(resolvedHandle.type());
-            return LambdaForm.basicTypeSignature(methodType());
-        }
-
         MethodType methodType() {
             if (resolvedHandle != null)
                 return resolvedHandle.type();
@@ -1224,18 +1256,15 @@
             return (member == null) ? null : member.getDeclaringClass();
         }
 
-        char returnType() {
+        BasicType returnType() {
             return basicType(methodType().returnType());
         }
 
-        char parameterType(int n) {
+        BasicType parameterType(int n) {
             return basicType(methodType().parameterType(n));
         }
 
         int arity() {
-            //int siglen = member.getMethodType().parameterCount();
-            //if (!member.isStatic())  siglen += 1;
-            //return siglen;
             return methodType().parameterCount();
         }
 
@@ -1243,74 +1272,109 @@
             if (member == null)  return String.valueOf(resolvedHandle);
             return member.getDeclaringClass().getSimpleName()+"."+member.getName();
         }
-    }
 
-    void resolve() {
-        for (Name n : names) n.resolve();
-    }
-
-    public static char basicType(Class<?> type) {
-        char c = Wrapper.basicTypeChar(type);
-        if ("ZBSC".indexOf(c) >= 0)  c = 'I';
-        assert("LIJFDV".indexOf(c) >= 0);
-        return c;
-    }
-    public static char[] basicTypes(List<Class<?>> types) {
-        char[] btypes = new char[types.size()];
-        for (int i = 0; i < btypes.length; i++) {
-            btypes[i] = basicType(types.get(i));
+        public boolean isIdentity() {
+            return this.equals(identity(returnType()));
         }
-        return btypes;
+
+        public boolean isConstantZero() {
+            return this.equals(constantZero(returnType()));
+        }
+
+        public MethodHandleImpl.Intrinsic intrinsicName() {
+            return resolvedHandle == null ? MethodHandleImpl.Intrinsic.NONE
+                                          : resolvedHandle.intrinsicName();
+        }
     }
+
     public static String basicTypeSignature(MethodType type) {
         char[] sig = new char[type.parameterCount() + 2];
         int sigp = 0;
         for (Class<?> pt : type.parameterList()) {
-            sig[sigp++] = basicType(pt);
+            sig[sigp++] = basicTypeChar(pt);
         }
         sig[sigp++] = '_';
-        sig[sigp++] = basicType(type.returnType());
+        sig[sigp++] = basicTypeChar(type.returnType());
         assert(sigp == sig.length);
         return String.valueOf(sig);
     }
+    public static String shortenSignature(String signature) {
+        // Hack to make signatures more readable when they show up in method names.
+        final int NO_CHAR = -1, MIN_RUN = 3;
+        int c0, c1 = NO_CHAR, c1reps = 0;
+        StringBuilder buf = null;
+        int len = signature.length();
+        if (len < MIN_RUN)  return signature;
+        for (int i = 0; i <= len; i++) {
+            // shift in the next char:
+            c0 = c1; c1 = (i == len ? NO_CHAR : signature.charAt(i));
+            if (c1 == c0) { ++c1reps; continue; }
+            // shift in the next count:
+            int c0reps = c1reps; c1reps = 1;
+            // end of a  character run
+            if (c0reps < MIN_RUN) {
+                if (buf != null) {
+                    while (--c0reps >= 0)
+                        buf.append((char)c0);
+                }
+                continue;
+            }
+            // found three or more in a row
+            if (buf == null)
+                buf = new StringBuilder().append(signature, 0, i - c0reps);
+            buf.append((char)c0).append(c0reps);
+        }
+        return (buf == null) ? signature : buf.toString();
+    }
 
     static final class Name {
-        final char type;
+        final BasicType type;
         private short index;
         final NamedFunction function;
+        final Object constraint;  // additional type information, if not null
         @Stable final Object[] arguments;
 
-        private Name(int index, char type, NamedFunction function, Object[] arguments) {
+        private Name(int index, BasicType type, NamedFunction function, Object[] arguments) {
             this.index = (short)index;
             this.type = type;
             this.function = function;
             this.arguments = arguments;
+            this.constraint = null;
             assert(this.index == index);
         }
+        private Name(Name that, Object constraint) {
+            this.index = that.index;
+            this.type = that.type;
+            this.function = that.function;
+            this.arguments = that.arguments;
+            this.constraint = constraint;
+            assert(constraint == null || isParam());  // only params have constraints
+            assert(constraint == null || constraint instanceof BoundMethodHandle.SpeciesData || constraint instanceof Class);
+        }
         Name(MethodHandle function, Object... arguments) {
             this(new NamedFunction(function), arguments);
         }
         Name(MethodType functionType, Object... arguments) {
             this(new NamedFunction(functionType), arguments);
-            assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == 'L');
+            assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == L_TYPE);
         }
         Name(MemberName function, Object... arguments) {
             this(new NamedFunction(function), arguments);
         }
         Name(NamedFunction function, Object... arguments) {
-            this(-1, function.returnType(), function, arguments = arguments.clone());
+            this(-1, function.returnType(), function, arguments = Arrays.copyOf(arguments, arguments.length, Object[].class));
             assert(arguments.length == function.arity()) : "arity mismatch: arguments.length=" + arguments.length + " == function.arity()=" + function.arity() + " in " + debugString();
             for (int i = 0; i < arguments.length; i++)
                 assert(typesMatch(function.parameterType(i), arguments[i])) : "types don't match: function.parameterType(" + i + ")=" + function.parameterType(i) + ", arguments[" + i + "]=" + arguments[i] + " in " + debugString();
         }
-        Name(int index, char type) {
+        /** Create a raw parameter of the given type, with an expected index. */
+        Name(int index, BasicType type) {
             this(index, type, null, null);
         }
-        Name(char type) {
-            this(-1, type);
-        }
+        /** Create a raw parameter of the given type. */
+        Name(BasicType type) { this(-1, type); }
 
-        char type() { return type; }
+        BasicType type() { return type; }
         int index() { return index; }
         boolean initIndex(int i) {
             if (index != i) {
@@ -1319,7 +1383,9 @@
             }
             return true;
         }
-
+        char typeChar() {
+            return type.btChar;
+        }
 
         void resolve() {
             if (function != null)
@@ -1332,7 +1398,11 @@
         }
         Name cloneWithIndex(int i) {
             Object[] newArguments = (arguments == null) ? null : arguments.clone();
-            return new Name(i, type, function, newArguments);
+            return new Name(i, type, function, newArguments).withConstraint(constraint);
+        }
+        Name withConstraint(Object constraint) {
+            if (constraint == this.constraint)  return this;
+            return new Name(this, constraint);
         }
         Name replaceName(Name oldName, Name newName) {  // FIXME: use replaceNames uniformly
             if (oldName == newName)  return this;
@@ -1352,7 +1422,11 @@
             if (!replaced)  return this;
             return new Name(function, arguments);
         }
+        /** In the arguments of this Name, replace oldNames[i] pairwise by newNames[i].
+         *  Limit such replacements to {@code start<=i<end}.  Return possibly changed self.
+         */
         Name replaceNames(Name[] oldNames, Name[] newNames, int start, int end) {
+            if (start >= end)  return this;
             @SuppressWarnings("LocalVariableHidesMemberVariable")
             Object[] arguments = this.arguments;
             boolean replaced = false;
@@ -1397,18 +1471,26 @@
             return function == null;
         }
         boolean isConstantZero() {
-            return !isParam() && arguments.length == 0 && function.equals(constantZero(0, type).function);
+            return !isParam() && arguments.length == 0 && function.isConstantZero();
         }
 
         public String toString() {
-            return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+type;
+            return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+typeChar();
         }
         public String debugString() {
-            String s = toString();
+            String s = paramString();
             return (function == null) ? s : s + "=" + exprString();
         }
+        public String paramString() {
+            String s = toString();
+            Object c = constraint;
+            if (c == null)
+                return s;
+            if (c instanceof Class)  c = ((Class<?>)c).getSimpleName();
+            return s + "/" + c;
+        }
         public String exprString() {
-            if (function == null)  return "null";
+            if (function == null)  return toString();
             StringBuilder buf = new StringBuilder(function.toString());
             buf.append("(");
             String cma = "";
@@ -1423,48 +1505,20 @@
             return buf.toString();
         }
 
-        private static boolean typesMatch(char parameterType, Object object) {
+        static boolean typesMatch(BasicType parameterType, Object object) {
             if (object instanceof Name) {
                 return ((Name)object).type == parameterType;
             }
             switch (parameterType) {
-                case 'I':  return object instanceof Integer;
-                case 'J':  return object instanceof Long;
-                case 'F':  return object instanceof Float;
-                case 'D':  return object instanceof Double;
+                case I_TYPE:  return object instanceof Integer;
+                case J_TYPE:  return object instanceof Long;
+                case F_TYPE:  return object instanceof Float;
+                case D_TYPE:  return object instanceof Double;
             }
-            assert(parameterType == 'L');
+            assert(parameterType == L_TYPE);
             return true;
         }
 
-        /**
-         * Does this Name precede the given binding node in some canonical order?
-         * This predicate is used to order data bindings (via insertion sort)
-         * with some stability.
-         */
-        boolean isSiblingBindingBefore(Name binding) {
-            assert(!binding.isParam());
-            if (isParam())  return true;
-            if (function.equals(binding.function) &&
-                arguments.length == binding.arguments.length) {
-                boolean sawInt = false;
-                for (int i = 0; i < arguments.length; i++) {
-                    Object a1 = arguments[i];
-                    Object a2 = binding.arguments[i];
-                    if (!a1.equals(a2)) {
-                        if (a1 instanceof Integer && a2 instanceof Integer) {
-                            if (sawInt)  continue;
-                            sawInt = true;
-                            if ((int)a1 < (int)a2)  continue;  // still might be true
-                        }
-                        return false;
-                    }
-                }
-                return sawInt;
-            }
-            return false;
-        }
-
         /** Return the index of the last occurrence of n in the argument array.
          *  Return -1 if the name is not used.
          */
@@ -1510,7 +1564,7 @@
         @Override
         public int hashCode() {
             if (isParam())
-                return index | (type << 8);
+                return index | (type.ordinal() << 8);
             return function.hashCode() ^ Arrays.hashCode(arguments);
         }
     }
@@ -1545,14 +1599,17 @@
     }
 
     static Name argument(int which, char type) {
-        int tn = ALL_TYPES.indexOf(type);
-        if (tn < 0 || which >= INTERNED_ARGUMENT_LIMIT)
+        return argument(which, basicType(type));
+    }
+    static Name argument(int which, BasicType type) {
+        if (which >= INTERNED_ARGUMENT_LIMIT)
             return new Name(which, type);
-        return INTERNED_ARGUMENTS[tn][which];
+        return INTERNED_ARGUMENTS[type.ordinal()][which];
     }
     static Name internArgument(Name n) {
         assert(n.isParam()) : "not param: " + n;
         assert(n.index < INTERNED_ARGUMENT_LIMIT);
+        if (n.constraint != null)  return n;
         return argument(n.index, n.type);
     }
     static Name[] arguments(int extra, String types) {
@@ -1590,56 +1647,118 @@
             names[i] = argument(i, basicType(types.parameterType(i)));
         return names;
     }
-    static final String ALL_TYPES = "LIJFD";  // omit V, not an argument type
     static final int INTERNED_ARGUMENT_LIMIT = 10;
     private static final Name[][] INTERNED_ARGUMENTS
-            = new Name[ALL_TYPES.length()][INTERNED_ARGUMENT_LIMIT];
+            = new Name[ARG_TYPE_LIMIT][INTERNED_ARGUMENT_LIMIT];
     static {
-        for (int tn = 0; tn < ALL_TYPES.length(); tn++) {
-            for (int i = 0; i < INTERNED_ARGUMENTS[tn].length; i++) {
-                char type = ALL_TYPES.charAt(tn);
-                INTERNED_ARGUMENTS[tn][i] = new Name(i, type);
+        for (BasicType type : BasicType.ARG_TYPES) {
+            int ord = type.ordinal();
+            for (int i = 0; i < INTERNED_ARGUMENTS[ord].length; i++) {
+                INTERNED_ARGUMENTS[ord][i] = new Name(i, type);
             }
         }
     }
 
     private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory();
 
-    static Name constantZero(int which, char type) {
-        return CONSTANT_ZERO[ALL_TYPES.indexOf(type)].newIndex(which);
+    static LambdaForm identityForm(BasicType type) {
+        return LF_identityForm[type.ordinal()];
     }
-    private static final Name[] CONSTANT_ZERO
-            = new Name[ALL_TYPES.length()];
-    static {
-        for (int tn = 0; tn < ALL_TYPES.length(); tn++) {
-            char bt = ALL_TYPES.charAt(tn);
-            Wrapper wrap = Wrapper.forBasicType(bt);
-            MemberName zmem = new MemberName(LambdaForm.class, "zero"+bt, MethodType.methodType(wrap.primitiveType()), REF_invokeStatic);
+    static LambdaForm zeroForm(BasicType type) {
+        return LF_zeroForm[type.ordinal()];
+    }
+    static NamedFunction identity(BasicType type) {
+        return NF_identity[type.ordinal()];
+    }
+    static NamedFunction constantZero(BasicType type) {
+        return NF_zero[type.ordinal()];
+    }
+    private static final LambdaForm[] LF_identityForm = new LambdaForm[TYPE_LIMIT];
+    private static final LambdaForm[] LF_zeroForm = new LambdaForm[TYPE_LIMIT];
+    private static final NamedFunction[] NF_identity = new NamedFunction[TYPE_LIMIT];
+    private static final NamedFunction[] NF_zero = new NamedFunction[TYPE_LIMIT];
+    private static void createIdentityForms() {
+        for (BasicType type : BasicType.ALL_TYPES) {
+            int ord = type.ordinal();
+            char btChar = type.basicTypeChar();
+            boolean isVoid = (type == V_TYPE);
+            Class<?> btClass = type.btClass;
+            MethodType zeType = MethodType.methodType(btClass);
+            MethodType idType = isVoid ? zeType : zeType.appendParameterTypes(btClass);
+
+            // Look up some symbolic names.  It might not be necessary to have these,
+            // but if we need to emit direct references to bytecodes, it helps.
+            // Zero is built from a call to an identity function with a constant zero input.
+            MemberName idMem = new MemberName(LambdaForm.class, "identity_"+btChar, idType, REF_invokeStatic);
+            MemberName zeMem = new MemberName(LambdaForm.class, "zero_"+btChar, zeType, REF_invokeStatic);
             try {
-                zmem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zmem, null, NoSuchMethodException.class);
+                zeMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zeMem, null, NoSuchMethodException.class);
+                idMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, idMem, null, NoSuchMethodException.class);
             } catch (IllegalAccessException|NoSuchMethodException ex) {
                 throw newInternalError(ex);
             }
-            NamedFunction zcon = new NamedFunction(zmem);
-            Name n = new Name(zcon).newIndex(0);
-            assert(n.type == ALL_TYPES.charAt(tn));
-            CONSTANT_ZERO[tn] = n;
-            assert(n.isConstantZero());
+
+            NamedFunction idFun = new NamedFunction(idMem);
+            LambdaForm idForm;
+            if (isVoid) {
+                Name[] idNames = new Name[] { argument(0, L_TYPE) };
+                idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT);
+            } else {
+                Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) };
+                idForm = new LambdaForm(idMem.getName(), 2, idNames, 1);
+            }
+            LF_identityForm[ord] = idForm;
+            NF_identity[ord] = idFun;
+
+            NamedFunction zeFun = new NamedFunction(zeMem);
+            LambdaForm zeForm;
+            if (isVoid) {
+                zeForm = idForm;
+            } else {
+                Object zeValue = Wrapper.forBasicType(btChar).zero();
+                Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) };
+                zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1);
+            }
+            LF_zeroForm[ord] = zeForm;
+            NF_zero[ord] = zeFun;
+
+            assert(idFun.isIdentity());
+            assert(zeFun.isConstantZero());
+            assert(new Name(zeFun).isConstantZero());
+        }
+
+        // Do this in a separate pass, so that SimpleMethodHandle.make can see the tables.
+        for (BasicType type : BasicType.ALL_TYPES) {
+            int ord = type.ordinal();
+            NamedFunction idFun = NF_identity[ord];
+            LambdaForm idForm = LF_identityForm[ord];
+            MemberName idMem = idFun.member;
+            idFun.resolvedHandle = SimpleMethodHandle.make(idMem.getInvocationType(), idForm);
+
+            NamedFunction zeFun = NF_zero[ord];
+            LambdaForm zeForm = LF_zeroForm[ord];
+            MemberName zeMem = zeFun.member;
+            zeFun.resolvedHandle = SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm);
+
+            assert(idFun.isIdentity());
+            assert(zeFun.isConstantZero());
+            assert(new Name(zeFun).isConstantZero());
         }
     }
 
     // Avoid appealing to ValueConversions at bootstrap time:
-    private static int zeroI() { return 0; }
-    private static long zeroJ() { return 0; }
-    private static float zeroF() { return 0; }
-    private static double zeroD() { return 0; }
-    private static Object zeroL() { return null; }
-
-    // Put this last, so that previous static inits can run before.
-    static {
-        if (USE_PREDEFINED_INTERPRET_METHODS)
-            PREPARED_FORMS.putAll(computeInitialPreparedForms());
-    }
+    private static int identity_I(int x) { return x; }
+    private static long identity_J(long x) { return x; }
+    private static float identity_F(float x) { return x; }
+    private static double identity_D(double x) { return x; }
+    private static Object identity_L(Object x) { return x; }
+    private static void identity_V() { return; }  // same as zeroV, but that's OK
+    private static int zero_I() { return 0; }
+    private static long zero_J() { return 0; }
+    private static float zero_F() { return 0; }
+    private static double zero_D() { return 0; }
+    private static Object zero_L() { return null; }
+    private static void zero_V() { return; }
 
     /**
      * Internal marker for byte-compiled LambdaForms.
@@ -1659,38 +1778,21 @@
     @interface Hidden {
     }
 
-
-/*
-    // Smoke-test for the invokers used in this file.
-    static void testMethodHandleLinkers() throws Throwable {
-        MemberName.Factory lookup = MemberName.getFactory();
-        MemberName asList_MN = new MemberName(Arrays.class, "asList",
-                                              MethodType.methodType(List.class, Object[].class),
-                                              REF_invokeStatic);
-        //MethodHandleNatives.resolve(asList_MN, null);
-        asList_MN = lookup.resolveOrFail(asList_MN, REF_invokeStatic, null, NoSuchMethodException.class);
-        System.out.println("about to call "+asList_MN);
-        Object[] abc = { "a", "bc" };
-        List<?> lst = (List<?>) MethodHandle.linkToStatic(abc, asList_MN);
-        System.out.println("lst="+lst);
-        MemberName toString_MN = new MemberName(Object.class.getMethod("toString"));
-        String s1 = (String) MethodHandle.linkToVirtual(lst, toString_MN);
-        toString_MN = new MemberName(Object.class.getMethod("toString"), true);
-        String s2 = (String) MethodHandle.linkToSpecial(lst, toString_MN);
-        System.out.println("[s1,s2,lst]="+Arrays.asList(s1, s2, lst.toString()));
-        MemberName toArray_MN = new MemberName(List.class.getMethod("toArray"));
-        Object[] arr = (Object[]) MethodHandle.linkToInterface(lst, toArray_MN);
-        System.out.println("toArray="+Arrays.toString(arr));
+    private static final HashMap<String,Integer> DEBUG_NAME_COUNTERS;
+    static {
+        if (debugEnabled())
+            DEBUG_NAME_COUNTERS = new HashMap<>();
+        else
+            DEBUG_NAME_COUNTERS = null;
     }
-    static { try { testMethodHandleLinkers(); } catch (Throwable ex) { throw new RuntimeException(ex); } }
-    // Requires these definitions in MethodHandle:
-    static final native Object linkToStatic(Object x1, MemberName mn) throws Throwable;
-    static final native Object linkToVirtual(Object x1, MemberName mn) throws Throwable;
-    static final native Object linkToSpecial(Object x1, MemberName mn) throws Throwable;
-    static final native Object linkToInterface(Object x1, MemberName mn) throws Throwable;
- */
 
-    static { NamedFunction.initializeInvokers(); }
+    // Put this last, so that previous static inits can run before.
+    static {
+        createIdentityForms();
+        if (USE_PREDEFINED_INTERPRET_METHODS)
+            computeInitialPreparedForms();
+        NamedFunction.initializeInvokers();
+    }
 
     // The following hack is necessary in order to suppress TRACE_INTERPRETER
     // during execution of the static initializes of this class.
diff --git a/src/share/classes/java/lang/invoke/LambdaFormBuffer.java b/src/share/classes/java/lang/invoke/LambdaFormBuffer.java
new file mode 100644
index 0000000..872a2a5
--- /dev/null
+++ b/src/share/classes/java/lang/invoke/LambdaFormBuffer.java
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.invoke;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+
+/** Working storage for an LF that is being transformed.
+ *  Similarly to a StringBuffer, the editing can take place in multiple steps.
+ */
+final class LambdaFormBuffer {
+    private int arity, length;
+    private Name[] names;
+    private Name[] originalNames;  // snapshot of pre-transaction names
+    private byte flags;
+    private int firstChange;
+    private Name resultName;
+    private String debugName;
+    private ArrayList<Name> dups;
+
+    private static final int F_TRANS = 0x10, F_OWNED = 0x03;
+
+    LambdaFormBuffer(LambdaForm lf) {
+        this(lf.arity, lf.names, lf.result);
+        debugName = lf.debugName;
+        assert(lf.nameRefsAreLegal());
+    }
+
+    private LambdaFormBuffer(int arity, Name[] names, int result) {
+        this.arity = arity;
+        setNames(names);
+        if (result == LAST_RESULT)  result = length - 1;
+        if (result >= 0 && names[result].type != V_TYPE)
+            resultName = names[result];
+    }
+
+    private LambdaForm lambdaForm() {
+        assert(!inTrans());  // need endEdit call to tidy things up
+        return new LambdaForm(debugName, arity, nameArray(), resultIndex());
+    }
+
+    Name name(int i) {
+        assert(i < length);
+        return names[i];
+    }
+
+    Name[] nameArray() {
+        return Arrays.copyOf(names, length);
+    }
+
+    int resultIndex() {
+        if (resultName == null)  return VOID_RESULT;
+        int index = indexOf(resultName, names);
+        assert(index >= 0);
+        return index;
+    }
+
+    void setNames(Name[] names2) {
+        names = originalNames = names2;  // keep a record of where everything was to start with
+        length = names2.length;
+        flags = 0;
+    }
+
+    private boolean verifyArity() {
+        for (int i = 0; i < arity && i < firstChange; i++) {
+            assert(names[i].isParam()) : "#" + i + "=" + names[i];
+        }
+        for (int i = arity; i < length; i++) {
+            assert(!names[i].isParam()) : "#" + i + "=" + names[i];
+        }
+        for (int i = length; i < names.length; i++) {
+            assert(names[i] == null) : "#" + i + "=" + names[i];
+        }
+        // check resultName also
+        if (resultName != null) {
+            int resultIndex = indexOf(resultName, names);
+            assert(resultIndex >= 0) : "not found: " + resultName.exprString() + Arrays.asList(names);
+            assert(names[resultIndex] == resultName);
+        }
+        return true;
+    }
+
+    private boolean verifyFirstChange() {
+        assert(inTrans());
+        for (int i = 0; i < length; i++) {
+            if (names[i] != originalNames[i]) {
+                assert(firstChange == i) : Arrays.asList(firstChange, i, originalNames[i].exprString(), Arrays.asList(names));
+                return true;
+            }
+        }
+        assert(firstChange == length) : Arrays.asList(firstChange, Arrays.asList(names));
+        return true;
+    }
+
+    private static int indexOf(NamedFunction fn, NamedFunction[] fns) {
+        for (int i = 0; i < fns.length; i++) {
+            if (fns[i] == fn)  return i;
+        }
+        return -1;
+    }
+
+    private static int indexOf(Name n, Name[] ns) {
+        for (int i = 0; i < ns.length; i++) {
+            if (ns[i] == n)  return i;
+        }
+        return -1;
+    }
+
+    boolean inTrans() {
+        return (flags & F_TRANS) != 0;
+    }
+
+    int ownedCount() {
+        return flags & F_OWNED;
+    }
+
+    void growNames(int insertPos, int growLength) {
+        int oldLength = length;
+        int newLength = oldLength + growLength;
+        int oc = ownedCount();
+        if (oc == 0 || newLength > names.length) {
+            names = Arrays.copyOf(names, (names.length + growLength) * 5 / 4);
+            if (oc == 0) {
+                flags++;
+                oc++;
+                assert(ownedCount() == oc);
+            }
+        }
+        if (originalNames != null && originalNames.length < names.length) {
+            originalNames = Arrays.copyOf(originalNames, names.length);
+            if (oc == 1) {
+                flags++;
+                oc++;
+                assert(ownedCount() == oc);
+            }
+        }
+        if (growLength == 0)  return;
+        int insertEnd = insertPos + growLength;
+        int tailLength = oldLength - insertPos;
+        System.arraycopy(names, insertPos, names, insertEnd, tailLength);
+        Arrays.fill(names, insertPos, insertEnd, null);
+        if (originalNames != null) {
+            System.arraycopy(originalNames, insertPos, originalNames, insertEnd, tailLength);
+            Arrays.fill(originalNames, insertPos, insertEnd, null);
+        }
+        length = newLength;
+        if (firstChange >= insertPos) {
+            firstChange += growLength;
+        }
+    }
+
+    int lastIndexOf(Name n) {
+        int result = -1;
+        for (int i = 0; i < length; i++) {
+            if (names[i] == n)  result = i;
+        }
+        return result;
+    }
+
+    /** We have just overwritten the name at pos1 with the name at pos2.
+     *  This means that there are two copies of the name, which we will have to fix later.
+     */
+    private void noteDuplicate(int pos1, int pos2) {
+        Name n = names[pos1];
+        assert(n == names[pos2]);
+        assert(originalNames[pos1] != null);  // something was replaced at pos1
+        assert(originalNames[pos2] == null || originalNames[pos2] == n);
+        if (dups == null) {
+            dups = new ArrayList<>();
+        }
+        dups.add(n);
+    }
+
+    /** Replace duplicate names by nulls, and remove all nulls. */
+    private void clearDuplicatesAndNulls() {
+        if (dups != null) {
+            // Remove duplicates.
+            assert(ownedCount() >= 1);
+            for (Name dup : dups) {
+                for (int i = firstChange; i < length; i++) {
+                    if (names[i] == dup && originalNames[i] != dup) {
+                        names[i] = null;
+                        assert(Arrays.asList(names).contains(dup));
+                        break;  // kill only one dup
+                    }
+                }
+            }
+            dups.clear();
+        }
+        // Now that we are done with originalNames, remove "killed" names.
+        int oldLength = length;
+        for (int i = firstChange; i < length; i++) {
+            if (names[i] == null) {
+                System.arraycopy(names, i + 1, names, i, (--length - i));
+                --i;  // restart loop at this position
+            }
+        }
+        if (length < oldLength) {
+            Arrays.fill(names, length, oldLength, null);
+        }
+        assert(!Arrays.asList(names).subList(0, length).contains(null));
+    }
+
+    /** Create a private, writable copy of names.
+     *  Preserve the original copy, for reference.
+     */
+    void startEdit() {
+        assert(verifyArity());
+        int oc = ownedCount();
+        assert(!inTrans());  // no nested transactions
+        flags |= F_TRANS;
+        Name[] oldNames = names;
+        Name[] ownBuffer = (oc == 2 ? originalNames : null);
+        assert(ownBuffer != oldNames);
+        if (ownBuffer != null && ownBuffer.length >= length) {
+            names = copyNamesInto(ownBuffer);
+        } else {
+            // make a new buffer to hold the names
+            final int SLOP = 2;
+            names = Arrays.copyOf(oldNames, Math.max(length + SLOP, oldNames.length));
+            if (oc < 2)  ++flags;
+            assert(ownedCount() == oc + 1);
+        }
+        originalNames = oldNames;
+        assert(originalNames != names);
+        firstChange = length;
+        assert(inTrans());
+    }
+
+    private void changeName(int i, Name name) {
+        assert(inTrans());
+        assert(i < length);
+        Name oldName = names[i];
+        assert(oldName == originalNames[i]);  // no multiple changes
+        assert(verifyFirstChange());
+        if (ownedCount() == 0)
+            growNames(0, 0);
+        names[i] = name;
+        if (firstChange > i) {
+            firstChange = i;
+        }
+        if (resultName != null && resultName == oldName) {
+            resultName = name;
+        }
+    }
+
+    /** Change the result name.  Null means a void result. */
+    void setResult(Name name) {
+        assert(name == null || lastIndexOf(name) >= 0);
+        resultName = name;
+    }
+
+    /** Finish a transaction. */
+    LambdaForm endEdit() {
+        assert(verifyFirstChange());
+        // Assuming names have been changed pairwise from originalNames[i] to names[i],
+        // update arguments to ensure referential integrity.
+        for (int i = Math.max(firstChange, arity); i < length; i++) {
+            Name name = names[i];
+            if (name == null)  continue;  // space for removed duplicate
+            Name newName = name.replaceNames(originalNames, names, firstChange, i);
+            if (newName != name) {
+                names[i] = newName;
+                if (resultName == name) {
+                    resultName = newName;
+                }
+            }
+        }
+        assert(inTrans());
+        flags &= ~F_TRANS;
+        clearDuplicatesAndNulls();
+        originalNames = null;
+        // If any parameters have been changed, then reorder them as needed.
+        // This is a "sheep-and-goats" stable sort, pushing all non-parameters
+        // to the right of all parameters.
+        if (firstChange < arity) {
+            Name[] exprs = new Name[arity - firstChange];
+            int argp = firstChange, exprp = 0;
+            for (int i = firstChange; i < arity; i++) {
+                Name name = names[i];
+                if (name.isParam()) {
+                    names[argp++] = name;
+                } else {
+                    exprs[exprp++] = name;
+                }
+            }
+            assert(exprp == (arity - argp));
+            // copy the exprs just after the last remaining param
+            System.arraycopy(exprs, 0, names, argp, exprp);
+            // adjust arity
+            arity -= exprp;
+        }
+        assert(verifyArity());
+        return lambdaForm();
+    }
+
+    private Name[] copyNamesInto(Name[] buffer) {
+        System.arraycopy(names, 0, buffer, 0, length);
+        Arrays.fill(buffer, length, buffer.length, null);
+        return buffer;
+    }
+
+    /** Replace any Name whose function is in oldFns with a copy
+     *  whose function is in the corresponding position in newFns.
+     *  Only do this if the arguments are exactly equal to the given.
+     */
+    LambdaFormBuffer replaceFunctions(NamedFunction[] oldFns, NamedFunction[] newFns,
+                                      Object... forArguments) {
+        assert(inTrans());
+        if (oldFns.length == 0)  return this;
+        for (int i = arity; i < length; i++) {
+            Name n = names[i];
+            int nfi = indexOf(n.function, oldFns);
+            if (nfi >= 0 && Arrays.equals(n.arguments, forArguments)) {
+                changeName(i, new Name(newFns[nfi], n.arguments));
+            }
+        }
+        return this;
+    }
+
+    private void replaceName(int pos, Name binding) {
+        assert(inTrans());
+        assert(verifyArity());
+        assert(pos < arity);
+        Name param = names[pos];
+        assert(param.isParam());
+        assert(param.type == binding.type);
+        changeName(pos, binding);
+    }
+
+    /** Replace a parameter by a fresh parameter. */
+    LambdaFormBuffer renameParameter(int pos, Name newParam) {
+        assert(newParam.isParam());
+        replaceName(pos, newParam);
+        return this;
+    }
+
+    /** Replace a parameter by a fresh expression. */
+    LambdaFormBuffer replaceParameterByNewExpression(int pos, Name binding) {
+        assert(!binding.isParam());
+        assert(lastIndexOf(binding) < 0);  // else use replaceParameterByCopy
+        replaceName(pos, binding);
+        return this;
+    }
+
+    /** Replace a parameter by another parameter or expression already in the form. */
+    LambdaFormBuffer replaceParameterByCopy(int pos, int valuePos) {
+        assert(pos != valuePos);
+        replaceName(pos, names[valuePos]);
+        noteDuplicate(pos, valuePos);  // temporarily, will occur twice in the names array
+        return this;
+    }
+
+    private void insertName(int pos, Name expr, boolean isParameter) {
+        assert(inTrans());
+        assert(verifyArity());
+        assert(isParameter ? pos <= arity : pos >= arity);
+        growNames(pos, 1);
+        if (isParameter)  arity += 1;
+        changeName(pos, expr);
+    }
+
+    /** Insert a fresh expression. */
+    LambdaFormBuffer insertExpression(int pos, Name expr) {
+        assert(!expr.isParam());
+        insertName(pos, expr, false);
+        return this;
+    }
+
+    /** Insert a fresh parameter. */
+    LambdaFormBuffer insertParameter(int pos, Name param) {
+        assert(param.isParam());
+        insertName(pos, param, true);
+        return this;
+    }
+}
diff --git a/src/share/classes/java/lang/invoke/LambdaFormEditor.java b/src/share/classes/java/lang/invoke/LambdaFormEditor.java
new file mode 100644
index 0000000..1c29d73
--- /dev/null
+++ b/src/share/classes/java/lang/invoke/LambdaFormEditor.java
@@ -0,0 +1,825 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.invoke;
+
+import java.util.Arrays;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleImpl.Intrinsic;
+import java.util.Collections;
+import java.util.concurrent.ConcurrentHashMap;
+
+import sun.invoke.util.Wrapper;
+
+/** Transforms on LFs.
+ *  A lambda-form editor can derive new LFs from its base LF.
+ *  The editor can cache derived LFs, which simplifies the reuse of their underlying bytecodes.
+ *  To support this caching, a LF has an optional pointer to its editor.
+ */
+class LambdaFormEditor {
+    final LambdaForm lambdaForm;
+
+    private LambdaFormEditor(LambdaForm lambdaForm) {
+        this.lambdaForm = lambdaForm;
+    }
+
+    // Factory method.
+    static LambdaFormEditor lambdaFormEditor(LambdaForm lambdaForm) {
+        // TO DO:  Consider placing intern logic here, to cut down on duplication.
+        // lambdaForm = findPreexistingEquivalent(lambdaForm)
+        return new LambdaFormEditor(lambdaForm);
+    }
+
+    /** A description of a cached transform, possibly associated with the result of the transform.
+     *  The logical content is a sequence of byte values, starting with a Kind.ordinal value.
+     *  The sequence is unterminated, ending with an indefinite number of zero bytes.
+     *  Sequences that are simple (short enough and with small enough values) pack into a 64-bit long.
+     */
+    private static final class Transform {
+        final long packedBytes;
+        final byte[] fullBytes;
+        final LambdaForm result;  // result of transform, or null, if there is none available
+
+        private enum Kind {
+            NO_KIND,  // necessary because ordinal must be greater than zero
+            BIND_ARG, ADD_ARG, DUP_ARG,
+            SPREAD_ARGS,
+            FILTER_ARG, FILTER_RETURN, FILTER_RETURN_TO_ZERO,
+            COLLECT_ARGS, COLLECT_ARGS_TO_VOID, COLLECT_ARGS_TO_ARRAY,
+            FOLD_ARGS, FOLD_ARGS_TO_VOID,
+            PERMUTE_ARGS
+            //maybe add more for guard with test, catch exception, pointwise type conversions
+        }
+
+        private static final boolean STRESS_TEST = false; // turn on to disable most packing
+        private static final int
+                PACKED_BYTE_SIZE = (STRESS_TEST ? 2 : 4),
+                PACKED_BYTE_MASK = (1 << PACKED_BYTE_SIZE) - 1,
+                PACKED_BYTE_MAX_LENGTH = (STRESS_TEST ? 3 : 64 / PACKED_BYTE_SIZE);
+
+        private static long packedBytes(byte[] bytes) {
+            if (bytes.length > PACKED_BYTE_MAX_LENGTH)  return 0;
+            long pb = 0;
+            int bitset = 0;
+            for (int i = 0; i < bytes.length; i++) {
+                int b = bytes[i] & 0xFF;
+                bitset |= b;
+                pb |= (long)b << (i * PACKED_BYTE_SIZE);
+            }
+            if (!inRange(bitset))
+                return 0;
+            return pb;
+        }
+        private static long packedBytes(int b0, int b1) {
+            assert(inRange(b0 | b1));
+            return (  (b0 << 0*PACKED_BYTE_SIZE)
+                    | (b1 << 1*PACKED_BYTE_SIZE));
+        }
+        private static long packedBytes(int b0, int b1, int b2) {
+            assert(inRange(b0 | b1 | b2));
+            return (  (b0 << 0*PACKED_BYTE_SIZE)
+                    | (b1 << 1*PACKED_BYTE_SIZE)
+                    | (b2 << 2*PACKED_BYTE_SIZE));
+        }
+        private static long packedBytes(int b0, int b1, int b2, int b3) {
+            assert(inRange(b0 | b1 | b2 | b3));
+            return (  (b0 << 0*PACKED_BYTE_SIZE)
+                    | (b1 << 1*PACKED_BYTE_SIZE)
+                    | (b2 << 2*PACKED_BYTE_SIZE)
+                    | (b3 << 3*PACKED_BYTE_SIZE));
+        }
+        private static boolean inRange(int bitset) {
+            assert((bitset & 0xFF) == bitset);  // incoming values must fit in *unsigned* byte
+            return ((bitset & ~PACKED_BYTE_MASK) == 0);
+        }
+        private static byte[] fullBytes(int... byteValues) {
+            byte[] bytes = new byte[byteValues.length];
+            int i = 0;
+            for (int bv : byteValues) {
+                bytes[i++] = bval(bv);
+            }
+            assert(packedBytes(bytes) == 0);
+            return bytes;
+        }
+
+        private byte byteAt(int i) {
+            long pb = packedBytes;
+            if (pb == 0) {
+                if (i >= fullBytes.length)  return 0;
+                return fullBytes[i];
+            }
+            assert(fullBytes == null);
+            if (i > PACKED_BYTE_MAX_LENGTH)  return 0;
+            int pos = (i * PACKED_BYTE_SIZE);
+            return (byte)((pb >>> pos) & PACKED_BYTE_MASK);
+        }
+
+        Kind kind() { return Kind.values()[byteAt(0)]; }
+
+        private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) {
+            this.packedBytes = packedBytes;
+            this.fullBytes = fullBytes;
+            this.result = result;
+        }
+        private Transform(long packedBytes) {
+            this(packedBytes, null, null);
+            assert(packedBytes != 0);
+        }
+        private Transform(byte[] fullBytes) {
+            this(0, fullBytes, null);
+        }
+
+        private static byte bval(int b) {
+            assert((b & 0xFF) == b);  // incoming value must fit in *unsigned* byte
+            return (byte)b;
+        }
+        private static byte bval(Kind k) {
+            return bval(k.ordinal());
+        }
+        static Transform of(Kind k, int b1) {
+            byte b0 = bval(k);
+            if (inRange(b0 | b1))
+                return new Transform(packedBytes(b0, b1));
+            else
+                return new Transform(fullBytes(b0, b1));
+        }
+        static Transform of(Kind k, int b1, int b2) {
+            byte b0 = (byte) k.ordinal();
+            if (inRange(b0 | b1 | b2))
+                return new Transform(packedBytes(b0, b1, b2));
+            else
+                return new Transform(fullBytes(b0, b1, b2));
+        }
+        static Transform of(Kind k, int b1, int b2, int b3) {
+            byte b0 = (byte) k.ordinal();
+            if (inRange(b0 | b1 | b2 | b3))
+                return new Transform(packedBytes(b0, b1, b2, b3));
+            else
+                return new Transform(fullBytes(b0, b1, b2, b3));
+        }
+        private static final byte[] NO_BYTES = {};
+        static Transform of(Kind k, int... b123) {
+            return ofBothArrays(k, b123, NO_BYTES);
+        }
+        static Transform of(Kind k, int b1, byte[] b234) {
+            return ofBothArrays(k, new int[]{ b1 }, b234);
+        }
+        static Transform of(Kind k, int b1, int b2, byte[] b345) {
+            return ofBothArrays(k, new int[]{ b1, b2 }, b345);
+        }
+        private static Transform ofBothArrays(Kind k, int[] b123, byte[] b456) {
+            byte[] fullBytes = new byte[1 + b123.length + b456.length];
+            int i = 0;
+            fullBytes[i++] = bval(k);
+            for (int bv : b123) {
+                fullBytes[i++] = bval(bv);
+            }
+            for (byte bv : b456) {
+                fullBytes[i++] = bv;
+            }
+            long packedBytes = packedBytes(fullBytes);
+            if (packedBytes != 0)
+                return new Transform(packedBytes);
+            else
+                return new Transform(fullBytes);
+        }
+
+        Transform withResult(LambdaForm result) {
+            return new Transform(this.packedBytes, this.fullBytes, result);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            return obj instanceof Transform && equals((Transform)obj);
+        }
+        public boolean equals(Transform that) {
+            return this.packedBytes == that.packedBytes && Arrays.equals(this.fullBytes, that.fullBytes);
+        }
+        @Override
+        public int hashCode() {
+            if (packedBytes != 0) {
+                assert(fullBytes == null);
+                return Long.hashCode(packedBytes);
+            }
+            return Arrays.hashCode(fullBytes);
+        }
+        @Override
+        public String toString() {
+            StringBuilder buf = new StringBuilder();
+            long bits = packedBytes;
+            if (bits != 0) {
+                buf.append("(");
+                while (bits != 0) {
+                    buf.append(bits & PACKED_BYTE_MASK);
+                    bits >>>= PACKED_BYTE_SIZE;
+                    if (bits != 0)  buf.append(",");
+                }
+                buf.append(")");
+            }
+            if (fullBytes != null) {
+                buf.append("unpacked");
+                buf.append(Arrays.toString(fullBytes));
+            }
+            if (result != null) {
+                buf.append(" result=");
+                buf.append(result);
+            }
+            return buf.toString();
+        }
+    }
+
+    /** Find a previously cached transform equivalent to the given one, and return its result. */
+    private LambdaForm getInCache(Transform key) {
+        assert(key.result == null);
+        // The transformCache is one of null, Transform, Transform[], or ConcurrentHashMap.
+        Object c = lambdaForm.transformCache;
+        Transform k = null;
+        if (c instanceof ConcurrentHashMap) {
+            @SuppressWarnings("unchecked")
+            ConcurrentHashMap<Transform,Transform> m = (ConcurrentHashMap<Transform,Transform>) c;
+            k = m.get(key);
+        } else if (c == null) {
+            return null;
+        } else if (c instanceof Transform) {
+            // one-element cache avoids overhead of an array
+            Transform t = (Transform)c;
+            if (t.equals(key))  k = t;
+        } else {
+            Transform[] ta = (Transform[])c;
+            for (int i = 0; i < ta.length; i++) {
+                Transform t = ta[i];
+                if (t == null)  break;
+                if (t.equals(key)) { k = t; break; }
+            }
+        }
+        assert(k == null || key.equals(k));
+        return k == null ? null : k.result;
+    }
+
+    /** Arbitrary but reasonable limits on Transform[] size for cache. */
+    private static final int MIN_CACHE_ARRAY_SIZE = 4, MAX_CACHE_ARRAY_SIZE = 16;
+
+    /** Cache a transform with its result, and return that result.
+     *  But if an equivalent transform has already been cached, return its result instead.
+     */
+    private LambdaForm putInCache(Transform key, LambdaForm form) {
+        key = key.withResult(form);
+        for (int pass = 0; ; pass++) {
+            Object c = lambdaForm.transformCache;
+            if (c instanceof ConcurrentHashMap) {
+                @SuppressWarnings("unchecked")
+                ConcurrentHashMap<Transform,Transform> m = (ConcurrentHashMap<Transform,Transform>) c;
+                Transform k = m.putIfAbsent(key, key);
+                return k != null ? k.result : form;
+            }
+            assert(pass == 0);
+            synchronized (lambdaForm) {
+                c = lambdaForm.transformCache;
+                if (c instanceof ConcurrentHashMap)
+                    continue;
+                if (c == null) {
+                    lambdaForm.transformCache = key;
+                    return form;
+                }
+                Transform[] ta;
+                if (c instanceof Transform) {
+                    Transform k = (Transform)c;
+                    if (k.equals(key)) {
+                        return k.result;
+                    }
+                    // expand one-element cache to small array
+                    ta = new Transform[MIN_CACHE_ARRAY_SIZE];
+                    ta[0] = k;
+                    lambdaForm.transformCache = c = ta;
+                } else {
+                    // it is already expanded
+                    ta = (Transform[])c;
+                }
+                int len = ta.length;
+                int i;
+                for (i = 0; i < len; i++) {
+                    Transform k = ta[i];
+                    if (k == null) {
+                        break;
+                    }
+                    if (k.equals(key)) {
+                        return k.result;
+                    }
+                }
+                if (i < len) {
+                    // just fall through to cache update
+                } else if (len < MAX_CACHE_ARRAY_SIZE) {
+                    len = Math.min(len * 2, MAX_CACHE_ARRAY_SIZE);
+                    ta = Arrays.copyOf(ta, len);
+                    lambdaForm.transformCache = ta;
+                } else {
+                    ConcurrentHashMap<Transform, Transform> m = new ConcurrentHashMap<>(MAX_CACHE_ARRAY_SIZE * 2);
+                    for (Transform k : ta) {
+                        m.put(k, k);
+                    }
+                    lambdaForm.transformCache = m;
+                    // The second iteration will update for this query, concurrently.
+                    continue;
+                }
+                ta[i] = key;
+                return form;
+            }
+        }
+    }
+
+    private LambdaFormBuffer buffer() {
+        return new LambdaFormBuffer(lambdaForm);
+    }
+
+    /// Editing methods for method handles.  These need to have fast paths.
+
+    private BoundMethodHandle.SpeciesData oldSpeciesData() {
+        return BoundMethodHandle.speciesData(lambdaForm);
+    }
+    private BoundMethodHandle.SpeciesData newSpeciesData(BasicType type) {
+        return oldSpeciesData().extendWith(type);
+    }
+
+    BoundMethodHandle bindArgumentL(BoundMethodHandle mh, int pos, Object value) {
+        assert(mh.speciesData() == oldSpeciesData());
+        BasicType bt = L_TYPE;
+        MethodType type2 = bindArgumentType(mh, pos, bt);
+        LambdaForm form2 = bindArgumentForm(1+pos);
+        return mh.copyWithExtendL(type2, form2, value);
+    }
+    BoundMethodHandle bindArgumentI(BoundMethodHandle mh, int pos, int value) {
+        assert(mh.speciesData() == oldSpeciesData());
+        BasicType bt = I_TYPE;
+        MethodType type2 = bindArgumentType(mh, pos, bt);
+        LambdaForm form2 = bindArgumentForm(1+pos);
+        return mh.copyWithExtendI(type2, form2, value);
+    }
+
+    BoundMethodHandle bindArgumentJ(BoundMethodHandle mh, int pos, long value) {
+        assert(mh.speciesData() == oldSpeciesData());
+        BasicType bt = J_TYPE;
+        MethodType type2 = bindArgumentType(mh, pos, bt);
+        LambdaForm form2 = bindArgumentForm(1+pos);
+        return mh.copyWithExtendJ(type2, form2, value);
+    }
+
+    BoundMethodHandle bindArgumentF(BoundMethodHandle mh, int pos, float value) {
+        assert(mh.speciesData() == oldSpeciesData());
+        BasicType bt = F_TYPE;
+        MethodType type2 = bindArgumentType(mh, pos, bt);
+        LambdaForm form2 = bindArgumentForm(1+pos);
+        return mh.copyWithExtendF(type2, form2, value);
+    }
+
+    BoundMethodHandle bindArgumentD(BoundMethodHandle mh, int pos, double value) {
+        assert(mh.speciesData() == oldSpeciesData());
+        BasicType bt = D_TYPE;
+        MethodType type2 = bindArgumentType(mh, pos, bt);
+        LambdaForm form2 = bindArgumentForm(1+pos);
+        return mh.copyWithExtendD(type2, form2, value);
+    }
+
+    private MethodType bindArgumentType(BoundMethodHandle mh, int pos, BasicType bt) {
+        assert(mh.form == lambdaForm);
+        assert(mh.form.names[1+pos].type == bt);
+        assert(BasicType.basicType(mh.type().parameterType(pos)) == bt);
+        return mh.type().dropParameterTypes(pos, pos+1);
+    }
+
+    /// Editing methods for lambda forms.
+    // Each editing method can (potentially) cache the edited LF so that it can be reused later.
+
+    LambdaForm bindArgumentForm(int pos) {
+        Transform key = Transform.of(Transform.Kind.BIND_ARG, pos);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.parameterConstraint(0) == newSpeciesData(lambdaForm.parameterType(pos)));
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        BoundMethodHandle.SpeciesData oldData = oldSpeciesData();
+        BoundMethodHandle.SpeciesData newData = newSpeciesData(lambdaForm.parameterType(pos));
+        Name oldBaseAddress = lambdaForm.parameter(0);  // BMH holding the values
+        Name newBaseAddress;
+        NamedFunction getter = newData.getterFunction(oldData.fieldCount());
+
+        if (pos != 0) {
+            // The newly created LF will run with a different BMH.
+            // Switch over any pre-existing BMH field references to the new BMH class.
+            buf.replaceFunctions(oldData.getterFunctions(), newData.getterFunctions(), oldBaseAddress);
+            newBaseAddress = oldBaseAddress.withConstraint(newData);
+            buf.renameParameter(0, newBaseAddress);
+            buf.replaceParameterByNewExpression(pos, new Name(getter, newBaseAddress));
+        } else {
+            // cannot bind the MH arg itself, unless oldData is empty
+            assert(oldData == BoundMethodHandle.SpeciesData.EMPTY);
+            newBaseAddress = new Name(L_TYPE).withConstraint(newData);
+            buf.replaceParameterByNewExpression(0, new Name(getter, newBaseAddress));
+            buf.insertParameter(0, newBaseAddress);
+        }
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm addArgumentForm(int pos, BasicType type) {
+        Transform key = Transform.of(Transform.Kind.ADD_ARG, pos, type.ordinal());
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity+1);
+            assert(form.parameterType(pos) == type);
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        buf.insertParameter(pos, new Name(type));
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm dupArgumentForm(int srcPos, int dstPos) {
+        Transform key = Transform.of(Transform.Kind.DUP_ARG, srcPos, dstPos);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity-1);
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        assert(lambdaForm.parameter(srcPos).constraint == null);
+        assert(lambdaForm.parameter(dstPos).constraint == null);
+        buf.replaceParameterByCopy(dstPos, srcPos);
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm spreadArgumentsForm(int pos, Class<?> arrayType, int arrayLength) {
+        Class<?> elementType = arrayType.getComponentType();
+        Class<?> erasedArrayType = arrayType;
+        if (!elementType.isPrimitive())
+            erasedArrayType = Object[].class;
+        BasicType bt = basicType(elementType);
+        int elementTypeKey = bt.ordinal();
+        if (bt.basicTypeClass() != elementType) {
+            if (elementType.isPrimitive()) {
+                elementTypeKey = TYPE_LIMIT + Wrapper.forPrimitiveType(elementType).ordinal();
+            }
+        }
+        Transform key = Transform.of(Transform.Kind.SPREAD_ARGS, pos, elementTypeKey, arrayLength);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity - arrayLength + 1);
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        assert(pos <= MethodType.MAX_JVM_ARITY);
+        assert(pos + arrayLength <= lambdaForm.arity);
+        assert(pos > 0);  // cannot spread the MH arg itself
+
+        Name spreadParam = new Name(L_TYPE);
+        Name checkSpread = new Name(MethodHandleImpl.Lazy.NF_checkSpreadArgument, spreadParam, arrayLength);
+
+        // insert the new expressions
+        int exprPos = lambdaForm.arity();
+        buf.insertExpression(exprPos++, checkSpread);
+        // adjust the arguments
+        MethodHandle aload = MethodHandles.arrayElementGetter(erasedArrayType);
+        for (int i = 0; i < arrayLength; i++) {
+            Name loadArgument = new Name(aload, spreadParam, i);
+            buf.insertExpression(exprPos + i, loadArgument);
+            buf.replaceParameterByCopy(pos + i, exprPos + i);
+        }
+        buf.insertParameter(pos, spreadParam);
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm collectArgumentsForm(int pos, MethodType collectorType) {
+        int collectorArity = collectorType.parameterCount();
+        boolean dropResult = (collectorType.returnType() == void.class);
+        if (collectorArity == 1 && !dropResult) {
+            return filterArgumentForm(pos, basicType(collectorType.parameterType(0)));
+        }
+        BasicType[] newTypes = BasicType.basicTypes(collectorType.parameterList());
+        Transform.Kind kind = (dropResult
+                ? Transform.Kind.COLLECT_ARGS_TO_VOID
+                : Transform.Kind.COLLECT_ARGS);
+        if (dropResult && collectorArity == 0)  pos = 1;  // pure side effect
+        Transform key = Transform.of(kind, pos, collectorArity, BasicType.basicTypesOrd(newTypes));
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity - (dropResult ? 0 : 1) + collectorArity);
+            return form;
+        }
+        form = makeArgumentCombinationForm(pos, collectorType, false, dropResult);
+        return putInCache(key, form);
+    }
+
+    LambdaForm collectArgumentArrayForm(int pos, MethodHandle arrayCollector) {
+        MethodType collectorType = arrayCollector.type();
+        int collectorArity = collectorType.parameterCount();
+        assert(arrayCollector.intrinsicName() == Intrinsic.NEW_ARRAY);
+        Class<?> arrayType = collectorType.returnType();
+        Class<?> elementType = arrayType.getComponentType();
+        BasicType argType = basicType(elementType);
+        int argTypeKey = argType.ordinal();
+        if (argType.basicTypeClass() != elementType) {
+            // return null if it requires more metadata (like String[].class)
+            if (!elementType.isPrimitive())
+                return null;
+            argTypeKey = TYPE_LIMIT + Wrapper.forPrimitiveType(elementType).ordinal();
+        }
+        assert(collectorType.parameterList().equals(Collections.nCopies(collectorArity, elementType)));
+        Transform.Kind kind = Transform.Kind.COLLECT_ARGS_TO_ARRAY;
+        Transform key = Transform.of(kind, pos, collectorArity, argTypeKey);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity - 1 + collectorArity);
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        assert(pos + 1 <= lambdaForm.arity);
+        assert(pos > 0);  // cannot filter the MH arg itself
+
+        Name[] newParams = new Name[collectorArity];
+        for (int i = 0; i < collectorArity; i++) {
+            newParams[i] = new Name(pos + i, argType);
+        }
+        Name callCombiner = new Name(arrayCollector, (Object[]) /*...*/ newParams);
+
+        // insert the new expression
+        int exprPos = lambdaForm.arity();
+        buf.insertExpression(exprPos, callCombiner);
+
+        // insert new arguments
+        int argPos = pos + 1;  // skip result parameter
+        for (Name newParam : newParams) {
+            buf.insertParameter(argPos++, newParam);
+        }
+        assert(buf.lastIndexOf(callCombiner) == exprPos+newParams.length);
+        buf.replaceParameterByCopy(pos, exprPos+newParams.length);
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm filterArgumentForm(int pos, BasicType newType) {
+        Transform key = Transform.of(Transform.Kind.FILTER_ARG, pos, newType.ordinal());
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity);
+            assert(form.parameterType(pos) == newType);
+            return form;
+        }
+
+        BasicType oldType = lambdaForm.parameterType(pos);
+        MethodType filterType = MethodType.methodType(oldType.basicTypeClass(),
+                newType.basicTypeClass());
+        form = makeArgumentCombinationForm(pos, filterType, false, false);
+        return putInCache(key, form);
+    }
+
+    private LambdaForm makeArgumentCombinationForm(int pos,
+                                                   MethodType combinerType,
+                                                   boolean keepArguments, boolean dropResult) {
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+        int combinerArity = combinerType.parameterCount();
+        int resultArity = (dropResult ? 0 : 1);
+
+        assert(pos <= MethodType.MAX_JVM_ARITY);
+        assert(pos + resultArity + (keepArguments ? combinerArity : 0) <= lambdaForm.arity);
+        assert(pos > 0);  // cannot filter the MH arg itself
+        assert(combinerType == combinerType.basicType());
+        assert(combinerType.returnType() != void.class || dropResult);
+
+        BoundMethodHandle.SpeciesData oldData = oldSpeciesData();
+        BoundMethodHandle.SpeciesData newData = newSpeciesData(L_TYPE);
+
+        // The newly created LF will run with a different BMH.
+        // Switch over any pre-existing BMH field references to the new BMH class.
+        Name oldBaseAddress = lambdaForm.parameter(0);  // BMH holding the values
+        buf.replaceFunctions(oldData.getterFunctions(), newData.getterFunctions(), oldBaseAddress);
+        Name newBaseAddress = oldBaseAddress.withConstraint(newData);
+        buf.renameParameter(0, newBaseAddress);
+
+        Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
+        Object[] combinerArgs = new Object[1 + combinerArity];
+        combinerArgs[0] = getCombiner;
+        Name[] newParams;
+        if (keepArguments) {
+            newParams = new Name[0];
+            System.arraycopy(lambdaForm.names, pos + resultArity,
+                             combinerArgs, 1, combinerArity);
+        } else {
+            newParams = new Name[combinerArity];
+            BasicType[] newTypes = basicTypes(combinerType.parameterList());
+            for (int i = 0; i < newTypes.length; i++) {
+                newParams[i] = new Name(pos + i, newTypes[i]);
+            }
+            System.arraycopy(newParams, 0,
+                             combinerArgs, 1, combinerArity);
+        }
+        Name callCombiner = new Name(combinerType, combinerArgs);
+
+        // insert the two new expressions
+        int exprPos = lambdaForm.arity();
+        buf.insertExpression(exprPos+0, getCombiner);
+        buf.insertExpression(exprPos+1, callCombiner);
+
+        // insert new arguments, if needed
+        int argPos = pos + resultArity;  // skip result parameter
+        for (Name newParam : newParams) {
+            buf.insertParameter(argPos++, newParam);
+        }
+        assert(buf.lastIndexOf(callCombiner) == exprPos+1+newParams.length);
+        if (!dropResult) {
+            buf.replaceParameterByCopy(pos, exprPos+1+newParams.length);
+        }
+
+        return buf.endEdit();
+    }
+
+    LambdaForm filterReturnForm(BasicType newType, boolean constantZero) {
+        Transform.Kind kind = (constantZero ? Transform.Kind.FILTER_RETURN_TO_ZERO : Transform.Kind.FILTER_RETURN);
+        Transform key = Transform.of(kind, newType.ordinal());
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity);
+            assert(form.returnType() == newType);
+            return form;
+        }
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        int insPos = lambdaForm.names.length;
+        Name callFilter;
+        if (constantZero) {
+            // Synthesize a constant zero value for the given type.
+            if (newType == V_TYPE)
+                callFilter = null;
+            else
+                callFilter = new Name(constantZero(newType));
+        } else {
+            BoundMethodHandle.SpeciesData oldData = oldSpeciesData();
+            BoundMethodHandle.SpeciesData newData = newSpeciesData(L_TYPE);
+
+            // The newly created LF will run with a different BMH.
+            // Switch over any pre-existing BMH field references to the new BMH class.
+            Name oldBaseAddress = lambdaForm.parameter(0);  // BMH holding the values
+            buf.replaceFunctions(oldData.getterFunctions(), newData.getterFunctions(), oldBaseAddress);
+            Name newBaseAddress = oldBaseAddress.withConstraint(newData);
+            buf.renameParameter(0, newBaseAddress);
+
+            Name getFilter = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
+            buf.insertExpression(insPos++, getFilter);
+            BasicType oldType = lambdaForm.returnType();
+            if (oldType == V_TYPE) {
+                MethodType filterType = MethodType.methodType(newType.basicTypeClass());
+                callFilter = new Name(filterType, getFilter);
+            } else {
+                MethodType filterType = MethodType.methodType(newType.basicTypeClass(), oldType.basicTypeClass());
+                callFilter = new Name(filterType, getFilter, lambdaForm.names[lambdaForm.result]);
+            }
+        }
+
+        if (callFilter != null)
+            buf.insertExpression(insPos++, callFilter);
+        buf.setResult(callFilter);
+
+        form = buf.endEdit();
+        return putInCache(key, form);
+    }
+
+    LambdaForm foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType) {
+        int combinerArity = combinerType.parameterCount();
+        Transform.Kind kind = (dropResult ? Transform.Kind.FOLD_ARGS_TO_VOID : Transform.Kind.FOLD_ARGS);
+        Transform key = Transform.of(kind, foldPos, combinerArity);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity - (kind == Transform.Kind.FOLD_ARGS ? 1 : 0));
+            return form;
+        }
+        form = makeArgumentCombinationForm(foldPos, combinerType, true, dropResult);
+        return putInCache(key, form);
+    }
+
+    LambdaForm permuteArgumentsForm(int skip, int[] reorder) {
+        assert(skip == 1);  // skip only the leading MH argument, names[0]
+        int length = lambdaForm.names.length;
+        int outArgs = reorder.length;
+        int inTypes = 0;
+        boolean nullPerm = true;
+        for (int i = 0; i < reorder.length; i++) {
+            int inArg = reorder[i];
+            if (inArg != i)  nullPerm = false;
+            inTypes = Math.max(inTypes, inArg+1);
+        }
+        assert(skip + reorder.length == lambdaForm.arity);
+        if (nullPerm)  return lambdaForm;  // do not bother to cache
+        Transform key = Transform.of(Transform.Kind.PERMUTE_ARGS, reorder);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == skip+inTypes) : form;
+            return form;
+        }
+
+        BasicType[] types = new BasicType[inTypes];
+        for (int i = 0; i < outArgs; i++) {
+            int inArg = reorder[i];
+            types[inArg] = lambdaForm.names[skip + i].type;
+        }
+        assert (skip + outArgs == lambdaForm.arity);
+        assert (permutedTypesMatch(reorder, types, lambdaForm.names, skip));
+        int pos = 0;
+        while (pos < outArgs && reorder[pos] == pos) {
+            pos += 1;
+        }
+        Name[] names2 = new Name[length - outArgs + inTypes];
+        System.arraycopy(lambdaForm.names, 0, names2, 0, skip + pos);
+        int bodyLength = length - lambdaForm.arity;
+        System.arraycopy(lambdaForm.names, skip + outArgs, names2, skip + inTypes, bodyLength);
+        int arity2 = names2.length - bodyLength;
+        int result2 = lambdaForm.result;
+        if (result2 >= 0) {
+            if (result2 < skip + outArgs) {
+                result2 = reorder[result2 - skip];
+            } else {
+                result2 = result2 - outArgs + inTypes;
+            }
+        }
+        for (int j = pos; j < outArgs; j++) {
+            Name n = lambdaForm.names[skip + j];
+            int i = reorder[j];
+            Name n2 = names2[skip + i];
+            if (n2 == null) {
+                names2[skip + i] = n2 = new Name(types[i]);
+            } else {
+                assert (n2.type == types[i]);
+            }
+            for (int k = arity2; k < names2.length; k++) {
+                names2[k] = names2[k].replaceName(n, n2);
+            }
+        }
+        for (int i = skip + pos; i < arity2; i++) {
+            if (names2[i] == null) {
+                names2[i] = argument(i, types[i - skip]);
+            }
+        }
+        for (int j = lambdaForm.arity; j < lambdaForm.names.length; j++) {
+            int i = j - lambdaForm.arity + arity2;
+            Name n = lambdaForm.names[j];
+            Name n2 = names2[i];
+            if (n != n2) {
+                for (int k = i + 1; k < names2.length; k++) {
+                    names2[k] = names2[k].replaceName(n, n2);
+                }
+            }
+        }
+
+        form = new LambdaForm(lambdaForm.debugName, arity2, names2, result2);
+        return putInCache(key, form);
+    }
+
+    static boolean permutedTypesMatch(int[] reorder, BasicType[] types, Name[] names, int skip) {
+        for (int i = 0; i < reorder.length; i++) {
+            assert (names[skip + i].isParam());
+            assert (names[skip + i].type == types[reorder[i]]);
+        }
+        return true;
+    }
+}
diff --git a/src/share/classes/java/lang/invoke/MemberName.java b/src/share/classes/java/lang/invoke/MemberName.java
index 9cc901e..cd169f3 100644
--- a/src/share/classes/java/lang/invoke/MemberName.java
+++ b/src/share/classes/java/lang/invoke/MemberName.java
@@ -327,10 +327,6 @@
         assert(getReferenceKind() == oldKind);
         assert(MethodHandleNatives.refKindIsValid(refKind));
         flags += (((int)refKind - oldKind) << MN_REFERENCE_KIND_SHIFT);
-//        if (isConstructor() && refKind != REF_newInvokeSpecial)
-//            flags += (IS_METHOD - IS_CONSTRUCTOR);
-//        else if (refKind == REF_newInvokeSpecial && isMethod())
-//            flags += (IS_CONSTRUCTOR - IS_METHOD);
         return this;
     }
 
@@ -344,9 +340,11 @@
         return !testFlags(mask, 0);
     }
 
-    /** Utility method to query if this member is a method handle invocation (invoke or invokeExact). */
+    /** Utility method to query if this member is a method handle invocation (invoke or invokeExact).
+     *  Also returns true for the non-public MH.invokeBasic.
+     */
     public boolean isMethodHandleInvoke() {
-        final int bits = MH_INVOKE_MODS;
+        final int bits = MH_INVOKE_MODS &~ Modifier.PUBLIC;
         final int negs = Modifier.STATIC;
         if (testFlags(bits | negs, bits) &&
             clazz == MethodHandle.class) {
@@ -355,7 +353,14 @@
         return false;
     }
     public static boolean isMethodHandleInvokeName(String name) {
-        return name.equals("invoke") || name.equals("invokeExact");
+        switch (name) {
+        case "invoke":
+        case "invokeExact":
+        case "invokeBasic":  // internal sig-poly method
+            return true;
+        default:
+            return false;
+        }
     }
     private static final int MH_INVOKE_MODS = Modifier.NATIVE | Modifier.FINAL | Modifier.PUBLIC;
 
@@ -720,16 +725,8 @@
         init(defClass, name, type, flagsMods(IS_FIELD, 0, refKind));
         initResolved(false);
     }
-    /** Create a field or type name from the given components:  Declaring class, name, type.
-     *  The declaring class may be supplied as null if this is to be a bare name and type.
-     *  The modifier flags default to zero.
-     *  The resulting name will in an unresolved state.
-     */
-    public MemberName(Class<?> defClass, String name, Class<?> type, Void unused) {
-        this(defClass, name, type, REF_NONE);
-        initResolved(false);
-    }
-    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
+    /** Create a method or constructor name from the given components:
+     *  Declaring class, name, type, reference kind.
      *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
      *  The declaring class may be supplied as null if this is to be a bare name and type.
      *  The last argument is optional, a boolean which requests REF_invokeSpecial.
diff --git a/src/share/classes/java/lang/invoke/MethodHandle.java b/src/share/classes/java/lang/invoke/MethodHandle.java
index ce115df..f0169e7 100644
--- a/src/share/classes/java/lang/invoke/MethodHandle.java
+++ b/src/share/classes/java/lang/invoke/MethodHandle.java
@@ -27,12 +27,8 @@
 
 
 import java.util.*;
-import sun.invoke.util.*;
-import sun.misc.Unsafe;
 
 import static java.lang.invoke.MethodHandleStatics.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * A method handle is a typed, directly executable reference to an underlying method,
@@ -625,15 +621,8 @@
      * @see MethodHandles#spreadInvoker
      */
     public Object invokeWithArguments(Object... arguments) throws Throwable {
-        int argc = arguments == null ? 0 : arguments.length;
-        @SuppressWarnings("LocalVariableHidesMemberVariable")
-        MethodType type = type();
-        if (type.parameterCount() != argc || isVarargsCollector()) {
-            // simulate invoke
-            return asType(MethodType.genericMethodType(argc)).invokeWithArguments(arguments);
-        }
-        MethodHandle invoker = type.invokers().varargsInvoker();
-        return invoker.invokeExact(this, arguments);
+        MethodType invocationType = MethodType.genericMethodType(arguments == null ? 0 : arguments.length);
+        return invocationType.invokers().spreadInvoker(0).invokeExact(asType(invocationType), arguments);
     }
 
     /**
@@ -731,7 +720,7 @@
      * <li>If the return type <em>T0</em> is void and <em>T1</em> a primitive,
      *     a zero value is introduced.
      * </ul>
-    * (<em>Note:</em> Both <em>T0</em> and <em>T1</em> may be regarded as static types,
+     * (<em>Note:</em> Both <em>T0</em> and <em>T1</em> may be regarded as static types,
      * because neither corresponds specifically to the <em>dynamic type</em> of any
      * actual argument or return value.)
      * <p>
@@ -763,18 +752,26 @@
             return this;
         }
         // Return 'this.asTypeCache' if the conversion is already memoized.
+        MethodHandle atc = asTypeCached(newType);
+        if (atc != null) {
+            return atc;
+        }
+        return asTypeUncached(newType);
+    }
+
+    private MethodHandle asTypeCached(MethodType newType) {
         MethodHandle atc = asTypeCache;
         if (atc != null && newType == atc.type) {
             return atc;
         }
-        return asTypeUncached(newType);
+        return null;
     }
 
     /** Override this to change asType behavior. */
     /*non-public*/ MethodHandle asTypeUncached(MethodType newType) {
         if (!type.isConvertibleTo(newType))
             throw new WrongMethodTypeException("cannot convert "+this+" to "+newType);
-        return asTypeCache = convertArguments(newType);
+        return asTypeCache = MethodHandleImpl.makePairwiseConvert(this, newType, true);
     }
 
     /**
@@ -867,34 +864,48 @@
      * @see #asCollector
      */
     public MethodHandle asSpreader(Class<?> arrayType, int arrayLength) {
-        asSpreaderChecks(arrayType, arrayLength);
-        int spreadArgPos = type.parameterCount() - arrayLength;
-        return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength);
+        MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength);
+        int arity = type().parameterCount();
+        int spreadArgPos = arity - arrayLength;
+        if (USE_LAMBDA_FORM_EDITOR) {
+            MethodHandle afterSpread = this.asType(postSpreadType);
+            BoundMethodHandle mh = afterSpread.rebind();
+            LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength);
+            MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType);
+            return mh.copyWith(preSpreadType, lform);
+        } else {
+            return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength);
+        }
     }
 
-    private void asSpreaderChecks(Class<?> arrayType, int arrayLength) {
+    /**
+     * See if {@code asSpreader} can be validly called with the given arguments.
+     * Return the type of the method handle call after spreading but before conversions.
+     */
+    private MethodType asSpreaderChecks(Class<?> arrayType, int arrayLength) {
         spreadArrayChecks(arrayType, arrayLength);
         int nargs = type().parameterCount();
         if (nargs < arrayLength || arrayLength < 0)
             throw newIllegalArgumentException("bad spread array length");
-        if (arrayType != Object[].class && arrayLength != 0) {
-            boolean sawProblem = false;
-            Class<?> arrayElement = arrayType.getComponentType();
-            for (int i = nargs - arrayLength; i < nargs; i++) {
-                if (!MethodType.canConvert(arrayElement, type().parameterType(i))) {
-                    sawProblem = true;
+        Class<?> arrayElement = arrayType.getComponentType();
+        MethodType mtype = type();
+        boolean match = true, fail = false;
+        for (int i = nargs - arrayLength; i < nargs; i++) {
+            Class<?> ptype = mtype.parameterType(i);
+            if (ptype != arrayElement) {
+                match = false;
+                if (!MethodType.canConvert(arrayElement, ptype)) {
+                    fail = true;
                     break;
                 }
             }
-            if (sawProblem) {
-                ArrayList<Class<?>> ptypes = new ArrayList<>(type().parameterList());
-                for (int i = nargs - arrayLength; i < nargs; i++) {
-                    ptypes.set(i, arrayElement);
-                }
-                // elicit an error:
-                this.asType(MethodType.methodType(type().returnType(), ptypes));
-            }
         }
+        if (match)  return mtype;
+        MethodType needType = mtype.asSpreaderType(arrayType, arrayLength);
+        if (!fail)  return needType;
+        // elicit an error:
+        this.asType(needType);
+        throw newInternalError("should not return", null);
     }
 
     private void spreadArrayChecks(Class<?> arrayType, int arrayLength) {
@@ -984,16 +995,31 @@
      */
     public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
         asCollectorChecks(arrayType, arrayLength);
-        int collectArgPos = type().parameterCount()-1;
-        MethodHandle target = this;
-        if (arrayType != type().parameterType(collectArgPos))
-            target = convertArguments(type().changeParameterType(collectArgPos, arrayType));
-        MethodHandle collector = ValueConversions.varargsArray(arrayType, arrayLength);
-        return MethodHandles.collectArguments(target, collectArgPos, collector);
+        int collectArgPos = type().parameterCount() - 1;
+        if (USE_LAMBDA_FORM_EDITOR) {
+            BoundMethodHandle mh = rebind();
+            MethodType resultType = type().asCollectorType(arrayType, arrayLength);
+            MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
+            LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray);
+            if (lform != null) {
+                return mh.copyWith(resultType, lform);
+            }
+            lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType());
+            return mh.copyWithExtendL(resultType, lform, newArray);
+        } else {
+            MethodHandle target = this;
+            if (arrayType != type().parameterType(collectArgPos))
+                target = MethodHandleImpl.makePairwiseConvert(this, type().changeParameterType(collectArgPos, arrayType), true);
+            MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength);
+            return MethodHandles.collectArguments(target, collectArgPos, collector);
+        }
     }
 
-    // private API: return true if last param exactly matches arrayType
-    private boolean asCollectorChecks(Class<?> arrayType, int arrayLength) {
+    /**
+     * See if {@code asCollector} can be validly called with the given arguments.
+     * Return false if the last parameter is not an exact match to arrayType.
+     */
+    /*non-public*/ boolean asCollectorChecks(Class<?> arrayType, int arrayLength) {
         spreadArrayChecks(arrayType, arrayLength);
         int nargs = type().parameterCount();
         if (nargs != 0) {
@@ -1155,7 +1181,7 @@
      * @see #asFixedArity
      */
     public MethodHandle asVarargsCollector(Class<?> arrayType) {
-        Class<?> arrayElement = arrayType.getComponentType();
+        arrayType.getClass(); // explicit NPE
         boolean lastMatch = asCollectorChecks(arrayType, 0);
         if (isVarargsCollector() && lastMatch)
             return this;
@@ -1257,14 +1283,8 @@
      * @see MethodHandles#insertArguments
      */
     public MethodHandle bindTo(Object x) {
-        Class<?> ptype;
-        @SuppressWarnings("LocalVariableHidesMemberVariable")
-        MethodType type = type();
-        if (type.parameterCount() == 0 ||
-            (ptype = type.parameterType(0)).isPrimitive())
-            throw newIllegalArgumentException("no leading reference parameter", x);
-        x = ptype.cast(x);  // throw CCE if needed
-        return bindReceiver(x);
+        x = type.leadingReferenceParameter().cast(x);  // throw CCE if needed
+        return bindArgumentL(0, x);
     }
 
     /**
@@ -1284,14 +1304,17 @@
      */
     @Override
     public String toString() {
-        if (DEBUG_METHOD_HANDLE_NAMES)  return debugString();
+        if (DEBUG_METHOD_HANDLE_NAMES)  return "MethodHandle"+debugString();
         return standardString();
     }
     String standardString() {
         return "MethodHandle"+type;
     }
+    /** Return a string with a several lines describing the method handle structure.
+     *  This string would be suitable for display in an IDE debugger.
+     */
     String debugString() {
-        return standardString()+"/LF="+internalForm()+internalProperties();
+        return type+" : "+internalForm()+internalProperties();
     }
 
     //// Implementation methods.
@@ -1300,22 +1323,42 @@
 
     // Other transforms to do:  convert, explicitCast, permute, drop, filter, fold, GWT, catch
 
+    BoundMethodHandle bindArgumentL(int pos, Object value) {
+        return rebind().bindArgumentL(pos, value);
+    }
+
     /*non-public*/
     MethodHandle setVarargs(MemberName member) throws IllegalAccessException {
         if (!member.isVarargs())  return this;
-        int argc = type().parameterCount();
-        if (argc != 0) {
-            Class<?> arrayType = type().parameterType(argc-1);
-            if (arrayType.isArray()) {
-                return MethodHandleImpl.makeVarargsCollector(this, arrayType);
-            }
+        Class<?> arrayType = type().lastParameterType();
+        if (arrayType.isArray()) {
+            return MethodHandleImpl.makeVarargsCollector(this, arrayType);
         }
         throw member.makeAccessException("cannot make variable arity", null);
     }
+
     /*non-public*/
-    MethodHandle viewAsType(MethodType newType) {
+    MethodHandle viewAsType(MethodType newType, boolean strict) {
         // No actual conversions, just a new view of the same method.
-        return MethodHandleImpl.makePairwiseConvert(this, newType, 0);
+        // Note that this operation must not produce a DirectMethodHandle,
+        // because retyped DMHs, like any transformed MHs,
+        // cannot be cracked into MethodHandleInfo.
+        assert viewAsTypeChecks(newType, strict);
+        BoundMethodHandle mh = rebind();
+        assert(!((MethodHandle)mh instanceof DirectMethodHandle));
+        return mh.copyWith(newType, mh.form);
+    }
+
+    /*non-public*/
+    boolean viewAsTypeChecks(MethodType newType, boolean strict) {
+        if (strict) {
+            assert(type().isViewableAs(newType, true))
+                : Arrays.asList(this, newType);
+        } else {
+            assert(type().basicType().isViewableAs(newType.basicType(), true))
+                : Arrays.asList(this, newType);
+        }
+        return true;
     }
 
     // Decoding
@@ -1336,9 +1379,15 @@
     }
 
     /*non-public*/
-    MethodHandle withInternalMemberName(MemberName member) {
+    MethodHandleImpl.Intrinsic intrinsicName() {
+        // no special intrinsic meaning to most MHs
+        return MethodHandleImpl.Intrinsic.NONE;
+    }
+
+    /*non-public*/
+    MethodHandle withInternalMemberName(MemberName member, boolean isInvokeSpecial) {
         if (member != null) {
-            return MethodHandleImpl.makeWrappedMember(this, member);
+            return MethodHandleImpl.makeWrappedMember(this, member, isInvokeSpecial);
         } else if (internalMemberName() == null) {
             // The required internaMemberName is null, and this MH (like most) doesn't have one.
             return this;
@@ -1362,7 +1411,7 @@
 
     /*non-public*/
     Object internalProperties() {
-        // Override to something like "/FOO=bar"
+        // Override to something to follow this.form, like "\n& FOO=bar"
         return "";
     }
 
@@ -1370,114 +1419,14 @@
     //// Sub-classes can override these default implementations.
     //// All these methods assume arguments are already validated.
 
-    /*non-public*/ MethodHandle convertArguments(MethodType newType) {
-        // Override this if it can be improved.
-        return MethodHandleImpl.makePairwiseConvert(this, newType, 1);
-    }
-
     /*non-public*/
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
-        // Override this if it can be improved.
-        return rebind().bindArgument(pos, basicType, value);
-    }
+    abstract MethodHandle copyWith(MethodType mt, LambdaForm lf);
 
-    /*non-public*/
-    MethodHandle bindReceiver(Object receiver) {
-        // Override this if it can be improved.
-        return bindArgument(0, 'L', receiver);
-    }
-
-    /*non-public*/
-    MethodHandle bindImmediate(int pos, char basicType, Object value) {
-        // Bind an immediate value to a position in the arguments.
-        // This means, elide the respective argument,
-        // and replace all references to it in NamedFunction args with the specified value.
-
-        // CURRENT RESTRICTIONS
-        // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others)
-        assert pos == 0 && basicType == 'L' && value instanceof Unsafe;
-        MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver!
-        LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos
-        return copyWith(type2, form2);
-    }
-
-    /*non-public*/
-    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
-        throw new InternalError("copyWith: " + this.getClass());
-    }
-
-    /*non-public*/
-    MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
-        // Override this if it can be improved.
-        return rebind().dropArguments(srcType, pos, drops);
-    }
-
-    /*non-public*/
-    MethodHandle permuteArguments(MethodType newType, int[] reorder) {
-        // Override this if it can be improved.
-        return rebind().permuteArguments(newType, reorder);
-    }
-
-    /*non-public*/
-    MethodHandle rebind() {
-        // Bind 'this' into a new invoker, of the known class BMH.
-        MethodType type2 = type();
-        LambdaForm form2 = reinvokerForm(this);
-        // form2 = lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }
-        return BoundMethodHandle.bindSingle(type2, form2, this);
-    }
-
-    /*non-public*/
-    MethodHandle reinvokerTarget() {
-        throw new InternalError("not a reinvoker MH: "+this.getClass().getName()+": "+this);
-    }
-
-    /** Create a LF which simply reinvokes a target of the given basic type.
-     *  The target MH must override {@link #reinvokerTarget} to provide the target.
+    /** Require this method handle to be a BMH, or else replace it with a "wrapper" BMH.
+     *  Many transforms are implemented only for BMHs.
+     *  @return a behaviorally equivalent BMH
      */
-    static LambdaForm reinvokerForm(MethodHandle target) {
-        MethodType mtype = target.type().basicType();
-        LambdaForm reinvoker = mtype.form().cachedLambdaForm(MethodTypeForm.LF_REINVOKE);
-        if (reinvoker != null)  return reinvoker;
-        if (mtype.parameterSlotCount() >= MethodType.MAX_MH_ARITY)
-            return makeReinvokerForm(target.type(), target);  // cannot cache this
-        reinvoker = makeReinvokerForm(mtype, null);
-        return mtype.form().setCachedLambdaForm(MethodTypeForm.LF_REINVOKE, reinvoker);
-    }
-    private static LambdaForm makeReinvokerForm(MethodType mtype, MethodHandle customTargetOrNull) {
-        boolean customized = (customTargetOrNull != null);
-        MethodHandle MH_invokeBasic = customized ? null : MethodHandles.basicInvoker(mtype);
-        final int THIS_BMH    = 0;
-        final int ARG_BASE    = 1;
-        final int ARG_LIMIT   = ARG_BASE + mtype.parameterCount();
-        int nameCursor = ARG_LIMIT;
-        final int NEXT_MH     = customized ? -1 : nameCursor++;
-        final int REINVOKE    = nameCursor++;
-        LambdaForm.Name[] names = LambdaForm.arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
-        Object[] targetArgs;
-        MethodHandle targetMH;
-        if (customized) {
-            targetArgs = Arrays.copyOfRange(names, ARG_BASE, ARG_LIMIT, Object[].class);
-            targetMH = customTargetOrNull;
-        } else {
-            names[NEXT_MH] = new LambdaForm.Name(NF_reinvokerTarget, names[THIS_BMH]);
-            targetArgs = Arrays.copyOfRange(names, THIS_BMH, ARG_LIMIT, Object[].class);
-            targetArgs[0] = names[NEXT_MH];  // overwrite this MH with next MH
-            targetMH = MethodHandles.basicInvoker(mtype);
-        }
-        names[REINVOKE] = new LambdaForm.Name(targetMH, targetArgs);
-        return new LambdaForm("BMH.reinvoke", ARG_LIMIT, names);
-    }
-
-    private static final LambdaForm.NamedFunction NF_reinvokerTarget;
-    static {
-        try {
-            NF_reinvokerTarget = new LambdaForm.NamedFunction(MethodHandle.class
-                .getDeclaredMethod("reinvokerTarget"));
-        } catch (ReflectiveOperationException ex) {
-            throw newInternalError(ex);
-        }
-    }
+    abstract BoundMethodHandle rebind();
 
     /**
      * Replace the old lambda form of this method handle with a new one.
@@ -1489,6 +1438,7 @@
     /*non-public*/
     void updateForm(LambdaForm newForm) {
         if (form == newForm)  return;
+        assert(this instanceof DirectMethodHandle && this.internalMemberName().isStatic());
         // ISSUE: Should we have a memory fence here?
         UNSAFE.putObject(this, FORM_OFFSET, newForm);
         this.form.prepare();  // as in MethodHandle.<init>
diff --git a/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/share/classes/java/lang/invoke/MethodHandleImpl.java
index ee1584f..3cab706 100644
--- a/src/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/src/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -27,8 +27,10 @@
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.Collections;
+
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyType;
@@ -44,6 +46,20 @@
  * @author jrose
  */
 /*non-public*/ abstract class MethodHandleImpl {
+    // Do not adjust this except for special platforms:
+    private static final int MAX_ARITY;
+    static {
+        final Object[] values = { 255 };
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                values[0] = Integer.getInteger(MethodHandleImpl.class.getName()+".MAX_ARITY", 255);
+                return null;
+            }
+        });
+        MAX_ARITY = (Integer) values[0];
+    }
+
     /// Factory methods to create method handles:
 
     static void initStatics() {
@@ -52,27 +68,55 @@
     }
 
     static MethodHandle makeArrayElementAccessor(Class<?> arrayClass, boolean isSetter) {
+        if (arrayClass == Object[].class)
+            return (isSetter ? ArrayAccessor.OBJECT_ARRAY_SETTER : ArrayAccessor.OBJECT_ARRAY_GETTER);
         if (!arrayClass.isArray())
             throw newIllegalArgumentException("not an array: "+arrayClass);
-        MethodHandle accessor = ArrayAccessor.getAccessor(arrayClass, isSetter);
-        MethodType srcType = accessor.type().erase();
-        MethodType lambdaType = srcType.invokerType();
-        Name[] names = arguments(1, lambdaType);
-        Name[] args  = Arrays.copyOfRange(names, 1, 1 + srcType.parameterCount());
-        names[names.length - 1] = new Name(accessor.asType(srcType), (Object[]) args);
-        LambdaForm form = new LambdaForm("getElement", lambdaType.parameterCount(), names);
-        MethodHandle mh = SimpleMethodHandle.make(srcType, form);
-        if (ArrayAccessor.needCast(arrayClass)) {
-            mh = mh.bindTo(arrayClass);
+        MethodHandle[] cache = ArrayAccessor.TYPED_ACCESSORS.get(arrayClass);
+        int cacheIndex = (isSetter ? ArrayAccessor.SETTER_INDEX : ArrayAccessor.GETTER_INDEX);
+        MethodHandle mh = cache[cacheIndex];
+        if (mh != null)  return mh;
+        mh = ArrayAccessor.getAccessor(arrayClass, isSetter);
+        MethodType correctType = ArrayAccessor.correctType(arrayClass, isSetter);
+        if (mh.type() != correctType) {
+            assert(mh.type().parameterType(0) == Object[].class);
+            assert((isSetter ? mh.type().parameterType(2) : mh.type().returnType()) == Object.class);
+            assert(isSetter || correctType.parameterType(0).getComponentType() == correctType.returnType());
+            // safe to view non-strictly, because element type follows from array type
+            mh = mh.viewAsType(correctType, false);
         }
-        mh = mh.asType(ArrayAccessor.correctType(arrayClass, isSetter));
+        mh = makeIntrinsic(mh, (isSetter ? Intrinsic.ARRAY_STORE : Intrinsic.ARRAY_LOAD));
+        // Atomically update accessor cache.
+        synchronized(cache) {
+            if (cache[cacheIndex] == null) {
+                cache[cacheIndex] = mh;
+            } else {
+                // Throw away newly constructed accessor and use cached version.
+                mh = cache[cacheIndex];
+            }
+        }
         return mh;
     }
 
     static final class ArrayAccessor {
         /// Support for array element access
-        static final HashMap<Class<?>, MethodHandle> GETTER_CACHE = new HashMap<>();  // TODO use it
-        static final HashMap<Class<?>, MethodHandle> SETTER_CACHE = new HashMap<>();  // TODO use it
+        static final int GETTER_INDEX = 0, SETTER_INDEX = 1, INDEX_LIMIT = 2;
+        static final ClassValue<MethodHandle[]> TYPED_ACCESSORS
+                = new ClassValue<MethodHandle[]>() {
+                    @Override
+                    protected MethodHandle[] computeValue(Class<?> type) {
+                        return new MethodHandle[INDEX_LIMIT];
+                    }
+                };
+        static final MethodHandle OBJECT_ARRAY_GETTER, OBJECT_ARRAY_SETTER;
+        static {
+            MethodHandle[] cache = TYPED_ACCESSORS.get(Object[].class);
+            cache[GETTER_INDEX] = OBJECT_ARRAY_GETTER = makeIntrinsic(getAccessor(Object[].class, false), Intrinsic.ARRAY_LOAD);
+            cache[SETTER_INDEX] = OBJECT_ARRAY_SETTER = makeIntrinsic(getAccessor(Object[].class, true),  Intrinsic.ARRAY_STORE);
+
+            assert(InvokerBytecodeGenerator.isStaticallyInvocable(ArrayAccessor.OBJECT_ARRAY_GETTER.internalMemberName()));
+            assert(InvokerBytecodeGenerator.isStaticallyInvocable(ArrayAccessor.OBJECT_ARRAY_SETTER.internalMemberName()));
+        }
 
         static int     getElementI(int[]     a, int i)            { return              a[i]; }
         static long    getElementJ(long[]    a, int i)            { return              a[i]; }
@@ -94,45 +138,21 @@
         static void    setElementC(char[]    a, int i, char    x) {              a[i] = x; }
         static void    setElementL(Object[]  a, int i, Object  x) {              a[i] = x; }
 
-        static Object  getElementL(Class<?> arrayClass, Object[] a, int i)           { arrayClass.cast(a); return a[i]; }
-        static void    setElementL(Class<?> arrayClass, Object[] a, int i, Object x) { arrayClass.cast(a); a[i] = x; }
-
-        // Weakly typed wrappers of Object[] accessors:
-        static Object  getElementL(Object    a, int i)            { return getElementL((Object[])a, i); }
-        static void    setElementL(Object    a, int i, Object  x) {        setElementL((Object[]) a, i, x); }
-        static Object  getElementL(Object   arrayClass, Object a, int i)             { return getElementL((Class<?>) arrayClass, (Object[])a, i); }
-        static void    setElementL(Object   arrayClass, Object a, int i, Object x)   {        setElementL((Class<?>) arrayClass, (Object[])a, i, x); }
-
-        static boolean needCast(Class<?> arrayClass) {
-            Class<?> elemClass = arrayClass.getComponentType();
-            return !elemClass.isPrimitive() && elemClass != Object.class;
-        }
         static String name(Class<?> arrayClass, boolean isSetter) {
             Class<?> elemClass = arrayClass.getComponentType();
-            if (elemClass == null)  throw new IllegalArgumentException();
+            if (elemClass == null)  throw newIllegalArgumentException("not an array", arrayClass);
             return (!isSetter ? "getElement" : "setElement") + Wrapper.basicTypeChar(elemClass);
         }
-        static final boolean USE_WEAKLY_TYPED_ARRAY_ACCESSORS = false;  // FIXME: decide
         static MethodType type(Class<?> arrayClass, boolean isSetter) {
             Class<?> elemClass = arrayClass.getComponentType();
             Class<?> arrayArgClass = arrayClass;
             if (!elemClass.isPrimitive()) {
                 arrayArgClass = Object[].class;
-                if (USE_WEAKLY_TYPED_ARRAY_ACCESSORS)
-                    arrayArgClass = Object.class;
+                elemClass = Object.class;
             }
-            if (!needCast(arrayClass)) {
-                return !isSetter ?
+            return !isSetter ?
                     MethodType.methodType(elemClass,  arrayArgClass, int.class) :
                     MethodType.methodType(void.class, arrayArgClass, int.class, elemClass);
-            } else {
-                Class<?> classArgClass = Class.class;
-                if (USE_WEAKLY_TYPED_ARRAY_ACCESSORS)
-                    classArgClass = Object.class;
-                return !isSetter ?
-                    MethodType.methodType(Object.class, classArgClass, arrayArgClass, int.class) :
-                    MethodType.methodType(void.class,   classArgClass, arrayArgClass, int.class, Object.class);
-            }
         }
         static MethodType correctType(Class<?> arrayClass, boolean isSetter) {
             Class<?> elemClass = arrayClass.getComponentType();
@@ -159,40 +179,110 @@
      * integral widening or narrowing, and floating point widening or narrowing.
      * @param srcType required call type
      * @param target original method handle
-     * @param level which strength of conversion is allowed
+     * @param strict if true, only asType conversions are allowed; if false, explicitCastArguments conversions allowed
+     * @param monobox if true, unboxing conversions are assumed to be exactly typed (Integer to int only, not long or double)
      * @return an adapter to the original handle with the desired new type,
      *          or the original target if the types are already identical
      *          or null if the adaptation cannot be made
      */
-    static MethodHandle makePairwiseConvert(MethodHandle target, MethodType srcType, int level) {
-        assert(level >= 0 && level <= 2);
+    static MethodHandle makePairwiseConvert(MethodHandle target, MethodType srcType,
+                                            boolean strict, boolean monobox) {
         MethodType dstType = target.type();
-        assert(dstType.parameterCount() == target.type().parameterCount());
         if (srcType == dstType)
             return target;
+        if (USE_LAMBDA_FORM_EDITOR) {
+            return makePairwiseConvertByEditor(target, srcType, strict, monobox);
+        } else {
+            return makePairwiseConvertIndirect(target, srcType, strict, monobox);
+        }
+    }
 
-        // Calculate extra arguments (temporaries) required in the names array.
-        // FIXME: Use an ArrayList<Name>.  Some arguments require more than one conversion step.
-        final int INARG_COUNT = srcType.parameterCount();
-        int conversions = 0;
-        boolean[] needConv = new boolean[1+INARG_COUNT];
-        for (int i = 0; i <= INARG_COUNT; i++) {
-            Class<?> src = (i == INARG_COUNT) ? dstType.returnType() : srcType.parameterType(i);
-            Class<?> dst = (i == INARG_COUNT) ? srcType.returnType() : dstType.parameterType(i);
-            if (!VerifyType.isNullConversion(src, dst) ||
-                level <= 1 && dst.isInterface() && !dst.isAssignableFrom(src)) {
-                needConv[i] = true;
-                conversions++;
+    private static int countNonNull(Object[] array) {
+        int count = 0;
+        for (Object x : array) {
+            if (x != null)  ++count;
+        }
+        return count;
+    }
+
+    static MethodHandle makePairwiseConvertByEditor(MethodHandle target, MethodType srcType,
+                                                    boolean strict, boolean monobox) {
+        Object[] convSpecs = computeValueConversions(srcType, target.type(), strict, monobox);
+        int convCount = countNonNull(convSpecs);
+        if (convCount == 0)
+            return target.viewAsType(srcType, strict);
+        MethodType basicSrcType = srcType.basicType();
+        MethodType midType = target.type().basicType();
+        BoundMethodHandle mh = target.rebind();
+        // FIXME: Reduce number of bindings when there is more than one Class conversion.
+        // FIXME: Reduce number of bindings when there are repeated conversions.
+        for (int i = 0; i < convSpecs.length-1; i++) {
+            Object convSpec = convSpecs[i];
+            if (convSpec == null)  continue;
+            MethodHandle fn;
+            if (convSpec instanceof Class) {
+                fn = Lazy.MH_castReference.bindTo(convSpec);
+            } else {
+                fn = (MethodHandle) convSpec;
+            }
+            Class<?> newType = basicSrcType.parameterType(i);
+            if (--convCount == 0)
+                midType = srcType;
+            else
+                midType = midType.changeParameterType(i, newType);
+            LambdaForm form2 = mh.editor().filterArgumentForm(1+i, BasicType.basicType(newType));
+            mh = mh.copyWithExtendL(midType, form2, fn);
+            mh = mh.rebind();
+        }
+        Object convSpec = convSpecs[convSpecs.length-1];
+        if (convSpec != null) {
+            MethodHandle fn;
+            if (convSpec instanceof Class) {
+                if (convSpec == void.class)
+                    fn = null;
+                else
+                    fn = Lazy.MH_castReference.bindTo(convSpec);
+            } else {
+                fn = (MethodHandle) convSpec;
+            }
+            Class<?> newType = basicSrcType.returnType();
+            assert(--convCount == 0);
+            midType = srcType;
+            if (fn != null) {
+                mh = mh.rebind();  // rebind if too complex
+                LambdaForm form2 = mh.editor().filterReturnForm(BasicType.basicType(newType), false);
+                mh = mh.copyWithExtendL(midType, form2, fn);
+            } else {
+                LambdaForm form2 = mh.editor().filterReturnForm(BasicType.basicType(newType), true);
+                mh = mh.copyWith(midType, form2);
             }
         }
-        boolean retConv = needConv[INARG_COUNT];
+        assert(convCount == 0);
+        assert(mh.type().equals(srcType));
+        return mh;
+    }
+
+    static MethodHandle makePairwiseConvertIndirect(MethodHandle target, MethodType srcType,
+                                                    boolean strict, boolean monobox) {
+        assert(target.type().parameterCount() == srcType.parameterCount());
+        // Calculate extra arguments (temporaries) required in the names array.
+        Object[] convSpecs = computeValueConversions(srcType, target.type(), strict, monobox);
+        final int INARG_COUNT = srcType.parameterCount();
+        int convCount = countNonNull(convSpecs);
+        boolean retConv = (convSpecs[INARG_COUNT] != null);
+        boolean retVoid = srcType.returnType() == void.class;
+        if (retConv && retVoid) {
+            convCount -= 1;
+            retConv = false;
+        }
 
         final int IN_MH         = 0;
         final int INARG_BASE    = 1;
         final int INARG_LIMIT   = INARG_BASE + INARG_COUNT;
-        final int NAME_LIMIT    = INARG_LIMIT + conversions + 1;
+        final int NAME_LIMIT    = INARG_LIMIT + convCount + 1;
         final int RETURN_CONV   = (!retConv ? -1         : NAME_LIMIT - 1);
         final int OUT_CALL      = (!retConv ? NAME_LIMIT : RETURN_CONV) - 1;
+        final int RESULT        = (retVoid ? -1 : NAME_LIMIT - 1);
 
         // Now build a LambdaForm.
         MethodType lambdaType = srcType.basicType().invokerType();
@@ -204,59 +294,21 @@
 
         int nameCursor = INARG_LIMIT;
         for (int i = 0; i < INARG_COUNT; i++) {
-            Class<?> src = srcType.parameterType(i);
-            Class<?> dst = dstType.parameterType(i);
-
-            if (!needConv[i]) {
+            Object convSpec = convSpecs[i];
+            if (convSpec == null) {
                 // do nothing: difference is trivial
                 outArgs[OUTARG_BASE + i] = names[INARG_BASE + i];
                 continue;
             }
 
-            // Tricky case analysis follows.
-            MethodHandle fn = null;
-            if (src.isPrimitive()) {
-                if (dst.isPrimitive()) {
-                    fn = ValueConversions.convertPrimitive(src, dst);
-                } else {
-                    Wrapper w = Wrapper.forPrimitiveType(src);
-                    MethodHandle boxMethod = ValueConversions.box(w);
-                    if (dst == w.wrapperType())
-                        fn = boxMethod;
-                    else
-                        fn = boxMethod.asType(MethodType.methodType(dst, src));
-                }
+            Name conv;
+            if (convSpec instanceof Class) {
+                Class<?> convClass = (Class<?>) convSpec;
+                conv = new Name(Lazy.MH_castReference, convClass, names[INARG_BASE + i]);
             } else {
-                if (dst.isPrimitive()) {
-                    // Caller has boxed a primitive.  Unbox it for the target.
-                    Wrapper w = Wrapper.forPrimitiveType(dst);
-                    if (level == 0 || VerifyType.isNullConversion(src, w.wrapperType())) {
-                        fn = ValueConversions.unbox(dst);
-                    } else if (src == Object.class || !Wrapper.isWrapperType(src)) {
-                        // Examples:  Object->int, Number->int, Comparable->int; Byte->int, Character->int
-                        // must include additional conversions
-                        // src must be examined at runtime, to detect Byte, Character, etc.
-                        MethodHandle unboxMethod = (level == 1
-                                                    ? ValueConversions.unbox(dst)
-                                                    : ValueConversions.unboxCast(dst));
-                        fn = unboxMethod;
-                    } else {
-                        // Example: Byte->int
-                        // Do this by reformulating the problem to Byte->byte.
-                        Class<?> srcPrim = Wrapper.forWrapperType(src).primitiveType();
-                        MethodHandle unbox = ValueConversions.unbox(srcPrim);
-                        // Compose the two conversions.  FIXME:  should make two Names for this job
-                        fn = unbox.asType(MethodType.methodType(dst, src));
-                    }
-                } else {
-                    // Simple reference conversion.
-                    // Note:  Do not check for a class hierarchy relation
-                    // between src and dst.  In all cases a 'null' argument
-                    // will pass the cast conversion.
-                    fn = ValueConversions.cast(dst, Lazy.MH_castReference);
-                }
+                MethodHandle fn = (MethodHandle) convSpec;
+                conv = new Name(fn, names[INARG_BASE + i]);
             }
-            Name conv = new Name(fn, names[INARG_BASE + i]);
             assert(names[nameCursor] == null);
             names[nameCursor++] = conv;
             assert(outArgs[OUTARG_BASE + i] == null);
@@ -267,29 +319,29 @@
         assert(nameCursor == OUT_CALL);
         names[OUT_CALL] = new Name(target, outArgs);
 
-        if (RETURN_CONV < 0) {
+        Object convSpec = convSpecs[INARG_COUNT];
+        if (!retConv) {
             assert(OUT_CALL == names.length-1);
         } else {
-            Class<?> needReturn = srcType.returnType();
-            Class<?> haveReturn = dstType.returnType();
-            MethodHandle fn;
-            Object[] arg = { names[OUT_CALL] };
-            if (haveReturn == void.class) {
-                // synthesize a zero value for the given void
-                Object zero = Wrapper.forBasicType(needReturn).zero();
-                fn = MethodHandles.constant(needReturn, zero);
-                arg = new Object[0];  // don't pass names[OUT_CALL] to conversion
+            Name conv;
+            if (convSpec == void.class) {
+                conv = new Name(LambdaForm.constantZero(BasicType.basicType(srcType.returnType())));
+            } else if (convSpec instanceof Class) {
+                Class<?> convClass = (Class<?>) convSpec;
+                conv = new Name(Lazy.MH_castReference, convClass, names[OUT_CALL]);
             } else {
-                MethodHandle identity = MethodHandles.identity(needReturn);
-                MethodType needConversion = identity.type().changeParameterType(0, haveReturn);
-                fn = makePairwiseConvert(identity, needConversion, level);
+                MethodHandle fn = (MethodHandle) convSpec;
+                if (fn.type().parameterCount() == 0)
+                    conv = new Name(fn);  // don't pass retval to void conversion
+                else
+                    conv = new Name(fn, names[OUT_CALL]);
             }
             assert(names[RETURN_CONV] == null);
-            names[RETURN_CONV] = new Name(fn, arg);
+            names[RETURN_CONV] = conv;
             assert(RETURN_CONV == names.length-1);
         }
 
-        LambdaForm form = new LambdaForm("convert", lambdaType.parameterCount(), names);
+        LambdaForm form = new LambdaForm("convert", lambdaType.parameterCount(), names, RESULT);
         return SimpleMethodHandle.make(srcType, form);
     }
 
@@ -312,12 +364,79 @@
         return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName());
     }
 
-    static MethodHandle makeReferenceIdentity(Class<?> refType) {
-        MethodType lambdaType = MethodType.genericMethodType(1).invokerType();
-        Name[] names = arguments(1, lambdaType);
-        names[names.length - 1] = new Name(ValueConversions.identity(), names[1]);
-        LambdaForm form = new LambdaForm("identity", lambdaType.parameterCount(), names);
-        return SimpleMethodHandle.make(MethodType.methodType(refType, refType), form);
+    static Object[] computeValueConversions(MethodType srcType, MethodType dstType,
+                                            boolean strict, boolean monobox) {
+        final int INARG_COUNT = srcType.parameterCount();
+        Object[] convSpecs = new Object[INARG_COUNT+1];
+        for (int i = 0; i <= INARG_COUNT; i++) {
+            boolean isRet = (i == INARG_COUNT);
+            Class<?> src = isRet ? dstType.returnType() : srcType.parameterType(i);
+            Class<?> dst = isRet ? srcType.returnType() : dstType.parameterType(i);
+            if (!VerifyType.isNullConversion(src, dst, /*keepInterfaces=*/ strict)) {
+                convSpecs[i] = valueConversion(src, dst, strict, monobox);
+            }
+        }
+        return convSpecs;
+    }
+    static MethodHandle makePairwiseConvert(MethodHandle target, MethodType srcType,
+                                            boolean strict) {
+        return makePairwiseConvert(target, srcType, strict, /*monobox=*/ false);
+    }
+
+    /**
+     * Find a conversion function from the given source to the given destination.
+     * This conversion function will be used as a LF NamedFunction.
+     * Return a Class object if a simple cast is needed.
+     * Return void.class if void is involved.
+     */
+    static Object valueConversion(Class<?> src, Class<?> dst, boolean strict, boolean monobox) {
+        assert(!VerifyType.isNullConversion(src, dst, /*keepInterfaces=*/ strict));  // caller responsibility
+        if (dst == void.class)
+            return dst;
+        MethodHandle fn;
+        if (src.isPrimitive()) {
+            if (src == void.class) {
+                return void.class;  // caller must recognize this specially
+            } else if (dst.isPrimitive()) {
+                // Examples: int->byte, byte->int, boolean->int (!strict)
+                fn = ValueConversions.convertPrimitive(src, dst);
+            } else {
+                // Examples: int->Integer, boolean->Object, float->Number
+                Wrapper wsrc = Wrapper.forPrimitiveType(src);
+                fn = ValueConversions.boxExact(wsrc);
+                assert(fn.type().parameterType(0) == wsrc.primitiveType());
+                assert(fn.type().returnType() == wsrc.wrapperType());
+                if (!VerifyType.isNullConversion(wsrc.wrapperType(), dst, strict)) {
+                    // Corner case, such as int->Long, which will probably fail.
+                    MethodType mt = MethodType.methodType(dst, src);
+                    if (strict)
+                        fn = fn.asType(mt);
+                    else
+                        fn = MethodHandleImpl.makePairwiseConvert(fn, mt, /*strict=*/ false);
+                }
+            }
+        } else if (dst.isPrimitive()) {
+            Wrapper wdst = Wrapper.forPrimitiveType(dst);
+            if (monobox || src == wdst.wrapperType()) {
+                // Use a strongly-typed unboxer, if possible.
+                fn = ValueConversions.unboxExact(wdst, strict);
+            } else {
+                // Examples:  Object->int, Number->int, Comparable->int, Byte->int
+                // must include additional conversions
+                // src must be examined at runtime, to detect Byte, Character, etc.
+                fn = (strict
+                        ? ValueConversions.unboxWiden(wdst)
+                        : ValueConversions.unboxCast(wdst));
+            }
+        } else {
+            // Simple reference conversion.
+            // Note:  Do not check for a class hierarchy relation
+            // between src and dst.  In all cases a 'null' argument
+            // will pass the cast conversion.
+            return dst;
+        }
+        assert(fn.type().parameterCount() <= 1) : "pc"+Arrays.asList(src.getSimpleName(), dst.getSimpleName(), fn);
+        return fn;
     }
 
     static MethodHandle makeVarargsCollector(MethodHandle target, Class<?> arrayType) {
@@ -326,34 +445,46 @@
         if (type.parameterType(last) != arrayType)
             target = target.asType(type.changeParameterType(last, arrayType));
         target = target.asFixedArity();  // make sure this attribute is turned off
-        return new AsVarargsCollector(target, target.type(), arrayType);
+        return new AsVarargsCollector(target, arrayType);
     }
 
-    static class AsVarargsCollector extends MethodHandle {
+    private static final class AsVarargsCollector extends DelegatingMethodHandle {
         private final MethodHandle target;
         private final Class<?> arrayType;
-        private /*@Stable*/ MethodHandle asCollectorCache;
+        private @Stable MethodHandle asCollectorCache;
 
-        AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
-            super(type, reinvokerForm(target));
+        AsVarargsCollector(MethodHandle target, Class<?> arrayType) {
+            this(target.type(), target, arrayType);
+        }
+        AsVarargsCollector(MethodType type, MethodHandle target, Class<?> arrayType) {
+            super(type, target);
             this.target = target;
             this.arrayType = arrayType;
             this.asCollectorCache = target.asCollector(arrayType, 0);
         }
 
-        @Override MethodHandle reinvokerTarget() { return target; }
-
         @Override
         public boolean isVarargsCollector() {
             return true;
         }
 
         @Override
+        protected MethodHandle getTarget() {
+            return target;
+        }
+
+        @Override
         public MethodHandle asFixedArity() {
             return target;
         }
 
         @Override
+        MethodHandle setVarargs(MemberName member) {
+            if (member.isVarargs())  return this;
+            return asFixedArity();
+        }
+
+        @Override
         public MethodHandle asTypeUncached(MethodType newType) {
             MethodType type = this.type();
             int collectArg = type.parameterCount() - 1;
@@ -381,54 +512,15 @@
         }
 
         @Override
-        MethodHandle setVarargs(MemberName member) {
-            if (member.isVarargs())  return this;
-            return asFixedArity();
-        }
-
-        @Override
-        MethodHandle viewAsType(MethodType newType) {
-            if (newType.lastParameterType() != type().lastParameterType())
-                throw new InternalError();
-            MethodHandle newTarget = asFixedArity().viewAsType(newType);
-            // put back the varargs bit:
-            return new AsVarargsCollector(newTarget, newType, arrayType);
-        }
-
-        @Override
-        MemberName internalMemberName() {
-            return asFixedArity().internalMemberName();
-        }
-        @Override
-        Class<?> internalCallerClass() {
-            return asFixedArity().internalCallerClass();
-        }
-
-        /*non-public*/
-        @Override
-        boolean isInvokeSpecial() {
-            return asFixedArity().isInvokeSpecial();
-        }
-
-
-        @Override
-        MethodHandle bindArgument(int pos, char basicType, Object value) {
-            return asFixedArity().bindArgument(pos, basicType, value);
-        }
-
-        @Override
-        MethodHandle bindReceiver(Object receiver) {
-            return asFixedArity().bindReceiver(receiver);
-        }
-
-        @Override
-        MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
-            return asFixedArity().dropArguments(srcType, pos, drops);
-        }
-
-        @Override
-        MethodHandle permuteArguments(MethodType newType, int[] reorder) {
-            return asFixedArity().permuteArguments(newType, reorder);
+        boolean viewAsTypeChecks(MethodType newType, boolean strict) {
+            super.viewAsTypeChecks(newType, true);
+            if (strict) return true;
+            // extra assertion for non-strict checks:
+            assert (type().lastParameterType().getComponentType()
+                    .isAssignableFrom(
+                            newType.lastParameterType().getComponentType()))
+                    : Arrays.asList(this, newType);
+            return true;
         }
     }
 
@@ -499,32 +591,52 @@
      * Pre-initialized NamedFunctions for bootstrapping purposes.
      * Factored in an inner class to delay initialization until first usage.
      */
-    private static class Lazy {
+    static class Lazy {
         private static final Class<?> MHI = MethodHandleImpl.class;
 
+        private static final MethodHandle[] ARRAYS;
+        private static final MethodHandle[] FILL_ARRAYS;
+
         static final NamedFunction NF_checkSpreadArgument;
         static final NamedFunction NF_guardWithCatch;
-        static final NamedFunction NF_selectAlternative;
         static final NamedFunction NF_throwException;
 
         static final MethodHandle MH_castReference;
+        static final MethodHandle MH_selectAlternative;
+        static final MethodHandle MH_copyAsPrimitiveArray;
+        static final MethodHandle MH_fillNewTypedArray;
+        static final MethodHandle MH_fillNewArray;
+        static final MethodHandle MH_arrayIdentity;
 
         static {
+            ARRAYS      = makeArrays();
+            FILL_ARRAYS = makeFillArrays();
+
             try {
                 NF_checkSpreadArgument = new NamedFunction(MHI.getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
                 NF_guardWithCatch      = new NamedFunction(MHI.getDeclaredMethod("guardWithCatch", MethodHandle.class, Class.class,
                                                                                  MethodHandle.class, Object[].class));
-                NF_selectAlternative   = new NamedFunction(MHI.getDeclaredMethod("selectAlternative", boolean.class, MethodHandle.class,
-                                                                                 MethodHandle.class));
                 NF_throwException      = new NamedFunction(MHI.getDeclaredMethod("throwException", Throwable.class));
 
                 NF_checkSpreadArgument.resolve();
                 NF_guardWithCatch.resolve();
-                NF_selectAlternative.resolve();
                 NF_throwException.resolve();
 
-                MethodType mt = MethodType.methodType(Object.class, Class.class, Object.class);
-                MH_castReference = IMPL_LOOKUP.findStatic(MHI, "castReference", mt);
+                MH_castReference        = IMPL_LOOKUP.findStatic(MHI, "castReference",
+                                            MethodType.methodType(Object.class, Class.class, Object.class));
+                MH_copyAsPrimitiveArray = IMPL_LOOKUP.findStatic(MHI, "copyAsPrimitiveArray",
+                                            MethodType.methodType(Object.class, Wrapper.class, Object[].class));
+                MH_arrayIdentity        = IMPL_LOOKUP.findStatic(MHI, "identity",
+                                            MethodType.methodType(Object[].class, Object[].class));
+                MH_fillNewArray         = IMPL_LOOKUP.findStatic(MHI, "fillNewArray",
+                                            MethodType.methodType(Object[].class, Integer.class, Object[].class));
+                MH_fillNewTypedArray    = IMPL_LOOKUP.findStatic(MHI, "fillNewTypedArray",
+                                            MethodType.methodType(Object[].class, Object[].class, Integer.class, Object[].class));
+
+                MH_selectAlternative    = makeIntrinsic(
+                        IMPL_LOOKUP.findStatic(MHI, "selectAlternative",
+                                MethodType.methodType(MethodHandle.class, boolean.class, MethodHandle.class, MethodHandle.class)),
+                        Intrinsic.SELECT_ALTERNATIVE);
             } catch (ReflectiveOperationException ex) {
                 throw newInternalError(ex);
             }
@@ -595,29 +707,66 @@
     MethodHandle makeGuardWithTest(MethodHandle test,
                                    MethodHandle target,
                                    MethodHandle fallback) {
-        MethodType basicType = target.type().basicType();
-        MethodHandle invokeBasic = MethodHandles.basicInvoker(basicType);
-        int arity = basicType.parameterCount();
-        int extraNames = 3;
-        MethodType lambdaType = basicType.invokerType();
-        Name[] names = arguments(extraNames, lambdaType);
+        MethodType type = target.type();
+        assert(test.type().equals(type.changeReturnType(boolean.class)) && fallback.type().equals(type));
+        MethodType basicType = type.basicType();
+        LambdaForm form = makeGuardWithTestForm(basicType);
+        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
+        BoundMethodHandle mh;
+        try {
+            mh = (BoundMethodHandle)
+                    data.constructor().invokeBasic(type, form,
+                        (Object) test, (Object) target, (Object) fallback);
+        } catch (Throwable ex) {
+            throw uncaughtException(ex);
+        }
+        assert(mh.type() == type);
+        return mh;
+    }
 
-        Object[] testArgs   = Arrays.copyOfRange(names, 1, 1 + arity, Object[].class);
-        Object[] targetArgs = Arrays.copyOfRange(names, 0, 1 + arity, Object[].class);
+    static
+    LambdaForm makeGuardWithTestForm(MethodType basicType) {
+        LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_GWT);
+        if (lform != null)  return lform;
+        final int THIS_MH      = 0;  // the BMH_LLL
+        final int ARG_BASE     = 1;  // start of incoming arguments
+        final int ARG_LIMIT    = ARG_BASE + basicType.parameterCount();
+        int nameCursor = ARG_LIMIT;
+        final int GET_TEST     = nameCursor++;
+        final int GET_TARGET   = nameCursor++;
+        final int GET_FALLBACK = nameCursor++;
+        final int CALL_TEST    = nameCursor++;
+        final int SELECT_ALT   = nameCursor++;
+        final int CALL_TARGET  = nameCursor++;
+        assert(CALL_TARGET == SELECT_ALT+1);  // must be true to trigger IBG.emitSelectAlternative
+
+        MethodType lambdaType = basicType.invokerType();
+        Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
+
+        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
+        names[THIS_MH] = names[THIS_MH].withConstraint(data);
+        names[GET_TEST]     = new Name(data.getterFunction(0), names[THIS_MH]);
+        names[GET_TARGET]   = new Name(data.getterFunction(1), names[THIS_MH]);
+        names[GET_FALLBACK] = new Name(data.getterFunction(2), names[THIS_MH]);
+
+        Object[] invokeArgs = Arrays.copyOfRange(names, 0, ARG_LIMIT, Object[].class);
 
         // call test
-        names[arity + 1] = new Name(test, testArgs);
+        MethodType testType = basicType.changeReturnType(boolean.class).basicType();
+        invokeArgs[0] = names[GET_TEST];
+        names[CALL_TEST] = new Name(testType, invokeArgs);
 
         // call selectAlternative
-        Object[] selectArgs = { names[arity + 1], target, fallback };
-        names[arity + 2] = new Name(Lazy.NF_selectAlternative, selectArgs);
-        targetArgs[0] = names[arity + 2];
+        names[SELECT_ALT] = new Name(Lazy.MH_selectAlternative, names[CALL_TEST],
+                                     names[GET_TARGET], names[GET_FALLBACK]);
 
         // call target or fallback
-        names[arity + 3] = new Name(new NamedFunction(invokeBasic), targetArgs);
+        invokeArgs[0] = names[SELECT_ALT];
+        names[CALL_TARGET] = new Name(basicType, invokeArgs);
 
-        LambdaForm form = new LambdaForm("guard", lambdaType.parameterCount(), names);
-        return SimpleMethodHandle.make(target.type(), form);
+        lform = new LambdaForm("guard", lambdaType.parameterCount(), names);
+
+        return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
     }
 
     /**
@@ -665,6 +814,7 @@
         Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
 
         BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLL();
+        names[THIS_MH]          = names[THIS_MH].withConstraint(data);
         names[GET_TARGET]       = new Name(data.getterFunction(0), names[THIS_MH]);
         names[GET_CLASS]        = new Name(data.getterFunction(1), names[THIS_MH]);
         names[GET_CATCHER]      = new Name(data.getterFunction(2), names[THIS_MH]);
@@ -679,7 +829,7 @@
         Object[] args = new Object[invokeBasic.type().parameterCount()];
         args[0] = names[GET_COLLECT_ARGS];
         System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT-ARG_BASE);
-        names[BOXED_ARGS] = new Name(new NamedFunction(invokeBasic), args);
+        names[BOXED_ARGS] = new Name(makeIntrinsic(invokeBasic, Intrinsic.GUARD_WITH_CATCH), args);
 
         // t_{i+1}:L=MethodHandleImpl.guardWithCatch(target:L,exType:L,catcher:L,t_{i}:L);
         Object[] gwcArgs = new Object[] {names[GET_TARGET], names[GET_CLASS], names[GET_CATCHER], names[BOXED_ARGS]};
@@ -688,7 +838,7 @@
         // t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
         MethodHandle invokeBasicUnbox = MethodHandles.basicInvoker(MethodType.methodType(basicType.rtype(), Object.class));
         Object[] unboxArgs  = new Object[] {names[GET_UNBOX_RESULT], names[TRY_CATCH]};
-        names[UNBOX_RESULT] = new Name(new NamedFunction(invokeBasicUnbox), unboxArgs);
+        names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
 
         lform = new LambdaForm("guardWithCatch", lambdaType.parameterCount(), names);
 
@@ -705,22 +855,27 @@
         // Prepare auxiliary method handles used during LambdaForm interpreation.
         // Box arguments and wrap them into Object[]: ValueConversions.array().
         MethodType varargsType = type.changeReturnType(Object[].class);
-        MethodHandle collectArgs = ValueConversions.varargsArray(type.parameterCount())
-                                                   .asType(varargsType);
+        MethodHandle collectArgs = varargsArray(type.parameterCount()).asType(varargsType);
         // Result unboxing: ValueConversions.unbox() OR ValueConversions.identity() OR ValueConversions.ignore().
         MethodHandle unboxResult;
-        if (type.returnType().isPrimitive()) {
-            unboxResult = ValueConversions.unbox(type.returnType());
+        Class<?> rtype = type.returnType();
+        if (rtype.isPrimitive()) {
+            if (rtype == void.class) {
+                unboxResult = ValueConversions.ignore();
+            } else {
+                Wrapper w = Wrapper.forPrimitiveType(type.returnType());
+                unboxResult = ValueConversions.unboxExact(w);
+            }
         } else {
-            unboxResult = ValueConversions.identity();
+            unboxResult = MethodHandles.identity(Object.class);
         }
 
         BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLL();
         BoundMethodHandle mh;
         try {
             mh = (BoundMethodHandle)
-                    data.constructor[0].invokeBasic(type, form, (Object) target, (Object) exType, (Object) catcher,
-                                                    (Object) collectArgs, (Object) unboxResult);
+                    data.constructor().invokeBasic(type, form, (Object) target, (Object) exType, (Object) catcher,
+                                                   (Object) collectArgs, (Object) unboxResult);
         } catch (Throwable ex) {
             throw uncaughtException(ex);
         }
@@ -758,9 +913,11 @@
         assert(Throwable.class.isAssignableFrom(type.parameterType(0)));
         int arity = type.parameterCount();
         if (arity > 1) {
-            return throwException(type.dropParameterTypes(1, arity)).dropArguments(type, 1, arity-1);
+            MethodHandle mh = throwException(type.dropParameterTypes(1, arity));
+            mh = MethodHandles.dropArguments(mh, 1, type.parameterList().subList(1, arity));
+            return mh;
         }
-        return makePairwiseConvert(Lazy.NF_throwException.resolvedHandle(), type, 2);
+        return makePairwiseConvert(Lazy.NF_throwException.resolvedHandle(), type, false, true);
     }
 
     static <T extends Throwable> Empty throwException(T t) throws T { throw t; }
@@ -782,7 +939,7 @@
         mh = mh.bindTo(new UnsupportedOperationException("cannot reflectively invoke MethodHandle"));
         if (!method.getInvocationType().equals(mh.type()))
             throw new InternalError(method.toString());
-        mh = mh.withInternalMemberName(method);
+        mh = mh.withInternalMemberName(method, false);
         mh = mh.asVarargsCollector(Object[].class);
         assert(method.isVarargs());
         FAKE_METHOD_HANDLE_INVOKE[idx] = mh;
@@ -819,7 +976,7 @@
             MethodHandle vamh = prepareForInvoker(mh);
             // Cache the result of makeInjectedInvoker once per argument class.
             MethodHandle bccInvoker = CV_makeInjectedInvoker.get(hostClass);
-            return restoreToType(bccInvoker.bindTo(vamh), mh.type(), mh.internalMemberName(), hostClass);
+            return restoreToType(bccInvoker.bindTo(vamh), mh, hostClass);
         }
 
         private static MethodHandle makeInjectedInvoker(Class<?> hostClass) {
@@ -874,12 +1031,14 @@
         }
 
         // Undo the adapter effect of prepareForInvoker:
-        private static MethodHandle restoreToType(MethodHandle vamh, MethodType type,
-                                                  MemberName member,
+        private static MethodHandle restoreToType(MethodHandle vamh,
+                                                  MethodHandle original,
                                                   Class<?> hostClass) {
+            MethodType type = original.type();
             MethodHandle mh = vamh.asCollector(Object[].class, type.parameterCount());
+            MemberName member = original.internalMemberName();
             mh = mh.asType(type);
-            mh = new WrappedMember(mh, type, member, hostClass);
+            mh = new WrappedMember(mh, type, member, original.isInvokeSpecial(), hostClass);
             return mh;
         }
 
@@ -945,29 +1104,23 @@
 
 
     /** This subclass allows a wrapped method handle to be re-associated with an arbitrary member name. */
-    static class WrappedMember extends MethodHandle {
+    private static final class WrappedMember extends DelegatingMethodHandle {
         private final MethodHandle target;
         private final MemberName member;
         private final Class<?> callerClass;
+        private final boolean isInvokeSpecial;
 
-        private WrappedMember(MethodHandle target, MethodType type, MemberName member, Class<?> callerClass) {
-            super(type, reinvokerForm(target));
+        private WrappedMember(MethodHandle target, MethodType type,
+                              MemberName member, boolean isInvokeSpecial,
+                              Class<?> callerClass) {
+            super(type, target);
             this.target = target;
             this.member = member;
             this.callerClass = callerClass;
+            this.isInvokeSpecial = isInvokeSpecial;
         }
 
         @Override
-        MethodHandle reinvokerTarget() {
-            return target;
-        }
-        @Override
-        public MethodHandle asTypeUncached(MethodType newType) {
-            // This MH is an alias for target, except for the MemberName
-            // Drop the MemberName if there is any conversion.
-            return asTypeCache = target.asType(newType);
-        }
-        @Override
         MemberName internalMemberName() {
             return member;
         }
@@ -977,18 +1130,368 @@
         }
         @Override
         boolean isInvokeSpecial() {
-            return target.isInvokeSpecial();
+            return isInvokeSpecial;
         }
         @Override
-        MethodHandle viewAsType(MethodType newType) {
-            return new WrappedMember(target, newType, member, callerClass);
+        protected MethodHandle getTarget() {
+            return target;
+        }
+        @Override
+        public MethodHandle asTypeUncached(MethodType newType) {
+            // This MH is an alias for target, except for the MemberName
+            // Drop the MemberName if there is any conversion.
+            return asTypeCache = target.asType(newType);
         }
     }
 
-    static MethodHandle makeWrappedMember(MethodHandle target, MemberName member) {
-        if (member.equals(target.internalMemberName()))
+    static MethodHandle makeWrappedMember(MethodHandle target, MemberName member, boolean isInvokeSpecial) {
+        if (member.equals(target.internalMemberName()) && isInvokeSpecial == target.isInvokeSpecial())
             return target;
-        return new WrappedMember(target, target.type(), member, null);
+        return new WrappedMember(target, target.type(), member, isInvokeSpecial, null);
     }
 
+    /** Intrinsic IDs */
+    /*non-public*/
+    enum Intrinsic {
+        SELECT_ALTERNATIVE,
+        GUARD_WITH_CATCH,
+        NEW_ARRAY,
+        ARRAY_LOAD,
+        ARRAY_STORE,
+        IDENTITY,
+        ZERO,
+        NONE // no intrinsic associated
+    }
+
+    /** Mark arbitrary method handle as intrinsic.
+     * InvokerBytecodeGenerator uses this info to produce more efficient bytecode shape. */
+    private static final class IntrinsicMethodHandle extends DelegatingMethodHandle {
+        private final MethodHandle target;
+        private final Intrinsic intrinsicName;
+
+        IntrinsicMethodHandle(MethodHandle target, Intrinsic intrinsicName) {
+            super(target.type(), target);
+            this.target = target;
+            this.intrinsicName = intrinsicName;
+        }
+
+        @Override
+        protected MethodHandle getTarget() {
+            return target;
+        }
+
+        @Override
+        Intrinsic intrinsicName() {
+            return intrinsicName;
+        }
+
+        @Override
+        public MethodHandle asTypeUncached(MethodType newType) {
+            // This MH is an alias for target, except for the intrinsic name
+            // Drop the name if there is any conversion.
+            return asTypeCache = target.asType(newType);
+        }
+
+        @Override
+        String internalProperties() {
+            return super.internalProperties() +
+                    "\n& Intrinsic="+intrinsicName;
+        }
+
+        @Override
+        public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
+            if (intrinsicName == Intrinsic.IDENTITY) {
+                MethodType resultType = type().asCollectorType(arrayType, arrayLength);
+                MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
+                return newArray.asType(resultType);
+            }
+            return super.asCollector(arrayType, arrayLength);
+        }
+    }
+
+    static MethodHandle makeIntrinsic(MethodHandle target, Intrinsic intrinsicName) {
+        if (intrinsicName == target.intrinsicName())
+            return target;
+        return new IntrinsicMethodHandle(target, intrinsicName);
+    }
+
+    static MethodHandle makeIntrinsic(MethodType type, LambdaForm form, Intrinsic intrinsicName) {
+        return new IntrinsicMethodHandle(SimpleMethodHandle.make(type, form), intrinsicName);
+    }
+
+    /// Collection of multiple arguments.
+
+    private static MethodHandle findCollector(String name, int nargs, Class<?> rtype, Class<?>... ptypes) {
+        MethodType type = MethodType.genericMethodType(nargs)
+                .changeReturnType(rtype)
+                .insertParameterTypes(0, ptypes);
+        try {
+            return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, name, type);
+        } catch (ReflectiveOperationException ex) {
+            return null;
+        }
+    }
+
+    private static final Object[] NO_ARGS_ARRAY = {};
+    private static Object[] makeArray(Object... args) { return args; }
+    private static Object[] array() { return NO_ARGS_ARRAY; }
+    private static Object[] array(Object a0)
+                { return makeArray(a0); }
+    private static Object[] array(Object a0, Object a1)
+                { return makeArray(a0, a1); }
+    private static Object[] array(Object a0, Object a1, Object a2)
+                { return makeArray(a0, a1, a2); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
+                { return makeArray(a0, a1, a2, a3); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4)
+                { return makeArray(a0, a1, a2, a3, a4); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5)
+                { return makeArray(a0, a1, a2, a3, a4, a5); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
+    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8, Object a9)
+                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+    private static MethodHandle[] makeArrays() {
+        ArrayList<MethodHandle> mhs = new ArrayList<>();
+        for (;;) {
+            MethodHandle mh = findCollector("array", mhs.size(), Object[].class);
+            if (mh == null)  break;
+            mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
+            mhs.add(mh);
+        }
+        assert(mhs.size() == 11);  // current number of methods
+        return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
+    }
+
+    // filling versions of the above:
+    // using Integer len instead of int len and no varargs to avoid bootstrapping problems
+    private static Object[] fillNewArray(Integer len, Object[] /*not ...*/ args) {
+        Object[] a = new Object[len];
+        fillWithArguments(a, 0, args);
+        return a;
+    }
+    private static Object[] fillNewTypedArray(Object[] example, Integer len, Object[] /*not ...*/ args) {
+        Object[] a = Arrays.copyOf(example, len);
+        assert(a.getClass() != Object[].class);
+        fillWithArguments(a, 0, args);
+        return a;
+    }
+    private static void fillWithArguments(Object[] a, int pos, Object... args) {
+        System.arraycopy(args, 0, a, pos, args.length);
+    }
+    // using Integer pos instead of int pos to avoid bootstrapping problems
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0)
+                { fillWithArguments(a, pos, a0); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1)
+                { fillWithArguments(a, pos, a0, a1); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2)
+                { fillWithArguments(a, pos, a0, a1, a2); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3)
+                { fillWithArguments(a, pos, a0, a1, a2, a3); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7, a8); return a; }
+    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
+                                  Object a4, Object a5, Object a6, Object a7,
+                                  Object a8, Object a9)
+                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); return a; }
+
+    private static final int FILL_ARRAYS_COUNT = 11; // current number of fillArray methods
+
+    private static MethodHandle[] makeFillArrays() {
+        ArrayList<MethodHandle> mhs = new ArrayList<>();
+        mhs.add(null);  // there is no empty fill; at least a0 is required
+        for (;;) {
+            MethodHandle mh = findCollector("fillArray", mhs.size(), Object[].class, Integer.class, Object[].class);
+            if (mh == null)  break;
+            mhs.add(mh);
+        }
+        assert(mhs.size() == FILL_ARRAYS_COUNT);
+        return mhs.toArray(new MethodHandle[0]);
+    }
+
+    private static Object copyAsPrimitiveArray(Wrapper w, Object... boxes) {
+        Object a = w.makeArray(boxes.length);
+        w.copyArrayUnboxing(boxes, 0, a, 0, boxes.length);
+        return a;
+    }
+
+    /** Return a method handle that takes the indicated number of Object
+     *  arguments and returns an Object array of them, as if for varargs.
+     */
+    static MethodHandle varargsArray(int nargs) {
+        MethodHandle mh = Lazy.ARRAYS[nargs];
+        if (mh != null)  return mh;
+        mh = findCollector("array", nargs, Object[].class);
+        if (mh != null)  mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
+        if (mh != null)  return Lazy.ARRAYS[nargs] = mh;
+        mh = buildVarargsArray(Lazy.MH_fillNewArray, Lazy.MH_arrayIdentity, nargs);
+        assert(assertCorrectArity(mh, nargs));
+        mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
+        return Lazy.ARRAYS[nargs] = mh;
+    }
+
+    private static boolean assertCorrectArity(MethodHandle mh, int arity) {
+        assert(mh.type().parameterCount() == arity) : "arity != "+arity+": "+mh;
+        return true;
+    }
+
+    // Array identity function (used as Lazy.MH_arrayIdentity).
+    static <T> T[] identity(T[] x) {
+        return x;
+    }
+
+    private static MethodHandle buildVarargsArray(MethodHandle newArray, MethodHandle finisher, int nargs) {
+        // Build up the result mh as a sequence of fills like this:
+        //   finisher(fill(fill(newArrayWA(23,x1..x10),10,x11..x20),20,x21..x23))
+        // The various fill(_,10*I,___*[J]) are reusable.
+        int leftLen = Math.min(nargs, LEFT_ARGS);  // absorb some arguments immediately
+        int rightLen = nargs - leftLen;
+        MethodHandle leftCollector = newArray.bindTo(nargs);
+        leftCollector = leftCollector.asCollector(Object[].class, leftLen);
+        MethodHandle mh = finisher;
+        if (rightLen > 0) {
+            MethodHandle rightFiller = fillToRight(LEFT_ARGS + rightLen);
+            if (mh == Lazy.MH_arrayIdentity)
+                mh = rightFiller;
+            else
+                mh = MethodHandles.collectArguments(mh, 0, rightFiller);
+        }
+        if (mh == Lazy.MH_arrayIdentity)
+            mh = leftCollector;
+        else
+            mh = MethodHandles.collectArguments(mh, 0, leftCollector);
+        return mh;
+    }
+
+    private static final int LEFT_ARGS = FILL_ARRAYS_COUNT - 1;
+    private static final MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
+    /** fill_array_to_right(N).invoke(a, argL..arg[N-1])
+     *  fills a[L]..a[N-1] with corresponding arguments,
+     *  and then returns a.  The value L is a global constant (LEFT_ARGS).
+     */
+    private static MethodHandle fillToRight(int nargs) {
+        MethodHandle filler = FILL_ARRAY_TO_RIGHT[nargs];
+        if (filler != null)  return filler;
+        filler = buildFiller(nargs);
+        assert(assertCorrectArity(filler, nargs - LEFT_ARGS + 1));
+        return FILL_ARRAY_TO_RIGHT[nargs] = filler;
+    }
+    private static MethodHandle buildFiller(int nargs) {
+        if (nargs <= LEFT_ARGS)
+            return Lazy.MH_arrayIdentity;  // no args to fill; return the array unchanged
+        // we need room for both mh and a in mh.invoke(a, arg*[nargs])
+        final int CHUNK = LEFT_ARGS;
+        int rightLen = nargs % CHUNK;
+        int midLen = nargs - rightLen;
+        if (rightLen == 0) {
+            midLen = nargs - (rightLen = CHUNK);
+            if (FILL_ARRAY_TO_RIGHT[midLen] == null) {
+                // build some precursors from left to right
+                for (int j = LEFT_ARGS % CHUNK; j < midLen; j += CHUNK)
+                    if (j > LEFT_ARGS)  fillToRight(j);
+            }
+        }
+        if (midLen < LEFT_ARGS) rightLen = nargs - (midLen = LEFT_ARGS);
+        assert(rightLen > 0);
+        MethodHandle midFill = fillToRight(midLen);  // recursive fill
+        MethodHandle rightFill = Lazy.FILL_ARRAYS[rightLen].bindTo(midLen);  // [midLen..nargs-1]
+        assert(midFill.type().parameterCount()   == 1 + midLen - LEFT_ARGS);
+        assert(rightFill.type().parameterCount() == 1 + rightLen);
+
+        // Combine the two fills:
+        //   right(mid(a, x10..x19), x20..x23)
+        // The final product will look like this:
+        //   right(mid(newArrayLeft(24, x0..x9), x10..x19), x20..x23)
+        if (midLen == LEFT_ARGS)
+            return rightFill;
+        else
+            return MethodHandles.collectArguments(rightFill, 0, midFill);
+    }
+
+    // Type-polymorphic version of varargs maker.
+    private static final ClassValue<MethodHandle[]> TYPED_COLLECTORS
+        = new ClassValue<MethodHandle[]>() {
+            @Override
+            protected MethodHandle[] computeValue(Class<?> type) {
+                return new MethodHandle[256];
+            }
+    };
+
+    static final int MAX_JVM_ARITY = 255;  // limit imposed by the JVM
+
+    /** Return a method handle that takes the indicated number of
+     *  typed arguments and returns an array of them.
+     *  The type argument is the array type.
+     */
+    static MethodHandle varargsArray(Class<?> arrayType, int nargs) {
+        Class<?> elemType = arrayType.getComponentType();
+        if (elemType == null)  throw new IllegalArgumentException("not an array: "+arrayType);
+        // FIXME: Need more special casing and caching here.
+        if (nargs >= MAX_JVM_ARITY/2 - 1) {
+            int slots = nargs;
+            final int MAX_ARRAY_SLOTS = MAX_JVM_ARITY - 1;  // 1 for receiver MH
+            if (slots <= MAX_ARRAY_SLOTS && elemType.isPrimitive())
+                slots *= Wrapper.forPrimitiveType(elemType).stackSlots();
+            if (slots > MAX_ARRAY_SLOTS)
+                throw new IllegalArgumentException("too many arguments: "+arrayType.getSimpleName()+", length "+nargs);
+        }
+        if (elemType == Object.class)
+            return varargsArray(nargs);
+        // other cases:  primitive arrays, subtypes of Object[]
+        MethodHandle cache[] = TYPED_COLLECTORS.get(elemType);
+        MethodHandle mh = nargs < cache.length ? cache[nargs] : null;
+        if (mh != null)  return mh;
+        if (nargs == 0) {
+            Object example = java.lang.reflect.Array.newInstance(arrayType.getComponentType(), 0);
+            mh = MethodHandles.constant(arrayType, example);
+        } else if (elemType.isPrimitive()) {
+            MethodHandle builder = Lazy.MH_fillNewArray;
+            MethodHandle producer = buildArrayProducer(arrayType);
+            mh = buildVarargsArray(builder, producer, nargs);
+        } else {
+            Class<? extends Object[]> objArrayType = arrayType.asSubclass(Object[].class);
+            Object[] example = Arrays.copyOf(NO_ARGS_ARRAY, 0, objArrayType);
+            MethodHandle builder = Lazy.MH_fillNewTypedArray.bindTo(example);
+            MethodHandle producer = Lazy.MH_arrayIdentity; // must be weakly typed
+            mh = buildVarargsArray(builder, producer, nargs);
+        }
+        mh = mh.asType(MethodType.methodType(arrayType, Collections.<Class<?>>nCopies(nargs, elemType)));
+        mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
+        assert(assertCorrectArity(mh, nargs));
+        if (nargs < cache.length)
+            cache[nargs] = mh;
+        return mh;
+    }
+
+    private static MethodHandle buildArrayProducer(Class<?> arrayType) {
+        Class<?> elemType = arrayType.getComponentType();
+        assert(elemType.isPrimitive());
+        return Lazy.MH_copyAsPrimitiveArray.bindTo(Wrapper.forPrimitiveType(elemType));
+    }
 }
diff --git a/src/share/classes/java/lang/invoke/MethodHandleNatives.java b/src/share/classes/java/lang/invoke/MethodHandleNatives.java
index fd5cac8..0f5169e 100644
--- a/src/share/classes/java/lang/invoke/MethodHandleNatives.java
+++ b/src/share/classes/java/lang/invoke/MethodHandleNatives.java
@@ -78,7 +78,7 @@
 
         // The JVM calls MethodHandleNatives.<clinit>.  Cascade the <clinit> calls as needed:
         MethodHandleImpl.initStatics();
-}
+    }
 
     // All compile-time constants go here.
     // There is an opportunity to check them against the JVM's idea of them.
@@ -293,6 +293,17 @@
         Class<?> caller = (Class<?>)callerObj;
         String name = nameObj.toString().intern();
         MethodType type = (MethodType)typeObj;
+        if (!TRACE_METHOD_LINKAGE)
+            return linkCallSiteImpl(caller, bootstrapMethod, name, type,
+                                    staticArguments, appendixResult);
+        return linkCallSiteTracing(caller, bootstrapMethod, name, type,
+                                   staticArguments, appendixResult);
+    }
+    static MemberName linkCallSiteImpl(Class<?> caller,
+                                       MethodHandle bootstrapMethod,
+                                       String name, MethodType type,
+                                       Object staticArguments,
+                                       Object[] appendixResult) {
         CallSite callSite = CallSite.makeSite(bootstrapMethod,
                                               name,
                                               type,
@@ -306,6 +317,30 @@
             return Invokers.linkToCallSiteMethod(type);
         }
     }
+    // Tracing logic:
+    static MemberName linkCallSiteTracing(Class<?> caller,
+                                          MethodHandle bootstrapMethod,
+                                          String name, MethodType type,
+                                          Object staticArguments,
+                                          Object[] appendixResult) {
+        Object bsmReference = bootstrapMethod.internalMemberName();
+        if (bsmReference == null)  bsmReference = bootstrapMethod;
+        Object staticArglist = (staticArguments instanceof Object[] ?
+                                java.util.Arrays.asList((Object[]) staticArguments) :
+                                staticArguments);
+        System.out.println("linkCallSite "+caller.getName()+" "+
+                           bsmReference+" "+
+                           name+type+"/"+staticArglist);
+        try {
+            MemberName res = linkCallSiteImpl(caller, bootstrapMethod, name, type,
+                                              staticArguments, appendixResult);
+            System.out.println("linkCallSite => "+res+" + "+appendixResult[0]);
+            return res;
+        } catch (Throwable ex) {
+            System.out.println("linkCallSite => throw "+ex);
+            throw ex;
+        }
+    }
 
     /**
      * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
diff --git a/src/share/classes/java/lang/invoke/MethodHandleProxies.java b/src/share/classes/java/lang/invoke/MethodHandleProxies.java
index 8d5ee2c..d549b63 100644
--- a/src/share/classes/java/lang/invoke/MethodHandleProxies.java
+++ b/src/share/classes/java/lang/invoke/MethodHandleProxies.java
@@ -33,6 +33,7 @@
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
+import static java.lang.invoke.MethodHandleStatics.*;
 
 /**
  * This class consists exclusively of static methods that help adapt
@@ -148,7 +149,7 @@
     public static
     <T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
         if (!intfc.isInterface() || !Modifier.isPublic(intfc.getModifiers()))
-            throw new IllegalArgumentException("not a public interface: "+intfc.getName());
+            throw newIllegalArgumentException("not a public interface", intfc.getName());
         final MethodHandle mh;
         if (System.getSecurityManager() != null) {
             final Class<?> caller = Reflection.getCallerClass();
@@ -165,7 +166,7 @@
         }
         final Method[] methods = getSingleNameMethods(intfc);
         if (methods == null)
-            throw new IllegalArgumentException("not a single-method interface: "+intfc.getName());
+            throw newIllegalArgumentException("not a single-method interface", intfc.getName());
         final MethodHandle[] vaTargets = new MethodHandle[methods.length];
         for (int i = 0; i < methods.length; i++) {
             Method sm = methods[i];
@@ -189,7 +190,7 @@
                         return getArg(method.getName());
                     if (isObjectMethod(method))
                         return callObjectMethod(proxy, method, args);
-                    throw new InternalError("bad proxy method: "+method);
+                    throw newInternalError("bad proxy method: "+method);
                 }
             };
 
@@ -240,7 +241,7 @@
                 return (WrapperInstance) x;
         } catch (ClassCastException ex) {
         }
-        throw new IllegalArgumentException("not a wrapper instance");
+        throw newIllegalArgumentException("not a wrapper instance");
     }
 
     /**
diff --git a/src/share/classes/java/lang/invoke/MethodHandleStatics.java b/src/share/classes/java/lang/invoke/MethodHandleStatics.java
index 8a8eedf..c3d9ac1 100644
--- a/src/share/classes/java/lang/invoke/MethodHandleStatics.java
+++ b/src/share/classes/java/lang/invoke/MethodHandleStatics.java
@@ -45,16 +45,21 @@
     static final boolean DUMP_CLASS_FILES;
     static final boolean TRACE_INTERPRETER;
     static final boolean TRACE_METHOD_LINKAGE;
-    static final Integer COMPILE_THRESHOLD;
+    static final boolean USE_LAMBDA_FORM_EDITOR;
+    static final int COMPILE_THRESHOLD;
+    static final int PROFILE_LEVEL;
+
     static {
-        final Object[] values = { false, false, false, false, null };
+        final Object[] values = { false, false, false, false, false, null, null };
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
-                    values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD");
+                    values[4] = Boolean.getBoolean("java.lang.invoke.MethodHandle.USE_LF_EDITOR");
+                    values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
+                    values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
                     return null;
                 }
             });
@@ -62,7 +67,19 @@
         DUMP_CLASS_FILES          = (Boolean) values[1];
         TRACE_INTERPRETER         = (Boolean) values[2];
         TRACE_METHOD_LINKAGE      = (Boolean) values[3];
-        COMPILE_THRESHOLD         = (Integer) values[4];
+        USE_LAMBDA_FORM_EDITOR    = (Boolean) values[4];
+        COMPILE_THRESHOLD         = (Integer) values[5];
+        PROFILE_LEVEL             = (Integer) values[6];
+    }
+
+    /** Tell if any of the debugging switches are turned on.
+     *  If this is the case, it is reasonable to perform extra checks or save extra information.
+     */
+    /*non-public*/ static boolean debugEnabled() {
+        return (DEBUG_METHOD_HANDLE_NAMES |
+                DUMP_CLASS_FILES |
+                TRACE_INTERPRETER |
+                TRACE_METHOD_LINKAGE);
     }
 
     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
@@ -93,6 +110,9 @@
     }
 
     // handy shared exception makers (they simplify the common case code)
+    /*non-public*/ static InternalError newInternalError(String message) {
+        return new InternalError(message);
+    }
     /*non-public*/ static InternalError newInternalError(String message, Throwable cause) {
         return new InternalError(message, cause);
     }
@@ -114,7 +134,10 @@
     /*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj, Object obj2) {
         return new IllegalArgumentException(message(message, obj, obj2));
     }
+    /** Propagate unchecked exceptions and errors, but wrap anything checked and throw that instead. */
     /*non-public*/ static Error uncaughtException(Throwable ex) {
+        if (ex instanceof Error)  throw (Error) ex;
+        if (ex instanceof RuntimeException)  throw (RuntimeException) ex;
         throw newInternalError("uncaught exception", ex);
     }
     static Error NYI() {
diff --git a/src/share/classes/java/lang/invoke/MethodHandles.java b/src/share/classes/java/lang/invoke/MethodHandles.java
index 09103d5..91855fb 100644
--- a/src/share/classes/java/lang/invoke/MethodHandles.java
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java
@@ -26,8 +26,8 @@
 package java.lang.invoke;
 
 import java.lang.reflect.*;
+import java.util.BitSet;
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Arrays;
 
 import sun.invoke.util.ValueConversions;
@@ -37,13 +37,14 @@
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
+import java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.MethodHandleImpl.Intrinsic;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 
 import java.util.concurrent.ConcurrentHashMap;
 
-import sun.security.util.SecurityConstants;
-
 /**
  * This class consists exclusively of static methods that operate on or return
  * method handles. They fall into several categories:
@@ -863,6 +864,8 @@
                 return invoker(type);
             if ("invokeExact".equals(name))
                 return exactInvoker(type);
+            if ("invokeBasic".equals(name))
+                return basicInvoker(type);
             assert(!MemberName.isMethodHandleInvokeName(name));
             return null;
         }
@@ -1142,7 +1145,7 @@
             Class<? extends Object> refc = receiver.getClass(); // may get NPE
             MemberName method = resolveOrFail(REF_invokeSpecial, refc, name, type);
             MethodHandle mh = getDirectMethodNoRestrict(REF_invokeSpecial, refc, method, findBoundCallerClass(method));
-            return mh.bindReceiver(receiver).setVarargs(method);
+            return mh.bindArgumentL(0, receiver).setVarargs(method);
         }
 
         /**
@@ -1577,7 +1580,7 @@
                 return false;
             return true;
         }
-        private MethodHandle restrictReceiver(MemberName method, MethodHandle mh, Class<?> caller) throws IllegalAccessException {
+        private MethodHandle restrictReceiver(MemberName method, DirectMethodHandle mh, Class<?> caller) throws IllegalAccessException {
             assert(!method.isStatic());
             // receiver type of mh is too wide; narrow to caller
             if (!method.getDeclaringClass().isAssignableFrom(caller)) {
@@ -1586,7 +1589,9 @@
             MethodType rawType = mh.type();
             if (rawType.parameterType(0) == caller)  return mh;
             MethodType narrowType = rawType.changeParameterType(0, caller);
-            return mh.viewAsType(narrowType);
+            assert(!mh.isVarargsCollector());  // viewAsType will lose varargs-ness
+            assert(mh.viewAsTypeChecks(narrowType, true));
+            return mh.copyWith(narrowType, mh.form);
         }
 
         /** Check access and get the requested method. */
@@ -1648,15 +1653,17 @@
                 checkMethod(refKind, refc, method);
             }
 
-            MethodHandle mh = DirectMethodHandle.make(refKind, refc, method);
-            mh = maybeBindCaller(method, mh, callerClass);
-            mh = mh.setVarargs(method);
+            DirectMethodHandle dmh = DirectMethodHandle.make(refKind, refc, method);
+            MethodHandle mh = dmh;
             // Optionally narrow the receiver argument to refc using restrictReceiver.
             if (doRestrict &&
                    (refKind == REF_invokeSpecial ||
                        (MethodHandleNatives.refKindHasReceiver(refKind) &&
-                           restrictProtectedReceiver(method))))
-                mh = restrictReceiver(method, mh, lookupClass());
+                           restrictProtectedReceiver(method)))) {
+                mh = restrictReceiver(method, dmh, lookupClass());
+            }
+            mh = maybeBindCaller(method, mh, callerClass);
+            mh = mh.setVarargs(method);
             return mh;
         }
         private MethodHandle maybeBindCaller(MemberName method, MethodHandle mh,
@@ -1688,12 +1695,12 @@
             // Optionally check with the security manager; this isn't needed for unreflect* calls.
             if (checkSecurity)
                 checkSecurityManager(refc, field);
-            MethodHandle mh = DirectMethodHandle.make(refc, field);
+            DirectMethodHandle dmh = DirectMethodHandle.make(refc, field);
             boolean doRestrict = (MethodHandleNatives.refKindHasReceiver(refKind) &&
                                     restrictProtectedReceiver(field));
             if (doRestrict)
-                mh = restrictReceiver(field, mh, lookupClass());
-            return mh;
+                return restrictReceiver(field, dmh, lookupClass());
+            return dmh;
         }
         /** Check access and get the requested constructor. */
         private MethodHandle getDirectConstructor(Class<?> refc, MemberName ctor) throws IllegalAccessException {
@@ -1880,7 +1887,8 @@
     static public
     MethodHandle spreadInvoker(MethodType type, int leadingArgCount) {
         if (leadingArgCount < 0 || leadingArgCount > type.parameterCount())
-            throw new IllegalArgumentException("bad argument count "+leadingArgCount);
+            throw newIllegalArgumentException("bad argument count", leadingArgCount);
+        type = type.asSpreaderType(Object[].class, type.parameterCount() - leadingArgCount);
         return type.invokers().spreadInvoker(leadingArgCount);
     }
 
@@ -1960,12 +1968,12 @@
      */
     static public
     MethodHandle invoker(MethodType type) {
-        return type.invokers().generalInvoker();
+        return type.invokers().genericInvoker();
     }
 
     static /*non-public*/
     MethodHandle basicInvoker(MethodType type) {
-        return type.form().basicInvoker();
+        return type.invokers().basicInvoker();
     }
 
      /// method handle modification (creation from other method handles)
@@ -2016,10 +2024,20 @@
      */
     public static
     MethodHandle explicitCastArguments(MethodHandle target, MethodType newType) {
-        if (!target.type().isCastableTo(newType)) {
-            throw new WrongMethodTypeException("cannot explicitly cast "+target+" to "+newType);
+        explicitCastArgumentsChecks(target, newType);
+        // use the asTypeCache when possible:
+        MethodType oldType = target.type();
+        if (oldType == newType)  return target;
+        if (oldType.explicitCastEquivalentToAsType(newType)) {
+            return target.asType(newType);
         }
-        return MethodHandleImpl.makePairwiseConvert(target, newType, 2);
+        return MethodHandleImpl.makePairwiseConvert(target, newType, false);
+    }
+
+    private static void explicitCastArgumentsChecks(MethodHandle target, MethodType newType) {
+        if (target.type().parameterCount() != newType.parameterCount()) {
+            throw new WrongMethodTypeException("cannot explicitly cast " + target + " to " + newType);
+        }
     }
 
     /**
@@ -2083,12 +2101,177 @@
      */
     public static
     MethodHandle permuteArguments(MethodHandle target, MethodType newType, int... reorder) {
-        reorder = reorder.clone();
-        checkReorder(reorder, newType, target.type());
-        return target.permuteArguments(newType, reorder);
+        reorder = reorder.clone();  // get a private copy
+        MethodType oldType = target.type();
+        permuteArgumentChecks(reorder, newType, oldType);
+        if (USE_LAMBDA_FORM_EDITOR) {
+            // first detect dropped arguments and handle them separately
+            int[] originalReorder = reorder;
+            BoundMethodHandle result = target.rebind();
+            LambdaForm form = result.form;
+            int newArity = newType.parameterCount();
+            // Normalize the reordering into a real permutation,
+            // by removing duplicates and adding dropped elements.
+            // This somewhat improves lambda form caching, as well
+            // as simplifying the transform by breaking it up into steps.
+            for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) {
+                if (ddIdx > 0) {
+                    // We found a duplicated entry at reorder[ddIdx].
+                    // Example:  (x,y,z)->asList(x,y,z)
+                    // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1)
+                    // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0)
+                    // The starred element corresponds to the argument
+                    // deleted by the dupArgumentForm transform.
+                    int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos];
+                    boolean killFirst = false;
+                    for (int val; (val = reorder[--dstPos]) != dupVal; ) {
+                        // Set killFirst if the dup is larger than an intervening position.
+                        // This will remove at least one inversion from the permutation.
+                        if (dupVal > val) killFirst = true;
+                    }
+                    if (!killFirst) {
+                        srcPos = dstPos;
+                        dstPos = ddIdx;
+                    }
+                    form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos);
+                    assert (reorder[srcPos] == reorder[dstPos]);
+                    oldType = oldType.dropParameterTypes(dstPos, dstPos + 1);
+                    // contract the reordering by removing the element at dstPos
+                    int tailPos = dstPos + 1;
+                    System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos);
+                    reorder = Arrays.copyOf(reorder, reorder.length - 1);
+                } else {
+                    int dropVal = ~ddIdx, insPos = 0;
+                    while (insPos < reorder.length && reorder[insPos] < dropVal) {
+                        // Find first element of reorder larger than dropVal.
+                        // This is where we will insert the dropVal.
+                        insPos += 1;
+                    }
+                    Class<?> ptype = newType.parameterType(dropVal);
+                    form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype));
+                    oldType = oldType.insertParameterTypes(insPos, ptype);
+                    // expand the reordering by inserting an element at insPos
+                    int tailPos = insPos + 1;
+                    reorder = Arrays.copyOf(reorder, reorder.length + 1);
+                    System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos);
+                    reorder[insPos] = dropVal;
+                }
+                assert (permuteArgumentChecks(reorder, newType, oldType));
+            }
+            assert (reorder.length == newArity);  // a perfect permutation
+            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
+            form = form.editor().permuteArgumentsForm(1, reorder);
+            if (newType == result.type() && form == result.internalForm())
+                return result;
+            return result.copyWith(newType, form);
+        } else {
+            // first detect dropped arguments and handle them separately
+            MethodHandle originalTarget = target;
+            int newArity = newType.parameterCount();
+            for (int dropIdx; (dropIdx = findFirstDrop(reorder, newArity)) >= 0; ) {
+                // dropIdx is missing from reorder; add it in at the end
+                int oldArity = reorder.length;
+                target = dropArguments(target, oldArity, newType.parameterType(dropIdx));
+                reorder = Arrays.copyOf(reorder, oldArity + 1);
+                reorder[oldArity] = dropIdx;
+            }
+            assert(target == originalTarget || permuteArgumentChecks(reorder, newType, target.type()));
+            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
+            BoundMethodHandle result = target.rebind();
+            LambdaForm form = result.form.permuteArguments(1, reorder, basicTypes(newType.parameterList()));
+            return result.copyWith(newType, form);
+        }
     }
 
-    private static void checkReorder(int[] reorder, MethodType newType, MethodType oldType) {
+    /** Return the first value in [0..newArity-1] that is not present in reorder. */
+    private static int findFirstDrop(int[] reorder, int newArity) {
+        final int BIT_LIMIT = 63;  // max number of bits in bit mask
+        if (newArity < BIT_LIMIT) {
+            long mask = 0;
+            for (int arg : reorder) {
+                assert(arg < newArity);
+                mask |= (1L << arg);
+            }
+            if (mask == (1L << newArity) - 1) {
+                assert(Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity);
+                return -1;
+            }
+            // find first zero
+            long zeroBit = Long.lowestOneBit(~mask);
+            int zeroPos = Long.numberOfTrailingZeros(zeroBit);
+            assert(zeroPos < newArity);
+            return zeroPos;
+        } else {
+            BitSet mask = new BitSet(newArity);
+            for (int arg : reorder) {
+                assert (arg < newArity);
+                mask.set(arg);
+            }
+            int zeroPos = mask.nextClearBit(0);
+            assert(zeroPos <= newArity);
+            if (zeroPos == newArity)
+                return -1;
+            return zeroPos;
+        }
+    }
+
+    /**
+     * Return an indication of any duplicate or omission in reorder.
+     * If the reorder contains a duplicate entry, return the index of the second occurrence.
+     * Otherwise, return ~(n), for the first n in [0..newArity-1] that is not present in reorder.
+     * Otherwise, return zero.
+     * If an element not in [0..newArity-1] is encountered, return reorder.length.
+     */
+    private static int findFirstDupOrDrop(int[] reorder, int newArity) {
+        final int BIT_LIMIT = 63;  // max number of bits in bit mask
+        if (newArity < BIT_LIMIT) {
+            long mask = 0;
+            for (int i = 0; i < reorder.length; i++) {
+                int arg = reorder[i];
+                if (arg >= newArity) {
+                    return reorder.length;
+                }
+                long bit = 1L << arg;
+                if ((mask & bit) != 0) {
+                    return i;  // >0 indicates a dup
+                }
+                mask |= bit;
+            }
+            if (mask == (1L << newArity) - 1) {
+                assert(Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity);
+                return 0;
+            }
+            // find first zero
+            long zeroBit = Long.lowestOneBit(~mask);
+            int zeroPos = Long.numberOfTrailingZeros(zeroBit);
+            assert(zeroPos <= newArity);
+            if (zeroPos == newArity) {
+                return 0;
+            }
+            return ~zeroPos;
+        } else {
+            // same algorithm, different bit set
+            BitSet mask = new BitSet(newArity);
+            for (int i = 0; i < reorder.length; i++) {
+                int arg = reorder[i];
+                if (arg >= newArity) {
+                    return reorder.length;
+                }
+                if (mask.get(arg)) {
+                    return i;  // >0 indicates a dup
+                }
+                mask.set(arg);
+            }
+            int zeroPos = mask.nextClearBit(0);
+            assert(zeroPos <= newArity);
+            if (zeroPos == newArity) {
+                return 0;
+            }
+            return ~zeroPos;
+        }
+    }
+
+    private static boolean permuteArgumentChecks(int[] reorder, MethodType newType, MethodType oldType) {
         if (newType.returnType() != oldType.returnType())
             throw newIllegalArgumentException("return types do not match",
                     oldType, newType);
@@ -2106,7 +2289,7 @@
                     throw newIllegalArgumentException("parameter types do not match after reorder",
                             oldType, newType);
             }
-            if (!bad)  return;
+            if (!bad)  return true;
         }
         throw newIllegalArgumentException("bad reorder array: "+Arrays.toString(reorder));
     }
@@ -2132,9 +2315,14 @@
             if (type == void.class)
                 throw newIllegalArgumentException("void type");
             Wrapper w = Wrapper.forPrimitiveType(type);
-            return insertArguments(identity(type), 0, w.convert(value, type));
+            value = w.convert(value, type);
+            if (w.zero().equals(value))
+                return zero(w, type);
+            return insertArguments(identity(type), 0, value);
         } else {
-            return identity(type).bindTo(type.cast(value));
+            if (value == null)
+                return zero(Wrapper.OBJECT, type);
+            return identity(type).bindTo(value);
         }
     }
 
@@ -2147,14 +2335,48 @@
      */
     public static
     MethodHandle identity(Class<?> type) {
-        if (type == void.class)
-            throw newIllegalArgumentException("void type");
-        else if (type == Object.class)
-            return ValueConversions.identity();
-        else if (type.isPrimitive())
-            return ValueConversions.identity(Wrapper.forPrimitiveType(type));
-        else
-            return MethodHandleImpl.makeReferenceIdentity(type);
+        Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT);
+        int pos = btw.ordinal();
+        MethodHandle ident = IDENTITY_MHS[pos];
+        if (ident == null) {
+            ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType()));
+        }
+        if (ident.type().returnType() == type)
+            return ident;
+        // something like identity(Foo.class); do not bother to intern these
+        assert(btw == Wrapper.OBJECT);
+        return makeIdentity(type);
+    }
+    private static final MethodHandle[] IDENTITY_MHS = new MethodHandle[Wrapper.values().length];
+    private static MethodHandle makeIdentity(Class<?> ptype) {
+        MethodType mtype = MethodType.methodType(ptype, ptype);
+        LambdaForm lform = LambdaForm.identityForm(BasicType.basicType(ptype));
+        return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.IDENTITY);
+    }
+
+    private static MethodHandle zero(Wrapper btw, Class<?> rtype) {
+        int pos = btw.ordinal();
+        MethodHandle zero = ZERO_MHS[pos];
+        if (zero == null) {
+            zero = setCachedMethodHandle(ZERO_MHS, pos, makeZero(btw.primitiveType()));
+        }
+        if (zero.type().returnType() == rtype)
+            return zero;
+        assert(btw == Wrapper.OBJECT);
+        return makeZero(rtype);
+    }
+    private static final MethodHandle[] ZERO_MHS = new MethodHandle[Wrapper.values().length];
+    private static MethodHandle makeZero(Class<?> rtype) {
+        MethodType mtype = MethodType.methodType(rtype);
+        LambdaForm lform = LambdaForm.zeroForm(BasicType.basicType(rtype));
+        return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.ZERO);
+    }
+
+    synchronized private static MethodHandle setCachedMethodHandle(MethodHandle[] cache, int pos, MethodHandle value) {
+        // Simulate a CAS, to avoid racy duplication of results.
+        MethodHandle prev = cache[pos];
+        if (prev != null) return prev;
+        return cache[pos] = value;
     }
 
     /**
@@ -2190,6 +2412,37 @@
     public static
     MethodHandle insertArguments(MethodHandle target, int pos, Object... values) {
         int insCount = values.length;
+        Class<?>[] ptypes = insertArgumentsChecks(target, insCount, pos);
+        if (insCount == 0)  return target;
+        BoundMethodHandle result = target.rebind();
+        for (int i = 0; i < insCount; i++) {
+            Object value = values[i];
+            Class<?> ptype = ptypes[pos+i];
+            if (ptype.isPrimitive()) {
+                result = insertArgumentPrimitive(result, pos, ptype, value);
+            } else {
+                value = ptype.cast(value);  // throw CCE if needed
+                result = result.bindArgumentL(pos, value);
+            }
+        }
+        return result;
+    }
+
+    private static BoundMethodHandle insertArgumentPrimitive(BoundMethodHandle result, int pos,
+                                                             Class<?> ptype, Object value) {
+        Wrapper w = Wrapper.forPrimitiveType(ptype);
+        // perform unboxing and/or primitive conversion
+        value = w.convert(value, ptype);
+        switch (w) {
+        case INT:     return result.bindArgumentI(pos, (int)value);
+        case LONG:    return result.bindArgumentJ(pos, (long)value);
+        case FLOAT:   return result.bindArgumentF(pos, (float)value);
+        case DOUBLE:  return result.bindArgumentD(pos, (double)value);
+        default:      return result.bindArgumentI(pos, ValueConversions.widenSubword(value));
+        }
+    }
+
+    private static Class<?>[] insertArgumentsChecks(MethodHandle target, int insCount, int pos) throws RuntimeException {
         MethodType oldType = target.type();
         int outargs = oldType.parameterCount();
         int inargs  = outargs - insCount;
@@ -2197,31 +2450,7 @@
             throw newIllegalArgumentException("too many values to insert");
         if (pos < 0 || pos > inargs)
             throw newIllegalArgumentException("no argument type to append");
-        MethodHandle result = target;
-        for (int i = 0; i < insCount; i++) {
-            Object value = values[i];
-            Class<?> ptype = oldType.parameterType(pos+i);
-            if (ptype.isPrimitive()) {
-                char btype = 'I';
-                Wrapper w = Wrapper.forPrimitiveType(ptype);
-                switch (w) {
-                case LONG:    btype = 'J'; break;
-                case FLOAT:   btype = 'F'; break;
-                case DOUBLE:  btype = 'D'; break;
-                }
-                // perform unboxing and/or primitive conversion
-                value = w.convert(value, ptype);
-                result = result.bindArgument(pos, btype, value);
-                continue;
-            }
-            value = ptype.cast(value);  // throw CCE if needed
-            if (pos == 0) {
-                result = result.bindReceiver(value);
-            } else {
-                result = result.bindArgument(pos, 'L', value);
-            }
-        }
-        return result;
+        return oldType.ptypes();
     }
 
     /**
@@ -2269,18 +2498,33 @@
     public static
     MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
         MethodType oldType = target.type();  // get NPE
+        int dropped = dropArgumentChecks(oldType, pos, valueTypes);
+        MethodType newType = oldType.insertParameterTypes(pos, valueTypes);
+        if (dropped == 0)  return target;
+        BoundMethodHandle result = target.rebind();
+        LambdaForm lform = result.form;
+        if (USE_LAMBDA_FORM_EDITOR) {
+            int insertFormArg = 1 + pos;
+            for (Class<?> ptype : valueTypes) {
+                lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype));
+            }
+        } else {
+            lform = lform.addArguments(pos, valueTypes);
+        }
+        result = result.copyWith(newType, lform);
+        return result;
+    }
+
+    private static int dropArgumentChecks(MethodType oldType, int pos, List<Class<?>> valueTypes) {
         int dropped = valueTypes.size();
         MethodType.checkSlotCount(dropped);
-        if (dropped == 0)  return target;
         int outargs = oldType.parameterCount();
         int inargs  = outargs + dropped;
-        if (pos < 0 || pos >= inargs)
-            throw newIllegalArgumentException("no argument type to remove");
-        ArrayList<Class<?>> ptypes = new ArrayList<>(oldType.parameterList());
-        ptypes.addAll(pos, valueTypes);
-        if (ptypes.size() != inargs)  throw newIllegalArgumentException("valueTypes");
-        MethodType newType = MethodType.methodType(oldType.returnType(), ptypes);
-        return target.dropArguments(newType, pos, dropped);
+        if (pos < 0 || pos > outargs)
+            throw newIllegalArgumentException("no argument type to remove"
+                    + Arrays.asList(oldType, pos, valueTypes, inargs, outargs)
+                    );
+        return dropped;
     }
 
     /**
@@ -2402,32 +2646,47 @@
      */
     public static
     MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
-        MethodType targetType = target.type();
+        filterArgumentsCheckArity(target, pos, filters);
         MethodHandle adapter = target;
-        MethodType adapterType = null;
-        assert((adapterType = targetType) != null);
-        int maxPos = targetType.parameterCount();
-        if (pos + filters.length > maxPos)
-            throw newIllegalArgumentException("too many filters");
         int curPos = pos-1;  // pre-incremented
         for (MethodHandle filter : filters) {
             curPos += 1;
             if (filter == null)  continue;  // ignore null elements of filters
             adapter = filterArgument(adapter, curPos, filter);
-            assert((adapterType = adapterType.changeParameterType(curPos, filter.type().parameterType(0))) != null);
         }
-        assert(adapterType.equals(adapter.type()));
         return adapter;
     }
 
     /*non-public*/ static
     MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) {
+        filterArgumentChecks(target, pos, filter);
+        if (USE_LAMBDA_FORM_EDITOR) {
+            MethodType targetType = target.type();
+            MethodType filterType = filter.type();
+            BoundMethodHandle result = target.rebind();
+            Class<?> newParamType = filterType.parameterType(0);
+            LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType));
+            MethodType newType = targetType.changeParameterType(pos, newParamType);
+            result = result.copyWithExtendL(newType, lform, filter);
+            return result;
+        } else {
+            return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
+        }
+    }
+
+    private static void filterArgumentsCheckArity(MethodHandle target, int pos, MethodHandle[] filters) {
+        MethodType targetType = target.type();
+        int maxPos = targetType.parameterCount();
+        if (pos + filters.length > maxPos)
+            throw newIllegalArgumentException("too many filters");
+    }
+
+    private static void filterArgumentChecks(MethodHandle target, int pos, MethodHandle filter) throws RuntimeException {
         MethodType targetType = target.type();
         MethodType filterType = filter.type();
         if (filterType.parameterCount() != 1
             || filterType.returnType() != targetType.parameterType(pos))
             throw newIllegalArgumentException("target and filter types do not match", targetType, filterType);
-        return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
     }
 
     /**
@@ -2538,12 +2797,36 @@
      */
     public static
     MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) {
+        MethodType newType = collectArgumentsChecks(target, pos, filter);
+        if (USE_LAMBDA_FORM_EDITOR) {
+            MethodType collectorType = filter.type();
+            BoundMethodHandle result = target.rebind();
+            LambdaForm lform;
+            if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) {
+                lform = result.editor().collectArgumentArrayForm(1 + pos, filter);
+                if (lform != null) {
+                    return result.copyWith(newType, lform);
+                }
+            }
+            lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType());
+            return result.copyWithExtendL(newType, lform, filter);
+        } else {
+            return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
+        }
+    }
+
+    private static MethodType collectArgumentsChecks(MethodHandle target, int pos, MethodHandle filter) throws RuntimeException {
         MethodType targetType = target.type();
         MethodType filterType = filter.type();
-        if (filterType.returnType() != void.class &&
-            filterType.returnType() != targetType.parameterType(pos))
+        Class<?> rtype = filterType.returnType();
+        List<Class<?>> filterArgs = filterType.parameterList();
+        if (rtype == void.class) {
+            return targetType.insertParameterTypes(pos, filterArgs);
+        }
+        if (rtype != targetType.parameterType(pos)) {
             throw newIllegalArgumentException("target and filter types do not match", targetType, filterType);
-        return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
+        }
+        return targetType.dropParameterTypes(pos, pos+1).insertParameterTypes(pos, filterArgs);
     }
 
     /**
@@ -2607,15 +2890,26 @@
     MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
         MethodType targetType = target.type();
         MethodType filterType = filter.type();
+        filterReturnValueChecks(targetType, filterType);
+        if (USE_LAMBDA_FORM_EDITOR) {
+            BoundMethodHandle result = target.rebind();
+            BasicType rtype = BasicType.basicType(filterType.returnType());
+            LambdaForm lform = result.editor().filterReturnForm(rtype, false);
+            MethodType newType = targetType.changeReturnType(filterType.returnType());
+            result = result.copyWithExtendL(newType, lform, filter);
+            return result;
+        } else {
+            return MethodHandleImpl.makeCollectArguments(filter, target, 0, false);
+        }
+    }
+
+    private static void filterReturnValueChecks(MethodType targetType, MethodType filterType) throws RuntimeException {
         Class<?> rtype = targetType.returnType();
         int filterValues = filterType.parameterCount();
         if (filterValues == 0
                 ? (rtype != void.class)
                 : (rtype != filterType.parameterType(0)))
-            throw newIllegalArgumentException("target and filter types do not match", target, filter);
-        // result = fold( lambda(retval, arg...) { filter(retval) },
-        //                lambda(        arg...) { target(arg...) } )
-        return MethodHandleImpl.makeCollectArguments(filter, target, 0, false);
+            throw newIllegalArgumentException("target and filter types do not match", targetType, filterType);
     }
 
     /**
@@ -2696,24 +2990,40 @@
      */
     public static
     MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) {
-        int pos = 0;
+        int foldPos = 0;
         MethodType targetType = target.type();
         MethodType combinerType = combiner.type();
-        int foldPos = pos;
-        int foldArgs = combinerType.parameterCount();
-        int foldVals = combinerType.returnType() == void.class ? 0 : 1;
+        Class<?> rtype = foldArgumentChecks(foldPos, targetType, combinerType);
+        if (USE_LAMBDA_FORM_EDITOR) {
+            BoundMethodHandle result = target.rebind();
+            boolean dropResult = (rtype == void.class);
+            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
+            LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType());
+            MethodType newType = targetType;
+            if (!dropResult)
+                newType = newType.dropParameterTypes(foldPos, foldPos + 1);
+            result = result.copyWithExtendL(newType, lform, combiner);
+            return result;
+        } else {
+            return MethodHandleImpl.makeCollectArguments(target, combiner, foldPos, true);
+        }
+    }
+
+    private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) {
+        int foldArgs   = combinerType.parameterCount();
+        Class<?> rtype = combinerType.returnType();
+        int foldVals = rtype == void.class ? 0 : 1;
         int afterInsertPos = foldPos + foldVals;
         boolean ok = (targetType.parameterCount() >= afterInsertPos + foldArgs);
         if (ok && !(combinerType.parameterList()
                     .equals(targetType.parameterList().subList(afterInsertPos,
                                                                afterInsertPos + foldArgs))))
             ok = false;
-        if (ok && foldVals != 0 && !combinerType.returnType().equals(targetType.parameterType(0)))
+        if (ok && foldVals != 0 && combinerType.returnType() != targetType.parameterType(0))
             ok = false;
         if (!ok)
             throw misMatchedTypes("target and combiner types", targetType, combinerType);
-        MethodType newType = targetType.dropParameterTypes(foldPos, afterInsertPos);
-        return MethodHandleImpl.makeCollectArguments(target, combiner, foldPos, true);
+        return rtype;
     }
 
     /**
diff --git a/src/share/classes/java/lang/invoke/MethodType.java b/src/share/classes/java/lang/invoke/MethodType.java
index 08c17d7..c1b9848 100644
--- a/src/share/classes/java/lang/invoke/MethodType.java
+++ b/src/share/classes/java/lang/invoke/MethodType.java
@@ -466,6 +466,75 @@
         return dropParameterTypes(start, end).insertParameterTypes(start, ptypesToInsert);
     }
 
+    /** Replace the last arrayLength parameter types with the component type of arrayType.
+     * @param arrayType any array type
+     * @param arrayLength the number of parameter types to change
+     * @return the resulting type
+     */
+    /*non-public*/ MethodType asSpreaderType(Class<?> arrayType, int arrayLength) {
+        assert(parameterCount() >= arrayLength);
+        int spreadPos = ptypes.length - arrayLength;
+        if (arrayLength == 0)  return this;  // nothing to change
+        if (arrayType == Object[].class) {
+            if (isGeneric())  return this;  // nothing to change
+            if (spreadPos == 0) {
+                // no leading arguments to preserve; go generic
+                MethodType res = genericMethodType(arrayLength);
+                if (rtype != Object.class) {
+                    res = res.changeReturnType(rtype);
+                }
+                return res;
+            }
+        }
+        Class<?> elemType = arrayType.getComponentType();
+        assert(elemType != null);
+        for (int i = spreadPos; i < ptypes.length; i++) {
+            if (ptypes[i] != elemType) {
+                Class<?>[] fixedPtypes = ptypes.clone();
+                Arrays.fill(fixedPtypes, i, ptypes.length, elemType);
+                return methodType(rtype, fixedPtypes);
+            }
+        }
+        return this;  // arguments check out; no change
+    }
+
+    /** Return the leading parameter type, which must exist and be a reference.
+     *  @return the leading parameter type, after error checks
+     */
+    /*non-public*/ Class<?> leadingReferenceParameter() {
+        Class<?> ptype;
+        if (ptypes.length == 0 ||
+            (ptype = ptypes[0]).isPrimitive())
+            throw newIllegalArgumentException("no leading reference parameter");
+        return ptype;
+    }
+
+    /** Delete the last parameter type and replace it with arrayLength copies of the component type of arrayType.
+     * @param arrayType any array type
+     * @param arrayLength the number of parameter types to insert
+     * @return the resulting type
+     */
+    /*non-public*/ MethodType asCollectorType(Class<?> arrayType, int arrayLength) {
+        assert(parameterCount() >= 1);
+        assert(lastParameterType().isAssignableFrom(arrayType));
+        MethodType res;
+        if (arrayType == Object[].class) {
+            res = genericMethodType(arrayLength);
+            if (rtype != Object.class) {
+                res = res.changeReturnType(rtype);
+            }
+        } else {
+            Class<?> elemType = arrayType.getComponentType();
+            assert(elemType != null);
+            res = methodType(rtype, Collections.nCopies(arrayLength, elemType));
+        }
+        if (ptypes.length == 1) {
+            return res;
+        } else {
+            return res.insertParameterTypes(0, parameterList().subList(0, ptypes.length-1));
+        }
+    }
+
     /**
      * Finds or creates a method type with some parameter types omitted.
      * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
@@ -573,6 +642,10 @@
         return genericMethodType(parameterCount());
     }
 
+    /*non-public*/ boolean isGeneric() {
+        return this == erase() && !hasPrimitives();
+    }
+
     /**
      * Converts all primitive types to their corresponding wrapper types.
      * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
@@ -728,44 +801,127 @@
         return sb.toString();
     }
 
-
+    /** True if the old return type can always be viewed (w/o casting) under new return type,
+     *  and the new parameters can be viewed (w/o casting) under the old parameter types.
+     */
     /*non-public*/
-    boolean isViewableAs(MethodType newType) {
-        if (!VerifyType.isNullConversion(returnType(), newType.returnType()))
+    boolean isViewableAs(MethodType newType, boolean keepInterfaces) {
+        if (!VerifyType.isNullConversion(returnType(), newType.returnType(), keepInterfaces))
             return false;
+        return parametersAreViewableAs(newType, keepInterfaces);
+    }
+    /** True if the new parameters can be viewed (w/o casting) under the old parameter types. */
+    /*non-public*/
+    boolean parametersAreViewableAs(MethodType newType, boolean keepInterfaces) {
+        if (form == newType.form && form.erasedType == this)
+            return true;  // my reference parameters are all Object
+        if (ptypes == newType.ptypes)
+            return true;
         int argc = parameterCount();
         if (argc != newType.parameterCount())
             return false;
         for (int i = 0; i < argc; i++) {
-            if (!VerifyType.isNullConversion(newType.parameterType(i), parameterType(i)))
+            if (!VerifyType.isNullConversion(newType.parameterType(i), parameterType(i), keepInterfaces))
                 return false;
         }
         return true;
     }
     /*non-public*/
-    boolean isCastableTo(MethodType newType) {
-        int argc = parameterCount();
-        if (argc != newType.parameterCount())
-            return false;
-        return true;
-    }
-    /*non-public*/
     boolean isConvertibleTo(MethodType newType) {
+        MethodTypeForm oldForm = this.form();
+        MethodTypeForm newForm = newType.form();
+        if (oldForm == newForm)
+            // same parameter count, same primitive/object mix
+            return true;
         if (!canConvert(returnType(), newType.returnType()))
             return false;
-        int argc = parameterCount();
-        if (argc != newType.parameterCount())
+        Class<?>[] srcTypes = newType.ptypes;
+        Class<?>[] dstTypes = ptypes;
+        if (srcTypes == dstTypes)
+            return true;
+        int argc;
+        if ((argc = srcTypes.length) != dstTypes.length)
             return false;
-        for (int i = 0; i < argc; i++) {
-            if (!canConvert(newType.parameterType(i), parameterType(i)))
+        if (argc <= 1) {
+            if (argc == 1 && !canConvert(srcTypes[0], dstTypes[0]))
                 return false;
+            return true;
+        }
+        if ((oldForm.primitiveParameterCount() == 0 && oldForm.erasedType == this) ||
+            (newForm.primitiveParameterCount() == 0 && newForm.erasedType == newType)) {
+            // Somewhat complicated test to avoid a loop of 2 or more trips.
+            // If either type has only Object parameters, we know we can convert.
+            assert(canConvertParameters(srcTypes, dstTypes));
+            return true;
+        }
+        return canConvertParameters(srcTypes, dstTypes);
+    }
+
+    /** Returns true if MHs.explicitCastArguments produces the same result as MH.asType.
+     *  If the type conversion is impossible for either, the result should be false.
+     */
+    /*non-public*/
+    boolean explicitCastEquivalentToAsType(MethodType newType) {
+        if (this == newType)  return true;
+        if (!explicitCastEquivalentToAsType(rtype, newType.rtype)) {
+            return false;
+        }
+        Class<?>[] srcTypes = newType.ptypes;
+        Class<?>[] dstTypes = ptypes;
+        if (dstTypes == srcTypes) {
+            return true;
+        }
+        assert(dstTypes.length == srcTypes.length);
+        for (int i = 0; i < dstTypes.length; i++) {
+            if (!explicitCastEquivalentToAsType(srcTypes[i], dstTypes[i])) {
+                return false;
+            }
         }
         return true;
     }
+
+    /** Reports true if the src can be converted to the dst, by both asType and MHs.eCE,
+     *  and with the same effect.
+     *  MHs.eCA has the following "upgrades" to MH.asType:
+     *  1. interfaces are unchecked (that is, treated as if aliased to Object)
+     *     Therefore, {@code Object->CharSequence} is possible in both cases but has different semantics
+     *  2. the full matrix of primitive-to-primitive conversions is supported
+     *     Narrowing like {@code long->byte} and basic-typing like {@code boolean->int}
+     *     are not supported by asType, but anything supported by asType is equivalent
+     *     with MHs.eCE.
+     *  3a. unboxing conversions can be followed by the full matrix of primitive conversions
+     *  3b. unboxing of null is permitted (creates a zero primitive value)
+     * Other than interfaces, reference-to-reference conversions are the same.
+     * Boxing primitives to references is the same for both operators.
+     */
+    private static boolean explicitCastEquivalentToAsType(Class<?> src, Class<?> dst) {
+        if (src == dst || dst == Object.class || dst == void.class)  return true;
+        if (src.isPrimitive()) {
+            // Could be a prim/prim conversion, where casting is a strict superset.
+            // Or a boxing conversion, which is always to an exact wrapper class.
+            return canConvert(src, dst);
+        } else if (dst.isPrimitive()) {
+            // Unboxing behavior is different between MHs.eCA & MH.asType (see 3b).
+            return false;
+        } else {
+            // R->R always works, but we have to avoid a check-cast to an interface.
+            return !dst.isInterface() || dst.isAssignableFrom(src);
+        }
+    }
+
+    private boolean canConvertParameters(Class<?>[] srcTypes, Class<?>[] dstTypes) {
+        for (int i = 0; i < srcTypes.length; i++) {
+            if (!canConvert(srcTypes[i], dstTypes[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     /*non-public*/
     static boolean canConvert(Class<?> src, Class<?> dst) {
         // short-circuit a few cases:
-        if (src == dst || dst == Object.class)  return true;
+        if (src == dst || src == Object.class || dst == Object.class)  return true;
         // the remainder of this logic is documented in MethodHandle.asType
         if (src.isPrimitive()) {
             // can force void to an explicit null, a la reflect.Method.invoke
@@ -907,7 +1063,7 @@
         if (!descriptor.startsWith("(") ||  // also generates NPE if needed
             descriptor.indexOf(')') < 0 ||
             descriptor.indexOf('.') >= 0)
-            throw new IllegalArgumentException("not a method descriptor: "+descriptor);
+            throw newIllegalArgumentException("not a method descriptor: "+descriptor);
         List<Class<?>> types = BytecodeDescriptor.parseMethod(descriptor, loader);
         Class<?> rtype = types.remove(types.size() - 1);
         checkSlotCount(types.size());
diff --git a/src/share/classes/java/lang/invoke/MethodTypeForm.java b/src/share/classes/java/lang/invoke/MethodTypeForm.java
index d34a299..43e8558 100644
--- a/src/share/classes/java/lang/invoke/MethodTypeForm.java
+++ b/src/share/classes/java/lang/invoke/MethodTypeForm.java
@@ -47,15 +47,17 @@
     final int[] argToSlotTable, slotToArgTable;
     final long argCounts;               // packed slot & value counts
     final long primCounts;              // packed prim & double counts
-    final int vmslots;                  // total number of parameter slots
     final MethodType erasedType;        // the canonical erasure
     final MethodType basicType;         // the canonical erasure, with primitives simplified
 
     // Cached adapter information:
-    @Stable String typeString;           // argument type signature characters
-    @Stable MethodHandle genericInvoker; // JVM hook for inexact invoke
-    @Stable MethodHandle basicInvoker;   // cached instance of MH.invokeBasic
-    @Stable MethodHandle namedFunctionInvoker; // cached helper for LF.NamedFunction
+    @Stable final MethodHandle[] methodHandles;
+    // Indexes into methodHandles:
+    static final int
+            MH_BASIC_INV      =  0,  // cached instance of MH.invokeBasic
+            MH_NF_INV         =  1,  // cached helper for LF.NamedFunction
+            MH_UNINIT_CS      =  2,  // uninitialized call site
+            MH_LIMIT          =  3;
 
     // Cached lambda form information, for basic types only:
     final @Stable LambdaForm[] lambdaForms;
@@ -68,26 +70,55 @@
             LF_INVINTERFACE   =  4,
             LF_INVSTATIC_INIT =  5,  // DMH invokeStatic with <clinit> barrier
             LF_INTERPRET      =  6,  // LF interpreter
-            LF_COUNTER        =  7,  // CMH wrapper
-            LF_REINVOKE       =  8,  // other wrapper
-            LF_EX_LINKER      =  9,  // invokeExact_MT
-            LF_EX_INVOKER     = 10,  // invokeExact MH
-            LF_GEN_LINKER     = 11,
-            LF_GEN_INVOKER    = 12,
+            LF_REBIND         =  7,  // BoundMethodHandle
+            LF_DELEGATE       =  8,  // DelegatingMethodHandle
+            LF_EX_LINKER      =  9,  // invokeExact_MT (for invokehandle)
+            LF_EX_INVOKER     = 10,  // MHs.invokeExact
+            LF_GEN_LINKER     = 11,  // generic invoke_MT (for invokehandle)
+            LF_GEN_INVOKER    = 12,  // generic MHs.invoke
             LF_CS_LINKER      = 13,  // linkToCallSite_CS
             LF_MH_LINKER      = 14,  // linkToCallSite_MH
-            LF_GWC            = 15,
-            LF_LIMIT          = 16;
+            LF_GWC            = 15,  // guardWithCatch (catchException)
+            LF_GWT            = 16,  // guardWithTest
+            LF_LIMIT          = 17;
 
+    /** Return the type corresponding uniquely (1-1) to this MT-form.
+     *  It might have any primitive returns or arguments, but will have no references except Object.
+     */
     public MethodType erasedType() {
         return erasedType;
     }
 
+    /** Return the basic type derived from the erased type of this MT-form.
+     *  A basic type is erased (all references Object) and also has all primitive
+     *  types (except int, long, float, double, void) normalized to int.
+     *  Such basic types correspond to low-level JVM calling sequences.
+     */
     public MethodType basicType() {
         return basicType;
     }
 
+    private boolean assertIsBasicType() {
+        // primitives must be flattened also
+        assert(erasedType == basicType)
+                : "erasedType: " + erasedType + " != basicType: " + basicType;
+        return true;
+    }
+
+    public MethodHandle cachedMethodHandle(int which) {
+        assert(assertIsBasicType());
+        return methodHandles[which];
+    }
+
+    synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) {
+        // Simulate a CAS, to avoid racy duplication of results.
+        MethodHandle prev = methodHandles[which];
+        if (prev != null)  return prev;
+        return methodHandles[which] = mh;
+    }
+
     public LambdaForm cachedLambdaForm(int which) {
+        assert(assertIsBasicType());
         return lambdaForms[which];
     }
 
@@ -98,28 +129,6 @@
         return lambdaForms[which] = form;
     }
 
-    public MethodHandle basicInvoker() {
-        assert(erasedType == basicType) : "erasedType: " + erasedType + " != basicType: " + basicType;  // primitives must be flattened also
-        MethodHandle invoker = basicInvoker;
-        if (invoker != null)  return invoker;
-        invoker = DirectMethodHandle.make(invokeBasicMethod(basicType));
-        basicInvoker = invoker;
-        return invoker;
-    }
-
-    // This next one is called from LambdaForm.NamedFunction.<init>.
-    /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
-        assert(basicType == basicType.basicType());
-        try {
-            // Do approximately the same as this public API call:
-            //   Lookup.findVirtual(MethodHandle.class, name, type);
-            // But bypass access and corner case checks, since we know exactly what we need.
-            return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, "invokeBasic", basicType);
-         } catch (ReflectiveOperationException ex) {
-            throw newInternalError("JVM cannot find invoker for "+basicType, ex);
-        }
-    }
-
     /**
      * Build an MTF for a given type, which must have all references erased to Object.
      * This MTF will stand for that type and all un-erased variations.
@@ -172,6 +181,16 @@
             this.basicType = erasedType;
         } else {
             this.basicType = MethodType.makeImpl(bt, bpts, true);
+            // fill in rest of data from the basic type:
+            MethodTypeForm that = this.basicType.form();
+            assert(this != that);
+            this.primCounts = that.primCounts;
+            this.argCounts = that.argCounts;
+            this.argToSlotTable = that.argToSlotTable;
+            this.slotToArgTable = that.slotToArgTable;
+            this.methodHandles = null;
+            this.lambdaForms = null;
+            return;
         }
         if (lac != 0) {
             int slot = ptypeCount + lac;
@@ -187,10 +206,14 @@
                 argToSlotTab[1+i]  = slot;
             }
             assert(slot == 0);  // filled the table
-        }
-        this.primCounts = pack(lrc, prc, lac, pac);
-        this.argCounts = pack(rslotCount, rtypeCount, pslotCount, ptypeCount);
-        if (slotToArgTab == null) {
+        } else if (pac != 0) {
+            // have primitives but no long primitives; share slot counts with generic
+            assert(ptypeCount == pslotCount);
+            MethodTypeForm that = MethodType.genericMethodType(ptypeCount).form();
+            assert(this != that);
+            slotToArgTab = that.slotToArgTable;
+            argToSlotTab = that.argToSlotTable;
+        } else {
             int slot = ptypeCount; // first arg is deepest in stack
             slotToArgTab = new int[slot+1];
             argToSlotTab = new int[1+ptypeCount];
@@ -201,19 +224,17 @@
                 argToSlotTab[1+i]  = slot;
             }
         }
+        this.primCounts = pack(lrc, prc, lac, pac);
+        this.argCounts = pack(rslotCount, rtypeCount, pslotCount, ptypeCount);
         this.argToSlotTable = argToSlotTab;
         this.slotToArgTable = slotToArgTab;
 
         if (pslotCount >= 256)  throw newIllegalArgumentException("too many arguments");
 
-        // send a few bits down to the JVM:
-        this.vmslots = parameterSlotCount();
-
-        if (basicType == erasedType) {
-            lambdaForms = new LambdaForm[LF_LIMIT];
-        } else {
-            lambdaForms = null;  // could be basicType.form().lambdaForms;
-        }
+        // Initialize caches, but only for basic types
+        assert(basicType == erasedType);
+        this.lambdaForms = new LambdaForm[LF_LIMIT];
+        this.methodHandles = new MethodHandle[MH_LIMIT];
     }
 
     private static long pack(int a, int b, int c, int d) {
@@ -300,7 +321,7 @@
      */
     public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) {
         Class<?>[] ptypes = mt.ptypes();
-        Class<?>[] ptc = MethodTypeForm.canonicalizes(ptypes, howArgs);
+        Class<?>[] ptc = MethodTypeForm.canonicalizeAll(ptypes, howArgs);
         Class<?> rtype = mt.returnType();
         Class<?> rtc = MethodTypeForm.canonicalize(rtype, howRet);
         if (ptc == null && rtc == null) {
@@ -368,7 +389,7 @@
     /** Canonicalize each param type in the given array.
      *  Return null if all types are already canonicalized.
      */
-    static Class<?>[] canonicalizes(Class<?>[] ts, int how) {
+    static Class<?>[] canonicalizeAll(Class<?>[] ts, int how) {
         Class<?>[] cs = null;
         for (int imax = ts.length, i = 0; i < imax; i++) {
             Class<?> c = canonicalize(ts[i], how);
diff --git a/src/share/classes/java/lang/invoke/SimpleMethodHandle.java b/src/share/classes/java/lang/invoke/SimpleMethodHandle.java
index c2d8e58..c9e37a8 100644
--- a/src/share/classes/java/lang/invoke/SimpleMethodHandle.java
+++ b/src/share/classes/java/lang/invoke/SimpleMethodHandle.java
@@ -25,46 +25,77 @@
 
 package java.lang.invoke;
 
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleStatics.*;
 
 /**
  * A method handle whose behavior is determined only by its LambdaForm.
  * @author jrose
  */
-final class SimpleMethodHandle extends MethodHandle {
+final class SimpleMethodHandle extends BoundMethodHandle {
     private SimpleMethodHandle(MethodType type, LambdaForm form) {
         super(type, form);
     }
 
-    /*non-public*/ static SimpleMethodHandle make(MethodType type, LambdaForm form) {
+    /*non-public*/ static BoundMethodHandle make(MethodType type, LambdaForm form) {
         return new SimpleMethodHandle(type, form);
     }
 
-    @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
-        MethodType type2 = type().dropParameterTypes(pos, pos+1);
-        LambdaForm form2 = internalForm().bind(1+pos, BoundMethodHandle.SpeciesData.EMPTY);
-        return BoundMethodHandle.bindSingle(type2, form2, basicType, value);
+    /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.EMPTY;
+
+    /*non-public*/ public SpeciesData speciesData() {
+            return SPECIES_DATA;
     }
 
     @Override
-    MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
-        LambdaForm newForm = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos+drops));
-        return new SimpleMethodHandle(srcType, newForm);
+    /*non-public*/ BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
+        return make(mt, lf);
     }
 
     @Override
-    MethodHandle permuteArguments(MethodType newType, int[] reorder) {
-        LambdaForm form2 = internalForm().permuteArguments(1, reorder, basicTypes(newType.parameterList()));
-        return new SimpleMethodHandle(newType, form2);
+    String internalProperties() {
+        return "\n& Class="+getClass().getSimpleName();
     }
 
     @Override
-    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
-        return new SimpleMethodHandle(mt, lf);
+    /*non-public*/ public int fieldCount() {
+        return 0;
     }
 
+    @Override
+    /*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
+        return BoundMethodHandle.bindSingle(mt, lf, narg); // Use known fast path.
+    }
+    @Override
+    /*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
+        try {
+            return (BoundMethodHandle) SPECIES_DATA.extendWith(I_TYPE).constructor().invokeBasic(mt, lf, narg);
+        } catch (Throwable ex) {
+            throw uncaughtException(ex);
+        }
+    }
+    @Override
+    /*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
+        try {
+            return (BoundMethodHandle) SPECIES_DATA.extendWith(J_TYPE).constructor().invokeBasic(mt, lf, narg);
+        } catch (Throwable ex) {
+            throw uncaughtException(ex);
+        }
+    }
+    @Override
+    /*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
+        try {
+            return (BoundMethodHandle) SPECIES_DATA.extendWith(F_TYPE).constructor().invokeBasic(mt, lf, narg);
+        } catch (Throwable ex) {
+            throw uncaughtException(ex);
+        }
+    }
+    @Override
+    /*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
+        try {
+            return (BoundMethodHandle) SPECIES_DATA.extendWith(D_TYPE).constructor().invokeBasic(mt, lf, narg);
+        } catch (Throwable ex) {
+            throw uncaughtException(ex);
+        }
+    }
 }
diff --git a/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java b/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java
index aecbeb6..6bfbf6b 100644
--- a/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java
+++ b/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java
@@ -158,19 +158,19 @@
         visitMethodInsn(Opcodes.INVOKESTATIC,
                 wrapperName(w),
                 NAME_BOX_METHOD,
-                boxingDescriptor(w));
+                boxingDescriptor(w), false);
     }
 
     /**
      * Convert types by unboxing. The source type is known to be a primitive wrapper.
-     * @param ws A primitive wrapper corresponding to wrapped reference source type
+     * @param sname A primitive wrapper corresponding to wrapped reference source type
      * @param wt A primitive wrapper being converted to
      */
     void unbox(String sname, Wrapper wt) {
         visitMethodInsn(Opcodes.INVOKEVIRTUAL,
                 sname,
                 unboxMethod(wt),
-                unboxingDescriptor(wt));
+                unboxingDescriptor(wt), false);
     }
 
     private String descriptorToName(String desc) {
diff --git a/src/share/classes/java/lang/management/ManagementFactory.java b/src/share/classes/java/lang/management/ManagementFactory.java
index 0c7297a..c444713 100644
--- a/src/share/classes/java/lang/management/ManagementFactory.java
+++ b/src/share/classes/java/lang/management/ManagementFactory.java
@@ -52,6 +52,7 @@
 import java.security.PrivilegedExceptionAction;
 import javax.management.JMX;
 import sun.management.ManagementFactoryHelper;
+import sun.management.ExtendedPlatformComponent;
 
 /**
  * The {@code ManagementFactory} class is a factory class for getting
@@ -489,6 +490,12 @@
             for (Map.Entry<ObjectName, DynamicMBean> e : dynmbeans.entrySet()) {
                 addDynamicMBean(platformMBeanServer, e.getValue(), e.getKey());
             }
+            for (final PlatformManagedObject o :
+                                       ExtendedPlatformComponent.getMXBeans()) {
+                if (!platformMBeanServer.isRegistered(o.getObjectName())) {
+                    addMXBean(platformMBeanServer, o);
+                }
+            }
         }
         return platformMBeanServer;
     }
@@ -655,9 +662,14 @@
     public static <T extends PlatformManagedObject>
             T getPlatformMXBean(Class<T> mxbeanInterface) {
         PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
-        if (pc == null)
+        if (pc == null) {
+            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
+            if (mbean != null) {
+                return mbean;
+            }
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " is not a platform management interface");
+        }
         if (!pc.isSingleton())
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " can have zero or more than one instances");
@@ -690,9 +702,14 @@
     public static <T extends PlatformManagedObject> List<T>
             getPlatformMXBeans(Class<T> mxbeanInterface) {
         PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
-        if (pc == null)
+        if (pc == null) {
+            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
+            if (mbean != null) {
+                return Collections.singletonList(mbean);
+            }
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " is not a platform management interface");
+        }
         return Collections.unmodifiableList(pc.getMXBeans(mxbeanInterface));
     }
 
@@ -737,9 +754,17 @@
         throws java.io.IOException
     {
         PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
-        if (pc == null)
+        if (pc == null) {
+            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
+            if (mbean != null) {
+                ObjectName on = mbean.getObjectName();
+                return ManagementFactory.newPlatformMXBeanProxy(connection,
+                                                                on.getCanonicalName(),
+                                                                mxbeanInterface);
+            }
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " is not a platform management interface");
+        }
         if (!pc.isSingleton())
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " can have zero or more than one instances");
@@ -781,6 +806,13 @@
     {
         PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
         if (pc == null) {
+            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
+            if (mbean != null) {
+                ObjectName on = mbean.getObjectName();
+                T proxy = ManagementFactory.newPlatformMXBeanProxy(connection,
+                            on.getCanonicalName(), mxbeanInterface);
+                return Collections.singletonList(proxy);
+            }
             throw new IllegalArgumentException(mxbeanInterface.getName() +
                 " is not a platform management interface");
         }
diff --git a/src/share/classes/java/lang/ref/ReferenceQueue.java b/src/share/classes/java/lang/ref/ReferenceQueue.java
index 61eaccb..534d21c 100644
--- a/src/share/classes/java/lang/ref/ReferenceQueue.java
+++ b/src/share/classes/java/lang/ref/ReferenceQueue.java
@@ -138,11 +138,17 @@
         synchronized (lock) {
             Reference<? extends T> r = reallyPoll();
             if (r != null) return r;
+            long start = (timeout == 0) ? 0 : System.nanoTime();
             for (;;) {
                 lock.wait(timeout);
                 r = reallyPoll();
                 if (r != null) return r;
-                if (timeout != 0) return null;
+                if (timeout != 0) {
+                    long end = System.nanoTime();
+                    timeout -= (end - start) / 1000_000;
+                    if (timeout <= 0) return null;
+                    start = end;
+                }
             }
         }
     }
diff --git a/src/share/classes/java/lang/reflect/AccessibleObject.java b/src/share/classes/java/lang/reflect/AccessibleObject.java
index f98aed5..0bf5e0e 100644
--- a/src/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/src/share/classes/java/lang/reflect/AccessibleObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,16 +129,24 @@
         setAccessible0(this, flag);
     }
 
-    /* Check that you aren't exposing java.lang.Class.<init>. */
+    /* Check that you aren't exposing java.lang.Class.<init> or sensitive
+       fields in java.lang.Class. */
     private static void setAccessible0(AccessibleObject obj, boolean flag)
         throws SecurityException
     {
         if (obj instanceof Constructor && flag == true) {
             Constructor<?> c = (Constructor<?>)obj;
             if (c.getDeclaringClass() == Class.class) {
-                throw new SecurityException("Can not make a java.lang.Class" +
+                throw new SecurityException("Cannot make a java.lang.Class" +
                                             " constructor accessible");
             }
+        } else if (obj instanceof Field && flag == true) {
+            Field f = (Field)obj;
+            if (f.getDeclaringClass() == Class.class &&
+                f.getName().equals("classLoader")) {
+                throw new SecurityException("Cannot make java.lang.Class.classLoader" +
+                                            " accessible");
+            }
         }
         obj.override = flag;
     }
diff --git a/src/share/classes/java/lang/reflect/Constructor.java b/src/share/classes/java/lang/reflect/Constructor.java
index d852fcd..fb2aa2c 100644
--- a/src/share/classes/java/lang/reflect/Constructor.java
+++ b/src/share/classes/java/lang/reflect/Constructor.java
@@ -94,9 +94,20 @@
     // For sharing of ConstructorAccessors. This branching structure
     // is currently only two levels deep (i.e., one root Constructor
     // and potentially many Constructor objects pointing to it.)
+    //
+    // If this branching structure would ever contain cycles, deadlocks can
+    // occur in annotation code.
     private Constructor<T>      root;
 
     /**
+     * Used by Excecutable for annotation sharing.
+     */
+    @Override
+    Executable getRoot() {
+        return root;
+    }
+
+    /**
      * Package-private constructor used by ReflectAccess to enable
      * instantiation of these objects in Java code from the java.lang
      * package via sun.reflect.LangReflectAccess.
@@ -132,6 +143,9 @@
         // which implicitly requires that new java.lang.reflect
         // objects be fabricated for each reflective call on Class
         // objects.)
+        if (this.root != null)
+            throw new IllegalArgumentException("Can not copy a non-root Constructor");
+
         Constructor<T> res = new Constructor<>(clazz,
                                                parameterTypes,
                                                exceptionTypes, modifiers, slot,
diff --git a/src/share/classes/java/lang/reflect/Executable.java b/src/share/classes/java/lang/reflect/Executable.java
index bf9c9b8..7564226 100644
--- a/src/share/classes/java/lang/reflect/Executable.java
+++ b/src/share/classes/java/lang/reflect/Executable.java
@@ -53,6 +53,11 @@
     abstract byte[] getAnnotationBytes();
 
     /**
+     * Accessor method to allow code sharing
+     */
+    abstract Executable getRoot();
+
+    /**
      * Does the Executable have generic information.
      */
     abstract boolean hasGenericInformation();
@@ -543,11 +548,16 @@
 
     private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
         if (declaredAnnotations == null) {
-            declaredAnnotations = AnnotationParser.parseAnnotations(
-                getAnnotationBytes(),
-                sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-                getDeclaringClass());
+            Executable root = getRoot();
+            if (root != null) {
+                declaredAnnotations = root.declaredAnnotations();
+            } else {
+                declaredAnnotations = AnnotationParser.parseAnnotations(
+                    getAnnotationBytes(),
+                    sun.misc.SharedSecrets.getJavaLangAccess().
+                    getConstantPool(getDeclaringClass()),
+                    getDeclaringClass());
+            }
         }
         return declaredAnnotations;
     }
diff --git a/src/share/classes/java/lang/reflect/Field.java b/src/share/classes/java/lang/reflect/Field.java
index 6e243bc..bb23b22 100644
--- a/src/share/classes/java/lang/reflect/Field.java
+++ b/src/share/classes/java/lang/reflect/Field.java
@@ -81,6 +81,9 @@
     // For sharing of FieldAccessors. This branching structure is
     // currently only two levels deep (i.e., one root Field and
     // potentially many Field objects pointing to it.)
+    //
+    // If this branching structure would ever contain cycles, deadlocks can
+    // occur in annotation code.
     private Field               root;
 
     // Generics infrastructure
@@ -141,6 +144,9 @@
         // which implicitly requires that new java.lang.reflect
         // objects be fabricated for each reflective call on Class
         // objects.)
+        if (this.root != null)
+            throw new IllegalArgumentException("Can not copy a non-root Field");
+
         Field res = new Field(clazz, name, type, modifiers, slot, signature, annotations);
         res.root = this;
         // Might as well eagerly propagate this if already present
@@ -1137,10 +1143,15 @@
 
     private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
         if (declaredAnnotations == null) {
-            declaredAnnotations = AnnotationParser.parseAnnotations(
-                annotations, sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-                getDeclaringClass());
+            Field root = this.root;
+            if (root != null) {
+                declaredAnnotations = root.declaredAnnotations();
+            } else {
+                declaredAnnotations = AnnotationParser.parseAnnotations(
+                        annotations,
+                        sun.misc.SharedSecrets.getJavaLangAccess().getConstantPool(getDeclaringClass()),
+                        getDeclaringClass());
+            }
         }
         return declaredAnnotations;
     }
diff --git a/src/share/classes/java/lang/reflect/Method.java b/src/share/classes/java/lang/reflect/Method.java
index b046a7a..786aac6 100644
--- a/src/share/classes/java/lang/reflect/Method.java
+++ b/src/share/classes/java/lang/reflect/Method.java
@@ -79,6 +79,9 @@
     // For sharing of MethodAccessors. This branching structure is
     // currently only two levels deep (i.e., one root Method and
     // potentially many Method objects pointing to it.)
+    //
+    // If this branching structure would ever contain cycles, deadlocks can
+    // occur in annotation code.
     private Method              root;
 
     // Generics infrastructure
@@ -144,6 +147,9 @@
         // which implicitly requires that new java.lang.reflect
         // objects be fabricated for each reflective call on Class
         // objects.)
+        if (this.root != null)
+            throw new IllegalArgumentException("Can not copy a non-root Method");
+
         Method res = new Method(clazz, name, parameterTypes, returnType,
                                 exceptionTypes, modifiers, slot, signature,
                                 annotations, parameterAnnotations, annotationDefault);
@@ -153,6 +159,14 @@
         return res;
     }
 
+    /**
+     * Used by Excecutable for annotation sharing.
+     */
+    @Override
+    Executable getRoot() {
+        return root;
+    }
+
     @Override
     boolean hasGenericInformation() {
         return (getGenericSignature() != null);
diff --git a/src/share/classes/java/math/MutableBigInteger.java b/src/share/classes/java/math/MutableBigInteger.java
index 5bb5c37..00e95aa 100644
--- a/src/share/classes/java/math/MutableBigInteger.java
+++ b/src/share/classes/java/math/MutableBigInteger.java
@@ -1261,19 +1261,20 @@
             int sigma = (int) Math.max(0, n32 - b.bitLength());   // step 3: sigma = max{T | (2^T)*B < beta^n}
             MutableBigInteger bShifted = new MutableBigInteger(b);
             bShifted.safeLeftShift(sigma);   // step 4a: shift b so its length is a multiple of n
-            safeLeftShift(sigma);     // step 4b: shift this by the same amount
+            MutableBigInteger aShifted = new MutableBigInteger (this);
+            aShifted.safeLeftShift(sigma);     // step 4b: shift a by the same amount
 
-            // step 5: t is the number of blocks needed to accommodate this plus one additional bit
-            int t = (int) ((bitLength()+n32) / n32);
+            // step 5: t is the number of blocks needed to accommodate a plus one additional bit
+            int t = (int) ((aShifted.bitLength()+n32) / n32);
             if (t < 2) {
                 t = 2;
             }
 
-            // step 6: conceptually split this into blocks a[t-1], ..., a[0]
-            MutableBigInteger a1 = getBlock(t-1, t, n);   // the most significant block of this
+            // step 6: conceptually split a into blocks a[t-1], ..., a[0]
+            MutableBigInteger a1 = aShifted.getBlock(t-1, t, n);   // the most significant block of a
 
             // step 7: z[t-2] = [a[t-1], a[t-2]]
-            MutableBigInteger z = getBlock(t-2, t, n);    // the second to most significant block
+            MutableBigInteger z = aShifted.getBlock(t-2, t, n);    // the second to most significant block
             z.addDisjoint(a1, n);   // z[t-2]
 
             // do schoolbook division on blocks, dividing 2-block numbers by 1-block numbers
@@ -1284,7 +1285,7 @@
                 ri = z.divide2n1n(bShifted, qi);
 
                 // step 8b: z = [ri, a[i-1]]
-                z = getBlock(i-1, t, n);   // a[i-1]
+                z = aShifted.getBlock(i-1, t, n);   // a[i-1]
                 z.addDisjoint(ri, n);
                 quotient.addShifted(qi, i*n);   // update q (part of step 9)
             }
@@ -1292,7 +1293,7 @@
             ri = z.divide2n1n(bShifted, qi);
             quotient.add(qi);
 
-            ri.rightShift(sigma);   // step 9: this and b were shifted, so shift back
+            ri.rightShift(sigma);   // step 9: a and b were shifted, so shift back
             return ri;
         }
     }
diff --git a/src/share/classes/java/net/SocketInputStream.java b/src/share/classes/java/net/SocketInputStream.java
index 224051f..41b18bd 100644
--- a/src/share/classes/java/net/SocketInputStream.java
+++ b/src/share/classes/java/net/SocketInputStream.java
@@ -96,6 +96,26 @@
                                    int timeout)
         throws IOException;
 
+    // wrap native call to allow instrumentation
+    /**
+     * Reads into an array of bytes at the specified offset using
+     * the received socket primitive.
+     * @param fd the FileDescriptor
+     * @param b the buffer into which the data is read
+     * @param off the start offset of the data
+     * @param len the maximum number of bytes read
+     * @param timeout the read timeout in ms
+     * @return the actual number of bytes read, -1 is
+     *          returned when the end of the stream is reached.
+     * @exception IOException If an I/O error has occurred.
+     */
+    private int socketRead(FileDescriptor fd,
+                           byte b[], int off, int len,
+                           int timeout)
+        throws IOException {
+        return socketRead0(fd, b, off, len, timeout);
+    }
+
     /**
      * Reads into a byte array data from the socket.
      * @param b the buffer into which the data is read
@@ -147,7 +167,7 @@
         // acquire file descriptor and do the read
         FileDescriptor fd = impl.acquireFD();
         try {
-            n = socketRead0(fd, b, off, length, timeout);
+            n = socketRead(fd, b, off, length, timeout);
             if (n > 0) {
                 return n;
             }
@@ -165,7 +185,7 @@
             impl.setConnectionResetPending();
             impl.acquireFD();
             try {
-                n = socketRead0(fd, b, off, length, timeout);
+                n = socketRead(fd, b, off, length, timeout);
                 if (n > 0) {
                     return n;
                 }
diff --git a/src/share/classes/java/net/URLClassLoader.java b/src/share/classes/java/net/URLClassLoader.java
index f272346..a75ac30 100644
--- a/src/share/classes/java/net/URLClassLoader.java
+++ b/src/share/classes/java/net/URLClassLoader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -354,10 +354,11 @@
      * @exception NullPointerException if {@code name} is {@code null}.
      */
     protected Class<?> findClass(final String name)
-         throws ClassNotFoundException
+        throws ClassNotFoundException
     {
+        final Class<?> result;
         try {
-            return AccessController.doPrivileged(
+            result = AccessController.doPrivileged(
                 new PrivilegedExceptionAction<Class<?>>() {
                     public Class<?> run() throws ClassNotFoundException {
                         String path = name.replace('.', '/').concat(".class");
@@ -369,13 +370,17 @@
                                 throw new ClassNotFoundException(name, e);
                             }
                         } else {
-                            throw new ClassNotFoundException(name);
+                            return null;
                         }
                     }
                 }, acc);
         } catch (java.security.PrivilegedActionException pae) {
             throw (ClassNotFoundException) pae.getException();
         }
+        if (result == null) {
+            throw new ClassNotFoundException(name);
+        }
+        return result;
     }
 
     /*
@@ -407,6 +412,29 @@
         return pkg;
     }
 
+    // Also called by VM to define Package for classes loaded from the CDS
+    // archive
+    private void definePackageInternal(String pkgname, Manifest man, URL url)
+    {
+        if (getAndVerifyPackage(pkgname, man, url) == null) {
+            try {
+                if (man != null) {
+                    definePackage(pkgname, man, url);
+                } else {
+                    definePackage(pkgname, null, null, null, null, null, null, null);
+                }
+            } catch (IllegalArgumentException iae) {
+                // parallel-capable class loaders: re-verify in case of a
+                // race condition
+                if (getAndVerifyPackage(pkgname, man, url) == null) {
+                    // Should never happen
+                    throw new AssertionError("Cannot find package " +
+                                             pkgname);
+                }
+            }
+        }
+    }
+
     /*
      * Defines a Class using the class bytes obtained from the specified
      * Resource. The resulting Class must be resolved before it can be
@@ -420,23 +448,7 @@
             String pkgname = name.substring(0, i);
             // Check if package already loaded.
             Manifest man = res.getManifest();
-            if (getAndVerifyPackage(pkgname, man, url) == null) {
-                try {
-                    if (man != null) {
-                        definePackage(pkgname, man, url);
-                    } else {
-                        definePackage(pkgname, null, null, null, null, null, null, null);
-                    }
-                } catch (IllegalArgumentException iae) {
-                    // parallel-capable class loaders: re-verify in case of a
-                    // race condition
-                    if (getAndVerifyPackage(pkgname, man, url) == null) {
-                        // Should never happen
-                        throw new AssertionError("Cannot find package " +
-                                                 pkgname);
-                    }
-                }
-            }
+            definePackageInternal(pkgname, man, url);
         }
         // Now read the class bytes and define the class
         java.nio.ByteBuffer bb = res.getByteBuffer();
diff --git a/src/share/classes/java/security/KeyPairGenerator.java b/src/share/classes/java/security/KeyPairGenerator.java
index c09d251..2056768 100644
--- a/src/share/classes/java/security/KeyPairGenerator.java
+++ b/src/share/classes/java/security/KeyPairGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 
 import sun.security.jca.*;
 import sun.security.jca.GetInstance.Instance;
+import sun.security.util.Debug;
 
 /**
  * The KeyPairGenerator class is used to generate pairs of
@@ -126,6 +127,11 @@
 
 public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("keypairgenerator");
+
     private final String algorithm;
 
     // The provider
@@ -167,6 +173,12 @@
             kpg = new Delegate(spi, algorithm);
         }
         kpg.provider = instance.provider;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyPairGenerator." + algorithm +
+                " algorithm from: " + kpg.provider.getName());
+        }
+
         return kpg;
     }
 
@@ -557,6 +569,11 @@
             provider = instance.provider;
             this.serviceIterator = serviceIterator;
             initType = I_NONE;
+
+            if (!skipDebug && pdebug != null) {
+                pdebug.println("KeyPairGenerator." + algorithm +
+                    " algorithm from: " + provider.getName());
+            }
         }
 
         /**
diff --git a/src/share/classes/java/security/KeyStore.java b/src/share/classes/java/security/KeyStore.java
index 80bf17d..4278369 100644
--- a/src/share/classes/java/security/KeyStore.java
+++ b/src/share/classes/java/security/KeyStore.java
@@ -37,6 +37,8 @@
 import javax.security.auth.DestroyFailedException;
 import javax.security.auth.callback.*;
 
+import sun.security.util.Debug;
+
 /**
  * This class represents a storage facility for cryptographic
  * keys and certificates.
@@ -177,6 +179,11 @@
 
 public class KeyStore {
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("keystore");
+
     /*
      * Constant to lookup in the Security properties file to determine
      * the default keystore type.
@@ -801,6 +808,11 @@
         this.keyStoreSpi = keyStoreSpi;
         this.provider = provider;
         this.type = type;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyStore." + type.toUpperCase() + " type from: " +
+                this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/java/security/MessageDigest.java b/src/share/classes/java/security/MessageDigest.java
index 60d41ff..cf3e3a3 100644
--- a/src/share/classes/java/security/MessageDigest.java
+++ b/src/share/classes/java/security/MessageDigest.java
@@ -35,6 +35,8 @@
 
 import java.nio.ByteBuffer;
 
+import sun.security.util.Debug;
+
 /**
  * This MessageDigest class provides applications the functionality of a
  * message digest algorithm, such as SHA-1 or SHA-256.
@@ -103,6 +105,11 @@
 
 public abstract class MessageDigest extends MessageDigestSpi {
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("messagedigest");
+
     private String algorithm;
 
     // The state of this digest
@@ -156,18 +163,23 @@
     public static MessageDigest getInstance(String algorithm)
     throws NoSuchAlgorithmException {
         try {
+            MessageDigest md;
             Object[] objs = Security.getImpl(algorithm, "MessageDigest",
                                              (String)null);
             if (objs[0] instanceof MessageDigest) {
-                MessageDigest md = (MessageDigest)objs[0];
-                md.provider = (Provider)objs[1];
-                return md;
+                md = (MessageDigest)objs[0];
             } else {
-                MessageDigest delegate =
-                    new Delegate((MessageDigestSpi)objs[0], algorithm);
-                delegate.provider = (Provider)objs[1];
-                return delegate;
+                md = new Delegate((MessageDigestSpi)objs[0], algorithm);
             }
+            md.provider = (Provider)objs[1];
+
+            if (!skipDebug && pdebug != null) {
+                pdebug.println("MessageDigest." + algorithm +
+                    " algorithm from: " + md.provider.getName());
+            }
+
+            return md;
+
         } catch(NoSuchProviderException e) {
             throw new NoSuchAlgorithmException(algorithm + " not found");
         }
diff --git a/src/share/classes/java/security/SecureRandom.java b/src/share/classes/java/security/SecureRandom.java
index b9ae722..3481e21 100644
--- a/src/share/classes/java/security/SecureRandom.java
+++ b/src/share/classes/java/security/SecureRandom.java
@@ -32,6 +32,7 @@
 
 import sun.security.jca.*;
 import sun.security.jca.GetInstance.Instance;
+import sun.security.util.Debug;
 
 /**
  * This class provides a cryptographically strong random number
@@ -92,6 +93,11 @@
 
 public class SecureRandom extends java.util.Random {
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("securerandom");
+
     /**
      * The provider.
      *
@@ -234,6 +240,11 @@
         this.secureRandomSpi = secureRandomSpi;
         this.provider = provider;
         this.algorithm = algorithm;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("SecureRandom." + algorithm +
+                " algorithm from: " + this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/java/security/Signature.java b/src/share/classes/java/security/Signature.java
index 9394284..dccbe0b 100644
--- a/src/share/classes/java/security/Signature.java
+++ b/src/share/classes/java/security/Signature.java
@@ -121,6 +121,11 @@
     private static final Debug debug =
                         Debug.getInstance("jca", "Signature");
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("signature");
+
     /*
      * The algorithm for this signature object.
      * This value is used to map an OID to the particular algorithm.
@@ -451,6 +456,11 @@
             throws InvalidKeyException {
         engineInitVerify(publicKey);
         state = VERIFY;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Signature." + algorithm +
+                " verification algorithm from: " + this.provider.getName());
+        }
     }
 
     /**
@@ -495,6 +505,11 @@
         PublicKey publicKey = certificate.getPublicKey();
         engineInitVerify(publicKey);
         state = VERIFY;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Signature." + algorithm +
+                " verification algorithm from: " + this.provider.getName());
+        }
     }
 
     /**
@@ -511,6 +526,11 @@
             throws InvalidKeyException {
         engineInitSign(privateKey);
         state = SIGN;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Signature." + algorithm +
+                " signing algorithm from: " + this.provider.getName());
+        }
     }
 
     /**
@@ -529,6 +549,11 @@
             throws InvalidKeyException {
         engineInitSign(privateKey, random);
         state = SIGN;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Signature." + algorithm +
+                " signing algorithm from: " + this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/java/security/package-info.java b/src/share/classes/java/security/package-info.java
index 599e952..2c8205b 100644
--- a/src/share/classes/java/security/package-info.java
+++ b/src/share/classes/java/security/package-info.java
@@ -92,14 +92,14 @@
  *     </b></a></li>
  *
  *   <li><b>keytool</b>
- *     (<a href="{@docRoot}/../technotes/tools/solaris/keytool.html">
+ *     (<a href="{@docRoot}/../technotes/tools/unix/keytool.html">
  *       for Solaris/Linux</a>)
  *     (<a href="{@docRoot}/../technotes/tools/windows/keytool.html">
  *       for Windows</a>)
  *     </li>
  *
  *   <li><b>jarsigner</b>
- *     (<a href="{@docRoot}/../technotes/tools/solaris/jarsigner.html">
+ *     (<a href="{@docRoot}/../technotes/tools/unix/jarsigner.html">
  *       for Solaris/Linux</a>)
  *     (<a href="{@docRoot}/../technotes/tools/windows/jarsigner.html">
  *       for Windows</a>)
diff --git a/src/share/classes/java/text/DigitList.java b/src/share/classes/java/text/DigitList.java
index 3633064..0b73543 100644
--- a/src/share/classes/java/text/DigitList.java
+++ b/src/share/classes/java/text/DigitList.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -290,25 +290,26 @@
 
         FloatingDecimal.BinaryToASCIIConverter fdConverter  = FloatingDecimal.getBinaryToASCIIConverter(source);
         boolean hasBeenRoundedUp = fdConverter.digitsRoundedUp();
-        boolean allDecimalDigits = fdConverter.decimalDigitsExact();
+        boolean valueExactAsDecimal = fdConverter.decimalDigitsExact();
         assert !fdConverter.isExceptional();
         String digitsString = fdConverter.toJavaFormatString();
 
         set(isNegative, digitsString,
-            hasBeenRoundedUp, allDecimalDigits,
+            hasBeenRoundedUp, valueExactAsDecimal,
             maximumDigits, fixedPoint);
     }
 
     /**
      * Generate a representation of the form DDDDD, DDDDD.DDDDD, or
      * DDDDDE+/-DDDDD.
-     * @param roundedUp Boolean value indicating if the s digits were rounded-up.
-     * @param allDecimalDigits Boolean value indicating if the digits in s are
-     * an exact decimal representation of the double that was passed.
+     * @param roundedUp whether or not rounding up has already happened.
+     * @param valueExactAsDecimal whether or not collected digits provide
+     * an exact decimal representation of the value.
      */
     private void set(boolean isNegative, String s,
-                     boolean roundedUp, boolean allDecimalDigits,
+                     boolean roundedUp, boolean valueExactAsDecimal,
                      int maximumDigits, boolean fixedPoint) {
+
         this.isNegative = isNegative;
         int len = s.length();
         char[] source = getDataChars(len);
@@ -361,7 +362,7 @@
             } else if (-decimalAt == maximumDigits) {
                 // If we round 0.0009 to 3 fractional digits, then we have to
                 // create a new one digit in the least significant location.
-                if (shouldRoundUp(0, roundedUp, allDecimalDigits)) {
+                if (shouldRoundUp(0, roundedUp, valueExactAsDecimal)) {
                     count = 1;
                     ++decimalAt;
                     digits[0] = '1';
@@ -381,25 +382,26 @@
         // Eliminate digits beyond maximum digits to be displayed.
         // Round up if appropriate.
         round(fixedPoint ? (maximumDigits + decimalAt) : maximumDigits,
-              roundedUp, allDecimalDigits);
-    }
+              roundedUp, valueExactAsDecimal);
+
+     }
 
     /**
      * Round the representation to the given number of digits.
      * @param maximumDigits The maximum number of digits to be shown.
-     * @param alreadyRounded Boolean indicating if rounding up already happened.
-     * @param allDecimalDigits Boolean indicating if the digits provide an exact
-     * representation of the value.
+     * @param alreadyRounded whether or not rounding up has already happened.
+     * @param valueExactAsDecimal whether or not collected digits provide
+     * an exact decimal representation of the value.
      *
      * Upon return, count will be less than or equal to maximumDigits.
      */
     private final void round(int maximumDigits,
                              boolean alreadyRounded,
-                             boolean allDecimalDigits) {
+                             boolean valueExactAsDecimal) {
         // Eliminate digits beyond maximum digits to be displayed.
         // Round up if appropriate.
         if (maximumDigits >= 0 && maximumDigits < count) {
-            if (shouldRoundUp(maximumDigits, alreadyRounded, allDecimalDigits)) {
+            if (shouldRoundUp(maximumDigits, alreadyRounded, valueExactAsDecimal)) {
                 // Rounding up involved incrementing digits from LSD to MSD.
                 // In most cases this is simple, but in a worst case situation
                 // (9999..99) we have to adjust the decimalAt value.
@@ -440,6 +442,9 @@
      * <code>count-1</code>.  If 0, then all digits are rounded away, and
      * this method returns true if a one should be generated (e.g., formatting
      * 0.09 with "#.#").
+     * @param alreadyRounded whether or not rounding up has already happened.
+     * @param valueExactAsDecimal whether or not collected digits provide
+     * an exact decimal representation of the value.
      * @exception ArithmeticException if rounding is needed with rounding
      *            mode being set to RoundingMode.UNNECESSARY
      * @return true if digit <code>maximumDigits-1</code> should be
@@ -447,7 +452,7 @@
      */
     private boolean shouldRoundUp(int maximumDigits,
                                   boolean alreadyRounded,
-                                  boolean allDecimalDigits) {
+                                  boolean valueExactAsDecimal) {
         if (maximumDigits < count) {
             /*
              * To avoid erroneous double-rounding or truncation when converting
@@ -460,7 +465,7 @@
              *   account what FloatingDecimal has done in the binary to decimal
              *   conversion.
              *
-             *   Considering the tie cases, FloatingDecimal may round-up the
+             *   Considering the tie cases, FloatingDecimal may round up the
              *   value (returning decimal digits equal to tie when it is below),
              *   or "truncate" the value to the tie while value is above it,
              *   or provide the exact decimal digits when the binary value can be
@@ -490,7 +495,7 @@
              *
              * - For other numbers that are always converted to exact digits
              *   (like BigInteger, Long, ...), the passed alreadyRounded boolean
-             *   have to be  set to false, and allDecimalDigits has to be set to
+             *   have to be  set to false, and valueExactAsDecimal has to be set to
              *   true in the upper DigitList call stack, providing the right state
              *   for those situations..
              */
@@ -520,42 +525,31 @@
                 }
                 break;
             case HALF_UP:
-                if (digits[maximumDigits] >= '5') {
-                    // We should not round up if the rounding digits position is
-                    // exactly the last index and if digits were already rounded.
-                    if ((maximumDigits == (count - 1)) &&
-                        (alreadyRounded))
-                        return false;
-
-                    // Value was exactly at or was above tie. We must round up.
-                    return true;
-                }
-                break;
             case HALF_DOWN:
                 if (digits[maximumDigits] > '5') {
+                    // Value is above tie ==> must round up
                     return true;
-                } else if (digits[maximumDigits] == '5' ) {
-                    if (maximumDigits == (count - 1)) {
-                        // The rounding position is exactly the last index.
-                        if (allDecimalDigits || alreadyRounded)
-                            /* FloatingDecimal rounded up (value was below tie),
-                             * or provided the exact list of digits (value was
-                             * an exact tie). We should not round up, following
-                             * the HALF_DOWN rounding rule.
-                             */
-                            return false;
-                        else
-                            // Value was above the tie, we must round up.
-                            return true;
-                    }
-
-                    // We must round up if it gives a non null digit after '5'.
-                    for (int i=maximumDigits+1; i<count; ++i) {
-                        if (digits[i] != '0') {
-                            return true;
+                } else if (digits[maximumDigits] == '5') {
+                    // Digit at rounding position is a '5'. Tie cases.
+                    if (maximumDigits != (count - 1)) {
+                        // There are remaining digits. Above tie => must round up
+                        return true;
+                    } else {
+                        // Digit at rounding position is the last one !
+                        if (valueExactAsDecimal) {
+                            // Exact binary representation. On the tie.
+                            // Apply rounding given by roundingMode.
+                            return roundingMode == RoundingMode.HALF_UP;
+                        } else {
+                            // Not an exact binary representation.
+                            // Digit sequence either rounded up or truncated.
+                            // Round up only if it was truncated.
+                            return !alreadyRounded;
                         }
                     }
                 }
+                // Digit at rounding position is < '5' ==> no round up.
+                // Just let do the default, which is no round up (thus break).
                 break;
             case HALF_EVEN:
                 // Implement IEEE half-even rounding
@@ -569,7 +563,7 @@
                             // then we should not round up again.
                             return false;
 
-                        if (!allDecimalDigits)
+                        if (!valueExactAsDecimal)
                             // Otherwise if the digits don't represent exact value,
                             // value was above tie and FloatingDecimal truncated
                             // digits to tie. We must round up.
diff --git a/src/share/classes/java/time/chrono/JapaneseEra.java b/src/share/classes/java/time/chrono/JapaneseEra.java
index 0187565..0c9e3e8 100644
--- a/src/share/classes/java/time/chrono/JapaneseEra.java
+++ b/src/share/classes/java/time/chrono/JapaneseEra.java
@@ -127,7 +127,7 @@
 
     // the number of defined JapaneseEra constants.
     // There could be an extra era defined in its configuration.
-    private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET + 1;
+    private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET;
 
     /**
      * Serialization version.
@@ -148,7 +148,7 @@
         for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) {
             CalendarDate date = ERA_CONFIG[i].getSinceDate();
             LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth());
-            KNOWN_ERAS[i] = new JapaneseEra(i - ERA_OFFSET, isoDate);
+            KNOWN_ERAS[i] = new JapaneseEra(i - ERA_OFFSET + 1, isoDate);
         }
     };
 
@@ -195,7 +195,7 @@
      * @throws DateTimeException if the value is invalid
      */
     public static JapaneseEra of(int japaneseEra) {
-        if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET - 1 >= KNOWN_ERAS.length) {
+        if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET > KNOWN_ERAS.length) {
             throw new DateTimeException("Invalid era: " + japaneseEra);
         }
         return KNOWN_ERAS[ordinal(japaneseEra)];
diff --git a/src/share/classes/java/util/BitSet.java b/src/share/classes/java/util/BitSet.java
index ae95b8e..261a77c 100644
--- a/src/share/classes/java/util/BitSet.java
+++ b/src/share/classes/java/util/BitSet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -696,6 +696,9 @@
      *  <pre> {@code
      * for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
      *     // operate on index i here
+     *     if (i == Integer.MAX_VALUE) {
+     *         break; // or (i+1) would overflow
+     *     }
      * }}</pre>
      *
      * @param  fromIndex the index to start checking from (inclusive)
@@ -1186,10 +1189,12 @@
         int i = nextSetBit(0);
         if (i != -1) {
             b.append(i);
-            for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) {
+            while (true) {
+                if (++i < 0) break;
+                if ((i = nextSetBit(i)) < 0) break;
                 int endOfRun = nextClearBit(i);
                 do { b.append(", ").append(i); }
-                while (++i < endOfRun);
+                while (++i != endOfRun);
             }
         }
 
diff --git a/src/share/classes/java/util/Collections.java b/src/share/classes/java/util/Collections.java
index 1e2fbbe..4dbdf8a 100644
--- a/src/share/classes/java/util/Collections.java
+++ b/src/share/classes/java/util/Collections.java
@@ -2342,7 +2342,7 @@
 
         public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
             synchronized (mutex) {
-                return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, inclusive));
+                return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, inclusive), mutex);
             }
         }
     }
diff --git a/src/share/classes/java/util/IdentityHashMap.java b/src/share/classes/java/util/IdentityHashMap.java
index 6e50f8a..d40ad34 100644
--- a/src/share/classes/java/util/IdentityHashMap.java
+++ b/src/share/classes/java/util/IdentityHashMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package java.util;
 
-import java.io.*;
 import java.lang.reflect.Array;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
@@ -74,7 +73,7 @@
  * maximum size and the number of buckets is unspecified.
  *
  * <p>If the size of the map (the number of key-value mappings) sufficiently
- * exceeds the expected maximum size, the number of buckets is increased
+ * exceeds the expected maximum size, the number of buckets is increased.
  * Increasing the number of buckets ("rehashing") may be fairly expensive, so
  * it pays to create identity hash maps with a sufficiently large expected
  * maximum size.  On the other hand, iteration over collection views requires
@@ -160,6 +159,10 @@
      * The maximum capacity, used if a higher value is implicitly specified
      * by either of the constructors with arguments.
      * MUST be a power of two <= 1<<29.
+     *
+     * In fact, the map can hold no more than MAXIMUM_CAPACITY-1 items
+     * because it has to have at least one slot with the key == null
+     * in order to avoid infinite loops in get(), put(), remove()
      */
     private static final int MAXIMUM_CAPACITY = 1 << 29;
 
@@ -181,11 +184,6 @@
     transient int modCount;
 
     /**
-     * The next size value at which to resize (capacity * load factor).
-     */
-    private transient int threshold;
-
-    /**
      * Value representing null keys inside tables.
      */
     static final Object NULL_KEY = new Object();
@@ -229,27 +227,18 @@
     }
 
     /**
-     * Returns the appropriate capacity for the specified expected maximum
-     * size.  Returns the smallest power of two between MINIMUM_CAPACITY
-     * and MAXIMUM_CAPACITY, inclusive, that is greater than
-     * (3 * expectedMaxSize)/2, if such a number exists.  Otherwise
-     * returns MAXIMUM_CAPACITY.  If (3 * expectedMaxSize)/2 is negative, it
-     * is assumed that overflow has occurred, and MAXIMUM_CAPACITY is returned.
+     * Returns the appropriate capacity for the given expected maximum size.
+     * Returns the smallest power of two between MINIMUM_CAPACITY and
+     * MAXIMUM_CAPACITY, inclusive, that is greater than (3 *
+     * expectedMaxSize)/2, if such a number exists.  Otherwise returns
+     * MAXIMUM_CAPACITY.
      */
-    private int capacity(int expectedMaxSize) {
-        // Compute min capacity for expectedMaxSize given a load factor of 2/3
-        int minCapacity = (3 * expectedMaxSize)/2;
-
-        // Compute the appropriate capacity
-        int result;
-        if (minCapacity > MAXIMUM_CAPACITY || minCapacity < 0) {
-            result = MAXIMUM_CAPACITY;
-        } else {
-            result = MINIMUM_CAPACITY;
-            while (result < minCapacity)
-                result <<= 1;
-        }
-        return result;
+    private static int capacity(int expectedMaxSize) {
+        // assert expectedMaxSize >= 0;
+        return
+            (expectedMaxSize > MAXIMUM_CAPACITY / 3) ? MAXIMUM_CAPACITY :
+            (expectedMaxSize <= 2 * MINIMUM_CAPACITY / 3) ? MINIMUM_CAPACITY :
+            Integer.highestOneBit(expectedMaxSize + (expectedMaxSize << 1));
     }
 
     /**
@@ -262,7 +251,6 @@
         // assert initCapacity >= MINIMUM_CAPACITY;
         // assert initCapacity <= MAXIMUM_CAPACITY;
 
-        threshold = (initCapacity * 2)/3;
         table = new Object[2 * initCapacity];
     }
 
@@ -429,52 +417,58 @@
      * @see     #containsKey(Object)
      */
     public V put(K key, V value) {
-        Object k = maskNull(key);
-        Object[] tab = table;
-        int len = tab.length;
-        int i = hash(k, len);
+        final Object k = maskNull(key);
 
-        Object item;
-        while ( (item = tab[i]) != null) {
-            if (item == k) {
-                @SuppressWarnings("unchecked")
-                    V oldValue = (V) tab[i + 1];
-                tab[i + 1] = value;
-                return oldValue;
+        retryAfterResize: for (;;) {
+            final Object[] tab = table;
+            final int len = tab.length;
+            int i = hash(k, len);
+
+            for (Object item; (item = tab[i]) != null;
+                 i = nextKeyIndex(i, len)) {
+                if (item == k) {
+                    @SuppressWarnings("unchecked")
+                        V oldValue = (V) tab[i + 1];
+                    tab[i + 1] = value;
+                    return oldValue;
+                }
             }
-            i = nextKeyIndex(i, len);
-        }
 
-        modCount++;
-        tab[i] = k;
-        tab[i + 1] = value;
-        if (++size >= threshold)
-            resize(len); // len == 2 * current capacity.
-        return null;
+            final int s = size + 1;
+            // Use optimized form of 3 * s.
+            // Next capacity is len, 2 * current capacity.
+            if (s + (s << 1) > len && resize(len))
+                continue retryAfterResize;
+
+            modCount++;
+            tab[i] = k;
+            tab[i + 1] = value;
+            size = s;
+            return null;
+        }
     }
 
     /**
-     * Resize the table to hold given capacity.
+     * Resizes the table if necessary to hold given capacity.
      *
      * @param newCapacity the new capacity, must be a power of two.
+     * @return whether a resize did in fact take place
      */
-    private void resize(int newCapacity) {
+    private boolean resize(int newCapacity) {
         // assert (newCapacity & -newCapacity) == newCapacity; // power of 2
         int newLength = newCapacity * 2;
 
         Object[] oldTable = table;
         int oldLength = oldTable.length;
-        if (oldLength == 2*MAXIMUM_CAPACITY) { // can't expand any further
-            if (threshold == MAXIMUM_CAPACITY-1)
+        if (oldLength == 2 * MAXIMUM_CAPACITY) { // can't expand any further
+            if (size == MAXIMUM_CAPACITY - 1)
                 throw new IllegalStateException("Capacity exhausted.");
-            threshold = MAXIMUM_CAPACITY-1;  // Gigantic map!
-            return;
+            return false;
         }
         if (oldLength >= newLength)
-            return;
+            return false;
 
         Object[] newTable = new Object[newLength];
-        threshold = newLength / 3;
 
         for (int j = 0; j < oldLength; j += 2) {
             Object key = oldTable[j];
@@ -490,6 +484,7 @@
             }
         }
         table = newTable;
+        return true;
     }
 
     /**
@@ -504,8 +499,8 @@
         int n = m.size();
         if (n == 0)
             return;
-        if (n > threshold) // conservatively pre-expand
-            resize(capacity(n));
+        if (n > size)
+            resize(capacity(n)); // conservatively pre-expand
 
         for (Entry<? extends K, ? extends V> e : m.entrySet())
             put(e.getKey(), e.getValue());
@@ -542,7 +537,6 @@
                 return null;
             i = nextKeyIndex(i, len);
         }
-
     }
 
     /**
@@ -1266,8 +1260,8 @@
     private static final long serialVersionUID = 8188218128353913216L;
 
     /**
-     * Save the state of the <tt>IdentityHashMap</tt> instance to a stream
-     * (i.e., serialize it).
+     * Saves the state of the <tt>IdentityHashMap</tt> instance to a stream
+     * (i.e., serializes it).
      *
      * @serialData The <i>size</i> of the HashMap (the number of key-value
      *          mappings) (<tt>int</tt>), followed by the key (Object) and
@@ -1295,8 +1289,8 @@
     }
 
     /**
-     * Reconstitute the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
-     * deserialize it).
+     * Reconstitutes the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
+     * deserializes it).
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException  {
@@ -1305,9 +1299,10 @@
 
         // Read in size (number of Mappings)
         int size = s.readInt();
-
-        // Allow for 33% growth (i.e., capacity is >= 2* size()).
-        init(capacity((size*4)/3));
+        if (size < 0)
+            throw new java.io.StreamCorruptedException
+                ("Illegal mappings count: " + size);
+        init(capacity(size));
 
         // Read the keys and values, and put the mappings in the table
         for (int i=0; i<size; i++) {
@@ -1324,7 +1319,7 @@
      * update modCount, etc.
      */
     private void putForCreate(K key, V value)
-        throws IOException
+        throws java.io.StreamCorruptedException
     {
         Object k = maskNull(key);
         Object[] tab = table;
diff --git a/src/share/classes/java/util/TimeZone.java b/src/share/classes/java/util/TimeZone.java
index 9649793..356f33b 100644
--- a/src/share/classes/java/util/TimeZone.java
+++ b/src/share/classes/java/util/TimeZone.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -591,8 +591,7 @@
     /**
      * Gets the platform defined TimeZone ID.
      **/
-    private static native String getSystemTimeZoneID(String javaHome,
-                                                     String country);
+    private static native String getSystemTimeZoneID(String javaHome);
 
     /**
      * Gets the custom time zone ID based on the GMT offset of the
@@ -650,12 +649,10 @@
         // if the time zone ID is not set (yet), perform the
         // platform to Java time zone ID mapping.
         if (zoneID == null || zoneID.isEmpty()) {
-            String country = AccessController.doPrivileged(
-                    new GetPropertyAction("user.country"));
             String javaHome = AccessController.doPrivileged(
                     new GetPropertyAction("java.home"));
             try {
-                zoneID = getSystemTimeZoneID(javaHome, country);
+                zoneID = getSystemTimeZoneID(javaHome);
                 if (zoneID == null) {
                     zoneID = GMT_ID;
                 }
diff --git a/src/share/classes/java/util/concurrent/CompletableFuture.java b/src/share/classes/java/util/concurrent/CompletableFuture.java
index 9e89169..8476dcc 100644
--- a/src/share/classes/java/util/concurrent/CompletableFuture.java
+++ b/src/share/classes/java/util/concurrent/CompletableFuture.java
@@ -50,7 +50,6 @@
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CompletionException;
 import java.util.concurrent.CompletionStage;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.LockSupport;
 
 /**
@@ -77,9 +76,9 @@
  * <li>All <em>async</em> methods without an explicit Executor
  * argument are performed using the {@link ForkJoinPool#commonPool()}
  * (unless it does not support a parallelism level of at least two, in
- * which case, a new Thread is used). To simplify monitoring,
- * debugging, and tracking, all generated asynchronous tasks are
- * instances of the marker interface {@link
+ * which case, a new Thread is created to run each task).  To simplify
+ * monitoring, debugging, and tracking, all generated asynchronous
+ * tasks are instances of the marker interface {@link
  * AsynchronousCompletionTask}. </li>
  *
  * <li>All CompletionStage methods are implemented independently of
@@ -113,141 +112,1556 @@
     /*
      * Overview:
      *
-     * 1. Non-nullness of field result (set via CAS) indicates done.
-     * An AltResult is used to box null as a result, as well as to
-     * hold exceptions.  Using a single field makes completion fast
-     * and simple to detect and trigger, at the expense of a lot of
-     * encoding and decoding that infiltrates many methods. One minor
-     * simplification relies on the (static) NIL (to box null results)
-     * being the only AltResult with a null exception field, so we
-     * don't usually need explicit comparisons with NIL. The CF
-     * exception propagation mechanics surrounding decoding rely on
-     * unchecked casts of decoded results really being unchecked,
-     * where user type errors are caught at point of use, as is
-     * currently the case in Java. These are highlighted by using
-     * SuppressWarnings-annotated temporaries.
+     * A CompletableFuture may have dependent completion actions,
+     * collected in a linked stack. It atomically completes by CASing
+     * a result field, and then pops off and runs those actions. This
+     * applies across normal vs exceptional outcomes, sync vs async
+     * actions, binary triggers, and various forms of completions.
      *
-     * 2. Waiters are held in a Treiber stack similar to the one used
-     * in FutureTask, Phaser, and SynchronousQueue. See their
-     * internal documentation for algorithmic details.
+     * Non-nullness of field result (set via CAS) indicates done.  An
+     * AltResult is used to box null as a result, as well as to hold
+     * exceptions.  Using a single field makes completion simple to
+     * detect and trigger.  Encoding and decoding is straightforward
+     * but adds to the sprawl of trapping and associating exceptions
+     * with targets.  Minor simplifications rely on (static) NIL (to
+     * box null results) being the only AltResult with a null
+     * exception field, so we don't usually need explicit comparisons.
+     * Even though some of the generics casts are unchecked (see
+     * SuppressWarnings annotations), they are placed to be
+     * appropriate even if checked.
      *
-     * 3. Completions are also kept in a list/stack, and pulled off
-     * and run when completion is triggered. (We could even use the
-     * same stack as for waiters, but would give up the potential
-     * parallelism obtained because woken waiters help release/run
-     * others -- see method postComplete).  Because post-processing
-     * may race with direct calls, class Completion opportunistically
-     * extends AtomicInteger so callers can claim the action via
-     * compareAndSet(0, 1).  The Completion.run methods are all
-     * written a boringly similar uniform way (that sometimes includes
-     * unnecessary-looking checks, kept to maintain uniformity).
-     * There are enough dimensions upon which they differ that
-     * attempts to factor commonalities while maintaining efficiency
-     * require more lines of code than they would save.
+     * Dependent actions are represented by Completion objects linked
+     * as Treiber stacks headed by field "stack". There are Completion
+     * classes for each kind of action, grouped into single-input
+     * (UniCompletion), two-input (BiCompletion), projected
+     * (BiCompletions using either (not both) of two inputs), shared
+     * (CoCompletion, used by the second of two sources), zero-input
+     * source actions, and Signallers that unblock waiters. Class
+     * Completion extends ForkJoinTask to enable async execution
+     * (adding no space overhead because we exploit its "tag" methods
+     * to maintain claims). It is also declared as Runnable to allow
+     * usage with arbitrary executors.
      *
-     * 4. The exported then/and/or methods do support a bit of
-     * factoring (see doThenApply etc). They must cope with the
-     * intrinsic races surrounding addition of a dependent action
-     * versus performing the action directly because the task is
-     * already complete.  For example, a CF may not be complete upon
-     * entry, so a dependent completion is added, but by the time it
-     * is added, the target CF is complete, so must be directly
-     * executed. This is all done while avoiding unnecessary object
-     * construction in safe-bypass cases.
+     * Support for each kind of CompletionStage relies on a separate
+     * class, along with two CompletableFuture methods:
+     *
+     * * A Completion class with name X corresponding to function,
+     *   prefaced with "Uni", "Bi", or "Or". Each class contains
+     *   fields for source(s), actions, and dependent. They are
+     *   boringly similar, differing from others only with respect to
+     *   underlying functional forms. We do this so that users don't
+     *   encounter layers of adaptors in common usages. We also
+     *   include "Relay" classes/methods that don't correspond to user
+     *   methods; they copy results from one stage to another.
+     *
+     * * Boolean CompletableFuture method x(...) (for example
+     *   uniApply) takes all of the arguments needed to check that an
+     *   action is triggerable, and then either runs the action or
+     *   arranges its async execution by executing its Completion
+     *   argument, if present. The method returns true if known to be
+     *   complete.
+     *
+     * * Completion method tryFire(int mode) invokes the associated x
+     *   method with its held arguments, and on success cleans up.
+     *   The mode argument allows tryFire to be called twice (SYNC,
+     *   then ASYNC); the first to screen and trap exceptions while
+     *   arranging to execute, and the second when called from a
+     *   task. (A few classes are not used async so take slightly
+     *   different forms.)  The claim() callback suppresses function
+     *   invocation if already claimed by another thread.
+     *
+     * * CompletableFuture method xStage(...) is called from a public
+     *   stage method of CompletableFuture x. It screens user
+     *   arguments and invokes and/or creates the stage object.  If
+     *   not async and x is already complete, the action is run
+     *   immediately.  Otherwise a Completion c is created, pushed to
+     *   x's stack (unless done), and started or triggered via
+     *   c.tryFire.  This also covers races possible if x completes
+     *   while pushing.  Classes with two inputs (for example BiApply)
+     *   deal with races across both while pushing actions.  The
+     *   second completion is a CoCompletion pointing to the first,
+     *   shared so that at most one performs the action.  The
+     *   multiple-arity methods allOf and anyOf do this pairwise to
+     *   form trees of completions.
+     *
+     * Note that the generic type parameters of methods vary according
+     * to whether "this" is a source, dependent, or completion.
+     *
+     * Method postComplete is called upon completion unless the target
+     * is guaranteed not to be observable (i.e., not yet returned or
+     * linked). Multiple threads can call postComplete, which
+     * atomically pops each dependent action, and tries to trigger it
+     * via method tryFire, in NESTED mode.  Triggering can propagate
+     * recursively, so NESTED mode returns its completed dependent (if
+     * one exists) for further processing by its caller (see method
+     * postFire).
+     *
+     * Blocking methods get() and join() rely on Signaller Completions
+     * that wake up waiting threads.  The mechanics are similar to
+     * Treiber stack wait-nodes used in FutureTask, Phaser, and
+     * SynchronousQueue. See their internal documentation for
+     * algorithmic details.
+     *
+     * Without precautions, CompletableFutures would be prone to
+     * garbage accumulation as chains of Completions build up, each
+     * pointing back to its sources. So we null out fields as soon as
+     * possible (see especially method Completion.detach). The
+     * screening checks needed anyway harmlessly ignore null arguments
+     * that may have been obtained during races with threads nulling
+     * out fields.  We also try to unlink fired Completions from
+     * stacks that might never be popped (see method postFire).
+     * Completion fields need not be declared as final or volatile
+     * because they are only visible to other threads upon safe
+     * publication.
      */
 
-    // preliminaries
+    volatile Object result;       // Either the result or boxed AltResult
+    volatile Completion stack;    // Top of Treiber stack of dependent actions
 
-    static final class AltResult {
-        final Throwable ex; // null only for NIL
-        AltResult(Throwable ex) { this.ex = ex; }
+    final boolean internalComplete(Object r) { // CAS from null to r
+        return UNSAFE.compareAndSwapObject(this, RESULT, null, r);
     }
 
+    final boolean casStack(Completion cmp, Completion val) {
+        return UNSAFE.compareAndSwapObject(this, STACK, cmp, val);
+    }
+
+    /** Returns true if successfully pushed c onto stack. */
+    final boolean tryPushStack(Completion c) {
+        Completion h = stack;
+        lazySetNext(c, h);
+        return UNSAFE.compareAndSwapObject(this, STACK, h, c);
+    }
+
+    /** Unconditionally pushes c onto stack, retrying if necessary. */
+    final void pushStack(Completion c) {
+        do {} while (!tryPushStack(c));
+    }
+
+    /* ------------- Encoding and decoding outcomes -------------- */
+
+    static final class AltResult { // See above
+        final Throwable ex;        // null only for NIL
+        AltResult(Throwable x) { this.ex = x; }
+    }
+
+    /** The encoding of the null value. */
     static final AltResult NIL = new AltResult(null);
 
-    // Fields
+    /** Completes with the null value, unless already completed. */
+    final boolean completeNull() {
+        return UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                           NIL);
+    }
 
-    volatile Object result;    // Either the result or boxed AltResult
-    volatile WaitNode waiters; // Treiber stack of threads blocked on get()
-    volatile CompletionNode completions; // list (Treiber stack) of completions
+    /** Returns the encoding of the given non-exceptional value. */
+    final Object encodeValue(T t) {
+        return (t == null) ? NIL : t;
+    }
 
-    // Basic utilities for triggering and processing completions
+    /** Completes with a non-exceptional result, unless already completed. */
+    final boolean completeValue(T t) {
+        return UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                           (t == null) ? NIL : t);
+    }
 
     /**
-     * Removes and signals all waiting threads and runs all completions.
+     * Returns the encoding of the given (non-null) exception as a
+     * wrapped CompletionException unless it is one already.
+     */
+    static AltResult encodeThrowable(Throwable x) {
+        return new AltResult((x instanceof CompletionException) ? x :
+                             new CompletionException(x));
+    }
+
+    /** Completes with an exceptional result, unless already completed. */
+    final boolean completeThrowable(Throwable x) {
+        return UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                           encodeThrowable(x));
+    }
+
+    /**
+     * Returns the encoding of the given (non-null) exception as a
+     * wrapped CompletionException unless it is one already.  May
+     * return the given Object r (which must have been the result of a
+     * source future) if it is equivalent, i.e. if this is a simple
+     * relay of an existing CompletionException.
+     */
+    static Object encodeThrowable(Throwable x, Object r) {
+        if (!(x instanceof CompletionException))
+            x = new CompletionException(x);
+        else if (r instanceof AltResult && x == ((AltResult)r).ex)
+            return r;
+        return new AltResult(x);
+    }
+
+    /**
+     * Completes with the given (non-null) exceptional result as a
+     * wrapped CompletionException unless it is one already, unless
+     * already completed.  May complete with the given Object r
+     * (which must have been the result of a source future) if it is
+     * equivalent, i.e. if this is a simple propagation of an
+     * existing CompletionException.
+     */
+    final boolean completeThrowable(Throwable x, Object r) {
+        return UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                           encodeThrowable(x, r));
+    }
+
+    /**
+     * Returns the encoding of the given arguments: if the exception
+     * is non-null, encodes as AltResult.  Otherwise uses the given
+     * value, boxed as NIL if null.
+     */
+    Object encodeOutcome(T t, Throwable x) {
+        return (x == null) ? (t == null) ? NIL : t : encodeThrowable(x);
+    }
+
+    /**
+     * Returns the encoding of a copied outcome; if exceptional,
+     * rewraps as a CompletionException, else returns argument.
+     */
+    static Object encodeRelay(Object r) {
+        Throwable x;
+        return (((r instanceof AltResult) &&
+                 (x = ((AltResult)r).ex) != null &&
+                 !(x instanceof CompletionException)) ?
+                new AltResult(new CompletionException(x)) : r);
+    }
+
+    /**
+     * Completes with r or a copy of r, unless already completed.
+     * If exceptional, r is first coerced to a CompletionException.
+     */
+    final boolean completeRelay(Object r) {
+        return UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                           encodeRelay(r));
+    }
+
+    /**
+     * Reports result using Future.get conventions.
+     */
+    private static <T> T reportGet(Object r)
+        throws InterruptedException, ExecutionException {
+        if (r == null) // by convention below, null means interrupted
+            throw new InterruptedException();
+        if (r instanceof AltResult) {
+            Throwable x, cause;
+            if ((x = ((AltResult)r).ex) == null)
+                return null;
+            if (x instanceof CancellationException)
+                throw (CancellationException)x;
+            if ((x instanceof CompletionException) &&
+                (cause = x.getCause()) != null)
+                x = cause;
+            throw new ExecutionException(x);
+        }
+        @SuppressWarnings("unchecked") T t = (T) r;
+        return t;
+    }
+
+    /**
+     * Decodes outcome to return result or throw unchecked exception.
+     */
+    private static <T> T reportJoin(Object r) {
+        if (r instanceof AltResult) {
+            Throwable x;
+            if ((x = ((AltResult)r).ex) == null)
+                return null;
+            if (x instanceof CancellationException)
+                throw (CancellationException)x;
+            if (x instanceof CompletionException)
+                throw (CompletionException)x;
+            throw new CompletionException(x);
+        }
+        @SuppressWarnings("unchecked") T t = (T) r;
+        return t;
+    }
+
+    /* ------------- Async task preliminaries -------------- */
+
+    /**
+     * A marker interface identifying asynchronous tasks produced by
+     * {@code async} methods. This may be useful for monitoring,
+     * debugging, and tracking asynchronous activities.
+     *
+     * @since 1.8
+     */
+    public static interface AsynchronousCompletionTask {
+    }
+
+    private static final boolean useCommonPool =
+        (ForkJoinPool.getCommonPoolParallelism() > 1);
+
+    /**
+     * Default executor -- ForkJoinPool.commonPool() unless it cannot
+     * support parallelism.
+     */
+    private static final Executor asyncPool = useCommonPool ?
+        ForkJoinPool.commonPool() : new ThreadPerTaskExecutor();
+
+    /** Fallback if ForkJoinPool.commonPool() cannot support parallelism */
+    static final class ThreadPerTaskExecutor implements Executor {
+        public void execute(Runnable r) { new Thread(r).start(); }
+    }
+
+    /**
+     * Null-checks user executor argument, and translates uses of
+     * commonPool to asyncPool in case parallelism disabled.
+     */
+    static Executor screenExecutor(Executor e) {
+        if (!useCommonPool && e == ForkJoinPool.commonPool())
+            return asyncPool;
+        if (e == null) throw new NullPointerException();
+        return e;
+    }
+
+    // Modes for Completion.tryFire. Signedness matters.
+    static final int SYNC   =  0;
+    static final int ASYNC  =  1;
+    static final int NESTED = -1;
+
+    /* ------------- Base Completion classes and operations -------------- */
+
+    @SuppressWarnings("serial")
+    abstract static class Completion extends ForkJoinTask<Void>
+        implements Runnable, AsynchronousCompletionTask {
+        volatile Completion next;      // Treiber stack link
+
+        /**
+         * Performs completion action if triggered, returning a
+         * dependent that may need propagation, if one exists.
+         *
+         * @param mode SYNC, ASYNC, or NESTED
+         */
+        abstract CompletableFuture<?> tryFire(int mode);
+
+        /** Returns true if possibly still triggerable. Used by cleanStack. */
+        abstract boolean isLive();
+
+        public final void run()                { tryFire(ASYNC); }
+        public final boolean exec()            { tryFire(ASYNC); return true; }
+        public final Void getRawResult()       { return null; }
+        public final void setRawResult(Void v) {}
+    }
+
+    static void lazySetNext(Completion c, Completion next) {
+        UNSAFE.putOrderedObject(c, NEXT, next);
+    }
+
+    /**
+     * Pops and tries to trigger all reachable dependents.  Call only
+     * when known to be done.
      */
     final void postComplete() {
-        WaitNode q; Thread t;
-        while ((q = waiters) != null) {
-            if (UNSAFE.compareAndSwapObject(this, WAITERS, q, q.next) &&
-                (t = q.thread) != null) {
-                q.thread = null;
-                LockSupport.unpark(t);
+        /*
+         * On each step, variable f holds current dependents to pop
+         * and run.  It is extended along only one path at a time,
+         * pushing others to avoid unbounded recursion.
+         */
+        CompletableFuture<?> f = this; Completion h;
+        while ((h = f.stack) != null ||
+               (f != this && (h = (f = this).stack) != null)) {
+            CompletableFuture<?> d; Completion t;
+            if (f.casStack(h, t = h.next)) {
+                if (t != null) {
+                    if (f != this) {
+                        pushStack(h);
+                        continue;
+                    }
+                    h.next = null;    // detach
+                }
+                f = (d = h.tryFire(NESTED)) == null ? this : d;
             }
         }
+    }
 
-        CompletionNode h; Completion c;
-        while ((h = completions) != null) {
-            if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, h, h.next) &&
-                (c = h.completion) != null)
-                c.run();
+    /** Traverses stack and unlinks dead Completions. */
+    final void cleanStack() {
+        for (Completion p = null, q = stack; q != null;) {
+            Completion s = q.next;
+            if (q.isLive()) {
+                p = q;
+                q = s;
+            }
+            else if (p == null) {
+                casStack(q, s);
+                q = stack;
+            }
+            else {
+                p.next = s;
+                if (p.isLive())
+                    q = s;
+                else {
+                    p = null;  // restart
+                    q = stack;
+                }
+            }
+        }
+    }
+
+    /* ------------- One-input Completions -------------- */
+
+    /** A Completion with a source, dependent, and executor. */
+    @SuppressWarnings("serial")
+    abstract static class UniCompletion<T,V> extends Completion {
+        Executor executor;                 // executor to use (null if none)
+        CompletableFuture<V> dep;          // the dependent to complete
+        CompletableFuture<T> src;          // source for action
+
+        UniCompletion(Executor executor, CompletableFuture<V> dep,
+                      CompletableFuture<T> src) {
+            this.executor = executor; this.dep = dep; this.src = src;
+        }
+
+        /**
+         * Returns true if action can be run. Call only when known to
+         * be triggerable. Uses FJ tag bit to ensure that only one
+         * thread claims ownership.  If async, starts as task -- a
+         * later call to tryFire will run action.
+         */
+        final boolean claim() {
+            Executor e = executor;
+            if (compareAndSetForkJoinTaskTag((short)0, (short)1)) {
+                if (e == null)
+                    return true;
+                executor = null; // disable
+                e.execute(this);
+            }
+            return false;
+        }
+
+        final boolean isLive() { return dep != null; }
+    }
+
+    /** Pushes the given completion (if it exists) unless done. */
+    final void push(UniCompletion<?,?> c) {
+        if (c != null) {
+            while (result == null && !tryPushStack(c))
+                lazySetNext(c, null); // clear on failure
         }
     }
 
     /**
-     * Triggers completion with the encoding of the given arguments:
-     * if the exception is non-null, encodes it as a wrapped
-     * CompletionException unless it is one already.  Otherwise uses
-     * the given result, boxed as NIL if null.
+     * Post-processing by dependent after successful UniCompletion
+     * tryFire.  Tries to clean stack of source a, and then either runs
+     * postComplete or returns this to caller, depending on mode.
      */
-    final void internalComplete(T v, Throwable ex) {
+    final CompletableFuture<T> postFire(CompletableFuture<?> a, int mode) {
+        if (a != null && a.stack != null) {
+            if (mode < 0 || a.result == null)
+                a.cleanStack();
+            else
+                a.postComplete();
+        }
+        if (result != null && stack != null) {
+            if (mode < 0)
+                return this;
+            else
+                postComplete();
+        }
+        return null;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniApply<T,V> extends UniCompletion<T,V> {
+        Function<? super T,? extends V> fn;
+        UniApply(Executor executor, CompletableFuture<V> dep,
+                 CompletableFuture<T> src,
+                 Function<? super T,? extends V> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<V> tryFire(int mode) {
+            CompletableFuture<V> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniApply(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final <S> boolean uniApply(CompletableFuture<S> a,
+                               Function<? super S,? extends T> f,
+                               UniApply<S,T> c) {
+        Object r; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    completeThrowable(x, r);
+                    break tryComplete;
+                }
+                r = null;
+            }
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                @SuppressWarnings("unchecked") S s = (S) r;
+                completeValue(f.apply(s));
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <V> CompletableFuture<V> uniApplyStage(
+        Executor e, Function<? super T,? extends V> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<V> d =  new CompletableFuture<V>();
+        if (e != null || !d.uniApply(this, f, null)) {
+            UniApply<T,V> c = new UniApply<T,V>(e, d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniAccept<T> extends UniCompletion<T,Void> {
+        Consumer<? super T> fn;
+        UniAccept(Executor executor, CompletableFuture<Void> dep,
+                  CompletableFuture<T> src, Consumer<? super T> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniAccept(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final <S> boolean uniAccept(CompletableFuture<S> a,
+                                Consumer<? super S> f, UniAccept<S> c) {
+        Object r; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    completeThrowable(x, r);
+                    break tryComplete;
+                }
+                r = null;
+            }
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                @SuppressWarnings("unchecked") S s = (S) r;
+                f.accept(s);
+                completeNull();
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private CompletableFuture<Void> uniAcceptStage(Executor e,
+                                                   Consumer<? super T> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.uniAccept(this, f, null)) {
+            UniAccept<T> c = new UniAccept<T>(e, d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniRun<T> extends UniCompletion<T,Void> {
+        Runnable fn;
+        UniRun(Executor executor, CompletableFuture<Void> dep,
+               CompletableFuture<T> src, Runnable fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniRun(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final boolean uniRun(CompletableFuture<?> a, Runnable f, UniRun<?> c) {
+        Object r; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        if (result == null) {
+            if (r instanceof AltResult && (x = ((AltResult)r).ex) != null)
+                completeThrowable(x, r);
+            else
+                try {
+                    if (c != null && !c.claim())
+                        return false;
+                    f.run();
+                    completeNull();
+                } catch (Throwable ex) {
+                    completeThrowable(ex);
+                }
+        }
+        return true;
+    }
+
+    private CompletableFuture<Void> uniRunStage(Executor e, Runnable f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.uniRun(this, f, null)) {
+            UniRun<T> c = new UniRun<T>(e, d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniWhenComplete<T> extends UniCompletion<T,T> {
+        BiConsumer<? super T, ? super Throwable> fn;
+        UniWhenComplete(Executor executor, CompletableFuture<T> dep,
+                        CompletableFuture<T> src,
+                        BiConsumer<? super T, ? super Throwable> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<T> tryFire(int mode) {
+            CompletableFuture<T> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniWhenComplete(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final boolean uniWhenComplete(CompletableFuture<T> a,
+                                  BiConsumer<? super T,? super Throwable> f,
+                                  UniWhenComplete<T> c) {
+        Object r; T t; Throwable x = null;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        if (result == null) {
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult) {
+                    x = ((AltResult)r).ex;
+                    t = null;
+                } else {
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                f.accept(t, x);
+                if (x == null) {
+                    internalComplete(r);
+                    return true;
+                }
+            } catch (Throwable ex) {
+                if (x == null)
+                    x = ex;
+            }
+            completeThrowable(x, r);
+        }
+        return true;
+    }
+
+    private CompletableFuture<T> uniWhenCompleteStage(
+        Executor e, BiConsumer<? super T, ? super Throwable> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<T> d = new CompletableFuture<T>();
+        if (e != null || !d.uniWhenComplete(this, f, null)) {
+            UniWhenComplete<T> c = new UniWhenComplete<T>(e, d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniHandle<T,V> extends UniCompletion<T,V> {
+        BiFunction<? super T, Throwable, ? extends V> fn;
+        UniHandle(Executor executor, CompletableFuture<V> dep,
+                  CompletableFuture<T> src,
+                  BiFunction<? super T, Throwable, ? extends V> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<V> tryFire(int mode) {
+            CompletableFuture<V> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniHandle(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final <S> boolean uniHandle(CompletableFuture<S> a,
+                                BiFunction<? super S, Throwable, ? extends T> f,
+                                UniHandle<S,T> c) {
+        Object r; S s; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        if (result == null) {
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult) {
+                    x = ((AltResult)r).ex;
+                    s = null;
+                } else {
+                    x = null;
+                    @SuppressWarnings("unchecked") S ss = (S) r;
+                    s = ss;
+                }
+                completeValue(f.apply(s, x));
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <V> CompletableFuture<V> uniHandleStage(
+        Executor e, BiFunction<? super T, Throwable, ? extends V> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<V> d = new CompletableFuture<V>();
+        if (e != null || !d.uniHandle(this, f, null)) {
+            UniHandle<T,V> c = new UniHandle<T,V>(e, d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniExceptionally<T> extends UniCompletion<T,T> {
+        Function<? super Throwable, ? extends T> fn;
+        UniExceptionally(CompletableFuture<T> dep, CompletableFuture<T> src,
+                         Function<? super Throwable, ? extends T> fn) {
+            super(null, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<T> tryFire(int mode) { // never ASYNC
+            // assert mode != ASYNC;
+            CompletableFuture<T> d; CompletableFuture<T> a;
+            if ((d = dep) == null || !d.uniExceptionally(a = src, fn, this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final boolean uniExceptionally(CompletableFuture<T> a,
+                                   Function<? super Throwable, ? extends T> f,
+                                   UniExceptionally<T> c) {
+        Object r; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        if (result == null) {
+            try {
+                if (r instanceof AltResult && (x = ((AltResult)r).ex) != null) {
+                    if (c != null && !c.claim())
+                        return false;
+                    completeValue(f.apply(x));
+                } else
+                    internalComplete(r);
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private CompletableFuture<T> uniExceptionallyStage(
+        Function<Throwable, ? extends T> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<T> d = new CompletableFuture<T>();
+        if (!d.uniExceptionally(this, f, null)) {
+            UniExceptionally<T> c = new UniExceptionally<T>(d, this, f);
+            push(c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniRelay<T> extends UniCompletion<T,T> { // for Compose
+        UniRelay(CompletableFuture<T> dep, CompletableFuture<T> src) {
+            super(null, dep, src);
+        }
+        final CompletableFuture<T> tryFire(int mode) {
+            CompletableFuture<T> d; CompletableFuture<T> a;
+            if ((d = dep) == null || !d.uniRelay(a = src))
+                return null;
+            src = null; dep = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final boolean uniRelay(CompletableFuture<T> a) {
+        Object r;
+        if (a == null || (r = a.result) == null)
+            return false;
+        if (result == null) // no need to claim
+            completeRelay(r);
+        return true;
+    }
+
+    @SuppressWarnings("serial")
+    static final class UniCompose<T,V> extends UniCompletion<T,V> {
+        Function<? super T, ? extends CompletionStage<V>> fn;
+        UniCompose(Executor executor, CompletableFuture<V> dep,
+                   CompletableFuture<T> src,
+                   Function<? super T, ? extends CompletionStage<V>> fn) {
+            super(executor, dep, src); this.fn = fn;
+        }
+        final CompletableFuture<V> tryFire(int mode) {
+            CompletableFuture<V> d; CompletableFuture<T> a;
+            if ((d = dep) == null ||
+                !d.uniCompose(a = src, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; fn = null;
+            return d.postFire(a, mode);
+        }
+    }
+
+    final <S> boolean uniCompose(
+        CompletableFuture<S> a,
+        Function<? super S, ? extends CompletionStage<T>> f,
+        UniCompose<S,T> c) {
+        Object r; Throwable x;
+        if (a == null || (r = a.result) == null || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    completeThrowable(x, r);
+                    break tryComplete;
+                }
+                r = null;
+            }
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                @SuppressWarnings("unchecked") S s = (S) r;
+                CompletableFuture<T> g = f.apply(s).toCompletableFuture();
+                if (g.result == null || !uniRelay(g)) {
+                    UniRelay<T> copy = new UniRelay<T>(this, g);
+                    g.push(copy);
+                    copy.tryFire(SYNC);
+                    if (result == null)
+                        return false;
+                }
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <V> CompletableFuture<V> uniComposeStage(
+        Executor e, Function<? super T, ? extends CompletionStage<V>> f) {
+        if (f == null) throw new NullPointerException();
+        Object r; Throwable x;
+        if (e == null && (r = result) != null) {
+            // try to return function result directly
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    return new CompletableFuture<V>(encodeThrowable(x, r));
+                }
+                r = null;
+            }
+            try {
+                @SuppressWarnings("unchecked") T t = (T) r;
+                return f.apply(t).toCompletableFuture();
+            } catch (Throwable ex) {
+                return new CompletableFuture<V>(encodeThrowable(ex));
+            }
+        }
+        CompletableFuture<V> d = new CompletableFuture<V>();
+        UniCompose<T,V> c = new UniCompose<T,V>(e, d, this, f);
+        push(c);
+        c.tryFire(SYNC);
+        return d;
+    }
+
+    /* ------------- Two-input Completions -------------- */
+
+    /** A Completion for an action with two sources */
+    @SuppressWarnings("serial")
+    abstract static class BiCompletion<T,U,V> extends UniCompletion<T,V> {
+        CompletableFuture<U> snd; // second source for action
+        BiCompletion(Executor executor, CompletableFuture<V> dep,
+                     CompletableFuture<T> src, CompletableFuture<U> snd) {
+            super(executor, dep, src); this.snd = snd;
+        }
+    }
+
+    /** A Completion delegating to a BiCompletion */
+    @SuppressWarnings("serial")
+    static final class CoCompletion extends Completion {
+        BiCompletion<?,?,?> base;
+        CoCompletion(BiCompletion<?,?,?> base) { this.base = base; }
+        final CompletableFuture<?> tryFire(int mode) {
+            BiCompletion<?,?,?> c; CompletableFuture<?> d;
+            if ((c = base) == null || (d = c.tryFire(mode)) == null)
+                return null;
+            base = null; // detach
+            return d;
+        }
+        final boolean isLive() {
+            BiCompletion<?,?,?> c;
+            return (c = base) != null && c.dep != null;
+        }
+    }
+
+    /** Pushes completion to this and b unless both done. */
+    final void bipush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
+        if (c != null) {
+            Object r;
+            while ((r = result) == null && !tryPushStack(c))
+                lazySetNext(c, null); // clear on failure
+            if (b != null && b != this && b.result == null) {
+                Completion q = (r != null) ? c : new CoCompletion(c);
+                while (b.result == null && !b.tryPushStack(q))
+                    lazySetNext(q, null); // clear on failure
+            }
+        }
+    }
+
+    /** Post-processing after successful BiCompletion tryFire. */
+    final CompletableFuture<T> postFire(CompletableFuture<?> a,
+                                        CompletableFuture<?> b, int mode) {
+        if (b != null && b.stack != null) { // clean second source
+            if (mode < 0 || b.result == null)
+                b.cleanStack();
+            else
+                b.postComplete();
+        }
+        return postFire(a, mode);
+    }
+
+    @SuppressWarnings("serial")
+    static final class BiApply<T,U,V> extends BiCompletion<T,U,V> {
+        BiFunction<? super T,? super U,? extends V> fn;
+        BiApply(Executor executor, CompletableFuture<V> dep,
+                CompletableFuture<T> src, CompletableFuture<U> snd,
+                BiFunction<? super T,? super U,? extends V> fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<V> tryFire(int mode) {
+            CompletableFuture<V> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.biApply(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final <R,S> boolean biApply(CompletableFuture<R> a,
+                                CompletableFuture<S> b,
+                                BiFunction<? super R,? super S,? extends T> f,
+                                BiApply<R,S,T> c) {
+        Object r, s; Throwable x;
+        if (a == null || (r = a.result) == null ||
+            b == null || (s = b.result) == null || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    completeThrowable(x, r);
+                    break tryComplete;
+                }
+                r = null;
+            }
+            if (s instanceof AltResult) {
+                if ((x = ((AltResult)s).ex) != null) {
+                    completeThrowable(x, s);
+                    break tryComplete;
+                }
+                s = null;
+            }
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                @SuppressWarnings("unchecked") R rr = (R) r;
+                @SuppressWarnings("unchecked") S ss = (S) s;
+                completeValue(f.apply(rr, ss));
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <U,V> CompletableFuture<V> biApplyStage(
+        Executor e, CompletionStage<U> o,
+        BiFunction<? super T,? super U,? extends V> f) {
+        CompletableFuture<U> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<V> d = new CompletableFuture<V>();
+        if (e != null || !d.biApply(this, b, f, null)) {
+            BiApply<T,U,V> c = new BiApply<T,U,V>(e, d, this, b, f);
+            bipush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class BiAccept<T,U> extends BiCompletion<T,U,Void> {
+        BiConsumer<? super T,? super U> fn;
+        BiAccept(Executor executor, CompletableFuture<Void> dep,
+                 CompletableFuture<T> src, CompletableFuture<U> snd,
+                 BiConsumer<? super T,? super U> fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.biAccept(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final <R,S> boolean biAccept(CompletableFuture<R> a,
+                                 CompletableFuture<S> b,
+                                 BiConsumer<? super R,? super S> f,
+                                 BiAccept<R,S> c) {
+        Object r, s; Throwable x;
+        if (a == null || (r = a.result) == null ||
+            b == null || (s = b.result) == null || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            if (r instanceof AltResult) {
+                if ((x = ((AltResult)r).ex) != null) {
+                    completeThrowable(x, r);
+                    break tryComplete;
+                }
+                r = null;
+            }
+            if (s instanceof AltResult) {
+                if ((x = ((AltResult)s).ex) != null) {
+                    completeThrowable(x, s);
+                    break tryComplete;
+                }
+                s = null;
+            }
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                @SuppressWarnings("unchecked") R rr = (R) r;
+                @SuppressWarnings("unchecked") S ss = (S) s;
+                f.accept(rr, ss);
+                completeNull();
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <U> CompletableFuture<Void> biAcceptStage(
+        Executor e, CompletionStage<U> o,
+        BiConsumer<? super T,? super U> f) {
+        CompletableFuture<U> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.biAccept(this, b, f, null)) {
+            BiAccept<T,U> c = new BiAccept<T,U>(e, d, this, b, f);
+            bipush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class BiRun<T,U> extends BiCompletion<T,U,Void> {
+        Runnable fn;
+        BiRun(Executor executor, CompletableFuture<Void> dep,
+              CompletableFuture<T> src,
+              CompletableFuture<U> snd,
+              Runnable fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.biRun(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final boolean biRun(CompletableFuture<?> a, CompletableFuture<?> b,
+                        Runnable f, BiRun<?,?> c) {
+        Object r, s; Throwable x;
+        if (a == null || (r = a.result) == null ||
+            b == null || (s = b.result) == null || f == null)
+            return false;
+        if (result == null) {
+            if (r instanceof AltResult && (x = ((AltResult)r).ex) != null)
+                completeThrowable(x, r);
+            else if (s instanceof AltResult && (x = ((AltResult)s).ex) != null)
+                completeThrowable(x, s);
+            else
+                try {
+                    if (c != null && !c.claim())
+                        return false;
+                    f.run();
+                    completeNull();
+                } catch (Throwable ex) {
+                    completeThrowable(ex);
+                }
+        }
+        return true;
+    }
+
+    private CompletableFuture<Void> biRunStage(Executor e, CompletionStage<?> o,
+                                               Runnable f) {
+        CompletableFuture<?> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.biRun(this, b, f, null)) {
+            BiRun<T,?> c = new BiRun<>(e, d, this, b, f);
+            bipush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class BiRelay<T,U> extends BiCompletion<T,U,Void> { // for And
+        BiRelay(CompletableFuture<Void> dep,
+                CompletableFuture<T> src,
+                CompletableFuture<U> snd) {
+            super(null, dep, src, snd);
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null || !d.biRelay(a = src, b = snd))
+                return null;
+            src = null; snd = null; dep = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    boolean biRelay(CompletableFuture<?> a, CompletableFuture<?> b) {
+        Object r, s; Throwable x;
+        if (a == null || (r = a.result) == null ||
+            b == null || (s = b.result) == null)
+            return false;
+        if (result == null) {
+            if (r instanceof AltResult && (x = ((AltResult)r).ex) != null)
+                completeThrowable(x, r);
+            else if (s instanceof AltResult && (x = ((AltResult)s).ex) != null)
+                completeThrowable(x, s);
+            else
+                completeNull();
+        }
+        return true;
+    }
+
+    /** Recursively constructs a tree of completions. */
+    static CompletableFuture<Void> andTree(CompletableFuture<?>[] cfs,
+                                           int lo, int hi) {
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (lo > hi) // empty
+            d.result = NIL;
+        else {
+            CompletableFuture<?> a, b;
+            int mid = (lo + hi) >>> 1;
+            if ((a = (lo == mid ? cfs[lo] :
+                      andTree(cfs, lo, mid))) == null ||
+                (b = (lo == hi ? a : (hi == mid+1) ? cfs[hi] :
+                      andTree(cfs, mid+1, hi)))  == null)
+                throw new NullPointerException();
+            if (!d.biRelay(a, b)) {
+                BiRelay<?,?> c = new BiRelay<>(d, a, b);
+                a.bipush(b, c);
+                c.tryFire(SYNC);
+            }
+        }
+        return d;
+    }
+
+    /* ------------- Projected (Ored) BiCompletions -------------- */
+
+    /** Pushes completion to this and b unless either done. */
+    final void orpush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
+        if (c != null) {
+            while ((b == null || b.result == null) && result == null) {
+                if (tryPushStack(c)) {
+                    if (b != null && b != this && b.result == null) {
+                        Completion q = new CoCompletion(c);
+                        while (result == null && b.result == null &&
+                               !b.tryPushStack(q))
+                            lazySetNext(q, null); // clear on failure
+                    }
+                    break;
+                }
+                lazySetNext(c, null); // clear on failure
+            }
+        }
+    }
+
+    @SuppressWarnings("serial")
+    static final class OrApply<T,U extends T,V> extends BiCompletion<T,U,V> {
+        Function<? super T,? extends V> fn;
+        OrApply(Executor executor, CompletableFuture<V> dep,
+                CompletableFuture<T> src,
+                CompletableFuture<U> snd,
+                Function<? super T,? extends V> fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<V> tryFire(int mode) {
+            CompletableFuture<V> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.orApply(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final <R,S extends R> boolean orApply(CompletableFuture<R> a,
+                                          CompletableFuture<S> b,
+                                          Function<? super R, ? extends T> f,
+                                          OrApply<R,S,T> c) {
+        Object r; Throwable x;
+        if (a == null || b == null ||
+            ((r = a.result) == null && (r = b.result) == null) || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult) {
+                    if ((x = ((AltResult)r).ex) != null) {
+                        completeThrowable(x, r);
+                        break tryComplete;
+                    }
+                    r = null;
+                }
+                @SuppressWarnings("unchecked") R rr = (R) r;
+                completeValue(f.apply(rr));
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <U extends T,V> CompletableFuture<V> orApplyStage(
+        Executor e, CompletionStage<U> o,
+        Function<? super T, ? extends V> f) {
+        CompletableFuture<U> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<V> d = new CompletableFuture<V>();
+        if (e != null || !d.orApply(this, b, f, null)) {
+            OrApply<T,U,V> c = new OrApply<T,U,V>(e, d, this, b, f);
+            orpush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class OrAccept<T,U extends T> extends BiCompletion<T,U,Void> {
+        Consumer<? super T> fn;
+        OrAccept(Executor executor, CompletableFuture<Void> dep,
+                 CompletableFuture<T> src,
+                 CompletableFuture<U> snd,
+                 Consumer<? super T> fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.orAccept(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final <R,S extends R> boolean orAccept(CompletableFuture<R> a,
+                                           CompletableFuture<S> b,
+                                           Consumer<? super R> f,
+                                           OrAccept<R,S> c) {
+        Object r; Throwable x;
+        if (a == null || b == null ||
+            ((r = a.result) == null && (r = b.result) == null) || f == null)
+            return false;
+        tryComplete: if (result == null) {
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult) {
+                    if ((x = ((AltResult)r).ex) != null) {
+                        completeThrowable(x, r);
+                        break tryComplete;
+                    }
+                    r = null;
+                }
+                @SuppressWarnings("unchecked") R rr = (R) r;
+                f.accept(rr);
+                completeNull();
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private <U extends T> CompletableFuture<Void> orAcceptStage(
+        Executor e, CompletionStage<U> o, Consumer<? super T> f) {
+        CompletableFuture<U> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.orAccept(this, b, f, null)) {
+            OrAccept<T,U> c = new OrAccept<T,U>(e, d, this, b, f);
+            orpush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class OrRun<T,U> extends BiCompletion<T,U,Void> {
+        Runnable fn;
+        OrRun(Executor executor, CompletableFuture<Void> dep,
+              CompletableFuture<T> src,
+              CompletableFuture<U> snd,
+              Runnable fn) {
+            super(executor, dep, src, snd); this.fn = fn;
+        }
+        final CompletableFuture<Void> tryFire(int mode) {
+            CompletableFuture<Void> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null ||
+                !d.orRun(a = src, b = snd, fn, mode > 0 ? null : this))
+                return null;
+            dep = null; src = null; snd = null; fn = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final boolean orRun(CompletableFuture<?> a, CompletableFuture<?> b,
+                        Runnable f, OrRun<?,?> c) {
+        Object r; Throwable x;
+        if (a == null || b == null ||
+            ((r = a.result) == null && (r = b.result) == null) || f == null)
+            return false;
+        if (result == null) {
+            try {
+                if (c != null && !c.claim())
+                    return false;
+                if (r instanceof AltResult && (x = ((AltResult)r).ex) != null)
+                    completeThrowable(x, r);
+                else {
+                    f.run();
+                    completeNull();
+                }
+            } catch (Throwable ex) {
+                completeThrowable(ex);
+            }
+        }
+        return true;
+    }
+
+    private CompletableFuture<Void> orRunStage(Executor e, CompletionStage<?> o,
+                                               Runnable f) {
+        CompletableFuture<?> b;
+        if (f == null || (b = o.toCompletableFuture()) == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        if (e != null || !d.orRun(this, b, f, null)) {
+            OrRun<T,?> c = new OrRun<>(e, d, this, b, f);
+            orpush(b, c);
+            c.tryFire(SYNC);
+        }
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class OrRelay<T,U> extends BiCompletion<T,U,Object> { // for Or
+        OrRelay(CompletableFuture<Object> dep, CompletableFuture<T> src,
+                CompletableFuture<U> snd) {
+            super(null, dep, src, snd);
+        }
+        final CompletableFuture<Object> tryFire(int mode) {
+            CompletableFuture<Object> d;
+            CompletableFuture<T> a;
+            CompletableFuture<U> b;
+            if ((d = dep) == null || !d.orRelay(a = src, b = snd))
+                return null;
+            src = null; snd = null; dep = null;
+            return d.postFire(a, b, mode);
+        }
+    }
+
+    final boolean orRelay(CompletableFuture<?> a, CompletableFuture<?> b) {
+        Object r;
+        if (a == null || b == null ||
+            ((r = a.result) == null && (r = b.result) == null))
+            return false;
         if (result == null)
-            UNSAFE.compareAndSwapObject
-                (this, RESULT, null,
-                 (ex == null) ? (v == null) ? NIL : v :
-                 new AltResult((ex instanceof CompletionException) ? ex :
-                               new CompletionException(ex)));
-        postComplete(); // help out even if not triggered
+            completeRelay(r);
+        return true;
     }
 
-    /**
-     * If triggered, helps release and/or process completions.
-     */
-    final void helpPostComplete() {
-        if (result != null)
-            postComplete();
+    /** Recursively constructs a tree of completions. */
+    static CompletableFuture<Object> orTree(CompletableFuture<?>[] cfs,
+                                            int lo, int hi) {
+        CompletableFuture<Object> d = new CompletableFuture<Object>();
+        if (lo <= hi) {
+            CompletableFuture<?> a, b;
+            int mid = (lo + hi) >>> 1;
+            if ((a = (lo == mid ? cfs[lo] :
+                      orTree(cfs, lo, mid))) == null ||
+                (b = (lo == hi ? a : (hi == mid+1) ? cfs[hi] :
+                      orTree(cfs, mid+1, hi)))  == null)
+                throw new NullPointerException();
+            if (!d.orRelay(a, b)) {
+                OrRelay<?,?> c = new OrRelay<>(d, a, b);
+                a.orpush(b, c);
+                c.tryFire(SYNC);
+            }
+        }
+        return d;
     }
 
-    /* ------------- waiting for completions -------------- */
+    /* ------------- Zero-input Async forms -------------- */
 
-    /** Number of processors, for spin control */
-    static final int NCPU = Runtime.getRuntime().availableProcessors();
+    @SuppressWarnings("serial")
+    static final class AsyncSupply<T> extends ForkJoinTask<Void>
+            implements Runnable, AsynchronousCompletionTask {
+        CompletableFuture<T> dep; Supplier<T> fn;
+        AsyncSupply(CompletableFuture<T> dep, Supplier<T> fn) {
+            this.dep = dep; this.fn = fn;
+        }
+
+        public final Void getRawResult() { return null; }
+        public final void setRawResult(Void v) {}
+        public final boolean exec() { run(); return true; }
+
+        public void run() {
+            CompletableFuture<T> d; Supplier<T> f;
+            if ((d = dep) != null && (f = fn) != null) {
+                dep = null; fn = null;
+                if (d.result == null) {
+                    try {
+                        d.completeValue(f.get());
+                    } catch (Throwable ex) {
+                        d.completeThrowable(ex);
+                    }
+                }
+                d.postComplete();
+            }
+        }
+    }
+
+    static <U> CompletableFuture<U> asyncSupplyStage(Executor e,
+                                                     Supplier<U> f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<U> d = new CompletableFuture<U>();
+        e.execute(new AsyncSupply<U>(d, f));
+        return d;
+    }
+
+    @SuppressWarnings("serial")
+    static final class AsyncRun extends ForkJoinTask<Void>
+            implements Runnable, AsynchronousCompletionTask {
+        CompletableFuture<Void> dep; Runnable fn;
+        AsyncRun(CompletableFuture<Void> dep, Runnable fn) {
+            this.dep = dep; this.fn = fn;
+        }
+
+        public final Void getRawResult() { return null; }
+        public final void setRawResult(Void v) {}
+        public final boolean exec() { run(); return true; }
+
+        public void run() {
+            CompletableFuture<Void> d; Runnable f;
+            if ((d = dep) != null && (f = fn) != null) {
+                dep = null; fn = null;
+                if (d.result == null) {
+                    try {
+                        f.run();
+                        d.completeNull();
+                    } catch (Throwable ex) {
+                        d.completeThrowable(ex);
+                    }
+                }
+                d.postComplete();
+            }
+        }
+    }
+
+    static CompletableFuture<Void> asyncRunStage(Executor e, Runnable f) {
+        if (f == null) throw new NullPointerException();
+        CompletableFuture<Void> d = new CompletableFuture<Void>();
+        e.execute(new AsyncRun(d, f));
+        return d;
+    }
+
+    /* ------------- Signallers -------------- */
 
     /**
-     * Heuristic spin value for waitingGet() before blocking on
-     * multiprocessors
+     * Completion for recording and releasing a waiting thread.  This
+     * class implements ManagedBlocker to avoid starvation when
+     * blocking actions pile up in ForkJoinPools.
      */
-    static final int SPINS = (NCPU > 1) ? 1 << 8 : 0;
-
-    /**
-     * Linked nodes to record waiting threads in a Treiber stack.  See
-     * other classes such as Phaser and SynchronousQueue for more
-     * detailed explanation. This class implements ManagedBlocker to
-     * avoid starvation when blocking actions pile up in
-     * ForkJoinPools.
-     */
-    static final class WaitNode implements ForkJoinPool.ManagedBlocker {
-        long nanos;          // wait time if timed
-        final long deadline; // non-zero if timed
+    @SuppressWarnings("serial")
+    static final class Signaller extends Completion
+        implements ForkJoinPool.ManagedBlocker {
+        long nanos;                    // wait time if timed
+        final long deadline;           // non-zero if timed
         volatile int interruptControl; // > 0: interruptible, < 0: interrupted
         volatile Thread thread;
-        volatile WaitNode next;
-        WaitNode(boolean interruptible, long nanos, long deadline) {
+
+        Signaller(boolean interruptible, long nanos, long deadline) {
             this.thread = Thread.currentThread();
             this.interruptControl = interruptible ? 1 : 0;
             this.nanos = nanos;
             this.deadline = deadline;
         }
+        final CompletableFuture<?> tryFire(int ignore) {
+            Thread w; // no need to atomically claim
+            if ((w = thread) != null) {
+                thread = null;
+                LockSupport.unpark(w);
+            }
+            return null;
+        }
         public boolean isReleasable() {
             if (thread == null)
                 return true;
@@ -273,6 +1687,7 @@
                 LockSupport.parkNanos(this, nanos);
             return isReleasable();
         }
+        final boolean isLive() { return thread != null; }
     }
 
     /**
@@ -280,1832 +1695,89 @@
      * interrupted.
      */
     private Object waitingGet(boolean interruptible) {
-        WaitNode q = null;
+        Signaller q = null;
         boolean queued = false;
-        int spins = SPINS;
-        for (Object r;;) {
-            if ((r = result) != null) {
-                if (q != null) { // suppress unpark
-                    q.thread = null;
-                    if (q.interruptControl < 0) {
-                        if (interruptible) {
-                            removeWaiter(q);
-                            return null;
-                        }
-                        Thread.currentThread().interrupt();
-                    }
-                }
-                postComplete(); // help release others
-                return r;
-            }
+        int spins = -1;
+        Object r;
+        while ((r = result) == null) {
+            if (spins < 0)
+                spins = (Runtime.getRuntime().availableProcessors() > 1) ?
+                    1 << 8 : 0; // Use brief spin-wait on multiprocessors
             else if (spins > 0) {
-                int rnd = ThreadLocalRandom.nextSecondarySeed();
-                if (rnd == 0)
-                    rnd = ThreadLocalRandom.current().nextInt();
-                if (rnd >= 0)
+                if (ThreadLocalRandom.nextSecondarySeed() >= 0)
                     --spins;
             }
             else if (q == null)
-                q = new WaitNode(interruptible, 0L, 0L);
+                q = new Signaller(interruptible, 0L, 0L);
             else if (!queued)
-                queued = UNSAFE.compareAndSwapObject(this, WAITERS,
-                                                     q.next = waiters, q);
+                queued = tryPushStack(q);
             else if (interruptible && q.interruptControl < 0) {
-                removeWaiter(q);
+                q.thread = null;
+                cleanStack();
                 return null;
             }
             else if (q.thread != null && result == null) {
                 try {
                     ForkJoinPool.managedBlock(q);
-                } catch (InterruptedException ex) {
+                } catch (InterruptedException ie) {
                     q.interruptControl = -1;
                 }
             }
         }
+        if (q != null) {
+            q.thread = null;
+            if (q.interruptControl < 0) {
+                if (interruptible)
+                    r = null; // report interruption
+                else
+                    Thread.currentThread().interrupt();
+            }
+        }
+        postComplete();
+        return r;
     }
 
     /**
-     * Awaits completion or aborts on interrupt or timeout.
-     *
-     * @param nanos time to wait
-     * @return raw result
+     * Returns raw result after waiting, or null if interrupted, or
+     * throws TimeoutException on timeout.
      */
-    private Object timedAwaitDone(long nanos)
-        throws InterruptedException, TimeoutException {
-        WaitNode q = null;
+    private Object timedGet(long nanos) throws TimeoutException {
+        if (Thread.interrupted())
+            return null;
+        if (nanos <= 0L)
+            throw new TimeoutException();
+        long d = System.nanoTime() + nanos;
+        Signaller q = new Signaller(true, nanos, d == 0L ? 1L : d); // avoid 0
         boolean queued = false;
-        for (Object r;;) {
-            if ((r = result) != null) {
-                if (q != null) {
-                    q.thread = null;
-                    if (q.interruptControl < 0) {
-                        removeWaiter(q);
-                        throw new InterruptedException();
-                    }
-                }
-                postComplete();
-                return r;
-            }
-            else if (q == null) {
-                if (nanos <= 0L)
-                    throw new TimeoutException();
-                long d = System.nanoTime() + nanos;
-                q = new WaitNode(true, nanos, d == 0L ? 1L : d); // avoid 0
-            }
-            else if (!queued)
-                queued = UNSAFE.compareAndSwapObject(this, WAITERS,
-                                                     q.next = waiters, q);
-            else if (q.interruptControl < 0) {
-                removeWaiter(q);
-                throw new InterruptedException();
-            }
-            else if (q.nanos <= 0L) {
-                if (result == null) {
-                    removeWaiter(q);
-                    throw new TimeoutException();
-                }
+        Object r;
+        // We intentionally don't spin here (as waitingGet does) because
+        // the call to nanoTime() above acts much like a spin.
+        while ((r = result) == null) {
+            if (!queued)
+                queued = tryPushStack(q);
+            else if (q.interruptControl < 0 || q.nanos <= 0L) {
+                q.thread = null;
+                cleanStack();
+                if (q.interruptControl < 0)
+                    return null;
+                throw new TimeoutException();
             }
             else if (q.thread != null && result == null) {
                 try {
                     ForkJoinPool.managedBlock(q);
-                } catch (InterruptedException ex) {
+                } catch (InterruptedException ie) {
                     q.interruptControl = -1;
                 }
             }
         }
+        if (q.interruptControl < 0)
+            r = null;
+        q.thread = null;
+        postComplete();
+        return r;
     }
 
-    /**
-     * Tries to unlink a timed-out or interrupted wait node to avoid
-     * accumulating garbage.  Internal nodes are simply unspliced
-     * without CAS since it is harmless if they are traversed anyway
-     * by releasers.  To avoid effects of unsplicing from already
-     * removed nodes, the list is retraversed in case of an apparent
-     * race.  This is slow when there are a lot of nodes, but we don't
-     * expect lists to be long enough to outweigh higher-overhead
-     * schemes.
-     */
-    private void removeWaiter(WaitNode node) {
-        if (node != null) {
-            node.thread = null;
-            retry:
-            for (;;) {          // restart on removeWaiter race
-                for (WaitNode pred = null, q = waiters, s; q != null; q = s) {
-                    s = q.next;
-                    if (q.thread != null)
-                        pred = q;
-                    else if (pred != null) {
-                        pred.next = s;
-                        if (pred.thread == null) // check for race
-                            continue retry;
-                    }
-                    else if (!UNSAFE.compareAndSwapObject(this, WAITERS, q, s))
-                        continue retry;
-                }
-                break;
-            }
-        }
-    }
-
-    /* ------------- Async tasks -------------- */
-
-    /**
-     * A marker interface identifying asynchronous tasks produced by
-     * {@code async} methods. This may be useful for monitoring,
-     * debugging, and tracking asynchronous activities.
-     *
-     * @since 1.8
-     */
-    public static interface AsynchronousCompletionTask {
-    }
-
-    /** Base class can act as either FJ or plain Runnable */
-    @SuppressWarnings("serial")
-    abstract static class Async extends ForkJoinTask<Void>
-        implements Runnable, AsynchronousCompletionTask {
-        public final Void getRawResult() { return null; }
-        public final void setRawResult(Void v) { }
-        public final void run() { exec(); }
-    }
-
-    /**
-     * Starts the given async task using the given executor, unless
-     * the executor is ForkJoinPool.commonPool and it has been
-     * disabled, in which case starts a new thread.
-     */
-    static void execAsync(Executor e, Async r) {
-        if (e == ForkJoinPool.commonPool() &&
-            ForkJoinPool.getCommonPoolParallelism() <= 1)
-            new Thread(r).start();
-        else
-            e.execute(r);
-    }
-
-    static final class AsyncRun extends Async {
-        final Runnable fn;
-        final CompletableFuture<Void> dst;
-        AsyncRun(Runnable fn, CompletableFuture<Void> dst) {
-            this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<Void> d; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    fn.run();
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-                d.internalComplete(null, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncSupply<U> extends Async {
-        final Supplier<U> fn;
-        final CompletableFuture<U> dst;
-        AsyncSupply(Supplier<U> fn, CompletableFuture<U> dst) {
-            this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<U> d; U u; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    u = fn.get();
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                    u = null;
-                }
-                d.internalComplete(u, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncApply<T,U> extends Async {
-        final T arg;
-        final Function<? super T,? extends U> fn;
-        final CompletableFuture<U> dst;
-        AsyncApply(T arg, Function<? super T,? extends U> fn,
-                   CompletableFuture<U> dst) {
-            this.arg = arg; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<U> d; U u; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    u = fn.apply(arg);
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                    u = null;
-                }
-                d.internalComplete(u, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncCombine<T,U,V> extends Async {
-        final T arg1;
-        final U arg2;
-        final BiFunction<? super T,? super U,? extends V> fn;
-        final CompletableFuture<V> dst;
-        AsyncCombine(T arg1, U arg2,
-                     BiFunction<? super T,? super U,? extends V> fn,
-                     CompletableFuture<V> dst) {
-            this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<V> d; V v; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    v = fn.apply(arg1, arg2);
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                    v = null;
-                }
-                d.internalComplete(v, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncAccept<T> extends Async {
-        final T arg;
-        final Consumer<? super T> fn;
-        final CompletableFuture<?> dst;
-        AsyncAccept(T arg, Consumer<? super T> fn,
-                    CompletableFuture<?> dst) {
-            this.arg = arg; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<?> d; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    fn.accept(arg);
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-                d.internalComplete(null, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncAcceptBoth<T,U> extends Async {
-        final T arg1;
-        final U arg2;
-        final BiConsumer<? super T,? super U> fn;
-        final CompletableFuture<?> dst;
-        AsyncAcceptBoth(T arg1, U arg2,
-                        BiConsumer<? super T,? super U> fn,
-                        CompletableFuture<?> dst) {
-            this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<?> d; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    fn.accept(arg1, arg2);
-                    ex = null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-                d.internalComplete(null, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncCompose<T,U> extends Async {
-        final T arg;
-        final Function<? super T, ? extends CompletionStage<U>> fn;
-        final CompletableFuture<U> dst;
-        AsyncCompose(T arg,
-                     Function<? super T, ? extends CompletionStage<U>> fn,
-                     CompletableFuture<U> dst) {
-            this.arg = arg; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<U> d, fr; U u; Throwable ex;
-            if ((d = this.dst) != null && d.result == null) {
-                try {
-                    CompletionStage<U> cs = fn.apply(arg);
-                    fr = (cs == null) ? null : cs.toCompletableFuture();
-                    ex = (fr == null) ? new NullPointerException() : null;
-                } catch (Throwable rex) {
-                    ex = rex;
-                    fr = null;
-                }
-                if (ex != null)
-                    u = null;
-                else {
-                    Object r = fr.result;
-                    if (r == null)
-                        r = fr.waitingGet(false);
-                    if (r instanceof AltResult) {
-                        ex = ((AltResult)r).ex;
-                        u = null;
-                    }
-                    else {
-                        @SuppressWarnings("unchecked") U ur = (U) r;
-                        u = ur;
-                    }
-                }
-                d.internalComplete(u, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AsyncWhenComplete<T> extends Async {
-        final T arg1;
-        final Throwable arg2;
-        final BiConsumer<? super T,? super Throwable> fn;
-        final CompletableFuture<T> dst;
-        AsyncWhenComplete(T arg1, Throwable arg2,
-                          BiConsumer<? super T,? super Throwable> fn,
-                          CompletableFuture<T> dst) {
-            this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
-        }
-        public final boolean exec() {
-            CompletableFuture<T> d;
-            if ((d = this.dst) != null && d.result == null) {
-                Throwable ex = arg2;
-                try {
-                    fn.accept(arg1, ex);
-                } catch (Throwable rex) {
-                    if (ex == null)
-                        ex = rex;
-                }
-                d.internalComplete(arg1, ex);
-            }
-            return true;
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    /* ------------- Completions -------------- */
-
-    /**
-     * Simple linked list nodes to record completions, used in
-     * basically the same way as WaitNodes. (We separate nodes from
-     * the Completions themselves mainly because for the And and Or
-     * methods, the same Completion object resides in two lists.)
-     */
-    static final class CompletionNode {
-        final Completion completion;
-        volatile CompletionNode next;
-        CompletionNode(Completion completion) { this.completion = completion; }
-    }
-
-    // Opportunistically subclass AtomicInteger to use compareAndSet to claim.
-    @SuppressWarnings("serial")
-    abstract static class Completion extends AtomicInteger implements Runnable {
-    }
-
-    static final class ThenApply<T,U> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final Function<? super T,? extends U> fn;
-        final CompletableFuture<U> dst;
-        final Executor executor;
-        ThenApply(CompletableFuture<? extends T> src,
-                  Function<? super T,? extends U> fn,
-                  CompletableFuture<U> dst,
-                  Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final Function<? super T,? extends U> fn;
-            final CompletableFuture<U> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                U u = null;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncApply<T,U>(t, fn, dst));
-                        else
-                            u = fn.apply(t);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(u, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenAccept<T> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final Consumer<? super T> fn;
-        final CompletableFuture<?> dst;
-        final Executor executor;
-        ThenAccept(CompletableFuture<? extends T> src,
-                   Consumer<? super T> fn,
-                   CompletableFuture<?> dst,
-                   Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final Consumer<? super T> fn;
-            final CompletableFuture<?> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncAccept<T>(t, fn, dst));
-                        else
-                            fn.accept(t);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenRun extends Completion {
-        final CompletableFuture<?> src;
-        final Runnable fn;
-        final CompletableFuture<Void> dst;
-        final Executor executor;
-        ThenRun(CompletableFuture<?> src,
-                Runnable fn,
-                CompletableFuture<Void> dst,
-                Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final Runnable fn;
-            final CompletableFuture<Void> dst;
-            Object r; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult)
-                    ex = ((AltResult)r).ex;
-                else
-                    ex = null;
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncRun(fn, dst));
-                        else
-                            fn.run();
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenCombine<T,U,V> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final CompletableFuture<? extends U> snd;
-        final BiFunction<? super T,? super U,? extends V> fn;
-        final CompletableFuture<V> dst;
-        final Executor executor;
-        ThenCombine(CompletableFuture<? extends T> src,
-                    CompletableFuture<? extends U> snd,
-                    BiFunction<? super T,? super U,? extends V> fn,
-                    CompletableFuture<V> dst,
-                    Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final CompletableFuture<? extends U> b;
-            final BiFunction<? super T,? super U,? extends V> fn;
-            final CompletableFuture<V> dst;
-            Object r, s; T t; U u; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                (b = this.snd) != null &&
-                (s = b.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                if (ex != null)
-                    u = null;
-                else if (s instanceof AltResult) {
-                    ex = ((AltResult)s).ex;
-                    u = null;
-                }
-                else {
-                    @SuppressWarnings("unchecked") U us = (U) s;
-                    u = us;
-                }
-                Executor e = executor;
-                V v = null;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncCombine<T,U,V>(t, u, fn, dst));
-                        else
-                            v = fn.apply(t, u);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(v, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenAcceptBoth<T,U> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final CompletableFuture<? extends U> snd;
-        final BiConsumer<? super T,? super U> fn;
-        final CompletableFuture<Void> dst;
-        final Executor executor;
-        ThenAcceptBoth(CompletableFuture<? extends T> src,
-                       CompletableFuture<? extends U> snd,
-                       BiConsumer<? super T,? super U> fn,
-                       CompletableFuture<Void> dst,
-                       Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final CompletableFuture<? extends U> b;
-            final BiConsumer<? super T,? super U> fn;
-            final CompletableFuture<Void> dst;
-            Object r, s; T t; U u; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                (b = this.snd) != null &&
-                (s = b.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                if (ex != null)
-                    u = null;
-                else if (s instanceof AltResult) {
-                    ex = ((AltResult)s).ex;
-                    u = null;
-                }
-                else {
-                    @SuppressWarnings("unchecked") U us = (U) s;
-                    u = us;
-                }
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncAcceptBoth<T,U>(t, u, fn, dst));
-                        else
-                            fn.accept(t, u);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class RunAfterBoth extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<?> snd;
-        final Runnable fn;
-        final CompletableFuture<Void> dst;
-        final Executor executor;
-        RunAfterBoth(CompletableFuture<?> src,
-                     CompletableFuture<?> snd,
-                     Runnable fn,
-                     CompletableFuture<Void> dst,
-                     Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<?> b;
-            final Runnable fn;
-            final CompletableFuture<Void> dst;
-            Object r, s; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                (b = this.snd) != null &&
-                (s = b.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult)
-                    ex = ((AltResult)r).ex;
-                else
-                    ex = null;
-                if (ex == null && (s instanceof AltResult))
-                    ex = ((AltResult)s).ex;
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncRun(fn, dst));
-                        else
-                            fn.run();
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AndCompletion extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<?> snd;
-        final CompletableFuture<Void> dst;
-        AndCompletion(CompletableFuture<?> src,
-                      CompletableFuture<?> snd,
-                      CompletableFuture<Void> dst) {
-            this.src = src; this.snd = snd; this.dst = dst;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<?> b;
-            final CompletableFuture<Void> dst;
-            Object r, s; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                (b = this.snd) != null &&
-                (s = b.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult)
-                    ex = ((AltResult)r).ex;
-                else
-                    ex = null;
-                if (ex == null && (s instanceof AltResult))
-                    ex = ((AltResult)s).ex;
-                dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ApplyToEither<T,U> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final CompletableFuture<? extends T> snd;
-        final Function<? super T,? extends U> fn;
-        final CompletableFuture<U> dst;
-        final Executor executor;
-        ApplyToEither(CompletableFuture<? extends T> src,
-                      CompletableFuture<? extends T> snd,
-                      Function<? super T,? extends U> fn,
-                      CompletableFuture<U> dst,
-                      Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final CompletableFuture<? extends T> b;
-            final Function<? super T,? extends U> fn;
-            final CompletableFuture<U> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (((a = this.src) != null && (r = a.result) != null) ||
-                 ((b = this.snd) != null && (r = b.result) != null)) &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                U u = null;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncApply<T,U>(t, fn, dst));
-                        else
-                            u = fn.apply(t);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(u, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class AcceptEither<T> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final CompletableFuture<? extends T> snd;
-        final Consumer<? super T> fn;
-        final CompletableFuture<Void> dst;
-        final Executor executor;
-        AcceptEither(CompletableFuture<? extends T> src,
-                     CompletableFuture<? extends T> snd,
-                     Consumer<? super T> fn,
-                     CompletableFuture<Void> dst,
-                     Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final CompletableFuture<? extends T> b;
-            final Consumer<? super T> fn;
-            final CompletableFuture<Void> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (((a = this.src) != null && (r = a.result) != null) ||
-                 ((b = this.snd) != null && (r = b.result) != null)) &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncAccept<T>(t, fn, dst));
-                        else
-                            fn.accept(t);
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class RunAfterEither extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<?> snd;
-        final Runnable fn;
-        final CompletableFuture<Void> dst;
-        final Executor executor;
-        RunAfterEither(CompletableFuture<?> src,
-                       CompletableFuture<?> snd,
-                       Runnable fn,
-                       CompletableFuture<Void> dst,
-                       Executor executor) {
-            this.src = src; this.snd = snd;
-            this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<?> b;
-            final Runnable fn;
-            final CompletableFuture<Void> dst;
-            Object r; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (((a = this.src) != null && (r = a.result) != null) ||
-                 ((b = this.snd) != null && (r = b.result) != null)) &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult)
-                    ex = ((AltResult)r).ex;
-                else
-                    ex = null;
-                Executor e = executor;
-                if (ex == null) {
-                    try {
-                        if (e != null)
-                            execAsync(e, new AsyncRun(fn, dst));
-                        else
-                            fn.run();
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-                if (e == null || ex != null)
-                    dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class OrCompletion extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<?> snd;
-        final CompletableFuture<Object> dst;
-        OrCompletion(CompletableFuture<?> src,
-                     CompletableFuture<?> snd,
-                     CompletableFuture<Object> dst) {
-            this.src = src; this.snd = snd; this.dst = dst;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<?> b;
-            final CompletableFuture<Object> dst;
-            Object r, t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (((a = this.src) != null && (r = a.result) != null) ||
-                 ((b = this.snd) != null && (r = b.result) != null)) &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    t = r;
-                }
-                dst.internalComplete(t, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ExceptionCompletion<T> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final Function<? super Throwable, ? extends T> fn;
-        final CompletableFuture<T> dst;
-        ExceptionCompletion(CompletableFuture<? extends T> src,
-                            Function<? super Throwable, ? extends T> fn,
-                            CompletableFuture<T> dst) {
-            this.src = src; this.fn = fn; this.dst = dst;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final Function<? super Throwable, ? extends T> fn;
-            final CompletableFuture<T> dst;
-            Object r; T t = null; Throwable ex, dx = null;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if ((r instanceof AltResult) &&
-                    (ex = ((AltResult)r).ex) != null) {
-                    try {
-                        t = fn.apply(ex);
-                    } catch (Throwable rex) {
-                        dx = rex;
-                    }
-                }
-                else {
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                dst.internalComplete(t, dx);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class WhenCompleteCompletion<T> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final BiConsumer<? super T, ? super Throwable> fn;
-        final CompletableFuture<T> dst;
-        final Executor executor;
-        WhenCompleteCompletion(CompletableFuture<? extends T> src,
-                                  BiConsumer<? super T, ? super Throwable> fn,
-                                  CompletableFuture<T> dst,
-                                  Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final BiConsumer<? super T, ? super Throwable> fn;
-            final CompletableFuture<T> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                Throwable dx = null;
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncWhenComplete<T>(t, ex, fn, dst));
-                    else
-                        fn.accept(t, ex);
-                } catch (Throwable rex) {
-                    dx = rex;
-                }
-                if (e == null || dx != null)
-                    dst.internalComplete(t, ex != null ? ex : dx);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenCopy<T> extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<T> dst;
-        ThenCopy(CompletableFuture<?> src,
-                 CompletableFuture<T> dst) {
-            this.src = src; this.dst = dst;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<T> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                dst.internalComplete(t, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    // version of ThenCopy for CompletableFuture<Void> dst
-    static final class ThenPropagate extends Completion {
-        final CompletableFuture<?> src;
-        final CompletableFuture<Void> dst;
-        ThenPropagate(CompletableFuture<?> src,
-                      CompletableFuture<Void> dst) {
-            this.src = src; this.dst = dst;
-        }
-        public final void run() {
-            final CompletableFuture<?> a;
-            final CompletableFuture<Void> dst;
-            Object r; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult)
-                    ex = ((AltResult)r).ex;
-                else
-                    ex = null;
-                dst.internalComplete(null, ex);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class HandleCompletion<T,U> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final BiFunction<? super T, Throwable, ? extends U> fn;
-        final CompletableFuture<U> dst;
-        final Executor executor;
-        HandleCompletion(CompletableFuture<? extends T> src,
-                         BiFunction<? super T, Throwable, ? extends U> fn,
-                         CompletableFuture<U> dst,
-                          Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final BiFunction<? super T, Throwable, ? extends U> fn;
-            final CompletableFuture<U> dst;
-            Object r; T t; Throwable ex;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                Executor e = executor;
-                U u = null;
-                Throwable dx = null;
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncCombine<T,Throwable,U>(t, ex, fn, dst));
-                    else
-                        u = fn.apply(t, ex);
-                } catch (Throwable rex) {
-                    dx = rex;
-                }
-                if (e == null || dx != null)
-                    dst.internalComplete(u, dx);
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    static final class ThenCompose<T,U> extends Completion {
-        final CompletableFuture<? extends T> src;
-        final Function<? super T, ? extends CompletionStage<U>> fn;
-        final CompletableFuture<U> dst;
-        final Executor executor;
-        ThenCompose(CompletableFuture<? extends T> src,
-                    Function<? super T, ? extends CompletionStage<U>> fn,
-                    CompletableFuture<U> dst,
-                    Executor executor) {
-            this.src = src; this.fn = fn; this.dst = dst;
-            this.executor = executor;
-        }
-        public final void run() {
-            final CompletableFuture<? extends T> a;
-            final Function<? super T, ? extends CompletionStage<U>> fn;
-            final CompletableFuture<U> dst;
-            Object r; T t; Throwable ex; Executor e;
-            if ((dst = this.dst) != null &&
-                (fn = this.fn) != null &&
-                (a = this.src) != null &&
-                (r = a.result) != null &&
-                compareAndSet(0, 1)) {
-                if (r instanceof AltResult) {
-                    ex = ((AltResult)r).ex;
-                    t = null;
-                }
-                else {
-                    ex = null;
-                    @SuppressWarnings("unchecked") T tr = (T) r;
-                    t = tr;
-                }
-                CompletableFuture<U> c = null;
-                U u = null;
-                boolean complete = false;
-                if (ex == null) {
-                    if ((e = executor) != null)
-                        execAsync(e, new AsyncCompose<T,U>(t, fn, dst));
-                    else {
-                        try {
-                            CompletionStage<U> cs = fn.apply(t);
-                            c = (cs == null) ? null : cs.toCompletableFuture();
-                            if (c == null)
-                                ex = new NullPointerException();
-                        } catch (Throwable rex) {
-                            ex = rex;
-                        }
-                    }
-                }
-                if (c != null) {
-                    ThenCopy<U> d = null;
-                    Object s;
-                    if ((s = c.result) == null) {
-                        CompletionNode p = new CompletionNode
-                            (d = new ThenCopy<U>(c, dst));
-                        while ((s = c.result) == null) {
-                            if (UNSAFE.compareAndSwapObject
-                                (c, COMPLETIONS, p.next = c.completions, p))
-                                break;
-                        }
-                    }
-                    if (s != null && (d == null || d.compareAndSet(0, 1))) {
-                        complete = true;
-                        if (s instanceof AltResult) {
-                            ex = ((AltResult)s).ex;  // no rewrap
-                            u = null;
-                        }
-                        else {
-                            @SuppressWarnings("unchecked") U us = (U) s;
-                            u = us;
-                        }
-                    }
-                }
-                if (complete || ex != null)
-                    dst.internalComplete(u, ex);
-                if (c != null)
-                    c.helpPostComplete();
-            }
-        }
-        private static final long serialVersionUID = 5232453952276885070L;
-    }
-
-    // Implementations of stage methods with (plain, async, Executor) forms
-
-    private <U> CompletableFuture<U> doThenApply
-        (Function<? super T,? extends U> fn,
-         Executor e) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<U> dst = new CompletableFuture<U>();
-        ThenApply<T,U> d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p = new CompletionNode
-                (d = new ThenApply<T,U>(this, fn, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (this, COMPLETIONS, p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            U u = null;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncApply<T,U>(t, fn, dst));
-                    else
-                        u = fn.apply(t);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(u, ex);
-        }
-        helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<Void> doThenAccept(Consumer<? super T> fn,
-                                                 Executor e) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        ThenAccept<T> d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p = new CompletionNode
-                (d = new ThenAccept<T>(this, fn, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (this, COMPLETIONS, p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncAccept<T>(t, fn, dst));
-                    else
-                        fn.accept(t);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<Void> doThenRun(Runnable action,
-                                              Executor e) {
-        if (action == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        ThenRun d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p = new CompletionNode
-                (d = new ThenRun(this, action, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (this, COMPLETIONS, p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            Throwable ex;
-            if (r instanceof AltResult)
-                ex = ((AltResult)r).ex;
-            else
-                ex = null;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncRun(action, dst));
-                    else
-                        action.run();
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        return dst;
-    }
-
-    private <U,V> CompletableFuture<V> doThenCombine
-        (CompletableFuture<? extends U> other,
-         BiFunction<? super T,? super U,? extends V> fn,
-         Executor e) {
-        if (other == null || fn == null) throw new NullPointerException();
-        CompletableFuture<V> dst = new CompletableFuture<V>();
-        ThenCombine<T,U,V> d = null;
-        Object r, s = null;
-        if ((r = result) == null || (s = other.result) == null) {
-            d = new ThenCombine<T,U,V>(this, other, fn, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r == null && (r = result) == null) ||
-                   (s == null && (s = other.result) == null)) {
-                if (q != null) {
-                    if (s != null ||
-                        UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (r != null ||
-                         UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p)) {
-                    if (s != null)
-                        break;
-                    q = new CompletionNode(d);
-                }
-            }
-        }
-        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; U u; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            if (ex != null)
-                u = null;
-            else if (s instanceof AltResult) {
-                ex = ((AltResult)s).ex;
-                u = null;
-            }
-            else {
-                @SuppressWarnings("unchecked") U us = (U) s;
-                u = us;
-            }
-            V v = null;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncCombine<T,U,V>(t, u, fn, dst));
-                    else
-                        v = fn.apply(t, u);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(v, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private <U> CompletableFuture<Void> doThenAcceptBoth
-        (CompletableFuture<? extends U> other,
-         BiConsumer<? super T,? super U> fn,
-         Executor e) {
-        if (other == null || fn == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        ThenAcceptBoth<T,U> d = null;
-        Object r, s = null;
-        if ((r = result) == null || (s = other.result) == null) {
-            d = new ThenAcceptBoth<T,U>(this, other, fn, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r == null && (r = result) == null) ||
-                   (s == null && (s = other.result) == null)) {
-                if (q != null) {
-                    if (s != null ||
-                        UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (r != null ||
-                         UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p)) {
-                    if (s != null)
-                        break;
-                    q = new CompletionNode(d);
-                }
-            }
-        }
-        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; U u; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            if (ex != null)
-                u = null;
-            else if (s instanceof AltResult) {
-                ex = ((AltResult)s).ex;
-                u = null;
-            }
-            else {
-                @SuppressWarnings("unchecked") U us = (U) s;
-                u = us;
-            }
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncAcceptBoth<T,U>(t, u, fn, dst));
-                    else
-                        fn.accept(t, u);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<Void> doRunAfterBoth(CompletableFuture<?> other,
-                                                   Runnable action,
-                                                   Executor e) {
-        if (other == null || action == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        RunAfterBoth d = null;
-        Object r, s = null;
-        if ((r = result) == null || (s = other.result) == null) {
-            d = new RunAfterBoth(this, other, action, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r == null && (r = result) == null) ||
-                   (s == null && (s = other.result) == null)) {
-                if (q != null) {
-                    if (s != null ||
-                        UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (r != null ||
-                         UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p)) {
-                    if (s != null)
-                        break;
-                    q = new CompletionNode(d);
-                }
-            }
-        }
-        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
-            Throwable ex;
-            if (r instanceof AltResult)
-                ex = ((AltResult)r).ex;
-            else
-                ex = null;
-            if (ex == null && (s instanceof AltResult))
-                ex = ((AltResult)s).ex;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncRun(action, dst));
-                    else
-                        action.run();
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private <U> CompletableFuture<U> doApplyToEither
-        (CompletableFuture<? extends T> other,
-         Function<? super T, U> fn,
-         Executor e) {
-        if (other == null || fn == null) throw new NullPointerException();
-        CompletableFuture<U> dst = new CompletableFuture<U>();
-        ApplyToEither<T,U> d = null;
-        Object r;
-        if ((r = result) == null && (r = other.result) == null) {
-            d = new ApplyToEither<T,U>(this, other, fn, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r = result) == null && (r = other.result) == null) {
-                if (q != null) {
-                    if (UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p))
-                    q = new CompletionNode(d);
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            U u = null;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncApply<T,U>(t, fn, dst));
-                    else
-                        u = fn.apply(t);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(u, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<Void> doAcceptEither
-        (CompletableFuture<? extends T> other,
-         Consumer<? super T> fn,
-         Executor e) {
-        if (other == null || fn == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        AcceptEither<T> d = null;
-        Object r;
-        if ((r = result) == null && (r = other.result) == null) {
-            d = new AcceptEither<T>(this, other, fn, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r = result) == null && (r = other.result) == null) {
-                if (q != null) {
-                    if (UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p))
-                    q = new CompletionNode(d);
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncAccept<T>(t, fn, dst));
-                    else
-                        fn.accept(t);
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<Void> doRunAfterEither
-        (CompletableFuture<?> other,
-         Runnable action,
-         Executor e) {
-        if (other == null || action == null) throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        RunAfterEither d = null;
-        Object r;
-        if ((r = result) == null && (r = other.result) == null) {
-            d = new RunAfterEither(this, other, action, dst, e);
-            CompletionNode q = null, p = new CompletionNode(d);
-            while ((r = result) == null && (r = other.result) == null) {
-                if (q != null) {
-                    if (UNSAFE.compareAndSwapObject
-                        (other, COMPLETIONS, q.next = other.completions, q))
-                        break;
-                }
-                else if (UNSAFE.compareAndSwapObject
-                         (this, COMPLETIONS, p.next = completions, p))
-                    q = new CompletionNode(d);
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            Throwable ex;
-            if (r instanceof AltResult)
-                ex = ((AltResult)r).ex;
-            else
-                ex = null;
-            if (ex == null) {
-                try {
-                    if (e != null)
-                        execAsync(e, new AsyncRun(action, dst));
-                    else
-                        action.run();
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-            }
-            if (e == null || ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        other.helpPostComplete();
-        return dst;
-    }
-
-    private <U> CompletableFuture<U> doThenCompose
-        (Function<? super T, ? extends CompletionStage<U>> fn,
-         Executor e) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<U> dst = null;
-        ThenCompose<T,U> d = null;
-        Object r;
-        if ((r = result) == null) {
-            dst = new CompletableFuture<U>();
-            CompletionNode p = new CompletionNode
-                (d = new ThenCompose<T,U>(this, fn, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (this, COMPLETIONS, p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            if (ex == null) {
-                if (e != null) {
-                    if (dst == null)
-                        dst = new CompletableFuture<U>();
-                    execAsync(e, new AsyncCompose<T,U>(t, fn, dst));
-                }
-                else {
-                    try {
-                        CompletionStage<U> cs = fn.apply(t);
-                        if (cs == null ||
-                            (dst = cs.toCompletableFuture()) == null)
-                            ex = new NullPointerException();
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                }
-            }
-            if (dst == null)
-                dst = new CompletableFuture<U>();
-            if (ex != null)
-                dst.internalComplete(null, ex);
-        }
-        helpPostComplete();
-        dst.helpPostComplete();
-        return dst;
-    }
-
-    private CompletableFuture<T> doWhenComplete
-        (BiConsumer<? super T, ? super Throwable> fn,
-         Executor e) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<T> dst = new CompletableFuture<T>();
-        WhenCompleteCompletion<T> d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p =
-                new CompletionNode(d = new WhenCompleteCompletion<T>
-                                   (this, fn, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
-                                                p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            Throwable dx = null;
-            try {
-                if (e != null)
-                    execAsync(e, new AsyncWhenComplete<T>(t, ex, fn, dst));
-                else
-                    fn.accept(t, ex);
-            } catch (Throwable rex) {
-                dx = rex;
-            }
-            if (e == null || dx != null)
-                dst.internalComplete(t, ex != null ? ex : dx);
-        }
-        helpPostComplete();
-        return dst;
-    }
-
-    private <U> CompletableFuture<U> doHandle
-        (BiFunction<? super T, Throwable, ? extends U> fn,
-         Executor e) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<U> dst = new CompletableFuture<U>();
-        HandleCompletion<T,U> d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p =
-                new CompletionNode(d = new HandleCompletion<T,U>
-                                   (this, fn, dst, e));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
-                                                p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t; Throwable ex;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            U u = null;
-            Throwable dx = null;
-            try {
-                if (e != null)
-                    execAsync(e, new AsyncCombine<T,Throwable,U>(t, ex, fn, dst));
-                else {
-                    u = fn.apply(t, ex);
-                    dx = null;
-                }
-            } catch (Throwable rex) {
-                dx = rex;
-                u = null;
-            }
-            if (e == null || dx != null)
-                dst.internalComplete(u, dx);
-        }
-        helpPostComplete();
-        return dst;
-    }
-
-
-    // public methods
+    /* ------------- public methods -------------- */
 
     /**
      * Creates a new incomplete CompletableFuture.
@@ -2114,6 +1786,13 @@
     }
 
     /**
+     * Creates a new complete CompletableFuture with given encoded result.
+     */
+    private CompletableFuture(Object r) {
+        this.result = r;
+    }
+
+    /**
      * Returns a new CompletableFuture that is asynchronously completed
      * by a task running in the {@link ForkJoinPool#commonPool()} with
      * the value obtained by calling the given Supplier.
@@ -2124,10 +1803,7 @@
      * @return the new CompletableFuture
      */
     public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
-        if (supplier == null) throw new NullPointerException();
-        CompletableFuture<U> f = new CompletableFuture<U>();
-        execAsync(ForkJoinPool.commonPool(), new AsyncSupply<U>(supplier, f));
-        return f;
+        return asyncSupplyStage(asyncPool, supplier);
     }
 
     /**
@@ -2143,11 +1819,7 @@
      */
     public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier,
                                                        Executor executor) {
-        if (executor == null || supplier == null)
-            throw new NullPointerException();
-        CompletableFuture<U> f = new CompletableFuture<U>();
-        execAsync(executor, new AsyncSupply<U>(supplier, f));
-        return f;
+        return asyncSupplyStage(screenExecutor(executor), supplier);
     }
 
     /**
@@ -2160,10 +1832,7 @@
      * @return the new CompletableFuture
      */
     public static CompletableFuture<Void> runAsync(Runnable runnable) {
-        if (runnable == null) throw new NullPointerException();
-        CompletableFuture<Void> f = new CompletableFuture<Void>();
-        execAsync(ForkJoinPool.commonPool(), new AsyncRun(runnable, f));
-        return f;
+        return asyncRunStage(asyncPool, runnable);
     }
 
     /**
@@ -2178,11 +1847,7 @@
      */
     public static CompletableFuture<Void> runAsync(Runnable runnable,
                                                    Executor executor) {
-        if (executor == null || runnable == null)
-            throw new NullPointerException();
-        CompletableFuture<Void> f = new CompletableFuture<Void>();
-        execAsync(executor, new AsyncRun(runnable, f));
-        return f;
+        return asyncRunStage(screenExecutor(executor), runnable);
     }
 
     /**
@@ -2194,9 +1859,7 @@
      * @return the completed CompletableFuture
      */
     public static <U> CompletableFuture<U> completedFuture(U value) {
-        CompletableFuture<U> f = new CompletableFuture<U>();
-        f.result = (value == null) ? NIL : value;
-        return f;
+        return new CompletableFuture<U>((value == null) ? NIL : value);
     }
 
     /**
@@ -2220,21 +1883,8 @@
      * while waiting
      */
     public T get() throws InterruptedException, ExecutionException {
-        Object r; Throwable ex, cause;
-        if ((r = result) == null && (r = waitingGet(true)) == null)
-            throw new InterruptedException();
-        if (!(r instanceof AltResult)) {
-            @SuppressWarnings("unchecked") T tr = (T) r;
-            return tr;
-        }
-        if ((ex = ((AltResult)r).ex) == null)
-            return null;
-        if (ex instanceof CancellationException)
-            throw (CancellationException)ex;
-        if ((ex instanceof CompletionException) &&
-            (cause = ex.getCause()) != null)
-            ex = cause;
-        throw new ExecutionException(ex);
+        Object r;
+        return reportGet((r = result) == null ? waitingGet(true) : r);
     }
 
     /**
@@ -2252,24 +1902,9 @@
      */
     public T get(long timeout, TimeUnit unit)
         throws InterruptedException, ExecutionException, TimeoutException {
-        Object r; Throwable ex, cause;
+        Object r;
         long nanos = unit.toNanos(timeout);
-        if (Thread.interrupted())
-            throw new InterruptedException();
-        if ((r = result) == null)
-            r = timedAwaitDone(nanos);
-        if (!(r instanceof AltResult)) {
-            @SuppressWarnings("unchecked") T tr = (T) r;
-            return tr;
-        }
-        if ((ex = ((AltResult)r).ex) == null)
-            return null;
-        if (ex instanceof CancellationException)
-            throw (CancellationException)ex;
-        if ((ex instanceof CompletionException) &&
-            (cause = ex.getCause()) != null)
-            ex = cause;
-        throw new ExecutionException(ex);
+        return reportGet((r = result) == null ? timedGet(nanos) : r);
     }
 
     /**
@@ -2287,20 +1922,8 @@
      * exceptionally or a completion computation threw an exception
      */
     public T join() {
-        Object r; Throwable ex;
-        if ((r = result) == null)
-            r = waitingGet(false);
-        if (!(r instanceof AltResult)) {
-            @SuppressWarnings("unchecked") T tr = (T) r;
-            return tr;
-        }
-        if ((ex = ((AltResult)r).ex) == null)
-            return null;
-        if (ex instanceof CancellationException)
-            throw (CancellationException)ex;
-        if (ex instanceof CompletionException)
-            throw (CompletionException)ex;
-        throw new CompletionException(ex);
+        Object r;
+        return reportJoin((r = result) == null ? waitingGet(false) : r);
     }
 
     /**
@@ -2314,20 +1937,8 @@
      * exceptionally or a completion computation threw an exception
      */
     public T getNow(T valueIfAbsent) {
-        Object r; Throwable ex;
-        if ((r = result) == null)
-            return valueIfAbsent;
-        if (!(r instanceof AltResult)) {
-            @SuppressWarnings("unchecked") T tr = (T) r;
-            return tr;
-        }
-        if ((ex = ((AltResult)r).ex) == null)
-            return null;
-        if (ex instanceof CancellationException)
-            throw (CancellationException)ex;
-        if (ex instanceof CompletionException)
-            throw (CompletionException)ex;
-        throw new CompletionException(ex);
+        Object r;
+        return ((r = result) == null) ? valueIfAbsent : reportJoin(r);
     }
 
     /**
@@ -2339,9 +1950,7 @@
      * to transition to a completed state, else {@code false}
      */
     public boolean complete(T value) {
-        boolean triggered = result == null &&
-            UNSAFE.compareAndSwapObject(this, RESULT, null,
-                                        value == null ? NIL : value);
+        boolean triggered = completeValue(value);
         postComplete();
         return triggered;
     }
@@ -2356,244 +1965,200 @@
      */
     public boolean completeExceptionally(Throwable ex) {
         if (ex == null) throw new NullPointerException();
-        boolean triggered = result == null &&
-            UNSAFE.compareAndSwapObject(this, RESULT, null, new AltResult(ex));
+        boolean triggered = internalComplete(new AltResult(ex));
         postComplete();
         return triggered;
     }
 
-    // CompletionStage methods
-
-    public <U> CompletableFuture<U> thenApply
-        (Function<? super T,? extends U> fn) {
-        return doThenApply(fn, null);
+    public <U> CompletableFuture<U> thenApply(
+        Function<? super T,? extends U> fn) {
+        return uniApplyStage(null, fn);
     }
 
-    public <U> CompletableFuture<U> thenApplyAsync
-        (Function<? super T,? extends U> fn) {
-        return doThenApply(fn, ForkJoinPool.commonPool());
+    public <U> CompletableFuture<U> thenApplyAsync(
+        Function<? super T,? extends U> fn) {
+        return uniApplyStage(asyncPool, fn);
     }
 
-    public <U> CompletableFuture<U> thenApplyAsync
-        (Function<? super T,? extends U> fn,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenApply(fn, executor);
+    public <U> CompletableFuture<U> thenApplyAsync(
+        Function<? super T,? extends U> fn, Executor executor) {
+        return uniApplyStage(screenExecutor(executor), fn);
     }
 
-    public CompletableFuture<Void> thenAccept
-        (Consumer<? super T> action) {
-        return doThenAccept(action, null);
+    public CompletableFuture<Void> thenAccept(Consumer<? super T> action) {
+        return uniAcceptStage(null, action);
     }
 
-    public CompletableFuture<Void> thenAcceptAsync
-        (Consumer<? super T> action) {
-        return doThenAccept(action, ForkJoinPool.commonPool());
+    public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action) {
+        return uniAcceptStage(asyncPool, action);
     }
 
-    public CompletableFuture<Void> thenAcceptAsync
-        (Consumer<? super T> action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenAccept(action, executor);
+    public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action,
+                                                   Executor executor) {
+        return uniAcceptStage(screenExecutor(executor), action);
     }
 
-    public CompletableFuture<Void> thenRun
-        (Runnable action) {
-        return doThenRun(action, null);
+    public CompletableFuture<Void> thenRun(Runnable action) {
+        return uniRunStage(null, action);
     }
 
-    public CompletableFuture<Void> thenRunAsync
-        (Runnable action) {
-        return doThenRun(action, ForkJoinPool.commonPool());
+    public CompletableFuture<Void> thenRunAsync(Runnable action) {
+        return uniRunStage(asyncPool, action);
     }
 
-    public CompletableFuture<Void> thenRunAsync
-        (Runnable action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenRun(action, executor);
+    public CompletableFuture<Void> thenRunAsync(Runnable action,
+                                                Executor executor) {
+        return uniRunStage(screenExecutor(executor), action);
     }
 
-    public <U,V> CompletableFuture<V> thenCombine
-        (CompletionStage<? extends U> other,
-         BiFunction<? super T,? super U,? extends V> fn) {
-        return doThenCombine(other.toCompletableFuture(), fn, null);
+    public <U,V> CompletableFuture<V> thenCombine(
+        CompletionStage<? extends U> other,
+        BiFunction<? super T,? super U,? extends V> fn) {
+        return biApplyStage(null, other, fn);
     }
 
-    public <U,V> CompletableFuture<V> thenCombineAsync
-        (CompletionStage<? extends U> other,
-         BiFunction<? super T,? super U,? extends V> fn) {
-        return doThenCombine(other.toCompletableFuture(), fn,
-                             ForkJoinPool.commonPool());
+    public <U,V> CompletableFuture<V> thenCombineAsync(
+        CompletionStage<? extends U> other,
+        BiFunction<? super T,? super U,? extends V> fn) {
+        return biApplyStage(asyncPool, other, fn);
     }
 
-    public <U,V> CompletableFuture<V> thenCombineAsync
-        (CompletionStage<? extends U> other,
-         BiFunction<? super T,? super U,? extends V> fn,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenCombine(other.toCompletableFuture(), fn, executor);
+    public <U,V> CompletableFuture<V> thenCombineAsync(
+        CompletionStage<? extends U> other,
+        BiFunction<? super T,? super U,? extends V> fn, Executor executor) {
+        return biApplyStage(screenExecutor(executor), other, fn);
     }
 
-    public <U> CompletableFuture<Void> thenAcceptBoth
-        (CompletionStage<? extends U> other,
-         BiConsumer<? super T, ? super U> action) {
-        return doThenAcceptBoth(other.toCompletableFuture(), action, null);
+    public <U> CompletableFuture<Void> thenAcceptBoth(
+        CompletionStage<? extends U> other,
+        BiConsumer<? super T, ? super U> action) {
+        return biAcceptStage(null, other, action);
     }
 
-    public <U> CompletableFuture<Void> thenAcceptBothAsync
-        (CompletionStage<? extends U> other,
-         BiConsumer<? super T, ? super U> action) {
-        return doThenAcceptBoth(other.toCompletableFuture(), action,
-                                ForkJoinPool.commonPool());
+    public <U> CompletableFuture<Void> thenAcceptBothAsync(
+        CompletionStage<? extends U> other,
+        BiConsumer<? super T, ? super U> action) {
+        return biAcceptStage(asyncPool, other, action);
     }
 
-    public <U> CompletableFuture<Void> thenAcceptBothAsync
-        (CompletionStage<? extends U> other,
-         BiConsumer<? super T, ? super U> action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenAcceptBoth(other.toCompletableFuture(), action, executor);
+    public <U> CompletableFuture<Void> thenAcceptBothAsync(
+        CompletionStage<? extends U> other,
+        BiConsumer<? super T, ? super U> action, Executor executor) {
+        return biAcceptStage(screenExecutor(executor), other, action);
     }
 
-    public CompletableFuture<Void> runAfterBoth
-        (CompletionStage<?> other,
-         Runnable action) {
-        return doRunAfterBoth(other.toCompletableFuture(), action, null);
+    public CompletableFuture<Void> runAfterBoth(CompletionStage<?> other,
+                                                Runnable action) {
+        return biRunStage(null, other, action);
     }
 
-    public CompletableFuture<Void> runAfterBothAsync
-        (CompletionStage<?> other,
-         Runnable action) {
-        return doRunAfterBoth(other.toCompletableFuture(), action,
-                              ForkJoinPool.commonPool());
+    public CompletableFuture<Void> runAfterBothAsync(CompletionStage<?> other,
+                                                     Runnable action) {
+        return biRunStage(asyncPool, other, action);
     }
 
-    public CompletableFuture<Void> runAfterBothAsync
-        (CompletionStage<?> other,
-         Runnable action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doRunAfterBoth(other.toCompletableFuture(), action, executor);
+    public CompletableFuture<Void> runAfterBothAsync(CompletionStage<?> other,
+                                                     Runnable action,
+                                                     Executor executor) {
+        return biRunStage(screenExecutor(executor), other, action);
     }
 
-
-    public <U> CompletableFuture<U> applyToEither
-        (CompletionStage<? extends T> other,
-         Function<? super T, U> fn) {
-        return doApplyToEither(other.toCompletableFuture(), fn, null);
+    public <U> CompletableFuture<U> applyToEither(
+        CompletionStage<? extends T> other, Function<? super T, U> fn) {
+        return orApplyStage(null, other, fn);
     }
 
-    public <U> CompletableFuture<U> applyToEitherAsync
-        (CompletionStage<? extends T> other,
-         Function<? super T, U> fn) {
-        return doApplyToEither(other.toCompletableFuture(), fn,
-                               ForkJoinPool.commonPool());
+    public <U> CompletableFuture<U> applyToEitherAsync(
+        CompletionStage<? extends T> other, Function<? super T, U> fn) {
+        return orApplyStage(asyncPool, other, fn);
     }
 
-    public <U> CompletableFuture<U> applyToEitherAsync
-        (CompletionStage<? extends T> other,
-         Function<? super T, U> fn,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doApplyToEither(other.toCompletableFuture(), fn, executor);
+    public <U> CompletableFuture<U> applyToEitherAsync(
+        CompletionStage<? extends T> other, Function<? super T, U> fn,
+        Executor executor) {
+        return orApplyStage(screenExecutor(executor), other, fn);
     }
 
-    public CompletableFuture<Void> acceptEither
-        (CompletionStage<? extends T> other,
-         Consumer<? super T> action) {
-        return doAcceptEither(other.toCompletableFuture(), action, null);
+    public CompletableFuture<Void> acceptEither(
+        CompletionStage<? extends T> other, Consumer<? super T> action) {
+        return orAcceptStage(null, other, action);
     }
 
-    public CompletableFuture<Void> acceptEitherAsync
-        (CompletionStage<? extends T> other,
-         Consumer<? super T> action) {
-        return doAcceptEither(other.toCompletableFuture(), action,
-                              ForkJoinPool.commonPool());
+    public CompletableFuture<Void> acceptEitherAsync(
+        CompletionStage<? extends T> other, Consumer<? super T> action) {
+        return orAcceptStage(asyncPool, other, action);
     }
 
-    public CompletableFuture<Void> acceptEitherAsync
-        (CompletionStage<? extends T> other,
-         Consumer<? super T> action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doAcceptEither(other.toCompletableFuture(), action, executor);
+    public CompletableFuture<Void> acceptEitherAsync(
+        CompletionStage<? extends T> other, Consumer<? super T> action,
+        Executor executor) {
+        return orAcceptStage(screenExecutor(executor), other, action);
     }
 
     public CompletableFuture<Void> runAfterEither(CompletionStage<?> other,
                                                   Runnable action) {
-        return doRunAfterEither(other.toCompletableFuture(), action, null);
+        return orRunStage(null, other, action);
     }
 
-    public CompletableFuture<Void> runAfterEitherAsync
-        (CompletionStage<?> other,
-         Runnable action) {
-        return doRunAfterEither(other.toCompletableFuture(), action,
-                                ForkJoinPool.commonPool());
+    public CompletableFuture<Void> runAfterEitherAsync(CompletionStage<?> other,
+                                                       Runnable action) {
+        return orRunStage(asyncPool, other, action);
     }
 
-    public CompletableFuture<Void> runAfterEitherAsync
-        (CompletionStage<?> other,
-         Runnable action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doRunAfterEither(other.toCompletableFuture(), action, executor);
+    public CompletableFuture<Void> runAfterEitherAsync(CompletionStage<?> other,
+                                                       Runnable action,
+                                                       Executor executor) {
+        return orRunStage(screenExecutor(executor), other, action);
     }
 
-    public <U> CompletableFuture<U> thenCompose
-        (Function<? super T, ? extends CompletionStage<U>> fn) {
-        return doThenCompose(fn, null);
+    public <U> CompletableFuture<U> thenCompose(
+        Function<? super T, ? extends CompletionStage<U>> fn) {
+        return uniComposeStage(null, fn);
     }
 
-    public <U> CompletableFuture<U> thenComposeAsync
-        (Function<? super T, ? extends CompletionStage<U>> fn) {
-        return doThenCompose(fn, ForkJoinPool.commonPool());
+    public <U> CompletableFuture<U> thenComposeAsync(
+        Function<? super T, ? extends CompletionStage<U>> fn) {
+        return uniComposeStage(asyncPool, fn);
     }
 
-    public <U> CompletableFuture<U> thenComposeAsync
-        (Function<? super T, ? extends CompletionStage<U>> fn,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doThenCompose(fn, executor);
+    public <U> CompletableFuture<U> thenComposeAsync(
+        Function<? super T, ? extends CompletionStage<U>> fn,
+        Executor executor) {
+        return uniComposeStage(screenExecutor(executor), fn);
     }
 
-    public CompletableFuture<T> whenComplete
-        (BiConsumer<? super T, ? super Throwable> action) {
-        return doWhenComplete(action, null);
+    public CompletableFuture<T> whenComplete(
+        BiConsumer<? super T, ? super Throwable> action) {
+        return uniWhenCompleteStage(null, action);
     }
 
-    public CompletableFuture<T> whenCompleteAsync
-        (BiConsumer<? super T, ? super Throwable> action) {
-        return doWhenComplete(action, ForkJoinPool.commonPool());
+    public CompletableFuture<T> whenCompleteAsync(
+        BiConsumer<? super T, ? super Throwable> action) {
+        return uniWhenCompleteStage(asyncPool, action);
     }
 
-    public CompletableFuture<T> whenCompleteAsync
-        (BiConsumer<? super T, ? super Throwable> action,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doWhenComplete(action, executor);
+    public CompletableFuture<T> whenCompleteAsync(
+        BiConsumer<? super T, ? super Throwable> action, Executor executor) {
+        return uniWhenCompleteStage(screenExecutor(executor), action);
     }
 
-    public <U> CompletableFuture<U> handle
-        (BiFunction<? super T, Throwable, ? extends U> fn) {
-        return doHandle(fn, null);
+    public <U> CompletableFuture<U> handle(
+        BiFunction<? super T, Throwable, ? extends U> fn) {
+        return uniHandleStage(null, fn);
     }
 
-    public <U> CompletableFuture<U> handleAsync
-        (BiFunction<? super T, Throwable, ? extends U> fn) {
-        return doHandle(fn, ForkJoinPool.commonPool());
+    public <U> CompletableFuture<U> handleAsync(
+        BiFunction<? super T, Throwable, ? extends U> fn) {
+        return uniHandleStage(asyncPool, fn);
     }
 
-    public <U> CompletableFuture<U> handleAsync
-        (BiFunction<? super T, Throwable, ? extends U> fn,
-         Executor executor) {
-        if (executor == null) throw new NullPointerException();
-        return doHandle(fn, executor);
+    public <U> CompletableFuture<U> handleAsync(
+        BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) {
+        return uniHandleStage(screenExecutor(executor), fn);
     }
 
     /**
-     * Returns this CompletableFuture
+     * Returns this CompletableFuture.
      *
      * @return this CompletableFuture
      */
@@ -2618,52 +2183,13 @@
      * exceptionally
      * @return the new CompletableFuture
      */
-    public CompletableFuture<T> exceptionally
-        (Function<Throwable, ? extends T> fn) {
-        if (fn == null) throw new NullPointerException();
-        CompletableFuture<T> dst = new CompletableFuture<T>();
-        ExceptionCompletion<T> d = null;
-        Object r;
-        if ((r = result) == null) {
-            CompletionNode p =
-                new CompletionNode(d = new ExceptionCompletion<T>
-                                   (this, fn, dst));
-            while ((r = result) == null) {
-                if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
-                                                p.next = completions, p))
-                    break;
-            }
-        }
-        if (r != null && (d == null || d.compareAndSet(0, 1))) {
-            T t = null; Throwable ex, dx = null;
-            if (r instanceof AltResult) {
-                if ((ex = ((AltResult)r).ex) != null) {
-                    try {
-                        t = fn.apply(ex);
-                    } catch (Throwable rex) {
-                        dx = rex;
-                    }
-                }
-            }
-            else {
-                @SuppressWarnings("unchecked") T tr = (T) r;
-                t = tr;
-            }
-            dst.internalComplete(t, dx);
-        }
-        helpPostComplete();
-        return dst;
+    public CompletableFuture<T> exceptionally(
+        Function<Throwable, ? extends T> fn) {
+        return uniExceptionallyStage(fn);
     }
 
     /* ------------- Arbitrary-arity constructions -------------- */
 
-    /*
-     * The basic plan of attack is to recursively form binary
-     * completion trees of elements. This can be overkill for small
-     * sets, but scales nicely. The And/All vs Or/Any forms use the
-     * same idea, but details differ.
-     */
-
     /**
      * Returns a new CompletableFuture that is completed when all of
      * the given CompletableFutures complete.  If any of the given
@@ -2688,82 +2214,7 @@
      * {@code null}
      */
     public static CompletableFuture<Void> allOf(CompletableFuture<?>... cfs) {
-        int len = cfs.length; // Directly handle empty and singleton cases
-        if (len > 1)
-            return allTree(cfs, 0, len - 1);
-        else {
-            CompletableFuture<Void> dst = new CompletableFuture<Void>();
-            CompletableFuture<?> f;
-            if (len == 0)
-                dst.result = NIL;
-            else if ((f = cfs[0]) == null)
-                throw new NullPointerException();
-            else {
-                ThenPropagate d = null;
-                CompletionNode p = null;
-                Object r;
-                while ((r = f.result) == null) {
-                    if (d == null)
-                        d = new ThenPropagate(f, dst);
-                    else if (p == null)
-                        p = new CompletionNode(d);
-                    else if (UNSAFE.compareAndSwapObject
-                             (f, COMPLETIONS, p.next = f.completions, p))
-                        break;
-                }
-                if (r != null && (d == null || d.compareAndSet(0, 1)))
-                    dst.internalComplete(null, (r instanceof AltResult) ?
-                                         ((AltResult)r).ex : null);
-                f.helpPostComplete();
-            }
-            return dst;
-        }
-    }
-
-    /**
-     * Recursively constructs an And'ed tree of CompletableFutures.
-     * Called only when array known to have at least two elements.
-     */
-    private static CompletableFuture<Void> allTree(CompletableFuture<?>[] cfs,
-                                                   int lo, int hi) {
-        CompletableFuture<?> fst, snd;
-        int mid = (lo + hi) >>> 1;
-        if ((fst = (lo == mid   ? cfs[lo] : allTree(cfs, lo,    mid))) == null ||
-            (snd = (hi == mid+1 ? cfs[hi] : allTree(cfs, mid+1, hi))) == null)
-            throw new NullPointerException();
-        CompletableFuture<Void> dst = new CompletableFuture<Void>();
-        AndCompletion d = null;
-        CompletionNode p = null, q = null;
-        Object r = null, s = null;
-        while ((r = fst.result) == null || (s = snd.result) == null) {
-            if (d == null)
-                d = new AndCompletion(fst, snd, dst);
-            else if (p == null)
-                p = new CompletionNode(d);
-            else if (q == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (fst, COMPLETIONS, p.next = fst.completions, p))
-                    q = new CompletionNode(d);
-            }
-            else if (UNSAFE.compareAndSwapObject
-                     (snd, COMPLETIONS, q.next = snd.completions, q))
-                break;
-        }
-        if ((r != null || (r = fst.result) != null) &&
-            (s != null || (s = snd.result) != null) &&
-            (d == null || d.compareAndSet(0, 1))) {
-            Throwable ex;
-            if (r instanceof AltResult)
-                ex = ((AltResult)r).ex;
-            else
-                ex = null;
-            if (ex == null && (s instanceof AltResult))
-                ex = ((AltResult)s).ex;
-            dst.internalComplete(null, ex);
-        }
-        fst.helpPostComplete();
-        snd.helpPostComplete();
-        return dst;
+        return andTree(cfs, 0, cfs.length - 1);
     }
 
     /**
@@ -2782,92 +2233,7 @@
      * {@code null}
      */
     public static CompletableFuture<Object> anyOf(CompletableFuture<?>... cfs) {
-        int len = cfs.length; // Same idea as allOf
-        if (len > 1)
-            return anyTree(cfs, 0, len - 1);
-        else {
-            CompletableFuture<Object> dst = new CompletableFuture<Object>();
-            CompletableFuture<?> f;
-            if (len == 0)
-                ; // skip
-            else if ((f = cfs[0]) == null)
-                throw new NullPointerException();
-            else {
-                ThenCopy<Object> d = null;
-                CompletionNode p = null;
-                Object r;
-                while ((r = f.result) == null) {
-                    if (d == null)
-                        d = new ThenCopy<Object>(f, dst);
-                    else if (p == null)
-                        p = new CompletionNode(d);
-                    else if (UNSAFE.compareAndSwapObject
-                             (f, COMPLETIONS, p.next = f.completions, p))
-                        break;
-                }
-                if (r != null && (d == null || d.compareAndSet(0, 1))) {
-                    Throwable ex; Object t;
-                    if (r instanceof AltResult) {
-                        ex = ((AltResult)r).ex;
-                        t = null;
-                    }
-                    else {
-                        ex = null;
-                        t = r;
-                    }
-                    dst.internalComplete(t, ex);
-                }
-                f.helpPostComplete();
-            }
-            return dst;
-        }
-    }
-
-    /**
-     * Recursively constructs an Or'ed tree of CompletableFutures.
-     */
-    private static CompletableFuture<Object> anyTree(CompletableFuture<?>[] cfs,
-                                                     int lo, int hi) {
-        CompletableFuture<?> fst, snd;
-        int mid = (lo + hi) >>> 1;
-        if ((fst = (lo == mid   ? cfs[lo] : anyTree(cfs, lo,    mid))) == null ||
-            (snd = (hi == mid+1 ? cfs[hi] : anyTree(cfs, mid+1, hi))) == null)
-            throw new NullPointerException();
-        CompletableFuture<Object> dst = new CompletableFuture<Object>();
-        OrCompletion d = null;
-        CompletionNode p = null, q = null;
-        Object r;
-        while ((r = fst.result) == null && (r = snd.result) == null) {
-            if (d == null)
-                d = new OrCompletion(fst, snd, dst);
-            else if (p == null)
-                p = new CompletionNode(d);
-            else if (q == null) {
-                if (UNSAFE.compareAndSwapObject
-                    (fst, COMPLETIONS, p.next = fst.completions, p))
-                    q = new CompletionNode(d);
-            }
-            else if (UNSAFE.compareAndSwapObject
-                     (snd, COMPLETIONS, q.next = snd.completions, q))
-                break;
-        }
-        if ((r != null || (r = fst.result) != null ||
-             (r = snd.result) != null) &&
-            (d == null || d.compareAndSet(0, 1))) {
-            Throwable ex; Object t;
-            if (r instanceof AltResult) {
-                ex = ((AltResult)r).ex;
-                t = null;
-            }
-            else {
-                ex = null;
-                t = r;
-            }
-            dst.internalComplete(t, ex);
-        }
-        fst.helpPostComplete();
-        snd.helpPostComplete();
-        return dst;
+        return orTree(cfs, 0, cfs.length - 1);
     }
 
     /* ------------- Control and status methods -------------- */
@@ -2887,8 +2253,7 @@
      */
     public boolean cancel(boolean mayInterruptIfRunning) {
         boolean cancelled = (result == null) &&
-            UNSAFE.compareAndSwapObject
-            (this, RESULT, null, new AltResult(new CancellationException()));
+            internalComplete(new AltResult(new CancellationException()));
         postComplete();
         return cancelled || isCancelled();
     }
@@ -2940,11 +2305,12 @@
      * Forcibly causes subsequent invocations of method {@link #get()}
      * and related methods to throw the given exception, whether or
      * not already completed. This method is designed for use only in
-     * recovery actions, and even in such situations may result in
-     * ongoing dependent completions using established versus
+     * error recovery actions, and even in such situations may result
+     * in ongoing dependent completions using established versus
      * overwritten outcomes.
      *
      * @param ex the exception
+     * @throws NullPointerException if the exception is null
      */
     public void obtrudeException(Throwable ex) {
         if (ex == null) throw new NullPointerException();
@@ -2962,7 +2328,7 @@
      */
     public int getNumberOfDependents() {
         int count = 0;
-        for (CompletionNode p = completions; p != null; p = p.next)
+        for (Completion p = stack; p != null; p = p.next)
             ++count;
         return count;
     }
@@ -2993,20 +2359,19 @@
     // Unsafe mechanics
     private static final sun.misc.Unsafe UNSAFE;
     private static final long RESULT;
-    private static final long WAITERS;
-    private static final long COMPLETIONS;
+    private static final long STACK;
+    private static final long NEXT;
     static {
         try {
-            UNSAFE = sun.misc.Unsafe.getUnsafe();
+            final sun.misc.Unsafe u;
+            UNSAFE = u = sun.misc.Unsafe.getUnsafe();
             Class<?> k = CompletableFuture.class;
-            RESULT = UNSAFE.objectFieldOffset
-                (k.getDeclaredField("result"));
-            WAITERS = UNSAFE.objectFieldOffset
-                (k.getDeclaredField("waiters"));
-            COMPLETIONS = UNSAFE.objectFieldOffset
-                (k.getDeclaredField("completions"));
-        } catch (Exception e) {
-            throw new Error(e);
+            RESULT = u.objectFieldOffset(k.getDeclaredField("result"));
+            STACK = u.objectFieldOffset(k.getDeclaredField("stack"));
+            NEXT = u.objectFieldOffset
+                (Completion.class.getDeclaredField("next"));
+        } catch (Exception x) {
+            throw new Error(x);
         }
     }
 }
diff --git a/src/share/classes/java/util/concurrent/CompletionStage.java b/src/share/classes/java/util/concurrent/CompletionStage.java
index 6de6098..304ede5 100644
--- a/src/share/classes/java/util/concurrent/CompletionStage.java
+++ b/src/share/classes/java/util/concurrent/CompletionStage.java
@@ -407,7 +407,7 @@
     /**
      * Returns a new CompletionStage that, when this and the other
      * given stage complete normally, executes the given action using
-     * the supplied executor
+     * the supplied executor.
      *
      * See the {@link CompletionStage} documentation for rules
      * covering exceptional completion.
@@ -569,7 +569,7 @@
     /**
      * Returns a new CompletionStage that, when either this or the
      * other given stage complete normally, executes the given action
-     * using supplied executor.
+     * using the supplied executor.
      *
      * See the {@link CompletionStage} documentation for rules
      * covering exceptional completion.
@@ -649,10 +649,15 @@
         (Function<Throwable, ? extends T> fn);
 
     /**
-     * Returns a new CompletionStage with the same result or exception
-     * as this stage, and when this stage completes, executes the
-     * given action with the result (or {@code null} if none) and the
-     * exception (or {@code null} if none) of this stage.
+     * Returns a new CompletionStage with the same result or exception as
+     * this stage, that executes the given action when this stage completes.
+     *
+     * <p>When this stage is complete, the given action is invoked with the
+     * result (or {@code null} if none) and the exception (or {@code null}
+     * if none) of this stage as arguments.  The returned stage is completed
+     * when the action returns.  If the supplied action itself encounters an
+     * exception, then the returned stage exceptionally completes with this
+     * exception unless this stage also completed exceptionally.
      *
      * @param action the action to perform
      * @return the new CompletionStage
@@ -661,12 +666,16 @@
         (BiConsumer<? super T, ? super Throwable> action);
 
     /**
-     * Returns a new CompletionStage with the same result or exception
-     * as this stage, and when this stage completes, executes the
-     * given action executes the given action using this stage's
-     * default asynchronous execution facility, with the result (or
-     * {@code null} if none) and the exception (or {@code null} if
-     * none) of this stage as arguments.
+     * Returns a new CompletionStage with the same result or exception as
+     * this stage, that executes the given action using this stage's
+     * default asynchronous execution facility when this stage completes.
+     *
+     * <p>When this stage is complete, the given action is invoked with the
+     * result (or {@code null} if none) and the exception (or {@code null}
+     * if none) of this stage as arguments.  The returned stage is completed
+     * when the action returns.  If the supplied action itself encounters an
+     * exception, then the returned stage exceptionally completes with this
+     * exception unless this stage also completed exceptionally.
      *
      * @param action the action to perform
      * @return the new CompletionStage
@@ -675,11 +684,16 @@
         (BiConsumer<? super T, ? super Throwable> action);
 
     /**
-     * Returns a new CompletionStage with the same result or exception
-     * as this stage, and when this stage completes, executes using
-     * the supplied Executor, the given action with the result (or
-     * {@code null} if none) and the exception (or {@code null} if
-     * none) of this stage as arguments.
+     * Returns a new CompletionStage with the same result or exception as
+     * this stage, that executes the given action using the supplied
+     * Executor when this stage completes.
+     *
+     * <p>When this stage is complete, the given action is invoked with the
+     * result (or {@code null} if none) and the exception (or {@code null}
+     * if none) of this stage as arguments.  The returned stage is completed
+     * when the action returns.  If the supplied action itself encounters an
+     * exception, then the returned stage exceptionally completes with this
+     * exception unless this stage also completed exceptionally.
      *
      * @param action the action to perform
      * @param executor the executor to use for asynchronous execution
@@ -693,9 +707,11 @@
      * Returns a new CompletionStage that, when this stage completes
      * either normally or exceptionally, is executed with this stage's
      * result and exception as arguments to the supplied function.
-     * The given function is invoked with the result (or {@code null}
-     * if none) and the exception (or {@code null} if none) of this
-     * stage when complete as arguments.
+     *
+     * <p>When this stage is complete, the given function is invoked
+     * with the result (or {@code null} if none) and the exception (or
+     * {@code null} if none) of this stage as arguments, and the
+     * function's result is used to complete the returned stage.
      *
      * @param fn the function to use to compute the value of the
      * returned CompletionStage
@@ -710,9 +726,11 @@
      * either normally or exceptionally, is executed using this stage's
      * default asynchronous execution facility, with this stage's
      * result and exception as arguments to the supplied function.
-     * The given function is invoked with the result (or {@code null}
-     * if none) and the exception (or {@code null} if none) of this
-     * stage when complete as arguments.
+     *
+     * <p>When this stage is complete, the given function is invoked
+     * with the result (or {@code null} if none) and the exception (or
+     * {@code null} if none) of this stage as arguments, and the
+     * function's result is used to complete the returned stage.
      *
      * @param fn the function to use to compute the value of the
      * returned CompletionStage
@@ -726,10 +744,12 @@
      * Returns a new CompletionStage that, when this stage completes
      * either normally or exceptionally, is executed using the
      * supplied executor, with this stage's result and exception as
-     * arguments to the supplied function.  The given function is
-     * invoked with the result (or {@code null} if none) and the
-     * exception (or {@code null} if none) of this stage when complete
-     * as arguments.
+     * arguments to the supplied function.
+     *
+     * <p>When this stage is complete, the given function is invoked
+     * with the result (or {@code null} if none) and the exception (or
+     * {@code null} if none) of this stage as arguments, and the
+     * function's result is used to complete the returned stage.
      *
      * @param fn the function to use to compute the value of the
      * returned CompletionStage
diff --git a/src/share/classes/java/util/concurrent/ForkJoinPool.java b/src/share/classes/java/util/concurrent/ForkJoinPool.java
index 9f5e149..8b6ed6d 100644
--- a/src/share/classes/java/util/concurrent/ForkJoinPool.java
+++ b/src/share/classes/java/util/concurrent/ForkJoinPool.java
@@ -49,6 +49,7 @@
 import java.util.concurrent.RunnableFuture;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
 import java.security.Permissions;
@@ -80,9 +81,9 @@
  *
  * <p>For applications that require separate or custom pools, a {@code
  * ForkJoinPool} may be constructed with a given target parallelism
- * level; by default, equal to the number of available processors. The
- * pool attempts to maintain enough active (or available) threads by
- * dynamically adding, suspending, or resuming internal worker
+ * level; by default, equal to the number of available processors.
+ * The pool attempts to maintain enough active (or available) threads
+ * by dynamically adding, suspending, or resuming internal worker
  * threads, even if some tasks are stalled waiting to join others.
  * However, no such adjustments are guaranteed in the face of blocked
  * I/O or other unmanaged synchronization. The nested {@link
@@ -178,7 +179,14 @@
      * that may be stolen by other workers.  Preference rules give
      * first priority to processing tasks from their own queues (LIFO
      * or FIFO, depending on mode), then to randomized FIFO steals of
-     * tasks in other queues.
+     * tasks in other queues.  This framework began as vehicle for
+     * supporting tree-structured parallelism using work-stealing.
+     * Over time, its scalability advantages led to extensions and
+     * changes to better support more diverse usage contexts.  Because
+     * most internal methods and nested classes are interrelated,
+     * their main rationale and descriptions are presented here;
+     * individual methods and nested classes contain only brief
+     * comments about details.
      *
      * WorkQueues
      * ==========
@@ -198,201 +206,318 @@
      * (http://research.sun.com/scalable/pubs/index.html) and
      * "Idempotent work stealing" by Michael, Saraswat, and Vechev,
      * PPoPP 2009 (http://portal.acm.org/citation.cfm?id=1504186).
-     * See also "Correct and Efficient Work-Stealing for Weak Memory
-     * Models" by Le, Pop, Cohen, and Nardelli, PPoPP 2013
-     * (http://www.di.ens.fr/~zappa/readings/ppopp13.pdf) for an
-     * analysis of memory ordering (atomic, volatile etc) issues.  The
-     * main differences ultimately stem from GC requirements that we
-     * null out taken slots as soon as we can, to maintain as small a
-     * footprint as possible even in programs generating huge numbers
-     * of tasks. To accomplish this, we shift the CAS arbitrating pop
-     * vs poll (steal) from being on the indices ("base" and "top") to
-     * the slots themselves.  So, both a successful pop and poll
-     * mainly entail a CAS of a slot from non-null to null.  Because
-     * we rely on CASes of references, we do not need tag bits on base
-     * or top.  They are simple ints as used in any circular
+     * The main differences ultimately stem from GC requirements that
+     * we null out taken slots as soon as we can, to maintain as small
+     * a footprint as possible even in programs generating huge
+     * numbers of tasks. To accomplish this, we shift the CAS
+     * arbitrating pop vs poll (steal) from being on the indices
+     * ("base" and "top") to the slots themselves.
+     *
+     * Adding tasks then takes the form of a classic array push(task):
+     *    q.array[q.top] = task; ++q.top;
+     *
+     * (The actual code needs to null-check and size-check the array,
+     * properly fence the accesses, and possibly signal waiting
+     * workers to start scanning -- see below.)  Both a successful pop
+     * and poll mainly entail a CAS of a slot from non-null to null.
+     *
+     * The pop operation (always performed by owner) is:
+     *   if ((base != top) and
+     *        (the task at top slot is not null) and
+     *        (CAS slot to null))
+     *           decrement top and return task;
+     *
+     * And the poll operation (usually by a stealer) is
+     *    if ((base != top) and
+     *        (the task at base slot is not null) and
+     *        (base has not changed) and
+     *        (CAS slot to null))
+     *           increment base and return task;
+     *
+     * Because we rely on CASes of references, we do not need tag bits
+     * on base or top.  They are simple ints as used in any circular
      * array-based queue (see for example ArrayDeque).  Updates to the
-     * indices must still be ordered in a way that guarantees that top
-     * == base means the queue is empty, but otherwise may err on the
-     * side of possibly making the queue appear nonempty when a push,
-     * pop, or poll have not fully committed. Note that this means
-     * that the poll operation, considered individually, is not
-     * wait-free. One thief cannot successfully continue until another
-     * in-progress one (or, if previously empty, a push) completes.
-     * However, in the aggregate, we ensure at least probabilistic
+     * indices guarantee that top == base means the queue is empty,
+     * but otherwise may err on the side of possibly making the queue
+     * appear nonempty when a push, pop, or poll have not fully
+     * committed. (Method isEmpty() checks the case of a partially
+     * completed removal of the last element.)  Because of this, the
+     * poll operation, considered individually, is not wait-free. One
+     * thief cannot successfully continue until another in-progress
+     * one (or, if previously empty, a push) completes.  However, in
+     * the aggregate, we ensure at least probabilistic
      * non-blockingness.  If an attempted steal fails, a thief always
      * chooses a different random victim target to try next. So, in
      * order for one thief to progress, it suffices for any
      * in-progress poll or new push on any empty queue to
      * complete. (This is why we normally use method pollAt and its
      * variants that try once at the apparent base index, else
-     * consider alternative actions, rather than method poll.)
+     * consider alternative actions, rather than method poll, which
+     * retries.)
      *
-     * This approach also enables support of a user mode in which local
-     * task processing is in FIFO, not LIFO order, simply by using
-     * poll rather than pop.  This can be useful in message-passing
-     * frameworks in which tasks are never joined.  However neither
-     * mode considers affinities, loads, cache localities, etc, so
-     * rarely provide the best possible performance on a given
-     * machine, but portably provide good throughput by averaging over
-     * these factors.  (Further, even if we did try to use such
-     * information, we do not usually have a basis for exploiting it.
-     * For example, some sets of tasks profit from cache affinities,
-     * but others are harmed by cache pollution effects.)
+     * This approach also enables support of a user mode in which
+     * local task processing is in FIFO, not LIFO order, simply by
+     * using poll rather than pop.  This can be useful in
+     * message-passing frameworks in which tasks are never joined.
+     * However neither mode considers affinities, loads, cache
+     * localities, etc, so rarely provide the best possible
+     * performance on a given machine, but portably provide good
+     * throughput by averaging over these factors.  Further, even if
+     * we did try to use such information, we do not usually have a
+     * basis for exploiting it.  For example, some sets of tasks
+     * profit from cache affinities, but others are harmed by cache
+     * pollution effects. Additionally, even though it requires
+     * scanning, long-term throughput is often best using random
+     * selection rather than directed selection policies, so cheap
+     * randomization of sufficient quality is used whenever
+     * applicable.  Various Marsaglia XorShifts (some with different
+     * shift constants) are inlined at use points.
      *
      * WorkQueues are also used in a similar way for tasks submitted
      * to the pool. We cannot mix these tasks in the same queues used
-     * for work-stealing (this would contaminate lifo/fifo
-     * processing). Instead, we randomly associate submission queues
+     * by workers. Instead, we randomly associate submission queues
      * with submitting threads, using a form of hashing.  The
      * ThreadLocalRandom probe value serves as a hash code for
      * choosing existing queues, and may be randomly repositioned upon
      * contention with other submitters.  In essence, submitters act
      * like workers except that they are restricted to executing local
      * tasks that they submitted (or in the case of CountedCompleters,
-     * others with the same root task).  However, because most
-     * shared/external queue operations are more expensive than
-     * internal, and because, at steady state, external submitters
-     * will compete for CPU with workers, ForkJoinTask.join and
-     * related methods disable them from repeatedly helping to process
-     * tasks if all workers are active.  Insertion of tasks in shared
+     * others with the same root task).  Insertion of tasks in shared
      * mode requires a lock (mainly to protect in the case of
-     * resizing) but we use only a simple spinlock (using bits in
-     * field qlock), because submitters encountering a busy queue move
-     * on to try or create other queues -- they block only when
-     * creating and registering new queues.
+     * resizing) but we use only a simple spinlock (using field
+     * qlock), because submitters encountering a busy queue move on to
+     * try or create other queues -- they block only when creating and
+     * registering new queues. Additionally, "qlock" saturates to an
+     * unlockable value (-1) at shutdown. Unlocking still can be and
+     * is performed by cheaper ordered writes of "qlock" in successful
+     * cases, but uses CAS in unsuccessful cases.
      *
      * Management
      * ==========
      *
      * The main throughput advantages of work-stealing stem from
      * decentralized control -- workers mostly take tasks from
-     * themselves or each other. We cannot negate this in the
-     * implementation of other management responsibilities. The main
-     * tactic for avoiding bottlenecks is packing nearly all
-     * essentially atomic control state into two volatile variables
-     * that are by far most often read (not written) as status and
-     * consistency checks.
+     * themselves or each other, at rates that can exceed a billion
+     * per second.  The pool itself creates, activates (enables
+     * scanning for and running tasks), deactivates, blocks, and
+     * terminates threads, all with minimal central information.
+     * There are only a few properties that we can globally track or
+     * maintain, so we pack them into a small number of variables,
+     * often maintaining atomicity without blocking or locking.
+     * Nearly all essentially atomic control state is held in two
+     * volatile variables that are by far most often read (not
+     * written) as status and consistency checks. (Also, field
+     * "config" holds unchanging configuration state.)
      *
-     * Field "ctl" contains 64 bits holding all the information needed
-     * to atomically decide to add, inactivate, enqueue (on an event
+     * Field "ctl" contains 64 bits holding information needed to
+     * atomically decide to add, inactivate, enqueue (on an event
      * queue), dequeue, and/or re-activate workers.  To enable this
      * packing, we restrict maximum parallelism to (1<<15)-1 (which is
      * far in excess of normal operating range) to allow ids, counts,
      * and their negations (used for thresholding) to fit into 16bit
-     * fields.
+     * subfields.
      *
-     * Field "plock" is a form of sequence lock with a saturating
-     * shutdown bit (similarly for per-queue "qlocks"), mainly
-     * protecting updates to the workQueues array, as well as to
-     * enable shutdown.  When used as a lock, it is normally only very
-     * briefly held, so is nearly always available after at most a
-     * brief spin, but we use a monitor-based backup strategy to
-     * block when needed.
+     * Field "runState" holds lockable state bits (STARTED, STOP, etc)
+     * also protecting updates to the workQueues array.  When used as
+     * a lock, it is normally held only for a few instructions (the
+     * only exceptions are one-time array initialization and uncommon
+     * resizing), so is nearly always available after at most a brief
+     * spin. But to be extra-cautious, after spinning, method
+     * awaitRunStateLock (called only if an initial CAS fails), uses a
+     * wait/notify mechanics on a builtin monitor to block when
+     * (rarely) needed. This would be a terrible idea for a highly
+     * contended lock, but most pools run without the lock ever
+     * contending after the spin limit, so this works fine as a more
+     * conservative alternative. Because we don't otherwise have an
+     * internal Object to use as a monitor, the "stealCounter" (an
+     * AtomicLong) is used when available (it too must be lazily
+     * initialized; see externalSubmit).
+     *
+     * Usages of "runState" vs "ctl" interact in only one case:
+     * deciding to add a worker thread (see tryAddWorker), in which
+     * case the ctl CAS is performed while the lock is held.
      *
      * Recording WorkQueues.  WorkQueues are recorded in the
-     * "workQueues" array that is created upon first use and expanded
-     * if necessary.  Updates to the array while recording new workers
-     * and unrecording terminated ones are protected from each other
-     * by a lock but the array is otherwise concurrently readable, and
-     * accessed directly.  To simplify index-based operations, the
-     * array size is always a power of two, and all readers must
-     * tolerate null slots. Worker queues are at odd indices. Shared
-     * (submission) queues are at even indices, up to a maximum of 64
-     * slots, to limit growth even if array needs to expand to add
-     * more workers. Grouping them together in this way simplifies and
-     * speeds up task scanning.
+     * "workQueues" array. The array is created upon first use (see
+     * externalSubmit) and expanded if necessary.  Updates to the
+     * array while recording new workers and unrecording terminated
+     * ones are protected from each other by the runState lock, but
+     * the array is otherwise concurrently readable, and accessed
+     * directly. We also ensure that reads of the array reference
+     * itself never become too stale. To simplify index-based
+     * operations, the array size is always a power of two, and all
+     * readers must tolerate null slots. Worker queues are at odd
+     * indices. Shared (submission) queues are at even indices, up to
+     * a maximum of 64 slots, to limit growth even if array needs to
+     * expand to add more workers. Grouping them together in this way
+     * simplifies and speeds up task scanning.
      *
      * All worker thread creation is on-demand, triggered by task
      * submissions, replacement of terminated workers, and/or
      * compensation for blocked workers. However, all other support
      * code is set up to work with other policies.  To ensure that we
-     * do not hold on to worker references that would prevent GC, ALL
+     * do not hold on to worker references that would prevent GC, All
      * accesses to workQueues are via indices into the workQueues
      * array (which is one source of some of the messy code
      * constructions here). In essence, the workQueues array serves as
-     * a weak reference mechanism. Thus for example the wait queue
-     * field of ctl stores indices, not references.  Access to the
-     * workQueues in associated methods (for example signalWork) must
-     * both index-check and null-check the IDs. All such accesses
-     * ignore bad IDs by returning out early from what they are doing,
-     * since this can only be associated with termination, in which
-     * case it is OK to give up.  All uses of the workQueues array
-     * also check that it is non-null (even if previously
-     * non-null). This allows nulling during termination, which is
-     * currently not necessary, but remains an option for
-     * resource-revocation-based shutdown schemes. It also helps
-     * reduce JIT issuance of uncommon-trap code, which tends to
-     * unnecessarily complicate control flow in some methods.
+     * a weak reference mechanism. Thus for example the stack top
+     * subfield of ctl stores indices, not references.
      *
-     * Event Queuing. Unlike HPC work-stealing frameworks, we cannot
-     * let workers spin indefinitely scanning for tasks when none can
-     * be found immediately, and we cannot start/resume workers unless
-     * there appear to be tasks available.  On the other hand, we must
-     * quickly prod them into action when new tasks are submitted or
-     * generated. In many usages, ramp-up time to activate workers is
-     * the main limiting factor in overall performance (this is
-     * compounded at program start-up by JIT compilation and
-     * allocation). So we try to streamline this as much as possible.
-     * We park/unpark workers after placing in an event wait queue
-     * when they cannot find work. This "queue" is actually a simple
-     * Treiber stack, headed by the "id" field of ctl, plus a 15bit
-     * counter value (that reflects the number of times a worker has
-     * been inactivated) to avoid ABA effects (we need only as many
-     * version numbers as worker threads). Successors are held in
-     * field WorkQueue.nextWait.  Queuing deals with several intrinsic
-     * races, mainly that a task-producing thread can miss seeing (and
-     * signalling) another thread that gave up looking for work but
-     * has not yet entered the wait queue. We solve this by requiring
-     * a full sweep of all workers (via repeated calls to method
-     * scan()) both before and after a newly waiting worker is added
-     * to the wait queue.  Because enqueued workers may actually be
-     * rescanning rather than waiting, we set and clear the "parker"
+     * Queuing Idle Workers. Unlike HPC work-stealing frameworks, we
+     * cannot let workers spin indefinitely scanning for tasks when
+     * none can be found immediately, and we cannot start/resume
+     * workers unless there appear to be tasks available.  On the
+     * other hand, we must quickly prod them into action when new
+     * tasks are submitted or generated. In many usages, ramp-up time
+     * to activate workers is the main limiting factor in overall
+     * performance, which is compounded at program start-up by JIT
+     * compilation and allocation. So we streamline this as much as
+     * possible.
+     *
+     * The "ctl" field atomically maintains active and total worker
+     * counts as well as a queue to place waiting threads so they can
+     * be located for signalling. Active counts also play the role of
+     * quiescence indicators, so are decremented when workers believe
+     * that there are no more tasks to execute. The "queue" is
+     * actually a form of Treiber stack.  A stack is ideal for
+     * activating threads in most-recently used order. This improves
+     * performance and locality, outweighing the disadvantages of
+     * being prone to contention and inability to release a worker
+     * unless it is topmost on stack.  We park/unpark workers after
+     * pushing on the idle worker stack (represented by the lower
+     * 32bit subfield of ctl) when they cannot find work.  The top
+     * stack state holds the value of the "scanState" field of the
+     * worker: its index and status, plus a version counter that, in
+     * addition to the count subfields (also serving as version
+     * stamps) provide protection against Treiber stack ABA effects.
+     *
+     * Field scanState is used by both workers and the pool to manage
+     * and track whether a worker is INACTIVE (possibly blocked
+     * waiting for a signal), or SCANNING for tasks (when neither hold
+     * it is busy running tasks).  When a worker is inactivated, its
+     * scanState field is set, and is prevented from executing tasks,
+     * even though it must scan once for them to avoid queuing
+     * races. Note that scanState updates lag queue CAS releases so
+     * usage requires care. When queued, the lower 16 bits of
+     * scanState must hold its pool index. So we place the index there
+     * upon initialization (see registerWorker) and otherwise keep it
+     * there or restore it when necessary.
+     *
+     * Memory ordering.  See "Correct and Efficient Work-Stealing for
+     * Weak Memory Models" by Le, Pop, Cohen, and Nardelli, PPoPP 2013
+     * (http://www.di.ens.fr/~zappa/readings/ppopp13.pdf) for an
+     * analysis of memory ordering requirements in work-stealing
+     * algorithms similar to the one used here.  We usually need
+     * stronger than minimal ordering because we must sometimes signal
+     * workers, requiring Dekker-like full-fences to avoid lost
+     * signals.  Arranging for enough ordering without expensive
+     * over-fencing requires tradeoffs among the supported means of
+     * expressing access constraints. The most central operations,
+     * taking from queues and updating ctl state, require full-fence
+     * CAS.  Array slots are read using the emulation of volatiles
+     * provided by Unsafe.  Access from other threads to WorkQueue
+     * base, top, and array requires a volatile load of the first of
+     * any of these read.  We use the convention of declaring the
+     * "base" index volatile, and always read it before other fields.
+     * The owner thread must ensure ordered updates, so writes use
+     * ordered intrinsics unless they can piggyback on those for other
+     * writes.  Similar conventions and rationales hold for other
+     * WorkQueue fields (such as "currentSteal") that are only written
+     * by owners but observed by others.
+     *
+     * Creating workers. To create a worker, we pre-increment total
+     * count (serving as a reservation), and attempt to construct a
+     * ForkJoinWorkerThread via its factory. Upon construction, the
+     * new thread invokes registerWorker, where it constructs a
+     * WorkQueue and is assigned an index in the workQueues array
+     * (expanding the array if necessary). The thread is then
+     * started. Upon any exception across these steps, or null return
+     * from factory, deregisterWorker adjusts counts and records
+     * accordingly.  If a null return, the pool continues running with
+     * fewer than the target number workers. If exceptional, the
+     * exception is propagated, generally to some external caller.
+     * Worker index assignment avoids the bias in scanning that would
+     * occur if entries were sequentially packed starting at the front
+     * of the workQueues array. We treat the array as a simple
+     * power-of-two hash table, expanding as needed. The seedIndex
+     * increment ensures no collisions until a resize is needed or a
+     * worker is deregistered and replaced, and thereafter keeps
+     * probability of collision low. We cannot use
+     * ThreadLocalRandom.getProbe() for similar purposes here because
+     * the thread has not started yet, but do so for creating
+     * submission queues for existing external threads.
+     *
+     * Deactivation and waiting. Queuing encounters several intrinsic
+     * races; most notably that a task-producing thread can miss
+     * seeing (and signalling) another thread that gave up looking for
+     * work but has not yet entered the wait queue.  When a worker
+     * cannot find a task to steal, it deactivates and enqueues. Very
+     * often, the lack of tasks is transient due to GC or OS
+     * scheduling. To reduce false-alarm deactivation, scanners
+     * compute checksums of queue states during sweeps.  (The
+     * stability checks used here and elsewhere are probabilistic
+     * variants of snapshot techniques -- see Herlihy & Shavit.)
+     * Workers give up and try to deactivate only after the sum is
+     * stable across scans. Further, to avoid missed signals, they
+     * repeat this scanning process after successful enqueuing until
+     * again stable.  In this state, the worker cannot take/run a task
+     * it sees until it is released from the queue, so the worker
+     * itself eventually tries to release itself or any successor (see
+     * tryRelease).  Otherwise, upon an empty scan, a deactivated
+     * worker uses an adaptive local spin construction (see awaitWork)
+     * before blocking (via park). Note the unusual conventions about
+     * Thread.interrupts surrounding parking and other blocking:
+     * Because interrupts are used solely to alert threads to check
+     * termination, which is checked anyway upon blocking, we clear
+     * status (using Thread.interrupted) before any call to park, so
+     * that park does not immediately return due to status being set
+     * via some other unrelated call to interrupt in user code.
+     *
+     * Signalling and activation.  Workers are created or activated
+     * only when there appears to be at least one task they might be
+     * able to find and execute.  Upon push (either by a worker or an
+     * external submission) to a previously (possibly) empty queue,
+     * workers are signalled if idle, or created if fewer exist than
+     * the given parallelism level.  These primary signals are
+     * buttressed by others whenever other threads remove a task from
+     * a queue and notice that there are other tasks there as well.
+     * On most platforms, signalling (unpark) overhead time is
+     * noticeably long, and the time between signalling a thread and
+     * it actually making progress can be very noticeably long, so it
+     * is worth offloading these delays from critical paths as much as
+     * possible. Also, because inactive workers are often rescanning
+     * or spinning rather than blocking, we set and clear the "parker"
      * field of WorkQueues to reduce unnecessary calls to unpark.
      * (This requires a secondary recheck to avoid missed signals.)
-     * Note the unusual conventions about Thread.interrupts
-     * surrounding parking and other blocking: Because interrupts are
-     * used solely to alert threads to check termination, which is
-     * checked anyway upon blocking, we clear status (using
-     * Thread.interrupted) before any call to park, so that park does
-     * not immediately return due to status being set via some other
-     * unrelated call to interrupt in user code.
-     *
-     * Signalling.  We create or wake up workers only when there
-     * appears to be at least one task they might be able to find and
-     * execute.  When a submission is added or another worker adds a
-     * task to a queue that has fewer than two tasks, they signal
-     * waiting workers (or trigger creation of new ones if fewer than
-     * the given parallelism level -- signalWork).  These primary
-     * signals are buttressed by others whenever other threads remove
-     * a task from a queue and notice that there are other tasks there
-     * as well.  So in general, pools will be over-signalled. On most
-     * platforms, signalling (unpark) overhead time is noticeably
-     * long, and the time between signalling a thread and it actually
-     * making progress can be very noticeably long, so it is worth
-     * offloading these delays from critical paths as much as
-     * possible. Additionally, workers spin-down gradually, by staying
-     * alive so long as they see the ctl state changing.  Similar
-     * stability-sensing techniques are also used before blocking in
-     * awaitJoin and helpComplete.
      *
      * Trimming workers. To release resources after periods of lack of
      * use, a worker starting to wait when the pool is quiescent will
-     * time out and terminate if the pool has remained quiescent for a
-     * given period -- a short period if there are more threads than
-     * parallelism, longer as the number of threads decreases. This
-     * will slowly propagate, eventually terminating all workers after
-     * periods of non-use.
+     * time out and terminate (see awaitWork) if the pool has remained
+     * quiescent for period IDLE_TIMEOUT, increasing the period as the
+     * number of threads decreases, eventually removing all workers.
+     * Also, when more than two spare threads exist, excess threads
+     * are immediately terminated at the next quiescent point.
+     * (Padding by two avoids hysteresis.)
      *
-     * Shutdown and Termination. A call to shutdownNow atomically sets
-     * a plock bit and then (non-atomically) sets each worker's
-     * qlock status, cancels all unprocessed tasks, and wakes up
-     * all waiting workers.  Detecting whether termination should
-     * commence after a non-abrupt shutdown() call requires more work
-     * and bookkeeping. We need consensus about quiescence (i.e., that
-     * there is no more work). The active count provides a primary
-     * indication but non-abrupt shutdown still requires a rechecking
-     * scan for any workers that are inactive but not queued.
+     * Shutdown and Termination. A call to shutdownNow invokes
+     * tryTerminate to atomically set a runState bit. The calling
+     * thread, as well as every other worker thereafter terminating,
+     * helps terminate others by setting their (qlock) status,
+     * cancelling their unprocessed tasks, and waking them up, doing
+     * so repeatedly until stable (but with a loop bounded by the
+     * number of workers).  Calls to non-abrupt shutdown() preface
+     * this by checking whether termination should commence. This
+     * relies primarily on the active count bits of "ctl" maintaining
+     * consensus -- tryTerminate is called from awaitWork whenever
+     * quiescent. However, external submitters do not take part in
+     * this consensus.  So, tryTerminate sweeps through queues (until
+     * stable) to ensure lack of in-flight submissions and workers
+     * about to process them before triggering the "STOP" phase of
+     * termination. (Note: there is an intrinsic conflict if
+     * helpQuiescePool is called when shutdown is enabled. Both wait
+     * for quiescence, but tryTerminate is biased to not trigger until
+     * helpQuiescePool completes.)
+     *
      *
      * Joining Tasks
      * =============
@@ -403,9 +528,9 @@
      * just let them block (as in Thread.join).  We also cannot just
      * reassign the joiner's run-time stack with another and replace
      * it later, which would be a form of "continuation", that even if
-     * possible is not necessarily a good idea since we sometimes need
-     * both an unblocked task and its continuation to progress.
-     * Instead we combine two tactics:
+     * possible is not necessarily a good idea since we may need both
+     * an unblocked task and its continuation to progress.  Instead we
+     * combine two tactics:
      *
      *   Helping: Arranging for the joiner to execute some task that it
      *      would be running if the steal had not occurred.
@@ -425,16 +550,16 @@
      * The ManagedBlocker extension API can't use helping so relies
      * only on compensation in method awaitBlocker.
      *
-     * The algorithm in tryHelpStealer entails a form of "linear"
-     * helping: Each worker records (in field currentSteal) the most
-     * recent task it stole from some other worker. Plus, it records
-     * (in field currentJoin) the task it is currently actively
-     * joining. Method tryHelpStealer uses these markers to try to
-     * find a worker to help (i.e., steal back a task from and execute
-     * it) that could hasten completion of the actively joined task.
-     * In essence, the joiner executes a task that would be on its own
-     * local deque had the to-be-joined task not been stolen. This may
-     * be seen as a conservative variant of the approach in Wagner &
+     * The algorithm in helpStealer entails a form of "linear
+     * helping".  Each worker records (in field currentSteal) the most
+     * recent task it stole from some other worker (or a submission).
+     * It also records (in field currentJoin) the task it is currently
+     * actively joining. Method helpStealer uses these markers to try
+     * to find a worker to help (i.e., steal back a task from and
+     * execute it) that could hasten completion of the actively joined
+     * task.  Thus, the joiner executes a task that would be on its
+     * own local deque had the to-be-joined task not been stolen. This
+     * is a conservative variant of the approach described in Wagner &
      * Calder "Leapfrogging: a portable technique for implementing
      * efficient futures" SIGPLAN Notices, 1993
      * (http://portal.acm.org/citation.cfm?id=155354). It differs in
@@ -452,37 +577,40 @@
      * which means that we miss links in the chain during long-lived
      * tasks, GC stalls etc (which is OK since blocking in such cases
      * is usually a good idea).  (4) We bound the number of attempts
-     * to find work (see MAX_HELP) and fall back to suspending the
+     * to find work using checksums and fall back to suspending the
      * worker and if necessary replacing it with another.
      *
-     * Helping actions for CountedCompleters are much simpler: Method
-     * helpComplete can take and execute any task with the same root
-     * as the task being waited on. However, this still entails some
-     * traversal of completer chains, so is less efficient than using
-     * CountedCompleters without explicit joins.
+     * Helping actions for CountedCompleters do not require tracking
+     * currentJoins: Method helpComplete takes and executes any task
+     * with the same root as the task being waited on (preferring
+     * local pops to non-local polls). However, this still entails
+     * some traversal of completer chains, so is less efficient than
+     * using CountedCompleters without explicit joins.
      *
-     * It is impossible to keep exactly the target parallelism number
-     * of threads running at any given time.  Determining the
-     * existence of conservatively safe helping targets, the
-     * availability of already-created spares, and the apparent need
-     * to create new spares are all racy, so we rely on multiple
-     * retries of each.  Compensation in the apparent absence of
-     * helping opportunities is challenging to control on JVMs, where
-     * GC and other activities can stall progress of tasks that in
-     * turn stall out many other dependent tasks, without us being
-     * able to determine whether they will ever require compensation.
-     * Even though work-stealing otherwise encounters little
-     * degradation in the presence of more threads than cores,
-     * aggressively adding new threads in such cases entails risk of
-     * unwanted positive feedback control loops in which more threads
-     * cause more dependent stalls (as well as delayed progress of
-     * unblocked threads to the point that we know they are available)
-     * leading to more situations requiring more threads, and so
-     * on. This aspect of control can be seen as an (analytically
-     * intractable) game with an opponent that may choose the worst
-     * (for us) active thread to stall at any time.  We take several
-     * precautions to bound losses (and thus bound gains), mainly in
-     * methods tryCompensate and awaitJoin.
+     * Compensation does not aim to keep exactly the target
+     * parallelism number of unblocked threads running at any given
+     * time. Some previous versions of this class employed immediate
+     * compensations for any blocked join. However, in practice, the
+     * vast majority of blockages are transient byproducts of GC and
+     * other JVM or OS activities that are made worse by replacement.
+     * Currently, compensation is attempted only after validating that
+     * all purportedly active threads are processing tasks by checking
+     * field WorkQueue.scanState, which eliminates most false
+     * positives.  Also, compensation is bypassed (tolerating fewer
+     * threads) in the most common case in which it is rarely
+     * beneficial: when a worker with an empty queue (thus no
+     * continuation tasks) blocks on a join and there still remain
+     * enough threads to ensure liveness.
+     *
+     * The compensation mechanism may be bounded.  Bounds for the
+     * commonPool (see commonMaxSpares) better enable JVMs to cope
+     * with programming errors and abuse before running out of
+     * resources to do so. In other cases, users may supply factories
+     * that limit thread construction. The effects of bounding in this
+     * pool (like all others) is imprecise.  Total worker counts are
+     * decremented when threads deregister, not when they exit and
+     * resources are reclaimed by the JVM and OS. So the number of
+     * simultaneously live threads may transiently exceed bounds.
      *
      * Common Pool
      * ===========
@@ -492,34 +620,52 @@
      * never be used, we minimize initial construction overhead and
      * footprint to the setup of about a dozen fields, with no nested
      * allocation. Most bootstrapping occurs within method
-     * fullExternalPush during the first submission to the pool.
+     * externalSubmit during the first submission to the pool.
      *
      * When external threads submit to the common pool, they can
-     * perform subtask processing (see externalHelpJoin and related
-     * methods).  This caller-helps policy makes it sensible to set
-     * common pool parallelism level to one (or more) less than the
-     * total number of available cores, or even zero for pure
-     * caller-runs.  We do not need to record whether external
-     * submissions are to the common pool -- if not, externalHelpJoin
-     * returns quickly (at the most helping to signal some common pool
-     * workers). These submitters would otherwise be blocked waiting
-     * for completion, so the extra effort (with liberally sprinkled
-     * task status checks) in inapplicable cases amounts to an odd
-     * form of limited spin-wait before blocking in ForkJoinTask.join.
+     * perform subtask processing (see externalHelpComplete and
+     * related methods) upon joins.  This caller-helps policy makes it
+     * sensible to set common pool parallelism level to one (or more)
+     * less than the total number of available cores, or even zero for
+     * pure caller-runs.  We do not need to record whether external
+     * submissions are to the common pool -- if not, external help
+     * methods return quickly. These submitters would otherwise be
+     * blocked waiting for completion, so the extra effort (with
+     * liberally sprinkled task status checks) in inapplicable cases
+     * amounts to an odd form of limited spin-wait before blocking in
+     * ForkJoinTask.join.
      *
      * As a more appropriate default in managed environments, unless
      * overridden by system properties, we use workers of subclass
      * InnocuousForkJoinWorkerThread when there is a SecurityManager
      * present. These workers have no permissions set, do not belong
      * to any user-defined ThreadGroup, and erase all ThreadLocals
-     * after executing any top-level task (see WorkQueue.runTask). The
-     * associated mechanics (mainly in ForkJoinWorkerThread) may be
-     * JVM-dependent and must access particular Thread class fields to
-     * achieve this effect.
+     * after executing any top-level task (see WorkQueue.runTask).
+     * The associated mechanics (mainly in ForkJoinWorkerThread) may
+     * be JVM-dependent and must access particular Thread class fields
+     * to achieve this effect.
      *
      * Style notes
      * ===========
      *
+     * Memory ordering relies mainly on Unsafe intrinsics that carry
+     * the further responsibility of explicitly performing null- and
+     * bounds- checks otherwise carried out implicitly by JVMs.  This
+     * can be awkward and ugly, but also reflects the need to control
+     * outcomes across the unusual cases that arise in very racy code
+     * with very few invariants. So these explicit checks would exist
+     * in some form anyway.  All fields are read into locals before
+     * use, and null-checked if they are references.  This is usually
+     * done in a "C"-like style of listing declarations at the heads
+     * of methods or blocks, and using inline assignments on first
+     * encounter.  Array bounds-checks are usually performed by
+     * masking with array.length-1, which relies on the invariant that
+     * these arrays are created with positive lengths, which is itself
+     * paranoically checked. Nearly all explicit checks lead to
+     * bypass/return, not exception throws, because they may
+     * legitimately arise due to cancellation/revocation during
+     * shutdown.
+     *
      * There is a lot of representation-level coupling among classes
      * ForkJoinPool, ForkJoinWorkerThread, and ForkJoinTask.  The
      * fields of WorkQueue maintain data structures managed by
@@ -527,22 +673,13 @@
      * trying to reduce this, since any associated future changes in
      * representations will need to be accompanied by algorithmic
      * changes anyway. Several methods intrinsically sprawl because
-     * they must accumulate sets of consistent reads of volatiles held
-     * in local variables.  Methods signalWork() and scan() are the
-     * main bottlenecks, so are especially heavily
-     * micro-optimized/mangled.  There are lots of inline assignments
-     * (of form "while ((local = field) != 0)") which are usually the
-     * simplest way to ensure the required read orderings (which are
-     * sometimes critical). This leads to a "C"-like style of listing
-     * declarations of these locals at the heads of methods or blocks.
-     * There are several occurrences of the unusual "do {} while
-     * (!cas...)"  which is the simplest way to force an update of a
-     * CAS'ed variable. There are also other coding oddities (including
-     * several unnecessary-looking hoisted null checks) that help
-     * some methods perform reasonably even when interpreted (not
-     * compiled).
+     * they must accumulate sets of consistent reads of fields held in
+     * local variables.  There are also other coding oddities
+     * (including several unnecessary-looking hoisted null checks)
+     * that help some methods perform reasonably even when interpreted
+     * (not compiled).
      *
-     * The order of declarations in this file is:
+     * The order of declarations in this file is (with a few exceptions):
      * (1) Static utility functions
      * (2) Nested (static) classes
      * (3) Static fields
@@ -609,56 +746,37 @@
         public final boolean exec() { return true; }
     }
 
+    // Constants shared across ForkJoinPool and WorkQueue
+
+    // Bounds
+    static final int SMASK        = 0xffff;        // short bits == max index
+    static final int MAX_CAP      = 0x7fff;        // max #workers - 1
+    static final int EVENMASK     = 0xfffe;        // even short bits
+    static final int SQMASK       = 0x007e;        // max 64 (even) slots
+
+    // Masks and units for WorkQueue.scanState and ctl sp subfield
+    static final int SCANNING     = 1;             // false when running tasks
+    static final int INACTIVE     = 1 << 31;       // must be negative
+    static final int SS_SEQ       = 1 << 16;       // version count
+
+    // Mode bits for ForkJoinPool.config and WorkQueue.config
+    static final int MODE_MASK    = 0xffff << 16;  // top half of int
+    static final int LIFO_QUEUE   = 0;
+    static final int FIFO_QUEUE   = 1 << 16;
+    static final int SHARED_QUEUE = 1 << 31;       // must be negative
+
     /**
      * Queues supporting work-stealing as well as external task
-     * submission. See above for main rationale and algorithms.
-     * Implementation relies heavily on "Unsafe" intrinsics
-     * and selective use of "volatile":
-     *
-     * Field "base" is the index (mod array.length) of the least valid
-     * queue slot, which is always the next position to steal (poll)
-     * from if nonempty. Reads and writes require volatile orderings
-     * but not CAS, because updates are only performed after slot
-     * CASes.
-     *
-     * Field "top" is the index (mod array.length) of the next queue
-     * slot to push to or pop from. It is written only by owner thread
-     * for push, or under lock for external/shared push, and accessed
-     * by other threads only after reading (volatile) base.  Both top
-     * and base are allowed to wrap around on overflow, but (top -
-     * base) (or more commonly -(base - top) to force volatile read of
-     * base before top) still estimates size. The lock ("qlock") is
-     * forced to -1 on termination, causing all further lock attempts
-     * to fail. (Note: we don't need CAS for termination state because
-     * upon pool shutdown, all shared-queues will stop being used
-     * anyway.)  Nearly all lock bodies are set up so that exceptions
-     * within lock bodies are "impossible" (modulo JVM errors that
-     * would cause failure anyway.)
-     *
-     * The array slots are read and written using the emulation of
-     * volatiles/atomics provided by Unsafe. Insertions must in
-     * general use putOrderedObject as a form of releasing store to
-     * ensure that all writes to the task object are ordered before
-     * its publication in the queue.  All removals entail a CAS to
-     * null.  The array is always a power of two. To ensure safety of
-     * Unsafe array operations, all accesses perform explicit null
-     * checks and implicit bounds checks via power-of-two masking.
-     *
-     * In addition to basic queuing support, this class contains
-     * fields described elsewhere to control execution. It turns out
-     * to work better memory-layout-wise to include them in this class
-     * rather than a separate class.
-     *
+     * submission. See above for descriptions and algorithms.
      * Performance on most platforms is very sensitive to placement of
      * instances of both WorkQueues and their arrays -- we absolutely
      * do not want multiple WorkQueue instances or multiple queue
-     * arrays sharing cache lines. (It would be best for queue objects
-     * and their arrays to share, but there is nothing available to
-     * help arrange that). The @Contended annotation alerts JVMs to
-     * try to keep instances apart.
+     * arrays sharing cache lines. The @Contended annotation alerts
+     * JVMs to try to keep instances apart.
      */
     @sun.misc.Contended
     static final class WorkQueue {
+
         /**
          * Capacity of work-stealing queue array upon initialization.
          * Must be a power of two; at least 4, but should be larger to
@@ -679,13 +797,13 @@
          */
         static final int MAXIMUM_QUEUE_CAPACITY = 1 << 26; // 64M
 
-        volatile int eventCount;   // encoded inactivation count; < 0 if inactive
-        int nextWait;              // encoded record of next event waiter
+        // Instance fields
+        volatile int scanState;    // versioned, <0: inactive; odd:scanning
+        int stackPred;             // pool stack (ctl) predecessor
         int nsteals;               // number of steals
-        int hint;                  // steal index hint
-        short poolIndex;           // index of this queue in pool
-        final short mode;          // 0: lifo, > 0: fifo, < 0: shared
-        volatile int qlock;        // 1: locked, -1: terminate; else 0
+        int hint;                  // randomization and stealer index hint
+        int config;                // pool index and mode
+        volatile int qlock;        // 1: locked, < 0: terminate; else 0
         volatile int base;         // index of next slot for poll
         int top;                   // index of next slot for push
         ForkJoinTask<?>[] array;   // the elements (initially unallocated)
@@ -693,19 +811,23 @@
         final ForkJoinWorkerThread owner; // owning thread or null if shared
         volatile Thread parker;    // == owner during call to park; else null
         volatile ForkJoinTask<?> currentJoin;  // task being joined in awaitJoin
-        ForkJoinTask<?> currentSteal; // current non-local task being executed
+        volatile ForkJoinTask<?> currentSteal; // mainly used by helpStealer
 
-        WorkQueue(ForkJoinPool pool, ForkJoinWorkerThread owner, int mode,
-                  int seed) {
+        WorkQueue(ForkJoinPool pool, ForkJoinWorkerThread owner) {
             this.pool = pool;
             this.owner = owner;
-            this.mode = (short)mode;
-            this.hint = seed; // store initial seed for runWorker
             // Place indices in the center of array (that is not yet allocated)
             base = top = INITIAL_QUEUE_CAPACITY >>> 1;
         }
 
         /**
+         * Returns an exportable index (used by ForkJoinWorkerThread).
+         */
+        final int getPoolIndex() {
+            return (config & 0xffff) >>> 1; // ignore odd/even tag bit
+        }
+
+        /**
          * Returns the approximate number of tasks in the queue.
          */
         final int queueSize() {
@@ -719,12 +841,10 @@
          * near-empty queue has at least one unclaimed task.
          */
         final boolean isEmpty() {
-            ForkJoinTask<?>[] a; int m, s;
-            int n = base - (s = top);
-            return (n >= 0 ||
-                    (n == -1 &&
-                     ((a = array) == null ||
-                      (m = a.length - 1) < 0 ||
+            ForkJoinTask<?>[] a; int n, m, s;
+            return ((n = base - (s = top)) >= 0 ||
+                    (n == -1 &&           // possibly one task
+                     ((a = array) == null || (m = a.length - 1) < 0 ||
                       U.getObject
                       (a, (long)((m & (s - 1)) << ASHIFT) + ABASE) == null)));
         }
@@ -738,12 +858,15 @@
          */
         final void push(ForkJoinTask<?> task) {
             ForkJoinTask<?>[] a; ForkJoinPool p;
-            int s = top, n;
+            int b = base, s = top, n;
             if ((a = array) != null) {    // ignore if queue removed
-                int m = a.length - 1;
+                int m = a.length - 1;     // fenced write for task visibility
                 U.putOrderedObject(a, ((m & s) << ASHIFT) + ABASE, task);
-                if ((n = (top = s + 1) - base) <= 2)
-                    (p = pool).signalWork(p.workQueues, this);
+                U.putOrderedInt(this, QTOP, s + 1);
+                if ((n = s - b) <= 1) {
+                    if ((p = pool) != null)
+                        p.signalWork(p.workQueues, this);
+                }
                 else if (n >= m)
                     growArray();
             }
@@ -764,7 +887,7 @@
             if (oldA != null && (oldMask = oldA.length - 1) >= 0 &&
                 (t = top) - (b = base) > 0) {
                 int mask = size - 1;
-                do {
+                do { // emulate poll from old array, push to new array
                     ForkJoinTask<?> x;
                     int oldj = ((b & oldMask) << ASHIFT) + ABASE;
                     int j    = ((b &    mask) << ASHIFT) + ABASE;
@@ -789,7 +912,7 @@
                     if ((t = (ForkJoinTask<?>)U.getObject(a, j)) == null)
                         break;
                     if (U.compareAndSwapObject(a, j, t, null)) {
-                        top = s;
+                        U.putOrderedInt(this, QTOP, s);
                         return t;
                     }
                 }
@@ -800,7 +923,7 @@
         /**
          * Takes a task in FIFO order if b is base of queue and a task
          * can be claimed without contention. Specialized versions
-         * appear in ForkJoinPool methods scan and tryHelpStealer.
+         * appear in ForkJoinPool methods scan and helpStealer.
          */
         final ForkJoinTask<?> pollAt(int b) {
             ForkJoinTask<?> t; ForkJoinTask<?>[] a;
@@ -808,7 +931,7 @@
                 int j = (((a.length - 1) & b) << ASHIFT) + ABASE;
                 if ((t = (ForkJoinTask<?>)U.getObjectVolatile(a, j)) != null &&
                     base == b && U.compareAndSwapObject(a, j, t, null)) {
-                    U.putOrderedInt(this, QBASE, b + 1);
+                    base = b + 1;
                     return t;
                 }
             }
@@ -823,16 +946,15 @@
             while ((b = base) - top < 0 && (a = array) != null) {
                 int j = (((a.length - 1) & b) << ASHIFT) + ABASE;
                 t = (ForkJoinTask<?>)U.getObjectVolatile(a, j);
-                if (t != null) {
-                    if (U.compareAndSwapObject(a, j, t, null)) {
-                        U.putOrderedInt(this, QBASE, b + 1);
-                        return t;
+                if (base == b) {
+                    if (t != null) {
+                        if (U.compareAndSwapObject(a, j, t, null)) {
+                            base = b + 1;
+                            return t;
+                        }
                     }
-                }
-                else if (base == b) {
-                    if (b + 1 == top)
+                    else if (b + 1 == top) // now empty
                         break;
-                    Thread.yield(); // wait for lagging update (very rare)
                 }
             }
             return null;
@@ -842,7 +964,7 @@
          * Takes next task, if one exists, in order specified by mode.
          */
         final ForkJoinTask<?> nextLocalTask() {
-            return mode == 0 ? pop() : poll();
+            return (config & FIFO_QUEUE) == 0 ? pop() : poll();
         }
 
         /**
@@ -852,7 +974,7 @@
             ForkJoinTask<?>[] a = array; int m;
             if (a == null || (m = a.length - 1) < 0)
                 return null;
-            int i = mode == 0 ? top - 1 : base;
+            int i = (config & FIFO_QUEUE) == 0 ? top - 1 : base;
             int j = ((i & m) << ASHIFT) + ABASE;
             return (ForkJoinTask<?>)U.getObjectVolatile(a, j);
         }
@@ -860,13 +982,13 @@
         /**
          * Pops the given task only if it is at the current top.
          * (A shared version is available only via FJP.tryExternalUnpush)
-         */
+        */
         final boolean tryUnpush(ForkJoinTask<?> t) {
             ForkJoinTask<?>[] a; int s;
             if ((a = array) != null && (s = top) != base &&
                 U.compareAndSwapObject
                 (a, (((a.length - 1) & --s) << ASHIFT) + ABASE, t, null)) {
-                top = s;
+                U.putOrderedInt(this, QTOP, s);
                 return true;
             }
             return false;
@@ -876,9 +998,16 @@
          * Removes and cancels all known tasks, ignoring any exceptions.
          */
         final void cancelAll() {
-            ForkJoinTask.cancelIgnoringExceptions(currentJoin);
-            ForkJoinTask.cancelIgnoringExceptions(currentSteal);
-            for (ForkJoinTask<?> t; (t = poll()) != null; )
+            ForkJoinTask<?> t;
+            if ((t = currentJoin) != null) {
+                currentJoin = null;
+                ForkJoinTask.cancelIgnoringExceptions(t);
+            }
+            if ((t = currentSteal) != null) {
+                currentSteal = null;
+                ForkJoinTask.cancelIgnoringExceptions(t);
+            }
+            while ((t = poll()) != null)
                 ForkJoinTask.cancelIgnoringExceptions(t);
         }
 
@@ -893,167 +1022,186 @@
         }
 
         /**
-         * Executes a top-level task and any local tasks remaining
-         * after execution.
+         * Removes and executes all local tasks. If LIFO, invokes
+         * pollAndExecAll. Otherwise implements a specialized pop loop
+         * to exec until empty.
          */
-        final void runTask(ForkJoinTask<?> task) {
-            if ((currentSteal = task) != null) {
-                ForkJoinWorkerThread thread;
-                task.doExec();
-                ForkJoinTask<?>[] a = array;
-                int md = mode;
-                ++nsteals;
-                currentSteal = null;
-                if (md != 0)
-                    pollAndExecAll();
-                else if (a != null) {
-                    int s, m = a.length - 1;
-                    ForkJoinTask<?> t;
-                    while ((s = top - 1) - base >= 0 &&
-                           (t = (ForkJoinTask<?>)U.getAndSetObject
-                            (a, ((m & s) << ASHIFT) + ABASE, null)) != null) {
-                        top = s;
+        final void execLocalTasks() {
+            int b = base, m, s;
+            ForkJoinTask<?>[] a = array;
+            if (b - (s = top - 1) <= 0 && a != null &&
+                (m = a.length - 1) >= 0) {
+                if ((config & FIFO_QUEUE) == 0) {
+                    for (ForkJoinTask<?> t;;) {
+                        if ((t = (ForkJoinTask<?>)U.getAndSetObject
+                             (a, ((m & s) << ASHIFT) + ABASE, null)) == null)
+                            break;
+                        U.putOrderedInt(this, QTOP, s);
                         t.doExec();
+                        if (base - (s = top - 1) > 0)
+                            break;
                     }
                 }
-                if ((thread = owner) != null) // no need to do in finally clause
+                else
+                    pollAndExecAll();
+            }
+        }
+
+        /**
+         * Executes the given task and any remaining local tasks.
+         */
+        final void runTask(ForkJoinTask<?> task) {
+            if (task != null) {
+                scanState &= ~SCANNING; // mark as busy
+                (currentSteal = task).doExec();
+                U.putOrderedObject(this, QCURRENTSTEAL, null); // release for GC
+                execLocalTasks();
+                ForkJoinWorkerThread thread = owner;
+                if (++nsteals < 0)      // collect on overflow
+                    transferStealCount(pool);
+                scanState |= SCANNING;
+                if (thread != null)
                     thread.afterTopLevelExec();
             }
         }
 
         /**
+         * Adds steal count to pool stealCounter if it exists, and resets.
+         */
+        final void transferStealCount(ForkJoinPool p) {
+            AtomicLong sc;
+            if (p != null && (sc = p.stealCounter) != null) {
+                int s = nsteals;
+                nsteals = 0;            // if negative, correct for overflow
+                sc.getAndAdd((long)(s < 0 ? Integer.MAX_VALUE : s));
+            }
+        }
+
+        /**
          * If present, removes from queue and executes the given task,
-         * or any other cancelled task. Returns (true) on any CAS
-         * or consistency check failure so caller can retry.
+         * or any other cancelled task. Used only by awaitJoin.
          *
-         * @return false if no progress can be made, else true
+         * @return true if queue empty and task not known to be done
          */
         final boolean tryRemoveAndExec(ForkJoinTask<?> task) {
-            boolean stat;
             ForkJoinTask<?>[] a; int m, s, b, n;
-            if (task != null && (a = array) != null && (m = a.length - 1) >= 0 &&
-                (n = (s = top) - (b = base)) > 0) {
-                boolean removed = false, empty = true;
-                stat = true;
-                for (ForkJoinTask<?> t;;) {           // traverse from s to b
-                    long j = ((--s & m) << ASHIFT) + ABASE;
-                    t = (ForkJoinTask<?>)U.getObject(a, j);
-                    if (t == null)                    // inconsistent length
-                        break;
-                    else if (t == task) {
-                        if (s + 1 == top) {           // pop
-                            if (!U.compareAndSwapObject(a, j, task, null))
-                                break;
-                            top = s;
-                            removed = true;
+            if ((a = array) != null && (m = a.length - 1) >= 0 &&
+                task != null) {
+                while ((n = (s = top) - (b = base)) > 0) {
+                    for (ForkJoinTask<?> t;;) {      // traverse from s to b
+                        long j = ((--s & m) << ASHIFT) + ABASE;
+                        if ((t = (ForkJoinTask<?>)U.getObject(a, j)) == null)
+                            return s + 1 == top;     // shorter than expected
+                        else if (t == task) {
+                            boolean removed = false;
+                            if (s + 1 == top) {      // pop
+                                if (U.compareAndSwapObject(a, j, task, null)) {
+                                    U.putOrderedInt(this, QTOP, s);
+                                    removed = true;
+                                }
+                            }
+                            else if (base == b)      // replace with proxy
+                                removed = U.compareAndSwapObject(
+                                    a, j, task, new EmptyTask());
+                            if (removed)
+                                task.doExec();
+                            break;
                         }
-                        else if (base == b)           // replace with proxy
-                            removed = U.compareAndSwapObject(a, j, task,
-                                                             new EmptyTask());
-                        break;
+                        else if (t.status < 0 && s + 1 == top) {
+                            if (U.compareAndSwapObject(a, j, t, null))
+                                U.putOrderedInt(this, QTOP, s);
+                            break;                  // was cancelled
+                        }
+                        if (--n == 0)
+                            return false;
                     }
-                    else if (t.status >= 0)
-                        empty = false;
-                    else if (s + 1 == top) {          // pop and throw away
-                        if (U.compareAndSwapObject(a, j, t, null))
-                            top = s;
-                        break;
-                    }
-                    if (--n == 0) {
-                        if (!empty && base == b)
-                            stat = false;
-                        break;
-                    }
+                    if (task.status < 0)
+                        return false;
                 }
-                if (removed)
-                    task.doExec();
             }
-            else
-                stat = false;
-            return stat;
+            return true;
         }
 
         /**
-         * Tries to poll for and execute the given task or any other
-         * task in its CountedCompleter computation.
+         * Pops task if in the same CC computation as the given task,
+         * in either shared or owned mode. Used only by helpComplete.
          */
-        final boolean pollAndExecCC(CountedCompleter<?> root) {
-            ForkJoinTask<?>[] a; int b; Object o; CountedCompleter<?> t, r;
-            if ((b = base) - top < 0 && (a = array) != null) {
+        final CountedCompleter<?> popCC(CountedCompleter<?> task, int mode) {
+            int s; ForkJoinTask<?>[] a; Object o;
+            if (base - (s = top) < 0 && (a = array) != null) {
+                long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE;
+                if ((o = U.getObjectVolatile(a, j)) != null &&
+                    (o instanceof CountedCompleter)) {
+                    CountedCompleter<?> t = (CountedCompleter<?>)o;
+                    for (CountedCompleter<?> r = t;;) {
+                        if (r == task) {
+                            if (mode < 0) { // must lock
+                                if (U.compareAndSwapInt(this, QLOCK, 0, 1)) {
+                                    if (top == s && array == a &&
+                                        U.compareAndSwapObject(a, j, t, null)) {
+                                        U.putOrderedInt(this, QTOP, s - 1);
+                                        U.putOrderedInt(this, QLOCK, 0);
+                                        return t;
+                                    }
+                                    U.compareAndSwapInt(this, QLOCK, 1, 0);
+                                }
+                            }
+                            else if (U.compareAndSwapObject(a, j, t, null)) {
+                                U.putOrderedInt(this, QTOP, s - 1);
+                                return t;
+                            }
+                            break;
+                        }
+                        else if ((r = r.completer) == null) // try parent
+                            break;
+                    }
+                }
+            }
+            return null;
+        }
+
+        /**
+         * Steals and runs a task in the same CC computation as the
+         * given task if one exists and can be taken without
+         * contention. Otherwise returns a checksum/control value for
+         * use by method helpComplete.
+         *
+         * @return 1 if successful, 2 if retryable (lost to another
+         * stealer), -1 if non-empty but no matching task found, else
+         * the base index, forced negative.
+         */
+        final int pollAndExecCC(CountedCompleter<?> task) {
+            int b, h; ForkJoinTask<?>[] a; Object o;
+            if ((b = base) - top >= 0 || (a = array) == null)
+                h = b | Integer.MIN_VALUE;  // to sense movement on re-poll
+            else {
                 long j = (((a.length - 1) & b) << ASHIFT) + ABASE;
                 if ((o = U.getObjectVolatile(a, j)) == null)
-                    return true; // retry
-                if (o instanceof CountedCompleter) {
-                    for (t = (CountedCompleter<?>)o, r = t;;) {
-                        if (r == root) {
+                    h = 2;                  // retryable
+                else if (!(o instanceof CountedCompleter))
+                    h = -1;                 // unmatchable
+                else {
+                    CountedCompleter<?> t = (CountedCompleter<?>)o;
+                    for (CountedCompleter<?> r = t;;) {
+                        if (r == task) {
                             if (base == b &&
                                 U.compareAndSwapObject(a, j, t, null)) {
-                                U.putOrderedInt(this, QBASE, b + 1);
+                                base = b + 1;
                                 t.doExec();
+                                h = 1;      // success
                             }
-                            return true;
-                        }
-                        else if ((r = r.completer) == null)
-                            break; // not part of root computation
-                    }
-                }
-            }
-            return false;
-        }
-
-        /**
-         * Tries to pop and execute the given task or any other task
-         * in its CountedCompleter computation.
-         */
-        final boolean externalPopAndExecCC(CountedCompleter<?> root) {
-            ForkJoinTask<?>[] a; int s; Object o; CountedCompleter<?> t, r;
-            if (base - (s = top) < 0 && (a = array) != null) {
-                long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE;
-                if ((o = U.getObject(a, j)) instanceof CountedCompleter) {
-                    for (t = (CountedCompleter<?>)o, r = t;;) {
-                        if (r == root) {
-                            if (U.compareAndSwapInt(this, QLOCK, 0, 1)) {
-                                if (top == s && array == a &&
-                                    U.compareAndSwapObject(a, j, t, null)) {
-                                    top = s - 1;
-                                    qlock = 0;
-                                    t.doExec();
-                                }
-                                else
-                                    qlock = 0;
-                            }
-                            return true;
-                        }
-                        else if ((r = r.completer) == null)
+                            else
+                                h = 2;      // lost CAS
                             break;
-                    }
-                }
-            }
-            return false;
-        }
-
-        /**
-         * Internal version
-         */
-        final boolean internalPopAndExecCC(CountedCompleter<?> root) {
-            ForkJoinTask<?>[] a; int s; Object o; CountedCompleter<?> t, r;
-            if (base - (s = top) < 0 && (a = array) != null) {
-                long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE;
-                if ((o = U.getObject(a, j)) instanceof CountedCompleter) {
-                    for (t = (CountedCompleter<?>)o, r = t;;) {
-                        if (r == root) {
-                            if (U.compareAndSwapObject(a, j, t, null)) {
-                                top = s - 1;
-                                t.doExec();
-                            }
-                            return true;
                         }
-                        else if ((r = r.completer) == null)
+                        else if ((r = r.completer) == null) {
+                            h = -1;         // unmatched
                             break;
+                        }
                     }
                 }
             }
-            return false;
+            return h;
         }
 
         /**
@@ -1061,28 +1209,31 @@
          */
         final boolean isApparentlyUnblocked() {
             Thread wt; Thread.State s;
-            return (eventCount >= 0 &&
+            return (scanState >= 0 &&
                     (wt = owner) != null &&
                     (s = wt.getState()) != Thread.State.BLOCKED &&
                     s != Thread.State.WAITING &&
                     s != Thread.State.TIMED_WAITING);
         }
 
-        // Unsafe mechanics
+        // Unsafe mechanics. Note that some are (and must be) the same as in FJP
         private static final sun.misc.Unsafe U;
-        private static final long QBASE;
+        private static final int  ABASE;
+        private static final int  ASHIFT;
+        private static final long QTOP;
         private static final long QLOCK;
-        private static final int ABASE;
-        private static final int ASHIFT;
+        private static final long QCURRENTSTEAL;
         static {
             try {
                 U = sun.misc.Unsafe.getUnsafe();
-                Class<?> k = WorkQueue.class;
+                Class<?> wk = WorkQueue.class;
                 Class<?> ak = ForkJoinTask[].class;
-                QBASE = U.objectFieldOffset
-                    (k.getDeclaredField("base"));
+                QTOP = U.objectFieldOffset
+                    (wk.getDeclaredField("top"));
                 QLOCK = U.objectFieldOffset
-                    (k.getDeclaredField("qlock"));
+                    (wk.getDeclaredField("qlock"));
+                QCURRENTSTEAL = U.objectFieldOffset
+                    (wk.getDeclaredField("currentSteal"));
                 ABASE = U.arrayBaseOffset(ak);
                 int scale = U.arrayIndexScale(ak);
                 if ((scale & (scale - 1)) != 0)
@@ -1126,6 +1277,11 @@
     static final int commonParallelism;
 
     /**
+     * Limit on spare thread construction in tryCompensate.
+     */
+    private static int commonMaxSpares;
+
+    /**
      * Sequence number for creating workerNamePrefix.
      */
     private static int poolNumberSequence;
@@ -1138,7 +1294,7 @@
         return ++poolNumberSequence;
     }
 
-    // static constants
+    // static configuration constants
 
     /**
      * Initial timeout value (in nanoseconds) for the thread
@@ -1148,27 +1304,32 @@
      * aggressive shrinkage during most transient stalls (long GCs
      * etc).
      */
-    private static final long IDLE_TIMEOUT      = 2000L * 1000L * 1000L; // 2sec
-
-    /**
-     * Timeout value when there are more threads than parallelism level
-     */
-    private static final long FAST_IDLE_TIMEOUT =  200L * 1000L * 1000L;
+    private static final long IDLE_TIMEOUT = 2000L * 1000L * 1000L; // 2sec
 
     /**
      * Tolerance for idle timeouts, to cope with timer undershoots
      */
-    private static final long TIMEOUT_SLOP = 2000000L;
+    private static final long TIMEOUT_SLOP = 20L * 1000L * 1000L;  // 20ms
 
     /**
-     * The maximum stolen->joining link depth allowed in method
-     * tryHelpStealer.  Must be a power of two.  Depths for legitimate
-     * chains are unbounded, but we use a fixed constant to avoid
-     * (otherwise unchecked) cycles and to bound staleness of
-     * traversal parameters at the expense of sometimes blocking when
-     * we could be helping.
+     * The initial value for commonMaxSpares during static
+     * initialization. The value is far in excess of normal
+     * requirements, but also far short of MAX_CAP and typical
+     * OS thread limits, so allows JVMs to catch misuse/abuse
+     * before running out of resources needed to do so.
      */
-    private static final int MAX_HELP = 64;
+    private static final int DEFAULT_COMMON_MAX_SPARES = 256;
+
+    /**
+     * Number of times to spin-wait before blocking. The spins (in
+     * awaitRunStateLock and awaitWork) currently use randomized
+     * spins. If/when MWAIT-like intrinsics becomes available, they
+     * may allow quieter spinning. The value of SPINS must be a power
+     * of two, at least 4. The current value causes spinning for a
+     * small fraction of typical context-switch times, well worthwhile
+     * given the typical likelihoods that blocking is not necessary.
+     */
+    private static final int SPINS  = 1 << 11;
 
     /**
      * Increment for seed generators. See class ThreadLocal for
@@ -1177,209 +1338,212 @@
     private static final int SEED_INCREMENT = 0x9e3779b9;
 
     /*
-     * Bits and masks for control variables
+     * Bits and masks for field ctl, packed with 4 16 bit subfields:
+     * AC: Number of active running workers minus target parallelism
+     * TC: Number of total workers minus target parallelism
+     * SS: version count and status of top waiting thread
+     * ID: poolIndex of top of Treiber stack of waiters
      *
-     * Field ctl is a long packed with:
-     * AC: Number of active running workers minus target parallelism (16 bits)
-     * TC: Number of total workers minus target parallelism (16 bits)
-     * ST: true if pool is terminating (1 bit)
-     * EC: the wait count of top waiting thread (15 bits)
-     * ID: poolIndex of top of Treiber stack of waiters (16 bits)
+     * When convenient, we can extract the lower 32 stack top bits
+     * (including version bits) as sp=(int)ctl.  The offsets of counts
+     * by the target parallelism and the positionings of fields makes
+     * it possible to perform the most common checks via sign tests of
+     * fields: When ac is negative, there are not enough active
+     * workers, when tc is negative, there are not enough total
+     * workers.  When sp is non-zero, there are waiting workers.  To
+     * deal with possibly negative fields, we use casts in and out of
+     * "short" and/or signed shifts to maintain signedness.
      *
-     * When convenient, we can extract the upper 32 bits of counts and
-     * the lower 32 bits of queue state, u = (int)(ctl >>> 32) and e =
-     * (int)ctl.  The ec field is never accessed alone, but always
-     * together with id and st. The offsets of counts by the target
-     * parallelism and the positionings of fields makes it possible to
-     * perform the most common checks via sign tests of fields: When
-     * ac is negative, there are not enough active workers, when tc is
-     * negative, there are not enough total workers, and when e is
-     * negative, the pool is terminating.  To deal with these possibly
-     * negative fields, we use casts in and out of "short" and/or
-     * signed shifts to maintain signedness.
-     *
-     * When a thread is queued (inactivated), its eventCount field is
-     * set negative, which is the only way to tell if a worker is
-     * prevented from executing tasks, even though it must continue to
-     * scan for them to avoid queuing races. Note however that
-     * eventCount updates lag releases so usage requires care.
-     *
-     * Field plock is an int packed with:
-     * SHUTDOWN: true if shutdown is enabled (1 bit)
-     * SEQ:  a sequence lock, with PL_LOCK bit set if locked (30 bits)
-     * SIGNAL: set when threads may be waiting on the lock (1 bit)
-     *
-     * The sequence number enables simple consistency checks:
-     * Staleness of read-only operations on the workQueues array can
-     * be checked by comparing plock before vs after the reads.
+     * Because it occupies uppermost bits, we can add one active count
+     * using getAndAddLong of AC_UNIT, rather than CAS, when returning
+     * from a blocked join.  Other updates entail multiple subfields
+     * and masking, requiring CAS.
      */
 
-    // bit positions/shifts for fields
+    // Lower and upper word masks
+    private static final long SP_MASK    = 0xffffffffL;
+    private static final long UC_MASK    = ~SP_MASK;
+
+    // Active counts
     private static final int  AC_SHIFT   = 48;
+    private static final long AC_UNIT    = 0x0001L << AC_SHIFT;
+    private static final long AC_MASK    = 0xffffL << AC_SHIFT;
+
+    // Total counts
     private static final int  TC_SHIFT   = 32;
-    private static final int  ST_SHIFT   = 31;
-    private static final int  EC_SHIFT   = 16;
+    private static final long TC_UNIT    = 0x0001L << TC_SHIFT;
+    private static final long TC_MASK    = 0xffffL << TC_SHIFT;
+    private static final long ADD_WORKER = 0x0001L << (TC_SHIFT + 15); // sign
 
-    // bounds
-    private static final int  SMASK      = 0xffff;  // short bits
-    private static final int  MAX_CAP    = 0x7fff;  // max #workers - 1
-    private static final int  EVENMASK   = 0xfffe;  // even short bits
-    private static final int  SQMASK     = 0x007e;  // max 64 (even) slots
-    private static final int  SHORT_SIGN = 1 << 15;
-    private static final int  INT_SIGN   = 1 << 31;
-
-    // masks
-    private static final long STOP_BIT   = 0x0001L << ST_SHIFT;
-    private static final long AC_MASK    = ((long)SMASK) << AC_SHIFT;
-    private static final long TC_MASK    = ((long)SMASK) << TC_SHIFT;
-
-    // units for incrementing and decrementing
-    private static final long TC_UNIT    = 1L << TC_SHIFT;
-    private static final long AC_UNIT    = 1L << AC_SHIFT;
-
-    // masks and units for dealing with u = (int)(ctl >>> 32)
-    private static final int  UAC_SHIFT  = AC_SHIFT - 32;
-    private static final int  UTC_SHIFT  = TC_SHIFT - 32;
-    private static final int  UAC_MASK   = SMASK << UAC_SHIFT;
-    private static final int  UTC_MASK   = SMASK << UTC_SHIFT;
-    private static final int  UAC_UNIT   = 1 << UAC_SHIFT;
-    private static final int  UTC_UNIT   = 1 << UTC_SHIFT;
-
-    // masks and units for dealing with e = (int)ctl
-    private static final int E_MASK      = 0x7fffffff; // no STOP_BIT
-    private static final int E_SEQ       = 1 << EC_SHIFT;
-
-    // plock bits
-    private static final int SHUTDOWN    = 1 << 31;
-    private static final int PL_LOCK     = 2;
-    private static final int PL_SIGNAL   = 1;
-    private static final int PL_SPINS    = 1 << 8;
-
-    // access mode for WorkQueue
-    static final int LIFO_QUEUE          =  0;
-    static final int FIFO_QUEUE          =  1;
-    static final int SHARED_QUEUE        = -1;
+    // runState bits: SHUTDOWN must be negative, others arbitrary powers of two
+    private static final int  RSLOCK     = 1;
+    private static final int  RSIGNAL    = 1 << 1;
+    private static final int  STARTED    = 1 << 2;
+    private static final int  STOP       = 1 << 29;
+    private static final int  TERMINATED = 1 << 30;
+    private static final int  SHUTDOWN   = 1 << 31;
 
     // Instance fields
-    volatile long stealCount;                  // collects worker counts
-    volatile long ctl;                         // main pool control
-    volatile int plock;                        // shutdown status and seqLock
-    volatile int indexSeed;                    // worker/submitter index seed
-    final short parallelism;                   // parallelism level
-    final short mode;                          // LIFO/FIFO
-    WorkQueue[] workQueues;                    // main registry
+    volatile long ctl;                   // main pool control
+    volatile int runState;               // lockable status
+    final int config;                    // parallelism, mode
+    int indexSeed;                       // to generate worker index
+    volatile WorkQueue[] workQueues;     // main registry
     final ForkJoinWorkerThreadFactory factory;
-    final UncaughtExceptionHandler ueh;        // per-worker UEH
-    final String workerNamePrefix;             // to create worker name string
+    final UncaughtExceptionHandler ueh;  // per-worker UEH
+    final String workerNamePrefix;       // to create worker name string
+    volatile AtomicLong stealCounter;    // also used as sync monitor
 
     /**
-     * Acquires the plock lock to protect worker array and related
-     * updates. This method is called only if an initial CAS on plock
-     * fails. This acts as a spinlock for normal cases, but falls back
-     * to builtin monitor to block when (rarely) needed. This would be
-     * a terrible idea for a highly contended lock, but works fine as
-     * a more conservative alternative to a pure spinlock.
+     * Acquires the runState lock; returns current (locked) runState.
      */
-    private int acquirePlock() {
-        int spins = PL_SPINS, ps, nps;
-        for (;;) {
-            if (((ps = plock) & PL_LOCK) == 0 &&
-                U.compareAndSwapInt(this, PLOCK, ps, nps = ps + PL_LOCK))
-                return nps;
-            else if (spins >= 0) {
-                if (ThreadLocalRandom.nextSecondarySeed() >= 0)
+    private int lockRunState() {
+        int rs;
+        return ((((rs = runState) & RSLOCK) != 0 ||
+                 !U.compareAndSwapInt(this, RUNSTATE, rs, rs |= RSLOCK)) ?
+                awaitRunStateLock() : rs);
+    }
+
+    /**
+     * Spins and/or blocks until runstate lock is available.  See
+     * above for explanation.
+     */
+    private int awaitRunStateLock() {
+        Object lock;
+        boolean wasInterrupted = false;
+        for (int spins = SPINS, r = 0, rs, ns;;) {
+            if (((rs = runState) & RSLOCK) == 0) {
+                if (U.compareAndSwapInt(this, RUNSTATE, rs, ns = rs | RSLOCK)) {
+                    if (wasInterrupted) {
+                        try {
+                            Thread.currentThread().interrupt();
+                        } catch (SecurityException ignore) {
+                        }
+                    }
+                    return ns;
+                }
+            }
+            else if (r == 0)
+                r = ThreadLocalRandom.nextSecondarySeed();
+            else if (spins > 0) {
+                r ^= r << 6; r ^= r >>> 21; r ^= r << 7; // xorshift
+                if (r >= 0)
                     --spins;
             }
-            else if (U.compareAndSwapInt(this, PLOCK, ps, ps | PL_SIGNAL)) {
-                synchronized (this) {
-                    if ((plock & PL_SIGNAL) != 0) {
+            else if ((rs & STARTED) == 0 || (lock = stealCounter) == null)
+                Thread.yield();   // initialization race
+            else if (U.compareAndSwapInt(this, RUNSTATE, rs, rs | RSIGNAL)) {
+                synchronized (lock) {
+                    if ((runState & RSIGNAL) != 0) {
                         try {
-                            wait();
+                            lock.wait();
                         } catch (InterruptedException ie) {
-                            try {
-                                Thread.currentThread().interrupt();
-                            } catch (SecurityException ignore) {
-                            }
+                            if (!(Thread.currentThread() instanceof
+                                  ForkJoinWorkerThread))
+                                wasInterrupted = true;
                         }
                     }
                     else
-                        notifyAll();
+                        lock.notifyAll();
                 }
             }
         }
     }
 
     /**
-     * Unlocks and signals any thread waiting for plock. Called only
-     * when CAS of seq value for unlock fails.
+     * Unlocks and sets runState to newRunState.
+     *
+     * @param oldRunState a value returned from lockRunState
+     * @param newRunState the next value (must have lock bit clear).
      */
-    private void releasePlock(int ps) {
-        plock = ps;
-        synchronized (this) { notifyAll(); }
-    }
-
-    /**
-     * Tries to create and start one worker if fewer than target
-     * parallelism level exist. Adjusts counts etc on failure.
-     */
-    private void tryAddWorker() {
-        long c; int u, e;
-        while ((u = (int)((c = ctl) >>> 32)) < 0 &&
-               (u & SHORT_SIGN) != 0 && (e = (int)c) >= 0) {
-            long nc = ((long)(((u + UTC_UNIT) & UTC_MASK) |
-                              ((u + UAC_UNIT) & UAC_MASK)) << 32) | (long)e;
-            if (U.compareAndSwapLong(this, CTL, c, nc)) {
-                ForkJoinWorkerThreadFactory fac;
-                Throwable ex = null;
-                ForkJoinWorkerThread wt = null;
-                try {
-                    if ((fac = factory) != null &&
-                        (wt = fac.newThread(this)) != null) {
-                        wt.start();
-                        break;
-                    }
-                } catch (Throwable rex) {
-                    ex = rex;
-                }
-                deregisterWorker(wt, ex);
-                break;
-            }
+    private void unlockRunState(int oldRunState, int newRunState) {
+        if (!U.compareAndSwapInt(this, RUNSTATE, oldRunState, newRunState)) {
+            Object lock = stealCounter;
+            runState = newRunState;              // clears RSIGNAL bit
+            if (lock != null)
+                synchronized (lock) { lock.notifyAll(); }
         }
     }
 
-    //  Registering and deregistering workers
+    // Creating, registering and deregistering workers
 
     /**
-     * Callback from ForkJoinWorkerThread to establish and record its
-     * WorkQueue. To avoid scanning bias due to packing entries in
-     * front of the workQueues array, we treat the array as a simple
-     * power-of-two hash table using per-thread seed as hash,
-     * expanding as needed.
+     * Tries to construct and start one worker. Assumes that total
+     * count has already been incremented as a reservation.  Invokes
+     * deregisterWorker on any failure.
+     *
+     * @return true if successful
+     */
+    private boolean createWorker() {
+        ForkJoinWorkerThreadFactory fac = factory;
+        Throwable ex = null;
+        ForkJoinWorkerThread wt = null;
+        try {
+            if (fac != null && (wt = fac.newThread(this)) != null) {
+                wt.start();
+                return true;
+            }
+        } catch (Throwable rex) {
+            ex = rex;
+        }
+        deregisterWorker(wt, ex);
+        return false;
+    }
+
+    /**
+     * Tries to add one worker, incrementing ctl counts before doing
+     * so, relying on createWorker to back out on failure.
+     *
+     * @param c incoming ctl value, with total count negative and no
+     * idle workers.  On CAS failure, c is refreshed and retried if
+     * this holds (otherwise, a new worker is not needed).
+     */
+    private void tryAddWorker(long c) {
+        boolean add = false;
+        do {
+            long nc = ((AC_MASK & (c + AC_UNIT)) |
+                       (TC_MASK & (c + TC_UNIT)));
+            if (ctl == c) {
+                int rs, stop;                 // check if terminating
+                if ((stop = (rs = lockRunState()) & STOP) == 0)
+                    add = U.compareAndSwapLong(this, CTL, c, nc);
+                unlockRunState(rs, rs & ~RSLOCK);
+                if (stop != 0)
+                    break;
+                if (add) {
+                    createWorker();
+                    break;
+                }
+            }
+        } while (((c = ctl) & ADD_WORKER) != 0L && (int)c == 0);
+    }
+
+    /**
+     * Callback from ForkJoinWorkerThread constructor to establish and
+     * record its WorkQueue.
      *
      * @param wt the worker thread
      * @return the worker's queue
      */
     final WorkQueue registerWorker(ForkJoinWorkerThread wt) {
-        UncaughtExceptionHandler handler; WorkQueue[] ws; int s, ps;
-        wt.setDaemon(true);
+        UncaughtExceptionHandler handler;
+        wt.setDaemon(true);                           // configure thread
         if ((handler = ueh) != null)
             wt.setUncaughtExceptionHandler(handler);
-        do {} while (!U.compareAndSwapInt(this, INDEXSEED, s = indexSeed,
-                                          s += SEED_INCREMENT) ||
-                     s == 0); // skip 0
-        WorkQueue w = new WorkQueue(this, wt, mode, s);
-        if (((ps = plock) & PL_LOCK) != 0 ||
-            !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
-            ps = acquirePlock();
-        int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
+        WorkQueue w = new WorkQueue(this, wt);
+        int i = 0;                                    // assign a pool index
+        int mode = config & MODE_MASK;
+        int rs = lockRunState();
         try {
-            if ((ws = workQueues) != null) {    // skip if shutting down
-                int n = ws.length, m = n - 1;
-                int r = (s << 1) | 1;           // use odd-numbered indices
-                if (ws[r &= m] != null) {       // collision
-                    int probes = 0;             // step by approx half size
+            WorkQueue[] ws; int n;                    // skip if no array
+            if ((ws = workQueues) != null && (n = ws.length) > 0) {
+                int s = indexSeed += SEED_INCREMENT;  // unlikely to collide
+                int m = n - 1;
+                i = ((s << 1) | 1) & m;               // odd-numbered indices
+                if (ws[i] != null) {                  // collision
+                    int probes = 0;                   // step by approx half n
                     int step = (n <= 4) ? 2 : ((n >>> 1) & EVENMASK) + 2;
-                    while (ws[r = (r + step) & m] != null) {
+                    while (ws[i = (i + step) & m] != null) {
                         if (++probes >= n) {
                             workQueues = ws = Arrays.copyOf(ws, n <<= 1);
                             m = n - 1;
@@ -1387,15 +1551,15 @@
                         }
                     }
                 }
-                w.poolIndex = (short)r;
-                w.eventCount = r; // volatile write orders
-                ws[r] = w;
+                w.hint = s;                           // use as random seed
+                w.config = i | mode;
+                w.scanState = i;                      // publication fence
+                ws[i] = w;
             }
         } finally {
-            if (!U.compareAndSwapInt(this, PLOCK, ps, nps))
-                releasePlock(nps);
+            unlockRunState(rs, rs & ~RSLOCK);
         }
-        wt.setName(workerNamePrefix.concat(Integer.toString(w.poolIndex >>> 1)));
+        wt.setName(workerNamePrefix.concat(Integer.toString(i >>> 1)));
         return w;
     }
 
@@ -1411,384 +1575,322 @@
     final void deregisterWorker(ForkJoinWorkerThread wt, Throwable ex) {
         WorkQueue w = null;
         if (wt != null && (w = wt.workQueue) != null) {
-            int ps;
-            w.qlock = -1;                // ensure set
-            U.getAndAddLong(this, STEALCOUNT, w.nsteals); // collect steals
-            if (((ps = plock) & PL_LOCK) != 0 ||
-                !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
-                ps = acquirePlock();
-            int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
-            try {
-                int idx = w.poolIndex;
-                WorkQueue[] ws = workQueues;
-                if (ws != null && idx >= 0 && idx < ws.length && ws[idx] == w)
-                    ws[idx] = null;
-            } finally {
-                if (!U.compareAndSwapInt(this, PLOCK, ps, nps))
-                    releasePlock(nps);
-            }
+            WorkQueue[] ws;                           // remove index from array
+            int idx = w.config & SMASK;
+            int rs = lockRunState();
+            if ((ws = workQueues) != null && ws.length > idx && ws[idx] == w)
+                ws[idx] = null;
+            unlockRunState(rs, rs & ~RSLOCK);
         }
-
-        long c;                          // adjust ctl counts
+        long c;                                       // decrement counts
         do {} while (!U.compareAndSwapLong
-                     (this, CTL, c = ctl, (((c - AC_UNIT) & AC_MASK) |
-                                           ((c - TC_UNIT) & TC_MASK) |
-                                           (c & ~(AC_MASK|TC_MASK)))));
-
-        if (!tryTerminate(false, false) && w != null && w.array != null) {
-            w.cancelAll();               // cancel remaining tasks
-            WorkQueue[] ws; WorkQueue v; Thread p; int u, i, e;
-            while ((u = (int)((c = ctl) >>> 32)) < 0 && (e = (int)c) >= 0) {
-                if (e > 0) {             // activate or create replacement
-                    if ((ws = workQueues) == null ||
-                        (i = e & SMASK) >= ws.length ||
-                        (v = ws[i]) == null)
-                        break;
-                    long nc = (((long)(v.nextWait & E_MASK)) |
-                               ((long)(u + UAC_UNIT) << 32));
-                    if (v.eventCount != (e | INT_SIGN))
-                        break;
-                    if (U.compareAndSwapLong(this, CTL, c, nc)) {
-                        v.eventCount = (e + E_SEQ) & E_MASK;
-                        if ((p = v.parker) != null)
-                            U.unpark(p);
-                        break;
-                    }
-                }
-                else {
-                    if ((short)u < 0)
-                        tryAddWorker();
-                    break;
-                }
-            }
+                     (this, CTL, c = ctl, ((AC_MASK & (c - AC_UNIT)) |
+                                           (TC_MASK & (c - TC_UNIT)) |
+                                           (SP_MASK & c))));
+        if (w != null) {
+            w.qlock = -1;                             // ensure set
+            w.transferStealCount(this);
+            w.cancelAll();                            // cancel remaining tasks
         }
-        if (ex == null)                     // help clean refs on way out
+        for (;;) {                                    // possibly replace
+            WorkQueue[] ws; int m, sp;
+            if (tryTerminate(false, false) || w == null || w.array == null ||
+                (runState & STOP) != 0 || (ws = workQueues) == null ||
+                (m = ws.length - 1) < 0)              // already terminating
+                break;
+            if ((sp = (int)(c = ctl)) != 0) {         // wake up replacement
+                if (tryRelease(c, ws[sp & m], AC_UNIT))
+                    break;
+            }
+            else if (ex != null && (c & ADD_WORKER) != 0L) {
+                tryAddWorker(c);                      // create replacement
+                break;
+            }
+            else                                      // don't need replacement
+                break;
+        }
+        if (ex == null)                               // help clean on way out
             ForkJoinTask.helpExpungeStaleExceptions();
-        else                                // rethrow
+        else                                          // rethrow
             ForkJoinTask.rethrow(ex);
     }
 
-    // Submissions
-
-    /**
-     * Unless shutting down, adds the given task to a submission queue
-     * at submitter's current queue index (modulo submission
-     * range). Only the most common path is directly handled in this
-     * method. All others are relayed to fullExternalPush.
-     *
-     * @param task the task. Caller must ensure non-null.
-     */
-    final void externalPush(ForkJoinTask<?> task) {
-        WorkQueue q; int m, s, n, am; ForkJoinTask<?>[] a;
-        int r = ThreadLocalRandom.getProbe();
-        int ps = plock;
-        WorkQueue[] ws = workQueues;
-        if (ps > 0 && ws != null && (m = (ws.length - 1)) >= 0 &&
-            (q = ws[m & r & SQMASK]) != null && r != 0 &&
-            U.compareAndSwapInt(q, QLOCK, 0, 1)) { // lock
-            if ((a = q.array) != null &&
-                (am = a.length - 1) > (n = (s = q.top) - q.base)) {
-                int j = ((am & s) << ASHIFT) + ABASE;
-                U.putOrderedObject(a, j, task);
-                q.top = s + 1;                     // push on to deque
-                q.qlock = 0;
-                if (n <= 1)
-                    signalWork(ws, q);
-                return;
-            }
-            q.qlock = 0;
-        }
-        fullExternalPush(task);
-    }
-
-    /**
-     * Full version of externalPush. This method is called, among
-     * other times, upon the first submission of the first task to the
-     * pool, so must perform secondary initialization.  It also
-     * detects first submission by an external thread by looking up
-     * its ThreadLocal, and creates a new shared queue if the one at
-     * index if empty or contended. The plock lock body must be
-     * exception-free (so no try/finally) so we optimistically
-     * allocate new queues outside the lock and throw them away if
-     * (very rarely) not needed.
-     *
-     * Secondary initialization occurs when plock is zero, to create
-     * workQueue array and set plock to a valid value.  This lock body
-     * must also be exception-free. Because the plock seq value can
-     * eventually wrap around zero, this method harmlessly fails to
-     * reinitialize if workQueues exists, while still advancing plock.
-     */
-    private void fullExternalPush(ForkJoinTask<?> task) {
-        int r;
-        if ((r = ThreadLocalRandom.getProbe()) == 0) {
-            ThreadLocalRandom.localInit();
-            r = ThreadLocalRandom.getProbe();
-        }
-        for (;;) {
-            WorkQueue[] ws; WorkQueue q; int ps, m, k;
-            boolean move = false;
-            if ((ps = plock) < 0)
-                throw new RejectedExecutionException();
-            else if (ps == 0 || (ws = workQueues) == null ||
-                     (m = ws.length - 1) < 0) { // initialize workQueues
-                int p = parallelism;            // find power of two table size
-                int n = (p > 1) ? p - 1 : 1;    // ensure at least 2 slots
-                n |= n >>> 1; n |= n >>> 2;  n |= n >>> 4;
-                n |= n >>> 8; n |= n >>> 16; n = (n + 1) << 1;
-                WorkQueue[] nws = ((ws = workQueues) == null || ws.length == 0 ?
-                                   new WorkQueue[n] : null);
-                if (((ps = plock) & PL_LOCK) != 0 ||
-                    !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
-                    ps = acquirePlock();
-                if (((ws = workQueues) == null || ws.length == 0) && nws != null)
-                    workQueues = nws;
-                int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
-                if (!U.compareAndSwapInt(this, PLOCK, ps, nps))
-                    releasePlock(nps);
-            }
-            else if ((q = ws[k = r & m & SQMASK]) != null) {
-                if (q.qlock == 0 && U.compareAndSwapInt(q, QLOCK, 0, 1)) {
-                    ForkJoinTask<?>[] a = q.array;
-                    int s = q.top;
-                    boolean submitted = false;
-                    try {                      // locked version of push
-                        if ((a != null && a.length > s + 1 - q.base) ||
-                            (a = q.growArray()) != null) {   // must presize
-                            int j = (((a.length - 1) & s) << ASHIFT) + ABASE;
-                            U.putOrderedObject(a, j, task);
-                            q.top = s + 1;
-                            submitted = true;
-                        }
-                    } finally {
-                        q.qlock = 0;  // unlock
-                    }
-                    if (submitted) {
-                        signalWork(ws, q);
-                        return;
-                    }
-                }
-                move = true; // move on failure
-            }
-            else if (((ps = plock) & PL_LOCK) == 0) { // create new queue
-                q = new WorkQueue(this, null, SHARED_QUEUE, r);
-                q.poolIndex = (short)k;
-                if (((ps = plock) & PL_LOCK) != 0 ||
-                    !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
-                    ps = acquirePlock();
-                if ((ws = workQueues) != null && k < ws.length && ws[k] == null)
-                    ws[k] = q;
-                int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
-                if (!U.compareAndSwapInt(this, PLOCK, ps, nps))
-                    releasePlock(nps);
-            }
-            else
-                move = true; // move if busy
-            if (move)
-                r = ThreadLocalRandom.advanceProbe(r);
-        }
-    }
-
-    // Maintaining ctl counts
-
-    /**
-     * Increments active count; mainly called upon return from blocking.
-     */
-    final void incrementActiveCount() {
-        long c;
-        do {} while (!U.compareAndSwapLong
-                     (this, CTL, c = ctl, ((c & ~AC_MASK) |
-                                           ((c & AC_MASK) + AC_UNIT))));
-    }
+    // Signalling
 
     /**
      * Tries to create or activate a worker if too few are active.
      *
      * @param ws the worker array to use to find signallees
-     * @param q if non-null, the queue holding tasks to be processed
+     * @param q a WorkQueue --if non-null, don't retry if now empty
      */
     final void signalWork(WorkQueue[] ws, WorkQueue q) {
-        for (;;) {
-            long c; int e, u, i; WorkQueue w; Thread p;
-            if ((u = (int)((c = ctl) >>> 32)) >= 0)
-                break;
-            if ((e = (int)c) <= 0) {
-                if ((short)u < 0)
-                    tryAddWorker();
+        long c; int sp, i; WorkQueue v; Thread p;
+        while ((c = ctl) < 0L) {                       // too few active
+            if ((sp = (int)c) == 0) {                  // no idle workers
+                if ((c & ADD_WORKER) != 0L)            // too few workers
+                    tryAddWorker(c);
                 break;
             }
-            if (ws == null || ws.length <= (i = e & SMASK) ||
-                (w = ws[i]) == null)
+            if (ws == null)                            // unstarted/terminated
                 break;
-            long nc = (((long)(w.nextWait & E_MASK)) |
-                       ((long)(u + UAC_UNIT)) << 32);
-            int ne = (e + E_SEQ) & E_MASK;
-            if (w.eventCount == (e | INT_SIGN) &&
-                U.compareAndSwapLong(this, CTL, c, nc)) {
-                w.eventCount = ne;
-                if ((p = w.parker) != null)
+            if (ws.length <= (i = sp & SMASK))         // terminated
+                break;
+            if ((v = ws[i]) == null)                   // terminating
+                break;
+            int vs = (sp + SS_SEQ) & ~INACTIVE;        // next scanState
+            int d = sp - v.scanState;                  // screen CAS
+            long nc = (UC_MASK & (c + AC_UNIT)) | (SP_MASK & v.stackPred);
+            if (d == 0 && U.compareAndSwapLong(this, CTL, c, nc)) {
+                v.scanState = vs;                      // activate v
+                if ((p = v.parker) != null)
                     U.unpark(p);
                 break;
             }
-            if (q != null && q.base >= q.top)
+            if (q != null && q.base == q.top)          // no more work
                 break;
         }
     }
 
+    /**
+     * Signals and releases worker v if it is top of idle worker
+     * stack.  This performs a one-shot version of signalWork only if
+     * there is (apparently) at least one idle worker.
+     *
+     * @param c incoming ctl value
+     * @param v if non-null, a worker
+     * @param inc the increment to active count (zero when compensating)
+     * @return true if successful
+     */
+    private boolean tryRelease(long c, WorkQueue v, long inc) {
+        int sp = (int)c, vs = (sp + SS_SEQ) & ~INACTIVE; Thread p;
+        if (v != null && v.scanState == sp) {          // v is at top of stack
+            long nc = (UC_MASK & (c + inc)) | (SP_MASK & v.stackPred);
+            if (U.compareAndSwapLong(this, CTL, c, nc)) {
+                v.scanState = vs;
+                if ((p = v.parker) != null)
+                    U.unpark(p);
+                return true;
+            }
+        }
+        return false;
+    }
+
     // Scanning for tasks
 
     /**
      * Top-level runloop for workers, called by ForkJoinWorkerThread.run.
      */
     final void runWorker(WorkQueue w) {
-        w.growArray(); // allocate queue
-        for (int r = w.hint; scan(w, r) == 0; ) {
+        w.growArray();                   // allocate queue
+        int seed = w.hint;               // initially holds randomization hint
+        int r = (seed == 0) ? 1 : seed;  // avoid 0 for xorShift
+        for (ForkJoinTask<?> t;;) {
+            if ((t = scan(w, r)) != null)
+                w.runTask(t);
+            else if (!awaitWork(w, r))
+                break;
             r ^= r << 13; r ^= r >>> 17; r ^= r << 5; // xorshift
         }
     }
 
     /**
-     * Scans for and, if found, runs one task, else possibly
-     * inactivates the worker. This method operates on single reads of
-     * volatile state and is designed to be re-invoked continuously,
-     * in part because it returns upon detecting inconsistencies,
-     * contention, or state changes that indicate possible success on
-     * re-invocation.
-     *
-     * The scan searches for tasks across queues starting at a random
-     * index, checking each at least twice.  The scan terminates upon
-     * either finding a non-empty queue, or completing the sweep. If
-     * the worker is not inactivated, it takes and runs a task from
-     * this queue. Otherwise, if not activated, it tries to activate
-     * itself or some other worker by signalling. On failure to find a
-     * task, returns (for retry) if pool state may have changed during
-     * an empty scan, or tries to inactivate if active, else possibly
-     * blocks or terminates via method awaitWork.
+     * Scans for and tries to steal a top-level task. Scans start at a
+     * random location, randomly moving on apparent contention,
+     * otherwise continuing linearly until reaching two consecutive
+     * empty passes over all queues with the same checksum (summing
+     * each base index of each queue, that moves on each steal), at
+     * which point the worker tries to inactivate and then re-scans,
+     * attempting to re-activate (itself or some other worker) if
+     * finding a task; otherwise returning null to await work.  Scans
+     * otherwise touch as little memory as possible, to reduce
+     * disruption on other scanning threads.
      *
      * @param w the worker (via its WorkQueue)
      * @param r a random seed
-     * @return worker qlock status if would have waited, else 0
+     * @return a task, or null if none found
      */
-    private final int scan(WorkQueue w, int r) {
+    private ForkJoinTask<?> scan(WorkQueue w, int r) {
         WorkQueue[] ws; int m;
-        long c = ctl;                            // for consistency check
-        if ((ws = workQueues) != null && (m = ws.length - 1) >= 0 && w != null) {
-            for (int j = m + m + 1, ec = w.eventCount;;) {
-                WorkQueue q; int b, e; ForkJoinTask<?>[] a; ForkJoinTask<?> t;
-                if ((q = ws[(r - j) & m]) != null &&
-                    (b = q.base) - q.top < 0 && (a = q.array) != null) {
-                    long i = (((a.length - 1) & b) << ASHIFT) + ABASE;
-                    if ((t = ((ForkJoinTask<?>)
-                              U.getObjectVolatile(a, i))) != null) {
-                        if (ec < 0)
-                            helpRelease(c, ws, w, q, b);
-                        else if (q.base == b &&
-                                 U.compareAndSwapObject(a, i, t, null)) {
-                            U.putOrderedInt(q, QBASE, b + 1);
-                            if ((b + 1) - q.top < 0)
-                                signalWork(ws, q);
-                            w.runTask(t);
+        if ((ws = workQueues) != null && (m = ws.length - 1) > 0 && w != null) {
+            int ss = w.scanState;                     // initially non-negative
+            for (int origin = r & m, k = origin, oldSum = 0, checkSum = 0;;) {
+                WorkQueue q; ForkJoinTask<?>[] a; ForkJoinTask<?> t;
+                int b, n; long c;
+                if ((q = ws[k]) != null) {
+                    if ((n = (b = q.base) - q.top) < 0 &&
+                        (a = q.array) != null) {      // non-empty
+                        long i = (((a.length - 1) & b) << ASHIFT) + ABASE;
+                        if ((t = ((ForkJoinTask<?>)
+                                  U.getObjectVolatile(a, i))) != null &&
+                            q.base == b) {
+                            if (ss >= 0) {
+                                if (U.compareAndSwapObject(a, i, t, null)) {
+                                    q.base = b + 1;
+                                    if (n < -1)       // signal others
+                                        signalWork(ws, q);
+                                    return t;
+                                }
+                            }
+                            else if (oldSum == 0 &&   // try to activate
+                                     w.scanState < 0)
+                                tryRelease(c = ctl, ws[m & (int)c], AC_UNIT);
                         }
+                        if (ss < 0)                   // refresh
+                            ss = w.scanState;
+                        r ^= r << 1; r ^= r >>> 3; r ^= r << 10;
+                        origin = k = r & m;           // move and rescan
+                        oldSum = checkSum = 0;
+                        continue;
                     }
-                    break;
+                    checkSum += b;
                 }
-                else if (--j < 0) {
-                    if ((ec | (e = (int)c)) < 0) // inactive or terminating
-                        return awaitWork(w, c, ec);
-                    else if (ctl == c) {         // try to inactivate and enqueue
-                        long nc = (long)ec | ((c - AC_UNIT) & (AC_MASK|TC_MASK));
-                        w.nextWait = e;
-                        w.eventCount = ec | INT_SIGN;
-                        if (!U.compareAndSwapLong(this, CTL, c, nc))
-                            w.eventCount = ec;   // back out
+                if ((k = (k + 1) & m) == origin) {    // continue until stable
+                    if ((ss >= 0 || (ss == (ss = w.scanState))) &&
+                        oldSum == (oldSum = checkSum)) {
+                        if (ss < 0 || w.qlock < 0)    // already inactive
+                            break;
+                        int ns = ss | INACTIVE;       // try to inactivate
+                        long nc = ((SP_MASK & ns) |
+                                   (UC_MASK & ((c = ctl) - AC_UNIT)));
+                        w.stackPred = (int)c;         // hold prev stack top
+                        U.putInt(w, QSCANSTATE, ns);
+                        if (U.compareAndSwapLong(this, CTL, c, nc))
+                            ss = ns;
+                        else
+                            w.scanState = ss;         // back out
                     }
-                    break;
+                    checkSum = 0;
                 }
             }
         }
-        return 0;
+        return null;
     }
 
     /**
-     * A continuation of scan(), possibly blocking or terminating
-     * worker w. Returns without blocking if pool state has apparently
-     * changed since last invocation.  Also, if inactivating w has
-     * caused the pool to become quiescent, checks for pool
+     * Possibly blocks worker w waiting for a task to steal, or
+     * returns false if the worker should terminate.  If inactivating
+     * w has caused the pool to become quiescent, checks for pool
      * termination, and, so long as this is not the only worker, waits
-     * for event for up to a given duration.  On timeout, if ctl has
-     * not changed, terminates the worker, which will in turn wake up
+     * for up to a given duration.  On timeout, if ctl has not
+     * changed, terminates the worker, which will in turn wake up
      * another worker to possibly repeat this process.
      *
      * @param w the calling worker
-     * @param c the ctl value on entry to scan
-     * @param ec the worker's eventCount on entry to scan
+     * @param r a random seed (for spins)
+     * @return false if the worker should terminate
      */
-    private final int awaitWork(WorkQueue w, long c, int ec) {
-        int stat, ns; long parkTime, deadline;
-        if ((stat = w.qlock) >= 0 && w.eventCount == ec && ctl == c &&
-            !Thread.interrupted()) {
-            int e = (int)c;
-            int u = (int)(c >>> 32);
-            int d = (u >> UAC_SHIFT) + parallelism; // active count
-
-            if (e < 0 || (d <= 0 && tryTerminate(false, false)))
-                stat = w.qlock = -1;          // pool is terminating
-            else if ((ns = w.nsteals) != 0) { // collect steals and retry
-                w.nsteals = 0;
-                U.getAndAddLong(this, STEALCOUNT, (long)ns);
+    private boolean awaitWork(WorkQueue w, int r) {
+        if (w == null || w.qlock < 0)                 // w is terminating
+            return false;
+        for (int pred = w.stackPred, spins = SPINS, ss;;) {
+            if ((ss = w.scanState) >= 0)
+                break;
+            else if (spins > 0) {
+                r ^= r << 6; r ^= r >>> 21; r ^= r << 7;
+                if (r >= 0 && --spins == 0) {         // randomize spins
+                    WorkQueue v; WorkQueue[] ws; int s, j; AtomicLong sc;
+                    if (pred != 0 && (ws = workQueues) != null &&
+                        (j = pred & SMASK) < ws.length &&
+                        (v = ws[j]) != null &&        // see if pred parking
+                        (v.parker == null || v.scanState >= 0))
+                        spins = SPINS;                // continue spinning
+                }
             }
-            else {
-                long pc = ((d > 0 || ec != (e | INT_SIGN)) ? 0L :
-                           ((long)(w.nextWait & E_MASK)) | // ctl to restore
-                           ((long)(u + UAC_UNIT)) << 32);
-                if (pc != 0L) {               // timed wait if last waiter
-                    int dc = -(short)(c >>> TC_SHIFT);
-                    parkTime = (dc < 0 ? FAST_IDLE_TIMEOUT:
-                                (dc + 1) * IDLE_TIMEOUT);
+            else if (w.qlock < 0)                     // recheck after spins
+                return false;
+            else if (!Thread.interrupted()) {
+                long c, prevctl, parkTime, deadline;
+                int ac = (int)((c = ctl) >> AC_SHIFT) + (config & SMASK);
+                if ((ac <= 0 && tryTerminate(false, false)) ||
+                    (runState & STOP) != 0)           // pool terminating
+                    return false;
+                if (ac <= 0 && ss == (int)c) {        // is last waiter
+                    prevctl = (UC_MASK & (c + AC_UNIT)) | (SP_MASK & pred);
+                    int t = (short)(c >>> TC_SHIFT);  // shrink excess spares
+                    if (t > 2 && U.compareAndSwapLong(this, CTL, c, prevctl))
+                        return false;                 // else use timed wait
+                    parkTime = IDLE_TIMEOUT * ((t >= 0) ? 1 : 1 - t);
                     deadline = System.nanoTime() + parkTime - TIMEOUT_SLOP;
                 }
                 else
-                    parkTime = deadline = 0L;
-                if (w.eventCount == ec && ctl == c) {
-                    Thread wt = Thread.currentThread();
-                    U.putObject(wt, PARKBLOCKER, this);
-                    w.parker = wt;            // emulate LockSupport.park
-                    if (w.eventCount == ec && ctl == c)
-                        U.park(false, parkTime);  // must recheck before park
-                    w.parker = null;
-                    U.putObject(wt, PARKBLOCKER, null);
-                    if (parkTime != 0L && ctl == c &&
-                        deadline - System.nanoTime() <= 0L &&
-                        U.compareAndSwapLong(this, CTL, c, pc))
-                        stat = w.qlock = -1;  // shrink pool
+                    prevctl = parkTime = deadline = 0L;
+                Thread wt = Thread.currentThread();
+                U.putObject(wt, PARKBLOCKER, this);   // emulate LockSupport
+                w.parker = wt;
+                if (w.scanState < 0 && ctl == c)      // recheck before park
+                    U.park(false, parkTime);
+                U.putOrderedObject(w, QPARKER, null);
+                U.putObject(wt, PARKBLOCKER, null);
+                if (w.scanState >= 0)
+                    break;
+                if (parkTime != 0L && ctl == c &&
+                    deadline - System.nanoTime() <= 0L &&
+                    U.compareAndSwapLong(this, CTL, c, prevctl))
+                    return false;                     // shrink pool
+            }
+        }
+        return true;
+    }
+
+    // Joining tasks
+
+    /**
+     * Tries to steal and run tasks within the target's computation.
+     * Uses a variant of the top-level algorithm, restricted to tasks
+     * with the given task as ancestor: It prefers taking and running
+     * eligible tasks popped from the worker's own queue (via
+     * popCC). Otherwise it scans others, randomly moving on
+     * contention or execution, deciding to give up based on a
+     * checksum (via return codes frob pollAndExecCC). The maxTasks
+     * argument supports external usages; internal calls use zero,
+     * allowing unbounded steps (external calls trap non-positive
+     * values).
+     *
+     * @param w caller
+     * @param maxTasks if non-zero, the maximum number of other tasks to run
+     * @return task status on exit
+     */
+    final int helpComplete(WorkQueue w, CountedCompleter<?> task,
+                           int maxTasks) {
+        WorkQueue[] ws; int s = 0, m;
+        if ((ws = workQueues) != null && (m = ws.length - 1) >= 0 &&
+            task != null && w != null) {
+            int mode = w.config;                 // for popCC
+            int r = w.hint ^ w.top;              // arbitrary seed for origin
+            int origin = r & m;                  // first queue to scan
+            int h = 1;                           // 1:ran, >1:contended, <0:hash
+            for (int k = origin, oldSum = 0, checkSum = 0;;) {
+                CountedCompleter<?> p; WorkQueue q;
+                if ((s = task.status) < 0)
+                    break;
+                if (h == 1 && (p = w.popCC(task, mode)) != null) {
+                    p.doExec();                  // run local task
+                    if (maxTasks != 0 && --maxTasks == 0)
+                        break;
+                    origin = k;                  // reset
+                    oldSum = checkSum = 0;
+                }
+                else {                           // poll other queues
+                    if ((q = ws[k]) == null)
+                        h = 0;
+                    else if ((h = q.pollAndExecCC(task)) < 0)
+                        checkSum += h;
+                    if (h > 0) {
+                        if (h == 1 && maxTasks != 0 && --maxTasks == 0)
+                            break;
+                        r ^= r << 13; r ^= r >>> 17; r ^= r << 5; // xorshift
+                        origin = k = r & m;      // move and restart
+                        oldSum = checkSum = 0;
+                    }
+                    else if ((k = (k + 1) & m) == origin) {
+                        if (oldSum == (oldSum = checkSum))
+                            break;
+                        checkSum = 0;
+                    }
                 }
             }
         }
-        return stat;
-    }
-
-    /**
-     * Possibly releases (signals) a worker. Called only from scan()
-     * when a worker with apparently inactive status finds a non-empty
-     * queue. This requires revalidating all of the associated state
-     * from caller.
-     */
-    private final void helpRelease(long c, WorkQueue[] ws, WorkQueue w,
-                                   WorkQueue q, int b) {
-        WorkQueue v; int e, i; Thread p;
-        if (w != null && w.eventCount < 0 && (e = (int)c) > 0 &&
-            ws != null && ws.length > (i = e & SMASK) &&
-            (v = ws[i]) != null && ctl == c) {
-            long nc = (((long)(v.nextWait & E_MASK)) |
-                       ((long)((int)(c >>> 32) + UAC_UNIT)) << 32);
-            int ne = (e + E_SEQ) & E_MASK;
-            if (q != null && q.base == b && w.eventCount < 0 &&
-                v.eventCount == (e | INT_SIGN) &&
-                U.compareAndSwapLong(this, CTL, c, nc)) {
-                v.eventCount = ne;
-                if ((p = v.parker) != null)
-                    U.unpark(p);
-            }
-        }
+        return s;
     }
 
     /**
@@ -1799,268 +1901,167 @@
      * execute tasks from. The first call to this method upon a
      * waiting join will often entail scanning/search, (which is OK
      * because the joiner has nothing better to do), but this method
-     * leaves hints in workers to speed up subsequent calls. The
-     * implementation is very branchy to cope with potential
-     * inconsistencies or loops encountering chains that are stale,
-     * unknown, or so long that they are likely cyclic.
+     * leaves hints in workers to speed up subsequent calls.
      *
-     * @param joiner the joining worker
+     * @param w caller
      * @param task the task to join
-     * @return 0 if no progress can be made, negative if task
-     * known complete, else positive
      */
-    private int tryHelpStealer(WorkQueue joiner, ForkJoinTask<?> task) {
-        int stat = 0, steps = 0;                    // bound to avoid cycles
-        if (task != null && joiner != null &&
-            joiner.base - joiner.top >= 0) {        // hoist checks
-            restart: for (;;) {
-                ForkJoinTask<?> subtask = task;     // current target
-                for (WorkQueue j = joiner, v;;) {   // v is stealer of subtask
-                    WorkQueue[] ws; int m, s, h;
-                    if ((s = task.status) < 0) {
-                        stat = s;
-                        break restart;
-                    }
-                    if ((ws = workQueues) == null || (m = ws.length - 1) <= 0)
-                        break restart;              // shutting down
-                    if ((v = ws[h = (j.hint | 1) & m]) == null ||
-                        v.currentSteal != subtask) {
-                        for (int origin = h;;) {    // find stealer
-                            if (((h = (h + 2) & m) & 15) == 1 &&
-                                (subtask.status < 0 || j.currentJoin != subtask))
-                                continue restart;   // occasional staleness check
-                            if ((v = ws[h]) != null &&
-                                v.currentSteal == subtask) {
-                                j.hint = h;        // save hint
+    private void helpStealer(WorkQueue w, ForkJoinTask<?> task) {
+        WorkQueue[] ws = workQueues;
+        int oldSum = 0, checkSum, m;
+        if (ws != null && (m = ws.length - 1) >= 0 && w != null &&
+            task != null) {
+            do {                                       // restart point
+                checkSum = 0;                          // for stability check
+                ForkJoinTask<?> subtask;
+                WorkQueue j = w, v;                    // v is subtask stealer
+                descent: for (subtask = task; subtask.status >= 0; ) {
+                    for (int h = j.hint | 1, k = 0, i; ; k += 2) {
+                        if (k > m)                     // can't find stealer
+                            break descent;
+                        if ((v = ws[i = (h + k) & m]) != null) {
+                            if (v.currentSteal == subtask) {
+                                j.hint = i;
                                 break;
                             }
-                            if (h == origin)
-                                break restart;      // cannot find stealer
+                            checkSum += v.base;
                         }
                     }
-                    for (;;) { // help stealer or descend to its stealer
+                    for (;;) {                         // help v or descend
                         ForkJoinTask<?>[] a; int b;
-                        if (subtask.status < 0)     // surround probes with
-                            continue restart;       //   consistency checks
-                        if ((b = v.base) - v.top < 0 && (a = v.array) != null) {
-                            int i = (((a.length - 1) & b) << ASHIFT) + ABASE;
-                            ForkJoinTask<?> t =
-                                (ForkJoinTask<?>)U.getObjectVolatile(a, i);
-                            if (subtask.status < 0 || j.currentJoin != subtask ||
-                                v.currentSteal != subtask)
-                                continue restart;   // stale
-                            stat = 1;               // apparent progress
-                            if (v.base == b) {
-                                if (t == null)
-                                    break restart;
-                                if (U.compareAndSwapObject(a, i, t, null)) {
-                                    U.putOrderedInt(v, QBASE, b + 1);
-                                    ForkJoinTask<?> ps = joiner.currentSteal;
-                                    int jt = joiner.top;
-                                    do {
-                                        joiner.currentSteal = t;
-                                        t.doExec(); // clear local tasks too
-                                    } while (task.status >= 0 &&
-                                             joiner.top != jt &&
-                                             (t = joiner.pop()) != null);
-                                    joiner.currentSteal = ps;
-                                    break restart;
-                                }
-                            }
+                        checkSum += (b = v.base);
+                        ForkJoinTask<?> next = v.currentJoin;
+                        if (subtask.status < 0 || j.currentJoin != subtask ||
+                            v.currentSteal != subtask) // stale
+                            break descent;
+                        if (b - v.top >= 0 || (a = v.array) == null) {
+                            if ((subtask = next) == null)
+                                break descent;
+                            j = v;
+                            break;
                         }
-                        else {                      // empty -- try to descend
-                            ForkJoinTask<?> next = v.currentJoin;
-                            if (subtask.status < 0 || j.currentJoin != subtask ||
-                                v.currentSteal != subtask)
-                                continue restart;   // stale
-                            else if (next == null || ++steps == MAX_HELP)
-                                break restart;      // dead-end or maybe cyclic
-                            else {
-                                subtask = next;
-                                j = v;
-                                break;
+                        int i = (((a.length - 1) & b) << ASHIFT) + ABASE;
+                        ForkJoinTask<?> t = ((ForkJoinTask<?>)
+                                             U.getObjectVolatile(a, i));
+                        if (v.base == b) {
+                            if (t == null)             // stale
+                                break descent;
+                            if (U.compareAndSwapObject(a, i, t, null)) {
+                                v.base = b + 1;
+                                ForkJoinTask<?> ps = w.currentSteal;
+                                int top = w.top;
+                                do {
+                                    U.putOrderedObject(w, QCURRENTSTEAL, t);
+                                    t.doExec();        // clear local tasks too
+                                } while (task.status >= 0 &&
+                                         w.top != top &&
+                                         (t = w.pop()) != null);
+                                U.putOrderedObject(w, QCURRENTSTEAL, ps);
+                                if (w.base != w.top)
+                                    return;            // can't further help
                             }
                         }
                     }
                 }
-            }
+            } while (task.status >= 0 && oldSum != (oldSum = checkSum));
         }
-        return stat;
-    }
-
-    /**
-     * Analog of tryHelpStealer for CountedCompleters. Tries to steal
-     * and run tasks within the target's computation.
-     *
-     * @param task the task to join
-     * @param maxTasks the maximum number of other tasks to run
-     */
-    final int helpComplete(WorkQueue joiner, CountedCompleter<?> task,
-                           int maxTasks) {
-        WorkQueue[] ws; int m;
-        int s = 0;
-        if ((ws = workQueues) != null && (m = ws.length - 1) >= 0 &&
-            joiner != null && task != null) {
-            int j = joiner.poolIndex;
-            int scans = m + m + 1;
-            long c = 0L;              // for stability check
-            for (int k = scans; ; j += 2) {
-                WorkQueue q;
-                if ((s = task.status) < 0)
-                    break;
-                else if (joiner.internalPopAndExecCC(task)) {
-                    if (--maxTasks <= 0) {
-                        s = task.status;
-                        break;
-                    }
-                    k = scans;
-                }
-                else if ((s = task.status) < 0)
-                    break;
-                else if ((q = ws[j & m]) != null && q.pollAndExecCC(task)) {
-                    if (--maxTasks <= 0) {
-                        s = task.status;
-                        break;
-                    }
-                    k = scans;
-                }
-                else if (--k < 0) {
-                    if (c == (c = ctl))
-                        break;
-                    k = scans;
-                }
-            }
-        }
-        return s;
     }
 
     /**
      * Tries to decrement active count (sometimes implicitly) and
      * possibly release or create a compensating worker in preparation
-     * for blocking. Fails on contention or termination. Otherwise,
-     * adds a new thread if no idle workers are available and pool
-     * may become starved.
+     * for blocking. Returns false (retryable by caller), on
+     * contention, detected staleness, instability, or termination.
      *
-     * @param c the assumed ctl value
+     * @param w caller
      */
-    final boolean tryCompensate(long c) {
-        WorkQueue[] ws = workQueues;
-        int pc = parallelism, e = (int)c, m, tc;
-        if (ws != null && (m = ws.length - 1) >= 0 && e >= 0 && ctl == c) {
-            WorkQueue w = ws[e & m];
-            if (e != 0 && w != null) {
-                Thread p;
-                long nc = ((long)(w.nextWait & E_MASK) |
-                           (c & (AC_MASK|TC_MASK)));
-                int ne = (e + E_SEQ) & E_MASK;
-                if (w.eventCount == (e | INT_SIGN) &&
-                    U.compareAndSwapLong(this, CTL, c, nc)) {
-                    w.eventCount = ne;
-                    if ((p = w.parker) != null)
-                        U.unpark(p);
-                    return true;   // replace with idle worker
+    private boolean tryCompensate(WorkQueue w) {
+        boolean canBlock;
+        WorkQueue[] ws; long c; int m, pc, sp;
+        if (w == null || w.qlock < 0 ||           // caller terminating
+            (ws = workQueues) == null || (m = ws.length - 1) <= 0 ||
+            (pc = config & SMASK) == 0)           // parallelism disabled
+            canBlock = false;
+        else if ((sp = (int)(c = ctl)) != 0)      // release idle worker
+            canBlock = tryRelease(c, ws[sp & m], 0L);
+        else {
+            int ac = (int)(c >> AC_SHIFT) + pc;
+            int tc = (short)(c >> TC_SHIFT) + pc;
+            int nbusy = 0;                        // validate saturation
+            for (int i = 0; i <= m; ++i) {        // two passes of odd indices
+                WorkQueue v;
+                if ((v = ws[((i << 1) | 1) & m]) != null) {
+                    if ((v.scanState & SCANNING) != 0)
+                        break;
+                    ++nbusy;
                 }
             }
-            else if ((tc = (short)(c >>> TC_SHIFT)) >= 0 &&
-                     (int)(c >> AC_SHIFT) + pc > 1) {
-                long nc = ((c - AC_UNIT) & AC_MASK) | (c & ~AC_MASK);
-                if (U.compareAndSwapLong(this, CTL, c, nc))
-                    return true;   // no compensation
+            if (nbusy != (tc << 1) || ctl != c)
+                canBlock = false;                 // unstable or stale
+            else if (tc >= pc && ac > 1 && w.isEmpty()) {
+                long nc = ((AC_MASK & (c - AC_UNIT)) |
+                           (~AC_MASK & c));       // uncompensated
+                canBlock = U.compareAndSwapLong(this, CTL, c, nc);
             }
-            else if (tc + pc < MAX_CAP) {
-                long nc = ((c + TC_UNIT) & TC_MASK) | (c & ~TC_MASK);
-                if (U.compareAndSwapLong(this, CTL, c, nc)) {
-                    ForkJoinWorkerThreadFactory fac;
-                    Throwable ex = null;
-                    ForkJoinWorkerThread wt = null;
-                    try {
-                        if ((fac = factory) != null &&
-                            (wt = fac.newThread(this)) != null) {
-                            wt.start();
-                            return true;
-                        }
-                    } catch (Throwable rex) {
-                        ex = rex;
-                    }
-                    deregisterWorker(wt, ex); // clean up and return false
-                }
+            else if (tc >= MAX_CAP ||
+                     (this == common && tc >= pc + commonMaxSpares))
+                throw new RejectedExecutionException(
+                    "Thread limit exceeded replacing blocked worker");
+            else {                                // similar to tryAddWorker
+                boolean add = false; int rs;      // CAS within lock
+                long nc = ((AC_MASK & c) |
+                           (TC_MASK & (c + TC_UNIT)));
+                if (((rs = lockRunState()) & STOP) == 0)
+                    add = U.compareAndSwapLong(this, CTL, c, nc);
+                unlockRunState(rs, rs & ~RSLOCK);
+                canBlock = add && createWorker(); // throws on exception
             }
         }
-        return false;
+        return canBlock;
     }
 
     /**
-     * Helps and/or blocks until the given task is done.
+     * Helps and/or blocks until the given task is done or timeout.
      *
-     * @param joiner the joining worker
+     * @param w caller
      * @param task the task
+     * @param deadline for timed waits, if nonzero
      * @return task status on exit
      */
-    final int awaitJoin(WorkQueue joiner, ForkJoinTask<?> task) {
+    final int awaitJoin(WorkQueue w, ForkJoinTask<?> task, long deadline) {
         int s = 0;
-        if (task != null && (s = task.status) >= 0 && joiner != null) {
-            ForkJoinTask<?> prevJoin = joiner.currentJoin;
-            joiner.currentJoin = task;
-            do {} while (joiner.tryRemoveAndExec(task) && // process local tasks
-                         (s = task.status) >= 0);
-            if (s >= 0 && (task instanceof CountedCompleter))
-                s = helpComplete(joiner, (CountedCompleter<?>)task, Integer.MAX_VALUE);
-            long cc = 0;        // for stability checks
-            while (s >= 0 && (s = task.status) >= 0) {
-                if ((s = tryHelpStealer(joiner, task)) == 0 &&
-                    (s = task.status) >= 0) {
-                    if (!tryCompensate(cc))
-                        cc = ctl;
-                    else {
-                        if (task.trySetSignal() && (s = task.status) >= 0) {
-                            synchronized (task) {
-                                if (task.status >= 0) {
-                                    try {                // see ForkJoinTask
-                                        task.wait();     //  for explanation
-                                    } catch (InterruptedException ie) {
-                                    }
-                                }
-                                else
-                                    task.notifyAll();
-                            }
-                        }
-                        long c; // reactivate
-                        do {} while (!U.compareAndSwapLong
-                                     (this, CTL, c = ctl,
-                                      ((c & ~AC_MASK) |
-                                       ((c & AC_MASK) + AC_UNIT))));
-                    }
+        if (task != null && w != null) {
+            ForkJoinTask<?> prevJoin = w.currentJoin;
+            U.putOrderedObject(w, QCURRENTJOIN, task);
+            CountedCompleter<?> cc = (task instanceof CountedCompleter) ?
+                (CountedCompleter<?>)task : null;
+            for (;;) {
+                if ((s = task.status) < 0)
+                    break;
+                if (cc != null)
+                    helpComplete(w, cc, 0);
+                else if (w.base == w.top || w.tryRemoveAndExec(task))
+                    helpStealer(w, task);
+                if ((s = task.status) < 0)
+                    break;
+                long ms, ns;
+                if (deadline == 0L)
+                    ms = 0L;
+                else if ((ns = deadline - System.nanoTime()) <= 0L)
+                    break;
+                else if ((ms = TimeUnit.NANOSECONDS.toMillis(ns)) <= 0L)
+                    ms = 1L;
+                if (tryCompensate(w)) {
+                    task.internalWait(ms);
+                    U.getAndAddLong(this, CTL, AC_UNIT);
                 }
             }
-            joiner.currentJoin = prevJoin;
+            U.putOrderedObject(w, QCURRENTJOIN, prevJoin);
         }
         return s;
     }
 
-    /**
-     * Stripped-down variant of awaitJoin used by timed joins. Tries
-     * to help join only while there is continuous progress. (Caller
-     * will then enter a timed wait.)
-     *
-     * @param joiner the joining worker
-     * @param task the task
-     */
-    final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
-        int s;
-        if (joiner != null && task != null && (s = task.status) >= 0) {
-            ForkJoinTask<?> prevJoin = joiner.currentJoin;
-            joiner.currentJoin = task;
-            do {} while (joiner.tryRemoveAndExec(task) && // process local tasks
-                         (s = task.status) >= 0);
-            if (s >= 0) {
-                if (task instanceof CountedCompleter)
-                    helpComplete(joiner, (CountedCompleter<?>)task, Integer.MAX_VALUE);
-                do {} while (task.status >= 0 &&
-                             tryHelpStealer(joiner, task) > 0);
-            }
-            joiner.currentJoin = prevJoin;
-        }
-    }
+    // Specialized scanning
 
     /**
      * Returns a (probably) non-empty steal queue, if one is found
@@ -2068,19 +2069,24 @@
      * caller if, by the time it tries to use the queue, it is empty.
      */
     private WorkQueue findNonEmptyStealQueue() {
+        WorkQueue[] ws; int m;  // one-shot version of scan loop
         int r = ThreadLocalRandom.nextSecondarySeed();
-        for (;;) {
-            int ps = plock, m; WorkQueue[] ws; WorkQueue q;
-            if ((ws = workQueues) != null && (m = ws.length - 1) >= 0) {
-                for (int j = (m + 1) << 2; j >= 0; --j) {
-                    if ((q = ws[(((r - j) << 1) | 1) & m]) != null &&
-                        q.base - q.top < 0)
+        if ((ws = workQueues) != null && (m = ws.length - 1) >= 0) {
+            for (int origin = r & m, k = origin, oldSum = 0, checkSum = 0;;) {
+                WorkQueue q; int b;
+                if ((q = ws[k]) != null) {
+                    if ((b = q.base) - q.top < 0)
                         return q;
+                    checkSum += b;
+                }
+                if ((k = (k + 1) & m) == origin) {
+                    if (oldSum == (oldSum = checkSum))
+                        break;
+                    checkSum = 0;
                 }
             }
-            if (plock == ps)
-                return null;
         }
+        return null;
     }
 
     /**
@@ -2090,35 +2096,34 @@
      * find tasks either.
      */
     final void helpQuiescePool(WorkQueue w) {
-        ForkJoinTask<?> ps = w.currentSteal;
+        ForkJoinTask<?> ps = w.currentSteal; // save context
         for (boolean active = true;;) {
             long c; WorkQueue q; ForkJoinTask<?> t; int b;
-            while ((t = w.nextLocalTask()) != null)
-                t.doExec();
+            w.execLocalTasks();     // run locals before each scan
             if ((q = findNonEmptyStealQueue()) != null) {
                 if (!active) {      // re-establish active count
                     active = true;
-                    do {} while (!U.compareAndSwapLong
-                                 (this, CTL, c = ctl,
-                                  ((c & ~AC_MASK) |
-                                   ((c & AC_MASK) + AC_UNIT))));
+                    U.getAndAddLong(this, CTL, AC_UNIT);
                 }
-                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
-                    w.runTask(t);
+                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null) {
+                    U.putOrderedObject(w, QCURRENTSTEAL, t);
+                    t.doExec();
+                    if (++w.nsteals < 0)
+                        w.transferStealCount(this);
+                }
             }
             else if (active) {      // decrement active count without queuing
-                long nc = ((c = ctl) & ~AC_MASK) | ((c & AC_MASK) - AC_UNIT);
-                if ((int)(nc >> AC_SHIFT) + parallelism == 0)
+                long nc = (AC_MASK & ((c = ctl) - AC_UNIT)) | (~AC_MASK & c);
+                if ((int)(nc >> AC_SHIFT) + (config & SMASK) <= 0)
                     break;          // bypass decrement-then-increment
                 if (U.compareAndSwapLong(this, CTL, c, nc))
                     active = false;
             }
-            else if ((int)((c = ctl) >> AC_SHIFT) + parallelism <= 0 &&
-                     U.compareAndSwapLong
-                     (this, CTL, c, ((c & ~AC_MASK) |
-                                     ((c & AC_MASK) + AC_UNIT))))
+            else if ((int)((c = ctl) >> AC_SHIFT) + (config & SMASK) <= 0 &&
+                     U.compareAndSwapLong(this, CTL, c, c + AC_UNIT))
                 break;
         }
+        U.putOrderedObject(w, QCURRENTSTEAL, ps);
     }
 
     /**
@@ -2141,7 +2146,7 @@
     /**
      * Returns a cheap heuristic guide for task partitioning when
      * programmers, frameworks, tools, or languages have little or no
-     * idea about task granularity.  In essence by offering this
+     * idea about task granularity.  In essence, by offering this
      * method, we ask users only about tradeoffs in overhead vs
      * expected throughput and its variance, rather than how finely to
      * partition tasks.
@@ -2179,15 +2184,12 @@
      * many of these by further considering the number of "idle"
      * threads, that are known to have zero queued tasks, so
      * compensate by a factor of (#idle/#active) threads.
-     *
-     * Note: The approximation of #busy workers as #active workers is
-     * not very good under current signalling scheme, and should be
-     * improved.
      */
     static int getSurplusQueuedTaskCount() {
         Thread t; ForkJoinWorkerThread wt; ForkJoinPool pool; WorkQueue q;
         if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)) {
-            int p = (pool = (wt = (ForkJoinWorkerThread)t).pool).parallelism;
+            int p = (pool = (wt = (ForkJoinWorkerThread)t).pool).
+                config & SMASK;
             int n = (q = wt.workQueue).top - q.base;
             int a = (int)(pool.ctl >> AC_SHIFT) + p;
             return n - (a > (p >>>= 1) ? 0 :
@@ -2202,13 +2204,7 @@
     //  Termination
 
     /**
-     * Possibly initiates and/or completes termination.  The caller
-     * triggering termination runs three passes through workQueues:
-     * (0) Setting termination status, followed by wakeups of queued
-     * workers; (1) cancelling all tasks; (2) interrupting lagging
-     * threads (likely in external tasks, but possibly also blocked in
-     * joins).  Each pass repeats previous steps because of potential
-     * lagging thread creation.
+     * Possibly initiates and/or completes termination.
      *
      * @param now if true, unconditionally terminate, else only
      * if no work and no active workers
@@ -2216,166 +2212,256 @@
      * @return true if now terminating or terminated
      */
     private boolean tryTerminate(boolean now, boolean enable) {
-        int ps;
-        if (this == common)                        // cannot shut down
+        int rs;
+        if (this == common)                       // cannot shut down
             return false;
-        if ((ps = plock) >= 0) {                   // enable by setting plock
+        if ((rs = runState) >= 0) {
             if (!enable)
                 return false;
-            if ((ps & PL_LOCK) != 0 ||
-                !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
-                ps = acquirePlock();
-            int nps = ((ps + PL_LOCK) & ~SHUTDOWN) | SHUTDOWN;
-            if (!U.compareAndSwapInt(this, PLOCK, ps, nps))
-                releasePlock(nps);
+            rs = lockRunState();                  // enter SHUTDOWN phase
+            unlockRunState(rs, (rs & ~RSLOCK) | SHUTDOWN);
         }
-        for (long c;;) {
-            if (((c = ctl) & STOP_BIT) != 0) {     // already terminating
-                if ((short)(c >>> TC_SHIFT) + parallelism <= 0) {
-                    synchronized (this) {
-                        notifyAll();               // signal when 0 workers
-                    }
-                }
-                return true;
-            }
-            if (!now) {                            // check if idle & no tasks
-                WorkQueue[] ws; WorkQueue w;
-                if ((int)(c >> AC_SHIFT) + parallelism > 0)
-                    return false;
-                if ((ws = workQueues) != null) {
-                    for (int i = 0; i < ws.length; ++i) {
-                        if ((w = ws[i]) != null &&
-                            (!w.isEmpty() ||
-                             ((i & 1) != 0 && w.eventCount >= 0))) {
-                            signalWork(ws, w);
-                            return false;
+
+        if ((rs & STOP) == 0) {
+            if (!now) {                           // check quiescence
+                for (long oldSum = 0L;;) {        // repeat until stable
+                    WorkQueue[] ws; WorkQueue w; int m, b; long c;
+                    long checkSum = ctl;
+                    if ((int)(checkSum >> AC_SHIFT) + (config & SMASK) > 0)
+                        return false;             // still active workers
+                    if ((ws = workQueues) == null || (m = ws.length - 1) <= 0)
+                        break;                    // check queues
+                    for (int i = 0; i <= m; ++i) {
+                        if ((w = ws[i]) != null) {
+                            if ((b = w.base) != w.top || w.scanState >= 0 ||
+                                w.currentSteal != null) {
+                                tryRelease(c = ctl, ws[m & (int)c], AC_UNIT);
+                                return false;     // arrange for recheck
+                            }
+                            checkSum += b;
+                            if ((i & 1) == 0)
+                                w.qlock = -1;     // try to disable external
                         }
                     }
+                    if (oldSum == (oldSum = checkSum))
+                        break;
                 }
             }
-            if (U.compareAndSwapLong(this, CTL, c, c | STOP_BIT)) {
-                for (int pass = 0; pass < 3; ++pass) {
-                    WorkQueue[] ws; WorkQueue w; Thread wt;
-                    if ((ws = workQueues) != null) {
-                        int n = ws.length;
-                        for (int i = 0; i < n; ++i) {
-                            if ((w = ws[i]) != null) {
-                                w.qlock = -1;
-                                if (pass > 0) {
-                                    w.cancelAll();
-                                    if (pass > 1 && (wt = w.owner) != null) {
-                                        if (!wt.isInterrupted()) {
-                                            try {
-                                                wt.interrupt();
-                                            } catch (Throwable ignore) {
-                                            }
-                                        }
-                                        U.unpark(wt);
-                                    }
+            if ((runState & STOP) == 0) {
+                rs = lockRunState();              // enter STOP phase
+                unlockRunState(rs, (rs & ~RSLOCK) | STOP);
+            }
+        }
+
+        int pass = 0;                             // 3 passes to help terminate
+        for (long oldSum = 0L;;) {                // or until done or stable
+            WorkQueue[] ws; WorkQueue w; ForkJoinWorkerThread wt; int m;
+            long checkSum = ctl;
+            if ((short)(checkSum >>> TC_SHIFT) + (config & SMASK) <= 0 ||
+                (ws = workQueues) == null || (m = ws.length - 1) <= 0) {
+                if ((runState & TERMINATED) == 0) {
+                    rs = lockRunState();          // done
+                    unlockRunState(rs, (rs & ~RSLOCK) | TERMINATED);
+                    synchronized (this) { notifyAll(); } // for awaitTermination
+                }
+                break;
+            }
+            for (int i = 0; i <= m; ++i) {
+                if ((w = ws[i]) != null) {
+                    checkSum += w.base;
+                    w.qlock = -1;                 // try to disable
+                    if (pass > 0) {
+                        w.cancelAll();            // clear queue
+                        if (pass > 1 && (wt = w.owner) != null) {
+                            if (!wt.isInterrupted()) {
+                                try {             // unblock join
+                                    wt.interrupt();
+                                } catch (Throwable ignore) {
                                 }
                             }
-                        }
-                        // Wake up workers parked on event queue
-                        int i, e; long cc; Thread p;
-                        while ((e = (int)(cc = ctl) & E_MASK) != 0 &&
-                               (i = e & SMASK) < n && i >= 0 &&
-                               (w = ws[i]) != null) {
-                            long nc = ((long)(w.nextWait & E_MASK) |
-                                       ((cc + AC_UNIT) & AC_MASK) |
-                                       (cc & (TC_MASK|STOP_BIT)));
-                            if (w.eventCount == (e | INT_SIGN) &&
-                                U.compareAndSwapLong(this, CTL, cc, nc)) {
-                                w.eventCount = (e + E_SEQ) & E_MASK;
-                                w.qlock = -1;
-                                if ((p = w.parker) != null)
-                                    U.unpark(p);
-                            }
+                            if (w.scanState < 0)
+                                U.unpark(wt);     // wake up
                         }
                     }
                 }
             }
+            if (checkSum != oldSum) {             // unstable
+                oldSum = checkSum;
+                pass = 0;
+            }
+            else if (pass > 3 && pass > m)        // can't further help
+                break;
+            else if (++pass > 1) {                // try to dequeue
+                long c; int j = 0, sp;            // bound attempts
+                while (j++ <= m && (sp = (int)(c = ctl)) != 0)
+                    tryRelease(c, ws[sp & m], AC_UNIT);
+            }
+        }
+        return true;
+    }
+
+    // External operations
+
+    /**
+     * Full version of externalPush, handling uncommon cases, as well
+     * as performing secondary initialization upon the first
+     * submission of the first task to the pool.  It also detects
+     * first submission by an external thread and creates a new shared
+     * queue if the one at index if empty or contended.
+     *
+     * @param task the task. Caller must ensure non-null.
+     */
+    private void externalSubmit(ForkJoinTask<?> task) {
+        int r;                                    // initialize caller's probe
+        if ((r = ThreadLocalRandom.getProbe()) == 0) {
+            ThreadLocalRandom.localInit();
+            r = ThreadLocalRandom.getProbe();
+        }
+        for (;;) {
+            WorkQueue[] ws; WorkQueue q; int rs, m, k;
+            boolean move = false;
+            if ((rs = runState) < 0) {
+                tryTerminate(false, false);     // help terminate
+                throw new RejectedExecutionException();
+            }
+            else if ((rs & STARTED) == 0 ||     // initialize
+                     ((ws = workQueues) == null || (m = ws.length - 1) < 0)) {
+                int ns = 0;
+                rs = lockRunState();
+                try {
+                    if ((rs & STARTED) == 0) {
+                        U.compareAndSwapObject(this, STEALCOUNTER, null,
+                                               new AtomicLong());
+                        // create workQueues array with size a power of two
+                        int p = config & SMASK; // ensure at least 2 slots
+                        int n = (p > 1) ? p - 1 : 1;
+                        n |= n >>> 1; n |= n >>> 2;  n |= n >>> 4;
+                        n |= n >>> 8; n |= n >>> 16; n = (n + 1) << 1;
+                        workQueues = new WorkQueue[n];
+                        ns = STARTED;
+                    }
+                } finally {
+                    unlockRunState(rs, (rs & ~RSLOCK) | ns);
+                }
+            }
+            else if ((q = ws[k = r & m & SQMASK]) != null) {
+                if (q.qlock == 0 && U.compareAndSwapInt(q, QLOCK, 0, 1)) {
+                    ForkJoinTask<?>[] a = q.array;
+                    int s = q.top;
+                    boolean submitted = false; // initial submission or resizing
+                    try {                      // locked version of push
+                        if ((a != null && a.length > s + 1 - q.base) ||
+                            (a = q.growArray()) != null) {
+                            int j = (((a.length - 1) & s) << ASHIFT) + ABASE;
+                            U.putOrderedObject(a, j, task);
+                            U.putOrderedInt(q, QTOP, s + 1);
+                            submitted = true;
+                        }
+                    } finally {
+                        U.compareAndSwapInt(q, QLOCK, 1, 0);
+                    }
+                    if (submitted) {
+                        signalWork(ws, q);
+                        return;
+                    }
+                }
+                move = true;                   // move on failure
+            }
+            else if (((rs = runState) & RSLOCK) == 0) { // create new queue
+                q = new WorkQueue(this, null);
+                q.hint = r;
+                q.config = k | SHARED_QUEUE;
+                q.scanState = INACTIVE;
+                rs = lockRunState();           // publish index
+                if (rs > 0 &&  (ws = workQueues) != null &&
+                    k < ws.length && ws[k] == null)
+                    ws[k] = q;                 // else terminated
+                unlockRunState(rs, rs & ~RSLOCK);
+            }
+            else
+                move = true;                   // move if busy
+            if (move)
+                r = ThreadLocalRandom.advanceProbe(r);
         }
     }
 
-    // external operations on common pool
+    /**
+     * Tries to add the given task to a submission queue at
+     * submitter's current queue. Only the (vastly) most common path
+     * is directly handled in this method, while screening for need
+     * for externalSubmit.
+     *
+     * @param task the task. Caller must ensure non-null.
+     */
+    final void externalPush(ForkJoinTask<?> task) {
+        WorkQueue[] ws; WorkQueue q; int m;
+        int r = ThreadLocalRandom.getProbe();
+        int rs = runState;
+        if ((ws = workQueues) != null && (m = (ws.length - 1)) >= 0 &&
+            (q = ws[m & r & SQMASK]) != null && r != 0 && rs > 0 &&
+            U.compareAndSwapInt(q, QLOCK, 0, 1)) {
+            ForkJoinTask<?>[] a; int am, n, s;
+            if ((a = q.array) != null &&
+                (am = a.length - 1) > (n = (s = q.top) - q.base)) {
+                int j = ((am & s) << ASHIFT) + ABASE;
+                U.putOrderedObject(a, j, task);
+                U.putOrderedInt(q, QTOP, s + 1);
+                U.putOrderedInt(q, QLOCK, 0);
+                if (n <= 1)
+                    signalWork(ws, q);
+                return;
+            }
+            U.compareAndSwapInt(q, QLOCK, 1, 0);
+        }
+        externalSubmit(task);
+    }
 
     /**
-     * Returns common pool queue for a thread that has submitted at
-     * least one task.
+     * Returns common pool queue for an external thread.
      */
     static WorkQueue commonSubmitterQueue() {
-        ForkJoinPool p; WorkQueue[] ws; int m, z;
-        return ((z = ThreadLocalRandom.getProbe()) != 0 &&
-                (p = common) != null &&
-                (ws = p.workQueues) != null &&
+        ForkJoinPool p = common;
+        int r = ThreadLocalRandom.getProbe();
+        WorkQueue[] ws; int m;
+        return (p != null && (ws = p.workQueues) != null &&
                 (m = ws.length - 1) >= 0) ?
-            ws[m & z & SQMASK] : null;
+            ws[m & r & SQMASK] : null;
     }
 
     /**
-     * Tries to pop the given task from submitter's queue in common pool.
+     * Performs tryUnpush for an external submitter: Finds queue,
+     * locks if apparently non-empty, validates upon locking, and
+     * adjusts top. Each check can fail but rarely does.
      */
     final boolean tryExternalUnpush(ForkJoinTask<?> task) {
-        WorkQueue joiner; ForkJoinTask<?>[] a; int m, s;
-        WorkQueue[] ws = workQueues;
-        int z = ThreadLocalRandom.getProbe();
-        boolean popped = false;
-        if (ws != null && (m = ws.length - 1) >= 0 &&
-            (joiner = ws[z & m & SQMASK]) != null &&
-            joiner.base != (s = joiner.top) &&
-            (a = joiner.array) != null) {
+        WorkQueue[] ws; WorkQueue w; ForkJoinTask<?>[] a; int m, s;
+        int r = ThreadLocalRandom.getProbe();
+        if ((ws = workQueues) != null && (m = ws.length - 1) >= 0 &&
+            (w = ws[m & r & SQMASK]) != null &&
+            (a = w.array) != null && (s = w.top) != w.base) {
             long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE;
-            if (U.getObject(a, j) == task &&
-                U.compareAndSwapInt(joiner, QLOCK, 0, 1)) {
-                if (joiner.top == s && joiner.array == a &&
+            if (U.compareAndSwapInt(w, QLOCK, 0, 1)) {
+                if (w.top == s && w.array == a &&
+                    U.getObject(a, j) == task &&
                     U.compareAndSwapObject(a, j, task, null)) {
-                    joiner.top = s - 1;
-                    popped = true;
+                    U.putOrderedInt(w, QTOP, s - 1);
+                    U.putOrderedInt(w, QLOCK, 0);
+                    return true;
                 }
-                joiner.qlock = 0;
+                U.compareAndSwapInt(w, QLOCK, 1, 0);
             }
         }
-        return popped;
+        return false;
     }
 
+    /**
+     * Performs helpComplete for an external submitter.
+     */
     final int externalHelpComplete(CountedCompleter<?> task, int maxTasks) {
-        WorkQueue joiner; int m;
-        WorkQueue[] ws = workQueues;
-        int j = ThreadLocalRandom.getProbe();
-        int s = 0;
-        if (ws != null && (m = ws.length - 1) >= 0 &&
-            (joiner = ws[j & m & SQMASK]) != null && task != null) {
-            int scans = m + m + 1;
-            long c = 0L;             // for stability check
-            j |= 1;                  // poll odd queues
-            for (int k = scans; ; j += 2) {
-                WorkQueue q;
-                if ((s = task.status) < 0)
-                    break;
-                else if (joiner.externalPopAndExecCC(task)) {
-                    if (--maxTasks <= 0) {
-                        s = task.status;
-                        break;
-                    }
-                    k = scans;
-                }
-                else if ((s = task.status) < 0)
-                    break;
-                else if ((q = ws[j & m]) != null && q.pollAndExecCC(task)) {
-                    if (--maxTasks <= 0) {
-                        s = task.status;
-                        break;
-                    }
-                    k = scans;
-                }
-                else if (--k < 0) {
-                    if (c == (c = ctl))
-                        break;
-                    k = scans;
-                }
-            }
-        }
-        return s;
+        WorkQueue[] ws; int n;
+        int r = ThreadLocalRandom.getProbe();
+        return ((ws = workQueues) == null || (n = ws.length) == 0) ? 0 :
+            helpComplete(ws[(n - 1) & r & SQMASK], task, maxTasks);
     }
 
     // Exported methods
@@ -2447,7 +2533,7 @@
         this(checkParallelism(parallelism),
              checkFactory(factory),
              handler,
-             (asyncMode ? FIFO_QUEUE : LIFO_QUEUE),
+             asyncMode ? FIFO_QUEUE : LIFO_QUEUE,
              "ForkJoinPool-" + nextPoolId() + "-worker-");
         checkPermission();
     }
@@ -2478,8 +2564,7 @@
         this.workerNamePrefix = workerNamePrefix;
         this.factory = factory;
         this.ueh = handler;
-        this.mode = (short)mode;
-        this.parallelism = (short)parallelism;
+        this.config = (parallelism & SMASK) | mode;
         long np = (long)(-parallelism); // offset ctl counts
         this.ctl = ((np << AC_SHIFT) & AC_MASK) | ((np << TC_SHIFT) & TC_MASK);
     }
@@ -2624,7 +2709,7 @@
         // In previous versions of this class, this method constructed
         // a task to run ForkJoinTask.invokeAll, but now external
         // invocation of multiple tasks is at least as efficient.
-        ArrayList<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
+        ArrayList<Future<T>> futures = new ArrayList<>(tasks.size());
 
         boolean done = false;
         try {
@@ -2670,7 +2755,7 @@
      */
     public int getParallelism() {
         int par;
-        return ((par = parallelism) > 0) ? par : 1;
+        return ((par = config & SMASK) > 0) ? par : 1;
     }
 
     /**
@@ -2692,7 +2777,7 @@
      * @return the number of worker threads
      */
     public int getPoolSize() {
-        return parallelism + (short)(ctl >>> TC_SHIFT);
+        return (config & SMASK) + (short)(ctl >>> TC_SHIFT);
     }
 
     /**
@@ -2702,7 +2787,7 @@
      * @return {@code true} if this pool uses async mode
      */
     public boolean getAsyncMode() {
-        return mode == FIFO_QUEUE;
+        return (config & FIFO_QUEUE) != 0;
     }
 
     /**
@@ -2733,7 +2818,7 @@
      * @return the number of active threads
      */
     public int getActiveThreadCount() {
-        int r = parallelism + (int)(ctl >> AC_SHIFT);
+        int r = (config & SMASK) + (int)(ctl >> AC_SHIFT);
         return (r <= 0) ? 0 : r; // suppress momentarily negative values
     }
 
@@ -2749,7 +2834,7 @@
      * @return {@code true} if all threads are currently idle
      */
     public boolean isQuiescent() {
-        return parallelism + (int)(ctl >> AC_SHIFT) <= 0;
+        return (config & SMASK) + (int)(ctl >> AC_SHIFT) <= 0;
     }
 
     /**
@@ -2764,7 +2849,8 @@
      * @return the number of steals
      */
     public long getStealCount() {
-        long count = stealCount;
+        AtomicLong sc = stealCounter;
+        long count = (sc == null) ? 0L : sc.get();
         WorkQueue[] ws; WorkQueue w;
         if ((ws = workQueues) != null) {
             for (int i = 1; i < ws.length; i += 2) {
@@ -2894,7 +2980,8 @@
     public String toString() {
         // Use a single pass through workQueues to collect counts
         long qt = 0L, qs = 0L; int rc = 0;
-        long st = stealCount;
+        AtomicLong sc = stealCounter;
+        long st = (sc == null) ? 0L : sc.get();
         long c = ctl;
         WorkQueue[] ws; WorkQueue w;
         if ((ws = workQueues) != null) {
@@ -2912,16 +2999,16 @@
                 }
             }
         }
-        int pc = parallelism;
+        int pc = (config & SMASK);
         int tc = pc + (short)(c >>> TC_SHIFT);
         int ac = pc + (int)(c >> AC_SHIFT);
         if (ac < 0) // ignore transient negative
             ac = 0;
-        String level;
-        if ((c & STOP_BIT) != 0)
-            level = (tc == 0) ? "Terminated" : "Terminating";
-        else
-            level = plock < 0 ? "Shutting down" : "Running";
+        int rs = runState;
+        String level = ((rs & TERMINATED) != 0 ? "Terminated" :
+                        (rs & STOP)       != 0 ? "Terminating" :
+                        (rs & SHUTDOWN)   != 0 ? "Shutting down" :
+                        "Running");
         return super.toString() +
             "[" + level +
             ", parallelism = " + pc +
@@ -2983,9 +3070,7 @@
      * @return {@code true} if all tasks have completed following shut down
      */
     public boolean isTerminated() {
-        long c = ctl;
-        return ((c & STOP_BIT) != 0L &&
-                (short)(c >>> TC_SHIFT) + parallelism <= 0);
+        return (runState & TERMINATED) != 0;
     }
 
     /**
@@ -3002,9 +3087,8 @@
      * @return {@code true} if terminating but not yet terminated
      */
     public boolean isTerminating() {
-        long c = ctl;
-        return ((c & STOP_BIT) != 0L &&
-                (short)(c >>> TC_SHIFT) + parallelism > 0);
+        int rs = runState;
+        return (rs & STOP) != 0 && (rs & TERMINATED) == 0;
     }
 
     /**
@@ -3013,7 +3097,7 @@
      * @return {@code true} if this pool has been shut down
      */
     public boolean isShutdown() {
-        return plock < 0;
+        return (runState & SHUTDOWN) != 0;
     }
 
     /**
@@ -3090,8 +3174,9 @@
             }
             found = false;
             for (int j = (m + 1) << 2; j >= 0; --j) {
-                ForkJoinTask<?> t; WorkQueue q; int b;
-                if ((q = ws[r++ & m]) != null && (b = q.base) - q.top < 0) {
+                ForkJoinTask<?> t; WorkQueue q; int b, k;
+                if ((k = r++ & m) <= m && k >= 0 && (q = ws[k]) != null &&
+                    (b = q.base) - q.top < 0) {
                     found = true;
                     if ((t = q.pollAt(b)) != null)
                         t.doExec();
@@ -3115,8 +3200,8 @@
      * in {@link ForkJoinPool}s.
      *
      * <p>A {@code ManagedBlocker} provides two methods.  Method
-     * {@code isReleasable} must return {@code true} if blocking is
-     * not necessary. Method {@code block} blocks the current thread
+     * {@link #isReleasable} must return {@code true} if blocking is
+     * not necessary. Method {@link #block} blocks the current thread
      * if necessary (perhaps internally invoking {@code isReleasable}
      * before actually blocking). These actions are performed by any
      * thread invoking {@link ForkJoinPool#managedBlock(ManagedBlocker)}.
@@ -3185,37 +3270,46 @@
     }
 
     /**
-     * Blocks in accord with the given blocker.  If the current thread
-     * is a {@link ForkJoinWorkerThread}, this method possibly
-     * arranges for a spare thread to be activated if necessary to
-     * ensure sufficient parallelism while the current thread is blocked.
+     * Runs the given possibly blocking task.  When {@linkplain
+     * ForkJoinTask#inForkJoinPool() running in a ForkJoinPool}, this
+     * method possibly arranges for a spare thread to be activated if
+     * necessary to ensure sufficient parallelism while the current
+     * thread is blocked in {@link ManagedBlocker#block blocker.block()}.
      *
-     * <p>If the caller is not a {@link ForkJoinTask}, this method is
+     * <p>This method repeatedly calls {@code blocker.isReleasable()} and
+     * {@code blocker.block()} until either method returns {@code true}.
+     * Every call to {@code blocker.block()} is preceded by a call to
+     * {@code blocker.isReleasable()} that returned {@code false}.
+     *
+     * <p>If not running in a ForkJoinPool, this method is
      * behaviorally equivalent to
      *  <pre> {@code
      * while (!blocker.isReleasable())
      *   if (blocker.block())
-     *     return;
-     * }</pre>
+     *     break;}</pre>
      *
-     * If the caller is a {@code ForkJoinTask}, then the pool may
-     * first be expanded to ensure parallelism, and later adjusted.
+     * If running in a ForkJoinPool, the pool may first be expanded to
+     * ensure sufficient parallelism available during the call to
+     * {@code blocker.block()}.
      *
-     * @param blocker the blocker
-     * @throws InterruptedException if blocker.block did so
+     * @param blocker the blocker task
+     * @throws InterruptedException if {@code blocker.block()} did so
      */
     public static void managedBlock(ManagedBlocker blocker)
         throws InterruptedException {
+        ForkJoinPool p;
+        ForkJoinWorkerThread wt;
         Thread t = Thread.currentThread();
-        if (t instanceof ForkJoinWorkerThread) {
-            ForkJoinPool p = ((ForkJoinWorkerThread)t).pool;
+        if ((t instanceof ForkJoinWorkerThread) &&
+            (p = (wt = (ForkJoinWorkerThread)t).pool) != null) {
+            WorkQueue w = wt.workQueue;
             while (!blocker.isReleasable()) {
-                if (p.tryCompensate(p.ctl)) {
+                if (p.tryCompensate(w)) {
                     try {
                         do {} while (!blocker.isReleasable() &&
                                      !blocker.block());
                     } finally {
-                        p.incrementActiveCount();
+                        U.getAndAddLong(p, CTL, AC_UNIT);
                     }
                     break;
                 }
@@ -3241,15 +3335,18 @@
 
     // Unsafe mechanics
     private static final sun.misc.Unsafe U;
+    private static final int  ABASE;
+    private static final int  ASHIFT;
     private static final long CTL;
+    private static final long RUNSTATE;
+    private static final long STEALCOUNTER;
     private static final long PARKBLOCKER;
-    private static final int ABASE;
-    private static final int ASHIFT;
-    private static final long STEALCOUNT;
-    private static final long PLOCK;
-    private static final long INDEXSEED;
-    private static final long QBASE;
+    private static final long QTOP;
     private static final long QLOCK;
+    private static final long QSCANSTATE;
+    private static final long QPARKER;
+    private static final long QCURRENTSTEAL;
+    private static final long QCURRENTJOIN;
 
     static {
         // initialize field offsets for CAS etc
@@ -3258,20 +3355,26 @@
             Class<?> k = ForkJoinPool.class;
             CTL = U.objectFieldOffset
                 (k.getDeclaredField("ctl"));
-            STEALCOUNT = U.objectFieldOffset
-                (k.getDeclaredField("stealCount"));
-            PLOCK = U.objectFieldOffset
-                (k.getDeclaredField("plock"));
-            INDEXSEED = U.objectFieldOffset
-                (k.getDeclaredField("indexSeed"));
+            RUNSTATE = U.objectFieldOffset
+                (k.getDeclaredField("runState"));
+            STEALCOUNTER = U.objectFieldOffset
+                (k.getDeclaredField("stealCounter"));
             Class<?> tk = Thread.class;
             PARKBLOCKER = U.objectFieldOffset
                 (tk.getDeclaredField("parkBlocker"));
             Class<?> wk = WorkQueue.class;
-            QBASE = U.objectFieldOffset
-                (wk.getDeclaredField("base"));
+            QTOP = U.objectFieldOffset
+                (wk.getDeclaredField("top"));
             QLOCK = U.objectFieldOffset
                 (wk.getDeclaredField("qlock"));
+            QSCANSTATE = U.objectFieldOffset
+                (wk.getDeclaredField("scanState"));
+            QPARKER = U.objectFieldOffset
+                (wk.getDeclaredField("parker"));
+            QCURRENTSTEAL = U.objectFieldOffset
+                (wk.getDeclaredField("currentSteal"));
+            QCURRENTJOIN = U.objectFieldOffset
+                (wk.getDeclaredField("currentJoin"));
             Class<?> ak = ForkJoinTask[].class;
             ABASE = U.arrayBaseOffset(ak);
             int scale = U.arrayIndexScale(ak);
@@ -3282,6 +3385,7 @@
             throw new Error(e);
         }
 
+        commonMaxSpares = DEFAULT_COMMON_MAX_SPARES;
         defaultForkJoinWorkerThreadFactory =
             new DefaultForkJoinWorkerThreadFactory();
         modifyThreadPermission = new RuntimePermission("modifyThread");
@@ -3289,7 +3393,7 @@
         common = java.security.AccessController.doPrivileged
             (new java.security.PrivilegedAction<ForkJoinPool>() {
                 public ForkJoinPool run() { return makeCommonPool(); }});
-        int par = common.parallelism; // report 1 even if threads disabled
+        int par = common.config & SMASK; // report 1 even if threads disabled
         commonParallelism = par > 0 ? par : 1;
     }
 
diff --git a/src/share/classes/java/util/concurrent/ForkJoinTask.java b/src/share/classes/java/util/concurrent/ForkJoinTask.java
index 936bfc2..4439c24 100644
--- a/src/share/classes/java/util/concurrent/ForkJoinTask.java
+++ b/src/share/classes/java/util/concurrent/ForkJoinTask.java
@@ -297,15 +297,22 @@
     }
 
     /**
-     * Tries to set SIGNAL status unless already completed. Used by
-     * ForkJoinPool. Other variants are directly incorporated into
-     * externalAwaitDone etc.
+     * If not done, sets SIGNAL status and performs Object.wait(timeout).
+     * This task may or may not be done on exit. Ignores interrupts.
      *
-     * @return true if successful
+     * @param timeout using Object.wait conventions.
      */
-    final boolean trySetSignal() {
-        int s = status;
-        return s >= 0 && U.compareAndSwapInt(this, STATUS, s, s | SIGNAL);
+    final void internalWait(long timeout) {
+        int s;
+        if ((s = status) >= 0 && // force completer to issue notify
+            U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
+            synchronized (this) {
+                if (status >= 0)
+                    try { wait(timeout); } catch (InterruptedException ie) { }
+                else
+                    notifyAll();
+            }
+        }
     }
 
     /**
@@ -313,35 +320,29 @@
      * @return status upon completion
      */
     private int externalAwaitDone() {
-        int s;
-        ForkJoinPool cp = ForkJoinPool.common;
-        if ((s = status) >= 0) {
-            if (cp != null) {
-                if (this instanceof CountedCompleter)
-                    s = cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
-                else if (cp.tryExternalUnpush(this))
-                    s = doExec();
-            }
-            if (s >= 0 && (s = status) >= 0) {
-                boolean interrupted = false;
-                do {
-                    if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
-                        synchronized (this) {
-                            if (status >= 0) {
-                                try {
-                                    wait();
-                                } catch (InterruptedException ie) {
-                                    interrupted = true;
-                                }
+        int s = ((this instanceof CountedCompleter) ? // try helping
+                 ForkJoinPool.common.externalHelpComplete(
+                     (CountedCompleter<?>)this, 0) :
+                 ForkJoinPool.common.tryExternalUnpush(this) ? doExec() : 0);
+        if (s >= 0 && (s = status) >= 0) {
+            boolean interrupted = false;
+            do {
+                if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
+                    synchronized (this) {
+                        if (status >= 0) {
+                            try {
+                                wait(0L);
+                            } catch (InterruptedException ie) {
+                                interrupted = true;
                             }
-                            else
-                                notifyAll();
                         }
+                        else
+                            notifyAll();
                     }
-                } while ((s = status) >= 0);
-                if (interrupted)
-                    Thread.currentThread().interrupt();
-            }
+                }
+            } while ((s = status) >= 0);
+            if (interrupted)
+                Thread.currentThread().interrupt();
         }
         return s;
     }
@@ -351,22 +352,22 @@
      */
     private int externalInterruptibleAwaitDone() throws InterruptedException {
         int s;
-        ForkJoinPool cp = ForkJoinPool.common;
         if (Thread.interrupted())
             throw new InterruptedException();
-        if ((s = status) >= 0 && cp != null) {
-            if (this instanceof CountedCompleter)
-                cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
-            else if (cp.tryExternalUnpush(this))
-                doExec();
-        }
-        while ((s = status) >= 0) {
-            if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
-                synchronized (this) {
-                    if (status >= 0)
-                        wait();
-                    else
-                        notifyAll();
+        if ((s = status) >= 0 &&
+            (s = ((this instanceof CountedCompleter) ?
+                  ForkJoinPool.common.externalHelpComplete(
+                      (CountedCompleter<?>)this, 0) :
+                  ForkJoinPool.common.tryExternalUnpush(this) ? doExec() :
+                  0)) >= 0) {
+            while ((s = status) >= 0) {
+                if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
+                    synchronized (this) {
+                        if (status >= 0)
+                            wait(0L);
+                        else
+                            notifyAll();
+                    }
                 }
             }
         }
@@ -386,7 +387,7 @@
             ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
             (w = (wt = (ForkJoinWorkerThread)t).workQueue).
             tryUnpush(this) && (s = doExec()) < 0 ? s :
-            wt.pool.awaitJoin(w, this) :
+            wt.pool.awaitJoin(w, this, 0L) :
             externalAwaitDone();
     }
 
@@ -399,7 +400,8 @@
         int s; Thread t; ForkJoinWorkerThread wt;
         return (s = doExec()) < 0 ? s :
             ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
-            (wt = (ForkJoinWorkerThread)t).pool.awaitJoin(wt.workQueue, this) :
+            (wt = (ForkJoinWorkerThread)t).pool.
+            awaitJoin(wt.workQueue, this, 0L) :
             externalAwaitDone();
     }
 
@@ -577,7 +579,7 @@
         Throwable ex;
         if (e == null || (ex = e.ex) == null)
             return null;
-        if (false && e.thrower != Thread.currentThread().getId()) {
+        if (e.thrower != Thread.currentThread().getId()) {
             Class<? extends Throwable> ec = ex.getClass();
             try {
                 Constructor<?> noArgCtor = null;
@@ -587,13 +589,17 @@
                     Class<?>[] ps = c.getParameterTypes();
                     if (ps.length == 0)
                         noArgCtor = c;
-                    else if (ps.length == 1 && ps[0] == Throwable.class)
-                        return (Throwable)(c.newInstance(ex));
+                    else if (ps.length == 1 && ps[0] == Throwable.class) {
+                        Throwable wx = (Throwable)c.newInstance(ex);
+                        return (wx == null) ? ex : wx;
+                    }
                 }
                 if (noArgCtor != null) {
                     Throwable wx = (Throwable)(noArgCtor.newInstance());
-                    wx.initCause(ex);
-                    return wx;
+                    if (wx != null) {
+                        wx.initCause(ex);
+                        return wx;
+                    }
                 }
             } catch (Exception ignore) {
             }
@@ -1017,67 +1023,40 @@
      */
     public final V get(long timeout, TimeUnit unit)
         throws InterruptedException, ExecutionException, TimeoutException {
+        int s;
+        long nanos = unit.toNanos(timeout);
         if (Thread.interrupted())
             throw new InterruptedException();
-        // Messy in part because we measure in nanosecs, but wait in millisecs
-        int s; long ms;
-        long ns = unit.toNanos(timeout);
-        ForkJoinPool cp;
-        if ((s = status) >= 0 && ns > 0L) {
-            long deadline = System.nanoTime() + ns;
-            ForkJoinPool p = null;
-            ForkJoinPool.WorkQueue w = null;
+        if ((s = status) >= 0 && nanos > 0L) {
+            long d = System.nanoTime() + nanos;
+            long deadline = (d == 0L) ? 1L : d; // avoid 0
             Thread t = Thread.currentThread();
             if (t instanceof ForkJoinWorkerThread) {
                 ForkJoinWorkerThread wt = (ForkJoinWorkerThread)t;
-                p = wt.pool;
-                w = wt.workQueue;
-                p.helpJoinOnce(w, this); // no retries on failure
+                s = wt.pool.awaitJoin(wt.workQueue, this, deadline);
             }
-            else if ((cp = ForkJoinPool.common) != null) {
-                if (this instanceof CountedCompleter)
-                    cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
-                else if (cp.tryExternalUnpush(this))
-                    doExec();
-            }
-            boolean canBlock = false;
-            boolean interrupted = false;
-            try {
-                while ((s = status) >= 0) {
-                    if (w != null && w.qlock < 0)
-                        cancelIgnoringExceptions(this);
-                    else if (!canBlock) {
-                        if (p == null || p.tryCompensate(p.ctl))
-                            canBlock = true;
-                    }
-                    else {
-                        if ((ms = TimeUnit.NANOSECONDS.toMillis(ns)) > 0L &&
-                            U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
-                            synchronized (this) {
-                                if (status >= 0) {
-                                    try {
-                                        wait(ms);
-                                    } catch (InterruptedException ie) {
-                                        if (p == null)
-                                            interrupted = true;
-                                    }
-                                }
-                                else
-                                    notifyAll();
-                            }
+            else if ((s = ((this instanceof CountedCompleter) ?
+                           ForkJoinPool.common.externalHelpComplete(
+                               (CountedCompleter<?>)this, 0) :
+                           ForkJoinPool.common.tryExternalUnpush(this) ?
+                           doExec() : 0)) >= 0) {
+                long ns, ms; // measure in nanosecs, but wait in millisecs
+                while ((s = status) >= 0 &&
+                       (ns = deadline - System.nanoTime()) > 0L) {
+                    if ((ms = TimeUnit.NANOSECONDS.toMillis(ns)) > 0L &&
+                        U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
+                        synchronized (this) {
+                            if (status >= 0)
+                                wait(ms); // OK to throw InterruptedException
+                            else
+                                notifyAll();
                         }
-                        if ((s = status) < 0 || interrupted ||
-                            (ns = deadline - System.nanoTime()) <= 0L)
-                            break;
                     }
                 }
-            } finally {
-                if (p != null && canBlock)
-                    p.incrementActiveCount();
             }
-            if (interrupted)
-                throw new InterruptedException();
         }
+        if (s >= 0)
+            s = status;
         if ((s &= DONE_MASK) != NORMAL) {
             Throwable ex;
             if (s == CANCELLED)
diff --git a/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java b/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
index 404c47c..8723f0a 100644
--- a/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
+++ b/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
@@ -66,7 +66,7 @@
      * owning thread.
      *
      * Support for (non-public) subclass InnocuousForkJoinWorkerThread
-     * requires that we break quite a lot of encapulation (via Unsafe)
+     * requires that we break quite a lot of encapsulation (via Unsafe)
      * both here and in the subclass to access and set Thread fields.
      */
 
@@ -118,7 +118,7 @@
      * @return the index number
      */
     public int getPoolIndex() {
-        return workQueue.poolIndex >>> 1; // ignore odd/even tag bit
+        return workQueue.getPoolIndex();
     }
 
     /**
@@ -171,7 +171,7 @@
     }
 
     /**
-     * Erases ThreadLocals by nulling out Thread maps
+     * Erases ThreadLocals by nulling out Thread maps.
      */
     final void eraseThreadLocals() {
         U.putObject(this, THREADLOCALS, null);
@@ -246,8 +246,8 @@
 
         /**
          * Returns a new group with the system ThreadGroup (the
-         * topmost, parentless group) as parent.  Uses Unsafe to
-         * traverse Thread group and ThreadGroup parent fields.
+         * topmost, parent-less group) as parent.  Uses Unsafe to
+         * traverse Thread.group and ThreadGroup.parent fields.
          */
         private static ThreadGroup createThreadGroup() {
             try {
@@ -274,4 +274,3 @@
     }
 
 }
-
diff --git a/src/share/classes/java/util/logging/FileHandler.java b/src/share/classes/java/util/logging/FileHandler.java
index 4d63b77..2c3bb50 100644
--- a/src/share/classes/java/util/logging/FileHandler.java
+++ b/src/share/classes/java/util/logging/FileHandler.java
@@ -25,6 +25,7 @@
 
 package java.util.logging;
 
+import static java.nio.file.StandardOpenOption.APPEND;
 import static java.nio.file.StandardOpenOption.CREATE_NEW;
 import static java.nio.file.StandardOpenOption.WRITE;
 
@@ -34,10 +35,17 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.channels.FileChannel;
+import java.nio.channels.OverlappingFileLockException;
 import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * Simple file logging <tt>Handler</tt>.
@@ -149,7 +157,7 @@
     private FileChannel lockFileChannel;
     private File files[];
     private static final int MAX_LOCKS = 100;
-    private static final java.util.HashMap<String, String> locks = new java.util.HashMap<>();
+    private static final Set<String> locks = new HashSet<>();
 
     /**
      * A metered stream is a subclass of OutputStream that
@@ -394,6 +402,14 @@
         openFiles();
     }
 
+    private  boolean isParentWritable(Path path) {
+        Path parent = path.getParent();
+        if (parent == null) {
+            parent = path.toAbsolutePath().getParent();
+        }
+        return parent != null && Files.isWritable(parent);
+    }
+
     /**
      * Open the set of output files, based on the configured
      * instance variables.
@@ -428,34 +444,80 @@
             // between processes (and not within a process), we first check
             // if we ourself already have the file locked.
             synchronized(locks) {
-                if (locks.get(lockFileName) != null) {
+                if (locks.contains(lockFileName)) {
                     // We already own this lock, for a different FileHandler
                     // object.  Try again.
                     continue;
                 }
 
-                try {
-                    lockFileChannel = FileChannel.open(Paths.get(lockFileName),
-                            CREATE_NEW, WRITE);
-                } catch (FileAlreadyExistsException ix) {
-                    // try the next lock file name in the sequence
-                    continue;
+                final Path lockFilePath = Paths.get(lockFileName);
+                FileChannel channel = null;
+                int retries = -1;
+                boolean fileCreated = false;
+                while (channel == null && retries++ < 1) {
+                    try {
+                        channel = FileChannel.open(lockFilePath,
+                                CREATE_NEW, WRITE);
+                        fileCreated = true;
+                    } catch (FileAlreadyExistsException ix) {
+                        // This may be a zombie file left over by a previous
+                        // execution. Reuse it - but only if we can actually
+                        // write to its directory.
+                        // Note that this is a situation that may happen,
+                        // but not too frequently.
+                        if (Files.isRegularFile(lockFilePath, LinkOption.NOFOLLOW_LINKS)
+                            && isParentWritable(lockFilePath)) {
+                            try {
+                                channel = FileChannel.open(lockFilePath,
+                                    WRITE, APPEND);
+                            } catch (NoSuchFileException x) {
+                                // Race condition - retry once, and if that
+                                // fails again just try the next name in
+                                // the sequence.
+                                continue;
+                            } catch(IOException x) {
+                                // the file may not be writable for us.
+                                // try the next name in the sequence
+                                break;
+                            }
+                        } else {
+                            // at this point channel should still be null.
+                            // break and try the next name in the sequence.
+                            break;
+                        }
+                    }
                 }
 
+                if (channel == null) continue; // try the next name;
+                lockFileChannel = channel;
+
                 boolean available;
                 try {
                     available = lockFileChannel.tryLock() != null;
                     // We got the lock OK.
+                    // At this point we could call File.deleteOnExit().
+                    // However, this could have undesirable side effects
+                    // as indicated by JDK-4872014. So we will instead
+                    // rely on the fact that close() will remove the lock
+                    // file and that whoever is creating FileHandlers should
+                    // be responsible for closing them.
                 } catch (IOException ix) {
                     // We got an IOException while trying to get the lock.
                     // This normally indicates that locking is not supported
                     // on the target directory.  We have to proceed without
-                    // getting a lock.   Drop through.
-                    available = true;
+                    // getting a lock.   Drop through, but only if we did
+                    // create the file...
+                    available = fileCreated;
+                } catch (OverlappingFileLockException x) {
+                    // someone already locked this file in this VM, through
+                    // some other channel - that is - using something else
+                    // than new FileHandler(...);
+                    // continue searching for an available lock.
+                    available = false;
                 }
                 if (available) {
                     // We got the lock.  Remember it.
-                    locks.put(lockFileName, lockFileName);
+                    locks.add(lockFileName);
                     break;
                 }
 
diff --git a/src/share/classes/java/util/stream/ForEachOps.java b/src/share/classes/java/util/stream/ForEachOps.java
index 2c343fb..b527f05 100644
--- a/src/share/classes/java/util/stream/ForEachOps.java
+++ b/src/share/classes/java/util/stream/ForEachOps.java
@@ -32,6 +32,7 @@
 import java.util.function.Consumer;
 import java.util.function.DoubleConsumer;
 import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
 import java.util.function.LongConsumer;
 
 /**
@@ -317,12 +318,55 @@
      */
     @SuppressWarnings("serial")
     static final class ForEachOrderedTask<S, T> extends CountedCompleter<Void> {
+        /*
+         * Our goal is to ensure that the elements associated with a task are
+         * processed according to an in-order traversal of the computation tree.
+         * We use completion counts for representing these dependencies, so that
+         * a task does not complete until all the tasks preceding it in this
+         * order complete.  We use the "completion map" to associate the next
+         * task in this order for any left child.  We increase the pending count
+         * of any node on the right side of such a mapping by one to indicate
+         * its dependency, and when a node on the left side of such a mapping
+         * completes, it decrements the pending count of its corresponding right
+         * side.  As the computation tree is expanded by splitting, we must
+         * atomically update the mappings to maintain the invariant that the
+         * completion map maps left children to the next node in the in-order
+         * traversal.
+         *
+         * Take, for example, the following computation tree of tasks:
+         *
+         *       a
+         *      / \
+         *     b   c
+         *    / \ / \
+         *   d  e f  g
+         *
+         * The complete map will contain (not necessarily all at the same time)
+         * the following associations:
+         *
+         *   d -> e
+         *   b -> f
+         *   f -> g
+         *
+         * Tasks e, f, g will have their pending counts increased by 1.
+         *
+         * The following relationships hold:
+         *
+         *   - completion of d "happens-before" e;
+         *   - completion of d and e "happens-before b;
+         *   - completion of b "happens-before" f; and
+         *   - completion of f "happens-before" g
+         *
+         * Thus overall the "happens-before" relationship holds for the
+         * reporting of elements, covered by tasks d, e, f and g, as specified
+         * by the forEachOrdered operation.
+         */
+
         private final PipelineHelper<T> helper;
         private Spliterator<S> spliterator;
         private final long targetSize;
         private final ConcurrentHashMap<ForEachOrderedTask<S, T>, ForEachOrderedTask<S, T>> completionMap;
         private final Sink<T> action;
-        private final Object lock;
         private final ForEachOrderedTask<S, T> leftPredecessor;
         private Node<T> node;
 
@@ -333,9 +377,9 @@
             this.helper = helper;
             this.spliterator = spliterator;
             this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
-            this.completionMap = new ConcurrentHashMap<>();
+            // Size map to avoid concurrent re-sizes
+            this.completionMap = new ConcurrentHashMap<>(Math.max(16, AbstractTask.LEAF_TARGET << 1));
             this.action = action;
-            this.lock = new Object();
             this.leftPredecessor = null;
         }
 
@@ -348,7 +392,6 @@
             this.targetSize = parent.targetSize;
             this.completionMap = parent.completionMap;
             this.action = parent.action;
-            this.lock = parent.lock;
             this.leftPredecessor = leftPredecessor;
         }
 
@@ -367,16 +410,42 @@
                     new ForEachOrderedTask<>(task, leftSplit, task.leftPredecessor);
                 ForEachOrderedTask<S, T> rightChild =
                     new ForEachOrderedTask<>(task, rightSplit, leftChild);
+
+                // Fork the parent task
+                // Completion of the left and right children "happens-before"
+                // completion of the parent
+                task.addToPendingCount(1);
+                // Completion of the left child "happens-before" completion of
+                // the right child
+                rightChild.addToPendingCount(1);
                 task.completionMap.put(leftChild, rightChild);
-                task.addToPendingCount(1); // forking
-                rightChild.addToPendingCount(1); // right pending on left child
+
+                // If task is not on the left spine
                 if (task.leftPredecessor != null) {
-                    leftChild.addToPendingCount(1); // left pending on previous subtree, except left spine
-                    if (task.completionMap.replace(task.leftPredecessor, task, leftChild))
-                        task.addToPendingCount(-1); // transfer my "right child" count to my left child
-                    else
-                        leftChild.addToPendingCount(-1); // left child is ready to go when ready
+                    /*
+                     * Completion of left-predecessor, or left subtree,
+                     * "happens-before" completion of left-most leaf node of
+                     * right subtree.
+                     * The left child's pending count needs to be updated before
+                     * it is associated in the completion map, otherwise the
+                     * left child can complete prematurely and violate the
+                     * "happens-before" constraint.
+                     */
+                    leftChild.addToPendingCount(1);
+                    // Update association of left-predecessor to left-most
+                    // leaf node of right subtree
+                    if (task.completionMap.replace(task.leftPredecessor, task, leftChild)) {
+                        // If replaced, adjust the pending count of the parent
+                        // to complete when its children complete
+                        task.addToPendingCount(-1);
+                    } else {
+                        // Left-predecessor has already completed, parent's
+                        // pending count is adjusted by left-predecessor;
+                        // left child is ready to complete
+                        leftChild.addToPendingCount(-1);
+                    }
                 }
+
                 ForEachOrderedTask<S, T> taskToFork;
                 if (forkRight) {
                     forkRight = false;
@@ -391,31 +460,49 @@
                 }
                 taskToFork.fork();
             }
-            if (task.getPendingCount() == 0) {
-                task.helper.wrapAndCopyInto(task.action, rightSplit);
-            }
-            else {
+
+            /*
+             * Task's pending count is either 0 or 1.  If 1 then the completion
+             * map will contain a value that is task, and two calls to
+             * tryComplete are required for completion, one below and one
+             * triggered by the completion of task's left-predecessor in
+             * onCompletion.  Therefore there is no data race within the if
+             * block.
+             */
+            if (task.getPendingCount() > 0) {
+                // Cannot complete just yet so buffer elements into a Node
+                // for use when completion occurs
+                @SuppressWarnings("unchecked")
+                IntFunction<T[]> generator = size -> (T[]) new Object[size];
                 Node.Builder<T> nb = task.helper.makeNodeBuilder(
-                  task.helper.exactOutputSizeIfKnown(rightSplit),
-                  size -> (T[]) new Object[size]);
+                        task.helper.exactOutputSizeIfKnown(rightSplit),
+                        generator);
                 task.node = task.helper.wrapAndCopyInto(nb, rightSplit).build();
+                task.spliterator = null;
             }
             task.tryComplete();
         }
 
         @Override
         public void onCompletion(CountedCompleter<?> caller) {
-            spliterator = null;
             if (node != null) {
-                // Dump any data from this leaf into the sink
-                synchronized (lock) {
-                    node.forEach(action);
-                }
+                // Dump buffered elements from this leaf into the sink
+                node.forEach(action);
                 node = null;
             }
-            ForEachOrderedTask<S, T> victim = completionMap.remove(this);
-            if (victim != null)
-                victim.tryComplete();
+            else if (spliterator != null) {
+                // Dump elements output from this leaf's pipeline into the sink
+                helper.wrapAndCopyInto(action, spliterator);
+                spliterator = null;
+            }
+
+            // The completion of this task *and* the dumping of elements
+            // "happens-before" completion of the associated left-most leaf task
+            // of right subtree (if any, which can be this task's right sibling)
+            //
+            ForEachOrderedTask<S, T> leftDescendant = completionMap.remove(this);
+            if (leftDescendant != null)
+                leftDescendant.tryComplete();
         }
     }
 }
diff --git a/src/share/classes/java/util/stream/Nodes.java b/src/share/classes/java/util/stream/Nodes.java
index d69b9f6..c18540c 100644
--- a/src/share/classes/java/util/stream/Nodes.java
+++ b/src/share/classes/java/util/stream/Nodes.java
@@ -63,7 +63,7 @@
     // IllegalArgumentException messages
     static final String BAD_SIZE = "Stream size exceeds max array size";
 
-    @SuppressWarnings("raw")
+    @SuppressWarnings("rawtypes")
     private static final Node EMPTY_NODE = new EmptyNode.OfRef();
     private static final Node.OfInt EMPTY_INT_NODE = new EmptyNode.OfInt();
     private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong();
@@ -956,6 +956,7 @@
          * Initiate a stack containing, in left-to-right order, the child nodes
          * covered by this spliterator
          */
+        @SuppressWarnings("unchecked")
         protected final Deque<N> initStack() {
             // Bias size to the case where leaf nodes are close to this node
             // 8 is the minimum initial capacity for the ArrayDeque implementation
@@ -969,6 +970,7 @@
          * Depth first search, in left-to-right order, of the node tree, using
          * an explicit stack, to find the next non-empty leaf node.
          */
+        @SuppressWarnings("unchecked")
         protected final N findNextLeafNode(Deque<N> stack) {
             N n = null;
             while ((n = stack.pollFirst()) != null) {
@@ -984,6 +986,7 @@
             return null;
         }
 
+        @SuppressWarnings("unchecked")
         protected final boolean initTryAdvance() {
             if (curNode == null)
                 return false;
@@ -1870,6 +1873,7 @@
             }
 
             assert task.offset + task.length < MAX_ARRAY_SIZE;
+            @SuppressWarnings("unchecked")
             T_SINK sink = (T_SINK) task;
             task.helper.wrapAndCopyInto(sink, rightSplit);
             task.propagateCompletion();
@@ -2173,6 +2177,7 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         protected T_NODE doLeaf() {
             T_BUILDER builder = builderFactory.apply(helper.exactOutputSizeIfKnown(spliterator));
             return (T_NODE) helper.wrapAndCopyInto(builder, spliterator).build();
diff --git a/src/share/classes/java/util/stream/SortedOps.java b/src/share/classes/java/util/stream/SortedOps.java
index 810de1c..592b609 100644
--- a/src/share/classes/java/util/stream/SortedOps.java
+++ b/src/share/classes/java/util/stream/SortedOps.java
@@ -29,7 +29,6 @@
 import java.util.Comparator;
 import java.util.Objects;
 import java.util.Spliterator;
-import java.util.concurrent.ForkJoinTask;
 import java.util.function.IntFunction;
 
 
@@ -113,7 +112,9 @@
                   StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
             this.isNaturalSort = true;
             // Will throw CCE when we try to sort if T is not Comparable
-            this.comparator = (Comparator<? super T>) Comparator.naturalOrder();
+            @SuppressWarnings("unchecked")
+            Comparator<? super T> comp = (Comparator<? super T>) Comparator.naturalOrder();
+            this.comparator = comp;
         }
 
         /**
@@ -170,7 +171,7 @@
         }
 
         @Override
-        public Sink<Integer> opWrapSink(int flags, Sink sink) {
+        public Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
             Objects.requireNonNull(sink);
 
             if (StreamOpFlag.SORTED.isKnown(flags))
@@ -335,6 +336,7 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         public void begin(long size) {
             if (size >= Nodes.MAX_ARRAY_SIZE)
                 throw new IllegalArgumentException(Nodes.BAD_SIZE);
diff --git a/src/share/classes/java/util/stream/SpinedBuffer.java b/src/share/classes/java/util/stream/SpinedBuffer.java
index 878b2c2..163692c 100644
--- a/src/share/classes/java/util/stream/SpinedBuffer.java
+++ b/src/share/classes/java/util/stream/SpinedBuffer.java
@@ -92,6 +92,7 @@
      * @throws IllegalArgumentException if the specified initial capacity
      *         is negative
      */
+    @SuppressWarnings("unchecked")
     SpinedBuffer(int initialCapacity) {
         super(initialCapacity);
         curChunk = (E[]) new Object[1 << initialChunkPower];
@@ -100,6 +101,7 @@
     /**
      * Constructs an empty list with an initial capacity of sixteen.
      */
+    @SuppressWarnings("unchecked")
     SpinedBuffer() {
         super();
         curChunk = (E[]) new Object[1 << initialChunkPower];
@@ -114,6 +116,7 @@
                : priorElementCount[spineIndex] + spine[spineIndex].length;
     }
 
+    @SuppressWarnings("unchecked")
     private void inflateSpine() {
         if (spine == null) {
             spine = (E[][]) new Object[MIN_SPINE_SIZE][];
@@ -125,6 +128,7 @@
     /**
      * Ensure that the buffer has at least capacity to hold the target size
      */
+    @SuppressWarnings("unchecked")
     protected final void ensureCapacity(long targetSize) {
         long capacity = capacity();
         if (targetSize > capacity) {
diff --git a/src/share/classes/java/util/stream/StreamSpliterators.java b/src/share/classes/java/util/stream/StreamSpliterators.java
index 7322773..6768342 100644
--- a/src/share/classes/java/util/stream/StreamSpliterators.java
+++ b/src/share/classes/java/util/stream/StreamSpliterators.java
@@ -516,6 +516,7 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         public T_SPLITR trySplit() {
             return (T_SPLITR) get().trySplit();
         }
@@ -643,6 +644,7 @@
             // existing and additionally created F/J tasks that perform
             // redundant work on no elements.
             while (true) {
+                @SuppressWarnings("unchecked")
                 T_SPLITR leftSplit = (T_SPLITR) s.trySplit();
                 if (leftSplit == null)
                     return null;
@@ -970,6 +972,7 @@
             // Stop splitting when there are no more limit permits
             if (permits.get() == 0)
                 return null;
+            @SuppressWarnings("unchecked")
             T_SPLITR split = (T_SPLITR) s.trySplit();
             return split == null ? null : makeSpliterator(split);
         }
@@ -1068,16 +1071,18 @@
                 super(s, skip, limit);
             }
 
-            OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive parent) {
+            OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive<T, T_CONS, T_BUFF, T_SPLITR> parent) {
                 super(s, parent);
             }
 
             @Override
             public boolean tryAdvance(T_CONS action) {
                 Objects.requireNonNull(action);
+                @SuppressWarnings("unchecked")
+                T_CONS consumer = (T_CONS) this;
 
                 while (permitStatus() != PermitStatus.NO_MORE) {
-                    if (!s.tryAdvance((T_CONS) this))
+                    if (!s.tryAdvance(consumer))
                         return false;
                     else if (acquirePermits(1) == 1) {
                         acceptConsumed(action);
@@ -1316,7 +1321,7 @@
      * estimate size is 0.
      *
      * <p>The {@code forEachRemaining} method if invoked will never terminate.
-     * The {@coe tryAdvance} method always returns true.
+     * The {@code tryAdvance} method always returns true.
      *
      */
     static abstract class InfiniteSupplyingSpliterator<T> implements Spliterator<T> {
diff --git a/src/share/classes/java/util/stream/Streams.java b/src/share/classes/java/util/stream/Streams.java
index 41f3ada..072691a 100644
--- a/src/share/classes/java/util/stream/Streams.java
+++ b/src/share/classes/java/util/stream/Streams.java
@@ -715,6 +715,7 @@
 
         @Override
         public T_SPLITR trySplit() {
+            @SuppressWarnings("unchecked")
             T_SPLITR ret = beforeSplit ? aSpliterator : (T_SPLITR) bSpliterator.trySplit();
             beforeSplit = false;
             return ret;
diff --git a/src/share/classes/javax/crypto/Cipher.java b/src/share/classes/javax/crypto/Cipher.java
index ffcc7cf..9593540 100644
--- a/src/share/classes/javax/crypto/Cipher.java
+++ b/src/share/classes/javax/crypto/Cipher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -167,6 +167,11 @@
     private static final Debug debug =
                         Debug.getInstance("jca", "Cipher");
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("cipher");
+
     /**
      * Constant used to initialize cipher to encryption mode.
      */
@@ -1110,6 +1115,21 @@
         }
     }
 
+    private static String getOpmodeString(int opmode) {
+        switch (opmode) {
+            case ENCRYPT_MODE:
+                return "encryption";
+            case DECRYPT_MODE:
+                return "decryption";
+            case WRAP_MODE:
+                return "key wrapping";
+            case UNWRAP_MODE:
+                return "key unwrapping";
+            default:
+                return "";
+        }
+    }
+
     /**
      * Initializes this cipher with a key.
      *
@@ -1235,6 +1255,12 @@
 
         initialized = true;
         this.opmode = opmode;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Cipher." + transformation + " " +
+                getOpmodeString(opmode) + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
@@ -1372,6 +1398,12 @@
 
         initialized = true;
         this.opmode = opmode;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Cipher." + transformation + " " +
+                getOpmodeString(opmode) + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
@@ -1509,6 +1541,12 @@
 
         initialized = true;
         this.opmode = opmode;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Cipher." + transformation + " " +
+                getOpmodeString(opmode) + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
@@ -1693,6 +1731,12 @@
 
         initialized = true;
         this.opmode = opmode;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Cipher." + transformation + " " +
+                getOpmodeString(opmode) + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/javax/crypto/KeyAgreement.java b/src/share/classes/javax/crypto/KeyAgreement.java
index 70221aa..2c24470 100644
--- a/src/share/classes/javax/crypto/KeyAgreement.java
+++ b/src/share/classes/javax/crypto/KeyAgreement.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,11 @@
     private static final Debug debug =
                         Debug.getInstance("jca", "KeyAgreement");
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("keyagreement");
+
     // The provider
     private Provider provider;
 
@@ -468,6 +473,11 @@
                 throw new InvalidKeyException(e);
             }
         }
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
@@ -524,6 +534,11 @@
         } else {
             chooseProvider(I_PARAMS, key, params, random);
         }
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/javax/crypto/KeyGenerator.java b/src/share/classes/javax/crypto/KeyGenerator.java
index 030207e..9da64e9 100644
--- a/src/share/classes/javax/crypto/KeyGenerator.java
+++ b/src/share/classes/javax/crypto/KeyGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 
 import sun.security.jca.*;
 import sun.security.jca.GetInstance.Instance;
+import sun.security.util.Debug;
 
 /**
  * This class provides the functionality of a secret (symmetric) key generator.
@@ -108,6 +109,11 @@
 
 public class KeyGenerator {
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("keygenerator");
+
     // see java.security.KeyPairGenerator for failover notes
 
     private final static int I_NONE   = 1;
@@ -145,6 +151,11 @@
         this.spi = keyGenSpi;
         this.provider = provider;
         this.algorithm = algorithm;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
@@ -158,6 +169,11 @@
             throw new NoSuchAlgorithmException
                 (algorithm + " KeyGenerator not available");
         }
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/javax/crypto/Mac.java b/src/share/classes/javax/crypto/Mac.java
index d0e241d..8a497da 100644
--- a/src/share/classes/javax/crypto/Mac.java
+++ b/src/share/classes/javax/crypto/Mac.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,11 @@
     private static final Debug debug =
                         Debug.getInstance("jca", "Mac");
 
+    private static final Debug pdebug =
+                        Debug.getInstance("provider", "Provider");
+    private static final boolean skipDebug =
+        Debug.isOn("engine=") && !Debug.isOn("mac");
+
     // The provider
     private Provider provider;
 
@@ -413,6 +418,11 @@
             throw new InvalidKeyException("init() failed", e);
         }
         initialized = true;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Mac." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
@@ -435,6 +445,11 @@
             chooseProvider(key, params);
         }
         initialized = true;
+
+        if (!skipDebug && pdebug != null) {
+            pdebug.println("Mac." + algorithm + " algorithm from: " +
+                this.provider.getName());
+        }
     }
 
     /**
diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/src/share/classes/javax/management/remote/rmi/RMIConnector.java
index 9d71ed9..d4928bd 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -1335,66 +1335,94 @@
                 int maxNotifications,
                 long timeout)
                 throws IOException, ClassNotFoundException {
-            IOException org;
 
+            boolean retried = false;
             while (true) { // used for a successful re-connection
+                           // or a transient network problem
                 try {
                     return connection.fetchNotifications(clientSequenceNumber,
                             maxNotifications,
-                            timeout);
+                            timeout); // return normally
                 } catch (IOException ioe) {
-                    org = ioe;
+                    // Examine the chain of exceptions to determine whether this
+                    // is a deserialization issue. If so - we propagate the
+                    // appropriate exception to the caller, who will then
+                    // proceed with fetching notifications one by one
+                    rethrowDeserializationException(ioe);
 
-                    // inform of IOException
                     try {
                         communicatorAdmin.gotIOException(ioe);
-
-                        // The connection should be re-established.
-                        continue;
+                        // reconnection OK, back to "while" to do again
                     } catch (IOException ee) {
-                        // No more fetch, the Exception will be re-thrown.
-                        break;
-                    } // never reached
-                } // never reached
-            }
+                        boolean toClose = false;
 
-            // specially treating for an UnmarshalException
-            if (org instanceof UnmarshalException) {
-                UnmarshalException ume = (UnmarshalException)org;
+                        synchronized (this) {
+                            if (terminated) {
+                                // the connection is closed.
+                                throw ioe;
+                            } else if (retried) {
+                                toClose = true;
+                            }
+                        }
 
-                if (ume.detail instanceof ClassNotFoundException)
-                    throw (ClassNotFoundException) ume.detail;
+                        if (toClose) {
+                            // JDK-8049303
+                            // We received an IOException - but the communicatorAdmin
+                            // did not close the connection - possibly because
+                            // the original exception was raised by a transient network
+                            // problem?
+                            // We already know that this exception is not due to a deserialization
+                            // issue as we already took care of that before involving the
+                            // communicatorAdmin. Moreover - we already made one retry attempt
+                            // at fetching the same batch of notifications - and the
+                            // problem persisted.
+                            // Since trying again doesn't seem to solve the issue, we will now
+                            // close the connection. Doing otherwise might cause the
+                            // NotifFetcher thread to die silently.
+                            final Notification failedNotif =
+                                    new JMXConnectionNotification(
+                                    JMXConnectionNotification.FAILED,
+                                    this,
+                                    connectionId,
+                                    clientNotifSeqNo++,
+                                    "Failed to communicate with the server: " + ioe.toString(),
+                                    ioe);
 
-                /* In Sun's RMI implementation, if a method return
-                   contains an unserializable object, then we get
-                   UnmarshalException wrapping WriteAbortedException
-                   wrapping NotSerializableException.  In that case we
-                   extract the NotSerializableException so that our
-                   caller can realize it should try to skip past the
-                   notification that presumably caused it.  It's not
-                   certain that every other RMI implementation will
-                   generate this exact exception sequence.  If not, we
-                   will not detect that the problem is due to an
-                   unserializable object, and we will stop trying to
-                   receive notifications from the server.  It's not
-                   clear we can do much better.  */
-                if (ume.detail instanceof WriteAbortedException) {
-                    WriteAbortedException wae =
-                            (WriteAbortedException) ume.detail;
-                    if (wae.detail instanceof IOException)
-                        throw (IOException) wae.detail;
+                            sendNotification(failedNotif);
+
+                            try {
+                                close(true);
+                            } catch (Exception e) {
+                                // OK.
+                                // We are closing
+                            }
+                            throw ioe; // the connection is closed here.
+                        } else {
+                            // JDK-8049303 possible transient network problem,
+                            // let's try one more time
+                            retried = true;
+                        }
+                    }
                 }
-            } else if (org instanceof MarshalException) {
+            }
+        }
+
+        private void rethrowDeserializationException(IOException ioe)
+                throws ClassNotFoundException, IOException {
+            // specially treating for an UnmarshalException
+            if (ioe instanceof UnmarshalException) {
+                throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
+                           // fetch one by one with UnmarshalException
+            } else if (ioe instanceof MarshalException) {
                 // IIOP will throw MarshalException wrapping a NotSerializableException
                 // when a server fails to serialize a response.
-                MarshalException me = (MarshalException)org;
+                MarshalException me = (MarshalException)ioe;
                 if (me.detail instanceof NotSerializableException) {
                     throw (NotSerializableException)me.detail;
                 }
             }
 
-            // Not serialization problem, simply re-throw the orginal exception
-            throw org;
+            // Not serialization problem, return.
         }
 
         protected Integer addListenerForMBeanRemovedNotif()
diff --git a/src/share/classes/javax/swing/JComboBox.java b/src/share/classes/javax/swing/JComboBox.java
index 1e0be3c..6e71c43 100644
--- a/src/share/classes/javax/swing/JComboBox.java
+++ b/src/share/classes/javax/swing/JComboBox.java
@@ -1308,7 +1308,8 @@
      */
     public void actionPerformed(ActionEvent e) {
         ComboBoxEditor editor = getEditor();
-        if ((editor != null) && (e != null) && (editor == e.getSource())) {
+        if ((editor != null) && (e != null)
+                && (editor.getEditorComponent() == e.getSource())) {
             setPopupVisible(false);
             getModel().setSelectedItem(editor.getItem());
             String oldCommand = getActionCommand();
diff --git a/src/share/classes/javax/swing/JComponent.java b/src/share/classes/javax/swing/JComponent.java
index 55695db..1d24558 100644
--- a/src/share/classes/javax/swing/JComponent.java
+++ b/src/share/classes/javax/swing/JComponent.java
@@ -56,6 +56,7 @@
 import java.io.IOException;
 import java.io.ObjectInputValidation;
 import java.io.InvalidObjectException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.swing.border.*;
 import javax.swing.event.*;
@@ -352,7 +353,8 @@
     private static final int AUTOSCROLLS_SET                          = 25;
     private static final int FOCUS_TRAVERSAL_KEYS_FORWARD_SET         = 26;
     private static final int FOCUS_TRAVERSAL_KEYS_BACKWARD_SET        = 27;
-    private static final int REVALIDATE_RUNNABLE_SCHEDULED            = 28;
+
+    private transient AtomicBoolean revalidateRunnableScheduled = new AtomicBoolean(false);
 
     /**
      * Temporary rectangles.
@@ -4859,16 +4861,11 @@
             // To avoid a flood of Runnables when constructing GUIs off
             // the EDT, a flag is maintained as to whether or not
             // a Runnable has been scheduled.
-            synchronized(this) {
-                if (getFlag(REVALIDATE_RUNNABLE_SCHEDULED)) {
-                    return;
-                }
-                setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true);
+            if (revalidateRunnableScheduled.getAndSet(true)) {
+                return;
             }
             SunToolkit.executeOnEventHandlerThread(this, () -> {
-                synchronized(JComponent.this) {
-                    setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
-                }
+                revalidateRunnableScheduled.set(false);
                 revalidate();
             });
         }
@@ -5508,6 +5505,7 @@
             ToolTipManager.sharedInstance().registerComponent(this);
         }
         setWriteObjCounter(this, (byte)0);
+        revalidateRunnableScheduled = new AtomicBoolean(false);
     }
 
 
diff --git a/src/share/classes/javax/swing/JFrame.java b/src/share/classes/javax/swing/JFrame.java
index b6f5ac3..ab3ad7f 100644
--- a/src/share/classes/javax/swing/JFrame.java
+++ b/src/share/classes/javax/swing/JFrame.java
@@ -24,14 +24,22 @@
  */
 package javax.swing;
 
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.PropertyChangeListener;
-import java.util.Locale;
-import java.util.Vector;
-import java.io.Serializable;
+import java.awt.AWTEvent;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.HeadlessException;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.event.WindowEvent;
 
-import javax.accessibility.*;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 
 
 /**
@@ -293,33 +301,28 @@
      * @see    #setDefaultCloseOperation
      * @see    java.awt.Window#processWindowEvent
      */
-    protected void processWindowEvent(WindowEvent e) {
+    protected void processWindowEvent(final WindowEvent e) {
         super.processWindowEvent(e);
 
         if (e.getID() == WindowEvent.WINDOW_CLOSING) {
-            switch(defaultCloseOperation) {
-              case HIDE_ON_CLOSE:
-                 setVisible(false);
-                 break;
-              case DISPOSE_ON_CLOSE:
-                 dispose();
-                 break;
-              case DO_NOTHING_ON_CLOSE:
-                 default:
-                 break;
-              case EXIT_ON_CLOSE:
-                  // This needs to match the checkExit call in
-                  // setDefaultCloseOperation
-                System.exit(0);
-                break;
+            switch (defaultCloseOperation) {
+                case HIDE_ON_CLOSE:
+                    setVisible(false);
+                    break;
+                case DISPOSE_ON_CLOSE:
+                    dispose();
+                    break;
+                case EXIT_ON_CLOSE:
+                    // This needs to match the checkExit call in
+                    // setDefaultCloseOperation
+                    System.exit(0);
+                    break;
+                case DO_NOTHING_ON_CLOSE:
+                default:
             }
         }
     }
 
-//    public void setMenuBar(MenuBar menu) {
-//        throw new IllegalComponentStateException("Please use setJMenuBar() with JFrame.");
-//    }
-
     /**
      * Sets the operation that will happen by default when
      * the user initiates a "close" on this frame.
diff --git a/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java
index 53b348f..c1383f6 100644
--- a/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java
+++ b/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java
@@ -30,6 +30,11 @@
 import java.util.*;
 import java.awt.FocusTraversalPolicy;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.security.action.GetPropertyAction;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * A FocusTraversalPolicy that determines traversal order by sorting the
@@ -89,6 +94,34 @@
     final private int FORWARD_TRAVERSAL = 0;
     final private int BACKWARD_TRAVERSAL = 1;
 
+    /*
+     * When true (by default), the legacy merge-sort algo is used to sort an FTP cycle.
+     * When false, the default (tim-sort) algo is used, which may lead to an exception.
+     * See: JDK-8048887
+     */
+    private static final boolean legacySortingFTPEnabled;
+    private static final Method legacyMergeSortMethod;
+
+    static {
+        legacySortingFTPEnabled = "true".equals(AccessController.doPrivileged(
+            new GetPropertyAction("swing.legacySortingFTPEnabled", "true")));
+        legacyMergeSortMethod = legacySortingFTPEnabled ?
+            AccessController.doPrivileged(new PrivilegedAction<Method>() {
+                public Method run() {
+                    try {
+                        Class c = Class.forName("java.util.Arrays");
+                        Method m = c.getDeclaredMethod("legacyMergeSort", new Class[]{Object[].class, Comparator.class});
+                        m.setAccessible(true);
+                        return m;
+                    } catch (ClassNotFoundException | NoSuchMethodException e) {
+                        // using default sorting algo
+                        return null;
+                    }
+                }
+            }) :
+            null;
+    }
+
     /**
      * Constructs a SortingFocusTraversalPolicy without a Comparator.
      * Subclasses must set the Comparator using <code>setComparator</code>
@@ -133,10 +166,32 @@
     private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
         if (focusCycleRoot.isShowing()) {
             enumerateCycle(focusCycleRoot, cycle);
-            Collections.sort(cycle, comparator);
+            if (!legacySortingFTPEnabled ||
+                !legacySort(cycle, comparator))
+            {
+                Collections.sort(cycle, comparator);
+            }
         }
     }
 
+    private boolean legacySort(List<Component> l, Comparator<? super Component> c) {
+        if (legacyMergeSortMethod == null)
+            return false;
+
+        Object[] a = l.toArray();
+        try {
+            legacyMergeSortMethod.invoke(null, a, c);
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            return false;
+        }
+        ListIterator<Component> i = l.listIterator();
+        for (Object e : a) {
+            i.next();
+            i.set((Component)e);
+        }
+        return true;
+    }
+
     private void enumerateCycle(Container container, List<Component> cycle) {
         if (!(container.isVisible() && container.isDisplayable())) {
             return;
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java b/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java
index 47c9b7d..89066d2 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,8 @@
 import javax.swing.text.View;
 import sun.swing.SwingUtilities2;
 import sun.awt.AppContext;
-
+import java.util.Enumeration;
+import java.util.HashSet;
 
 /**
  * RadioButtonUI implementation for BasicRadioButtonUI
@@ -44,15 +45,27 @@
 {
     private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object();
 
+    /**
+     * The icon.
+     */
     protected Icon icon;
 
     private boolean defaults_initialized = false;
 
     private final static String propertyPrefix = "RadioButton" + ".";
 
+    private KeyListener keyListener = null;
+
     // ********************************
     //        Create PLAF
     // ********************************
+
+    /**
+     * Returns an instance of {@code BasicRadioButtonUI}.
+     *
+     * @param b a component
+     * @return an instance of {@code BasicRadioButtonUI}
+     */
     public static ComponentUI createUI(JComponent b) {
         AppContext appContext = AppContext.getAppContext();
         BasicRadioButtonUI radioButtonUI =
@@ -64,6 +77,7 @@
         return radioButtonUI;
     }
 
+    @Override
     protected String getPropertyPrefix() {
         return propertyPrefix;
     }
@@ -71,7 +85,8 @@
     // ********************************
     //        Install PLAF
     // ********************************
-    protected void installDefaults(AbstractButton b){
+    @Override
+    protected void installDefaults(AbstractButton b) {
         super.installDefaults(b);
         if(!defaults_initialized) {
             icon = UIManager.getIcon(getPropertyPrefix() + "icon");
@@ -82,15 +97,80 @@
     // ********************************
     //        Uninstall PLAF
     // ********************************
-    protected void uninstallDefaults(AbstractButton b){
+    @Override
+    protected void uninstallDefaults(AbstractButton b) {
         super.uninstallDefaults(b);
         defaults_initialized = false;
     }
 
+    /**
+     * Returns the default icon.
+     *
+     * @return the default icon
+     */
     public Icon getDefaultIcon() {
         return icon;
     }
 
+    // ********************************
+    //        Install Listeners
+    // ********************************
+    @Override
+    protected void installListeners(AbstractButton button) {
+        super.installListeners(button);
+
+        // Only for JRadioButton
+        if (!(button instanceof JRadioButton))
+            return;
+
+        keyListener = createKeyListener();
+        button.addKeyListener(keyListener);
+
+        // Need to get traversal key event
+        button.setFocusTraversalKeysEnabled(false);
+
+        // Map actions to the arrow keys
+        button.getActionMap().put("Previous", new SelectPreviousBtn());
+        button.getActionMap().put("Next", new SelectNextBtn());
+
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+            put(KeyStroke.getKeyStroke("UP"), "Previous");
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+            put(KeyStroke.getKeyStroke("DOWN"), "Next");
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+            put(KeyStroke.getKeyStroke("LEFT"), "Previous");
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+            put(KeyStroke.getKeyStroke("RIGHT"), "Next");
+    }
+
+    // ********************************
+    //        UnInstall Listeners
+    // ********************************
+    @Override
+    protected void uninstallListeners(AbstractButton button) {
+        super.uninstallListeners(button);
+
+        // Only for JRadioButton
+        if (!(button instanceof JRadioButton))
+            return;
+
+        // Unmap actions from the arrow keys
+        button.getActionMap().remove("Previous");
+        button.getActionMap().remove("Next");
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+                    .remove(KeyStroke.getKeyStroke("UP"));
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+                    .remove(KeyStroke.getKeyStroke("DOWN"));
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+                    .remove(KeyStroke.getKeyStroke("LEFT"));
+        button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+                    .remove(KeyStroke.getKeyStroke("RIGHT"));
+
+        if (keyListener != null) {
+            button.removeKeyListener(keyListener);
+            keyListener = null;
+        }
+    }
 
     /* These Dimensions/Rectangles are allocated once for all
      * RadioButtonUI.paint() calls.  Re-using rectangles
@@ -106,6 +186,7 @@
     /**
      * paint the radio button
      */
+    @Override
     public synchronized void paint(Graphics g, JComponent c) {
         AbstractButton b = (AbstractButton) c;
         ButtonModel model = b.getModel();
@@ -195,7 +276,14 @@
         }
     }
 
-    protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){
+    /**
+     * Paints focused radio button.
+     *
+     * @param g an instance of {@code Graphics}
+     * @param textRect bounds
+     * @param size the size of radio button
+     */
+    protected void paintFocus(Graphics g, Rectangle textRect, Dimension size) {
     }
 
 
@@ -213,6 +301,7 @@
     /**
      * The preferred size of the radio button
      */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         if(c.getComponentCount() > 0) {
             return null;
@@ -258,4 +347,262 @@
         height += prefInsets.top + prefInsets.bottom;
         return new Dimension(width, height);
     }
+
+    /////////////////////////// Private functions ////////////////////////
+    /**
+     * Creates the key listener to handle tab navigation in JRadioButton Group.
+     */
+    private KeyListener createKeyListener() {
+         if (keyListener == null) {
+            keyListener = new KeyHandler();
+        }
+        return keyListener;
+    }
+
+
+    private boolean isValidRadioButtonObj(Object obj) {
+        return ((obj instanceof JRadioButton) &&
+                    ((JRadioButton) obj).isVisible() &&
+                    ((JRadioButton) obj).isEnabled());
+    }
+
+    /**
+     * Select radio button based on "Previous" or "Next" operation
+     *
+     * @param event, the event object.
+     * @param next, indicate if it's next one
+     */
+    private void selectRadioButton(ActionEvent event, boolean next) {
+        // Get the source of the event.
+        Object eventSrc = event.getSource();
+
+        // Check whether the source is JRadioButton, it so, whether it is visible
+        if (!isValidRadioButtonObj(eventSrc))
+            return;
+
+        ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
+        btnGroupInfo.selectNewButton(next);
+    }
+
+    /////////////////////////// Inner Classes ////////////////////////
+    @SuppressWarnings("serial")
+    private class SelectPreviousBtn extends AbstractAction {
+        public SelectPreviousBtn() {
+            super("Previous");
+        }
+
+        public void actionPerformed(ActionEvent e) {
+           BasicRadioButtonUI.this.selectRadioButton(e, false);
+        }
+    }
+
+    @SuppressWarnings("serial")
+    private class SelectNextBtn extends AbstractAction{
+        public SelectNextBtn() {
+            super("Next");
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            BasicRadioButtonUI.this.selectRadioButton(e, true);
+        }
+    }
+
+    /**
+     * ButtonGroupInfo, used to get related info in button group
+     * for given radio button
+     */
+    private class ButtonGroupInfo {
+
+        JRadioButton activeBtn = null;
+
+        JRadioButton firstBtn = null;
+        JRadioButton lastBtn = null;
+
+        JRadioButton previousBtn = null;
+        JRadioButton nextBtn = null;
+
+        HashSet<JRadioButton> btnsInGroup = null;
+
+        boolean srcFound = false;
+        public ButtonGroupInfo(JRadioButton btn) {
+            activeBtn = btn;
+            btnsInGroup = new HashSet<JRadioButton>();
+        }
+
+        // Check if given object is in the button group
+        boolean containsInGroup(Object obj){
+           return btnsInGroup.contains(obj);
+        }
+
+        // Check if the next object to gain focus belongs
+        // to the button group or not
+        Component getFocusTransferBaseComponent(boolean next){
+            Component focusBaseComp = activeBtn;
+            Window container = SwingUtilities.getWindowAncestor(activeBtn);
+            if (container != null) {
+                FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
+                Component comp = next ? policy.getComponentAfter(container, activeBtn)
+                                      : policy.getComponentBefore(container, activeBtn);
+
+                // If next component in the button group, use last/first button as base focus
+                // otherwise, use the activeBtn as the base focus
+                if (containsInGroup(comp)) {
+                    focusBaseComp = next ? lastBtn : firstBtn;
+                }
+            }
+
+            return focusBaseComp;
+        }
+
+        boolean getButtonGroupInfo() {
+            if (activeBtn == null)
+                return false;
+
+            btnsInGroup.clear();
+
+            // Get the button model from the source.
+            ButtonModel model = activeBtn.getModel();
+            if (!(model instanceof DefaultButtonModel))
+                return false;
+
+            // If the button model is DefaultButtonModel, and use it, otherwise return.
+            DefaultButtonModel bm = (DefaultButtonModel) model;
+
+            // get the ButtonGroup of the button from the button model
+            ButtonGroup group = bm.getGroup();
+            if (group == null)
+                return false;
+
+            // Get all the buttons in the group
+            Enumeration<AbstractButton> e = group.getElements();
+            if (e == null)
+                return false;
+
+            while (e.hasMoreElements()) {
+                AbstractButton curElement = e.nextElement();
+                if (!isValidRadioButtonObj(curElement))
+                    continue;
+
+                btnsInGroup.add((JRadioButton) curElement);
+
+                // If firstBtn is not set yet, curElement is that first button
+                if (null == firstBtn)
+                    firstBtn = (JRadioButton) curElement;
+
+                if (activeBtn == curElement)
+                    srcFound = true;
+                else if (!srcFound) {
+                    // The source has not been yet found and the current element
+                    // is the last previousBtn
+                    previousBtn = (JRadioButton) curElement;
+                } else if (nextBtn == null) {
+                    // The source has been found and the current element
+                    // is the next valid button of the list
+                    nextBtn = (JRadioButton) curElement;
+                }
+
+                // Set new last "valid" JRadioButton of the list
+                lastBtn = (JRadioButton) curElement;
+            }
+
+            return true;
+        }
+
+        /**
+          * Find the new radio button that focus needs to be
+          * moved to in the group, select the button
+          *
+          * @param next, indicate if it's arrow up/left or down/right
+          */
+        void selectNewButton(boolean next) {
+            if (!getButtonGroupInfo())
+                return;
+
+            if (srcFound) {
+                JRadioButton newSelectedBtn = null;
+                if (next) {
+                    // Select Next button. Cycle to the first button if the source
+                    // button is the last of the group.
+                    newSelectedBtn = (null == nextBtn) ? firstBtn : nextBtn;
+                } else {
+                    // Select previous button. Cycle to the last button if the source
+                    // button is the first button of the group.
+                    newSelectedBtn = (null == previousBtn) ? lastBtn : previousBtn;
+                }
+                if (newSelectedBtn != null &&
+                    (newSelectedBtn != activeBtn)) {
+                    newSelectedBtn.requestFocusInWindow();
+                    newSelectedBtn.setSelected(true);
+                }
+            }
+        }
+
+        /**
+          * Find the button group the passed in JRadioButton belongs to, and
+          * move focus to next component of the last button in the group
+          * or previous component of first button
+          *
+          * @param next, indicate if jump to next component or previous
+          */
+        void jumpToNextComponent(boolean next) {
+            if (!getButtonGroupInfo()){
+                // In case the button does not belong to any group, it needs
+                // to be treated as a component
+                if (activeBtn != null){
+                    lastBtn = activeBtn;
+                    firstBtn = activeBtn;
+                }
+                else
+                    return;
+            }
+
+            // Update the component we will use as base to transfer
+            // focus from
+            JComponent compTransferFocusFrom = activeBtn;
+
+            // If next component in the parent window is not in
+            // the button group, current active button will be
+            // base, otherwise, the base will be first or last
+            // button in the button group
+            Component focusBase = getFocusTransferBaseComponent(next);
+            if (focusBase != null){
+                if (next) {
+                    KeyboardFocusManager.
+                        getCurrentKeyboardFocusManager().focusNextComponent(focusBase);
+                } else {
+                    KeyboardFocusManager.
+                        getCurrentKeyboardFocusManager().focusPreviousComponent(focusBase);
+                }
+            }
+        }
+    }
+
+    /**
+     * Radiobutton KeyListener
+     */
+    private class KeyHandler implements KeyListener {
+
+        // This listener checks if the key event is a KeyEvent.VK_TAB
+        // or shift + KeyEvent.VK_TAB event on a radio button, consume the event
+        // if so and move the focus to next/previous component
+        public void keyPressed(KeyEvent e) {
+            if (e.getKeyCode() == KeyEvent.VK_TAB) {
+                 // Get the source of the event.
+                Object eventSrc = e.getSource();
+
+                // Check whether the source is a visible and enabled JRadioButton
+                if (isValidRadioButtonObj(eventSrc)) {
+                    e.consume();
+                    ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
+                    btnGroupInfo.jumpToNextComponent(!e.isShiftDown());
+                }
+            }
+        }
+
+        public void keyReleased(KeyEvent e) {
+        }
+
+        public void keyTyped(KeyEvent e) {
+        }
+    }
 }
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 7b7823f..f21120f 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -3239,6 +3239,7 @@
                 }
             }
             tabScroller.tabPanel.setPreferredSize(new Dimension(totalWidth, totalHeight));
+            tabScroller.tabPanel.invalidate();
         }
     }
 
@@ -3606,6 +3607,7 @@
             setFocusIndex(tabPane.getSelectedIndex(), false);
 
             if (scrollableTabLayoutEnabled()) {
+                ensureCurrentLayout();
                 int index = tabPane.getSelectedIndex();
                 if (index < rects.length && index != -1) {
                     tabScroller.tabPanel.scrollRectToVisible(
diff --git a/src/share/classes/javax/swing/text/FlowView.java b/src/share/classes/javax/swing/text/FlowView.java
index 53e63e2..9c5cf03 100644
--- a/src/share/classes/javax/swing/text/FlowView.java
+++ b/src/share/classes/javax/swing/text/FlowView.java
@@ -800,14 +800,22 @@
         @Override
         protected void forwardUpdate(DocumentEvent.ElementChange ec,
                                           DocumentEvent e, Shape a, ViewFactory f) {
-            calculateUpdateIndexes(e);
-            // Send update event to all views followed by the changed place.
-            lastUpdateIndex = Math.max((getViewCount() - 1), 0);
-            for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
-                View v = getView(i);
-                if (v != null) {
-                    Shape childAlloc = getChildAllocation(i, a);
-                    forwardUpdateToView(v, e, childAlloc, f);
+            // Update the view responsible for the changed element by invocation of
+            // super method.
+            super.forwardUpdate(ec, e, a, f);
+            // Re-calculate the update indexes and update the views followed by
+            // the changed place. Note: we update the views only when insertion or
+            // removal takes place.
+            DocumentEvent.EventType type = e.getType();
+            if (type == DocumentEvent.EventType.INSERT ||
+                type == DocumentEvent.EventType.REMOVE) {
+                firstUpdateIndex = Math.min((lastUpdateIndex + 1), (getViewCount() - 1));
+                lastUpdateIndex = Math.max((getViewCount() - 1), 0);
+                for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
+                    View v = getView(i);
+                    if (v != null) {
+                        v.updateAfterChange();
+                    }
                 }
             }
         }
diff --git a/src/share/classes/javax/swing/text/GlyphView.java b/src/share/classes/javax/swing/text/GlyphView.java
index 6aef368..fd75fa0 100644
--- a/src/share/classes/javax/swing/text/GlyphView.java
+++ b/src/share/classes/javax/swing/text/GlyphView.java
@@ -971,6 +971,14 @@
         }
     }
 
+    /** {@inheritDoc} */
+    @Override
+    void updateAfterChange() {
+        // Drop the break spots. They will be re-calculated during
+        // layout. It is necessary for proper line break calculation.
+        breakSpots = null;
+    }
+
     /**
      * Class to hold data needed to justify this GlyphView in a PargraphView.Row
      */
diff --git a/src/share/classes/javax/swing/text/View.java b/src/share/classes/javax/swing/text/View.java
index 2b49055..d1e4e13 100644
--- a/src/share/classes/javax/swing/text/View.java
+++ b/src/share/classes/javax/swing/text/View.java
@@ -1199,6 +1199,13 @@
     }
 
     /**
+     * Updates the view to reflect the changes.
+     */
+    void updateAfterChange() {
+        // Do nothing by default. Should be overridden in subclasses, if any.
+    }
+
+    /**
      * Forwards the <code>DocumentEvent</code> to the give child view.  This
      * simply messages the view with a call to <code>insertUpdate</code>,
      * <code>removeUpdate</code>, or <code>changedUpdate</code> depending
diff --git a/src/share/classes/javax/swing/text/html/HTMLDocument.java b/src/share/classes/javax/swing/text/html/HTMLDocument.java
index 04a165d..fd994e5 100644
--- a/src/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/src/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -1376,8 +1376,13 @@
             Element parent = elem.getParentElement();
 
             if (parent != null) {
+                // If we are going to insert the string into the body
+                // section, it is necessary to set the corrsponding flag.
+                if (HTML.Tag.BODY.name.equals(parent.getName())) {
+                    insertInBody = true;
+                }
                 int offset = elem.getEndOffset();
-                if (offset > getLength()) {
+                if (offset > (getLength() + 1)) {
                     offset--;
                 }
                 else if (elem.isLeaf() && getText(offset - 1, 1).
@@ -1385,6 +1390,10 @@
                     offset--;
                 }
                 insertHTML(parent, offset, htmlText, false);
+                // Cleanup the flag, if any.
+                if (insertInBody) {
+                    insertInBody = false;
+                }
             }
         }
     }
@@ -1823,6 +1832,11 @@
     private static char[] NEWLINE;
 
     /**
+     * Indicates that direct insertion to body section takes place.
+     */
+    private boolean insertInBody = false;
+
+    /**
      * I18N property key.
      *
      * @see AbstractDocument#I18NProperty
@@ -2571,7 +2585,9 @@
                     // Assume content should be added.
                     foundInsertTag(false);
                     foundInsertTag = true;
-                    inParagraph = impliedP = true;
+                    // If content is added directly to the body, it should
+                    // be wrapped by p-implied.
+                    inParagraph = impliedP = !insertInBody;
                 }
                 if (data.length >= 1) {
                     addContent(data, 0, data.length);
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java b/src/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
index 4f84215..c9bf9d3 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java
@@ -1858,7 +1858,7 @@
             break;
         case 'B': // pointer to CONSTANT_Byte
             av.visit(name,
-                    new Byte((byte) readInt(items[readUnsignedShort(v)])));
+                    (byte) readInt(items[readUnsignedShort(v)]));
             v += 2;
             break;
         case 'Z': // pointer to CONSTANT_Boolean
@@ -1868,13 +1868,13 @@
             v += 2;
             break;
         case 'S': // pointer to CONSTANT_Short
-            av.visit(name, new Short(
-                    (short) readInt(items[readUnsignedShort(v)])));
+            av.visit(name,
+                    (short) readInt(items[readUnsignedShort(v)]));
             v += 2;
             break;
         case 'C': // pointer to CONSTANT_Char
-            av.visit(name, new Character(
-                    (char) readInt(items[readUnsignedShort(v)])));
+            av.visit(name,
+                    (char) readInt(items[readUnsignedShort(v)]));
             v += 2;
             break;
         case 's': // pointer to CONSTANT_Utf8
@@ -2498,13 +2498,13 @@
         int index = items[item];
         switch (b[index - 1]) {
         case ClassWriter.INT:
-            return new Integer(readInt(index));
+            return readInt(index);
         case ClassWriter.FLOAT:
-            return new Float(Float.intBitsToFloat(readInt(index)));
+            return Float.intBitsToFloat(readInt(index));
         case ClassWriter.LONG:
-            return new Long(readLong(index));
+            return readLong(index);
         case ClassWriter.DOUBLE:
-            return new Double(Double.longBitsToDouble(readLong(index)));
+            return Double.longBitsToDouble(readLong(index));
         case ClassWriter.CLASS:
             return Type.getObjectType(readUTF8(index, buf));
         case ClassWriter.STR:
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/TypePath.java b/src/share/classes/jdk/internal/org/objectweb/asm/TypePath.java
index b43a11d..31fe2bc 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/TypePath.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/TypePath.java
@@ -181,6 +181,9 @@
                     typeArg = typeArg * 10 + c - '0';
                     i += 1;
                 }
+                if (i < n && typePath.charAt(i) == ';') {
+                    i += 1;
+                }
                 out.put11(TYPE_ARGUMENT, typeArg);
             }
         }
@@ -193,7 +196,7 @@
      * ARRAY_ELEMENT} steps are represented with '[', {@link #INNER_TYPE
      * INNER_TYPE} steps with '.', {@link #WILDCARD_BOUND WILDCARD_BOUND} steps
      * with '*' and {@link #TYPE_ARGUMENT TYPE_ARGUMENT} steps with their type
-     * argument index in decimal form.
+     * argument index in decimal form followed by ';'.
      */
     @Override
     public String toString() {
@@ -211,7 +214,7 @@
                 result.append('*');
                 break;
             case TYPE_ARGUMENT:
-                result.append(getStepArgument(i));
+                result.append(getStepArgument(i)).append(';');
                 break;
             default:
                 result.append('_');
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/commons/GeneratorAdapter.java b/src/share/classes/jdk/internal/org/objectweb/asm/commons/GeneratorAdapter.java
index 786a5b5..e198de7 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/GeneratorAdapter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/GeneratorAdapter.java
@@ -408,7 +408,7 @@
         } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
             mv.visitIntInsn(Opcodes.SIPUSH, value);
         } else {
-            mv.visitLdcInsn(new Integer(value));
+            mv.visitLdcInsn(value);
         }
     }
 
@@ -422,7 +422,7 @@
         if (value == 0L || value == 1L) {
             mv.visitInsn(Opcodes.LCONST_0 + (int) value);
         } else {
-            mv.visitLdcInsn(new Long(value));
+            mv.visitLdcInsn(value);
         }
     }
 
@@ -437,7 +437,7 @@
         if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2
             mv.visitInsn(Opcodes.FCONST_0 + (int) value);
         } else {
-            mv.visitLdcInsn(new Float(value));
+            mv.visitLdcInsn(value);
         }
     }
 
@@ -452,7 +452,7 @@
         if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d
             mv.visitInsn(Opcodes.DCONST_0 + (int) value);
         } else {
-            mv.visitLdcInsn(new Double(value));
+            mv.visitLdcInsn(value);
         }
     }
 
@@ -1647,11 +1647,13 @@
      */
     public void catchException(final Label start, final Label end,
             final Type exception) {
+        Label doCatch = new Label();
         if (exception == null) {
-            mv.visitTryCatchBlock(start, end, mark(), null);
+            mv.visitTryCatchBlock(start, end, doCatch, null);
         } else {
-            mv.visitTryCatchBlock(start, end, mark(),
+            mv.visitTryCatchBlock(start, end, doCatch,
                     exception.getInternalName());
         }
+        mark(doCatch);
     }
 }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java b/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java
index 2c54ea4..2df144e 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java
@@ -737,7 +737,7 @@
         } else if (cst >= Short.MIN_VALUE && cst <= Short.MAX_VALUE) {
             mv.visitIntInsn(Opcodes.SIPUSH, cst);
         } else {
-            mv.visitLdcInsn(new Integer(cst));
+            mv.visitLdcInsn(cst);
         }
     }
 
@@ -745,7 +745,7 @@
         if (cst == 0L || cst == 1L) {
             mv.visitInsn(Opcodes.LCONST_0 + (int) cst);
         } else {
-            mv.visitLdcInsn(new Long(cst));
+            mv.visitLdcInsn(cst);
         }
     }
 
@@ -754,7 +754,7 @@
         if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2
             mv.visitInsn(Opcodes.FCONST_0 + (int) cst);
         } else {
-            mv.visitLdcInsn(new Float(cst));
+            mv.visitLdcInsn(cst);
         }
     }
 
@@ -763,7 +763,7 @@
         if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d
             mv.visitInsn(Opcodes.DCONST_0 + (int) cst);
         } else {
-            mv.visitLdcInsn(new Double(cst));
+            mv.visitLdcInsn(cst);
         }
     }
 
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java b/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java
index 51fcb4c..cd407fd 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java
@@ -366,8 +366,7 @@
 
     protected void addSVUID(long svuid) {
         FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL
-                + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, new Long(
-                svuid));
+                + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, svuid);
         if (fv != null) {
             fv.visitEnd();
         }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java
index b67ea38..1bb9925 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java
@@ -247,11 +247,13 @@
                 an.accept(av.visitAnnotation(name, an.desc));
             } else if (value instanceof List) {
                 AnnotationVisitor v = av.visitArray(name);
-                List<?> array = (List<?>) value;
-                for (int j = 0; j < array.size(); ++j) {
-                    accept(v, null, array.get(j));
+                if (v != null) {
+                    List<?> array = (List<?>) value;
+                    for (int j = 0; j < array.size(); ++j) {
+                        accept(v, null, array.get(j));
+                    }
+                    v.visitEnd();
                 }
-                v.visitEnd();
             } else {
                 av.visit(name, value);
             }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
index 7acfff5..8dec6ed 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
@@ -550,6 +550,7 @@
     }
 
     // this class is not generified because it will create bridges
+    @SuppressWarnings("rawtypes")
     private final class InsnListIterator implements ListIterator {
 
         AbstractInsnNode next;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java
index b1daa38..ab408b7 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java
@@ -110,7 +110,7 @@
                 : labels.length);
         if (keys != null) {
             for (int i = 0; i < keys.length; ++i) {
-                this.keys.add(new Integer(keys[i]));
+                this.keys.add(keys[i]);
             }
         }
         if (labels != null) {
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java
index 2f61df3..cb84d42 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java
@@ -160,6 +160,7 @@
     @Override
     public void accept(final MethodVisitor mv) {
         mv.visitMethodInsn(opcode, owner, name, desc, itf);
+        acceptAnnotations(mv);
     }
 
     @Override
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
index bb01f7a..1561442 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
@@ -399,6 +399,7 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public AnnotationVisitor visitParameterAnnotation(final int parameter,
             final String desc, final boolean visible) {
         AnnotationNode an = new AnnotationNode(desc);
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
index 8f98753..b8d6fda 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
@@ -131,6 +131,7 @@
      * @throws AnalyzerException
      *             if a problem occurs during the analysis.
      */
+    @SuppressWarnings("unchecked")
     public Frame<V>[] analyze(final String owner, final MethodNode m)
             throws AnalyzerException {
         if ((m.access & (ACC_ABSTRACT | ACC_NATIVE)) != 0) {
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
index cbb5f86..4ba309d 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
@@ -112,6 +112,7 @@
      * @param nStack
      *            the maximum stack size of the frame.
      */
+    @SuppressWarnings("unchecked")
     public Frame(final int nLocals, final int nStack) {
         this.values = (V[]) new Value[nLocals + nStack];
         this.locals = nLocals;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java
index 0716deb..2567319 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java
@@ -802,7 +802,7 @@
         if (labels.get(label) != null) {
             throw new IllegalArgumentException("Already visited label");
         }
-        labels.put(label, new Integer(insnCount));
+        labels.put(label, insnCount);
         super.visitLabel(label);
     }
 
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
index c210e2c..b8e1cd1 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
@@ -732,7 +732,7 @@
         Textifier t = createTextifier();
         text.add(t.getText());
         text.add(visible ? ") // parameter " : ") // invisible, parameter ");
-        text.add(new Integer(parameter));
+        text.add(parameter);
         text.add("\n");
         return t;
     }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
index b1d9160..5ba3a33 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
@@ -1,12 +1,12 @@
 Path: .
-Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-05-27
+Working Copy Root Path: /hudson/jobs/objectweb-init/workspace/asm-svn-2014-10-15
 URL: file:///svnroot/asm/trunk/asm
 Repository Root: file:///svnroot/asm
 Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
-Revision: 1748
+Revision: 1772
 Node Kind: directory
 Schedule: normal
 Last Changed Author: ebruneton
-Last Changed Rev: 1747
-Last Changed Date: 2014-05-24 10:22:13 +0200 (Sat, 24 May 2014)
+Last Changed Rev: 1772
+Last Changed Date: 2014-09-06 09:13:07 +0200 (Sat, 06 Sep 2014)
 
diff --git a/src/share/classes/jdk/net/Sockets.java b/src/share/classes/jdk/net/Sockets.java
index ef75631..7b6f8db 100644
--- a/src/share/classes/jdk/net/Sockets.java
+++ b/src/share/classes/jdk/net/Sockets.java
@@ -119,6 +119,8 @@
                 Throwable t = ((InvocationTargetException)e).getTargetException();
                 if (t instanceof IOException) {
                     throw (IOException)t;
+                } else if (t instanceof RuntimeException) {
+                    throw (RuntimeException)t;
                 }
             }
             throw new RuntimeException(e);
@@ -135,6 +137,8 @@
                 Throwable t = ((InvocationTargetException)e).getTargetException();
                 if (t instanceof IOException) {
                     throw (IOException)t;
+                } else if (t instanceof RuntimeException) {
+                    throw (RuntimeException)t;
                 }
             }
             throw new RuntimeException(e);
@@ -367,6 +371,7 @@
         set = new HashSet<>();
         set.add(StandardSocketOptions.SO_RCVBUF);
         set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.IP_TOS);
         set = Collections.unmodifiableSet(set);
         options.put(ServerSocket.class, set);
 
diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
index 767a4b8..d86dd1b 100644
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
@@ -221,8 +221,17 @@
         }
 
         OutputStream os = new UnsyncBufferedOutputStream(bos);
+
+        DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
         try {
-            os.close();
+            ((DOMCanonicalizationMethod)
+                canonicalizationMethod).canonicalize(subTree, context, os);
+        } catch (TransformException te) {
+            throw new XMLSignatureException(te);
+        }
+
+        try {
+            os.flush();
         } catch (IOException e) {
             if (log.isLoggable(java.util.logging.Level.FINE)) {
                 log.log(java.util.logging.Level.FINE, e.getMessage(), e);
@@ -230,15 +239,6 @@
             // Impossible
         }
 
-        DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
-
-        try {
-            ((DOMCanonicalizationMethod)
-                canonicalizationMethod).canonicalize(subTree, context, bos);
-        } catch (TransformException te) {
-            throw new XMLSignatureException(te);
-        }
-
         byte[] signedInfoBytes = bos.toByteArray();
 
         // this whole block should only be done if logging is enabled
@@ -253,6 +253,15 @@
         }
 
         this.canonData = new ByteArrayInputStream(signedInfoBytes);
+
+        try {
+            os.close();
+        } catch (IOException e) {
+            if (log.isLoggable(java.util.logging.Level.FINE)) {
+                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+            }
+            // Impossible
+        }
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
diff --git a/src/share/classes/sun/awt/LightweightFrame.java b/src/share/classes/sun/awt/LightweightFrame.java
index 85d0592..e113190 100644
--- a/src/share/classes/sun/awt/LightweightFrame.java
+++ b/src/share/classes/sun/awt/LightweightFrame.java
@@ -25,6 +25,7 @@
 
 package sun.awt;
 
+import java.awt.Component;
 import java.awt.Container;
 import java.awt.Frame;
 import java.awt.Graphics;
@@ -33,6 +34,13 @@
 import java.awt.MenuComponent;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.InvalidDnDOperationException;
+import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.peer.FramePeer;
 
 /**
@@ -169,4 +177,27 @@
         hostW = w;
         hostH = h;
     }
+
+    /**
+     * Create a drag gesture recognizer for the lightweight frame.
+     */
+    public abstract <T extends DragGestureRecognizer> T createDragGestureRecognizer(
+            Class<T> abstractRecognizerClass,
+            DragSource ds, Component c, int srcActions,
+            DragGestureListener dgl);
+
+    /**
+     * Create a drag source context peer for the lightweight frame.
+     */
+    public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
+
+    /**
+     * Adds a drop target to the lightweight frame.
+     */
+    public abstract void addDropTarget(DropTarget dt);
+
+    /**
+     * Removes a drop target from the lightweight frame.
+     */
+    public abstract void removeDropTarget(DropTarget dt);
 }
diff --git a/src/share/classes/sun/awt/SunToolkit.java b/src/share/classes/sun/awt/SunToolkit.java
index 4a101c4..e546e00 100644
--- a/src/share/classes/sun/awt/SunToolkit.java
+++ b/src/share/classes/sun/awt/SunToolkit.java
@@ -2051,6 +2051,19 @@
         return isInstanceOf(cls.getSuperclass(), type);
     }
 
+    protected static LightweightFrame getLightweightFrame(Component c) {
+        for (; c != null; c = c.getParent()) {
+            if (c instanceof LightweightFrame) {
+                return (LightweightFrame)c;
+            }
+            if (c instanceof Window) {
+                // Don't traverse owner windows
+                return null;
+            }
+        }
+        return null;
+    }
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // The following methods help set and identify whether a particular
diff --git a/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/src/share/classes/sun/awt/datatransfer/DataTransferer.java
index c5a7f59..b21dab6 100644
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java
@@ -2895,6 +2895,14 @@
                     return comp;
                 }
 
+                if (flavor1.isFlavorTextType()) {
+                    return 1;
+                }
+
+                if (flavor2.isFlavorTextType()) {
+                    return -1;
+                }
+
                 // Next, look for application/x-java-* types. Prefer unknown
                 // MIME types because if the user provides his own data flavor,
                 // it will likely be the most descriptive one.
diff --git a/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java b/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java
new file mode 100644
index 0000000..94c0709
--- /dev/null
+++ b/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.awt.image;
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.image.*;
+
+/**
+ * This class provides default implementations for the
+ * <code>MultiResolutionImage</code> interface. The developer needs only
+ * to subclass this abstract class and define the <code>getResolutionVariant</code>,
+ * <code>getResolutionVariants</code>, and <code>getBaseImage</code> methods.
+ *
+ *
+ * For example,
+ * {@code
+ * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
+ *
+ *     int baseImageIndex;
+ *     Image[] resolutionVariants;
+ *
+ *     public CustomMultiResolutionImage(int baseImageIndex,
+ *             Image... resolutionVariants) {
+ *          this.baseImageIndex = baseImageIndex;
+ *          this.resolutionVariants = resolutionVariants;
+ *     }
+ *
+ *     @Override
+ *     public Image getResolutionVariant(float logicalDPIX, float logicalDPIY,
+ *             float baseImageWidth, float baseImageHeight,
+ *             float destImageWidth, float destImageHeight) {
+ *         // return a resolution variant based on the given logical DPI,
+ *         // base image size, or destination image size
+ *     }
+ *
+ *     @Override
+ *     public List<Image> getResolutionVariants() {
+ *         return Arrays.asList(resolutionVariants);
+ *     }
+ *
+ *     protected Image getBaseImage() {
+ *         return resolutionVariants[baseImageIndex];
+ *     }
+ * }
+ * }
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ *
+ */
+public abstract class AbstractMultiResolutionImage extends java.awt.Image
+        implements MultiResolutionImage {
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getWidth(ImageObserver observer) {
+        return getBaseImage().getWidth(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getHeight(ImageObserver observer) {
+        return getBaseImage().getHeight(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public ImageProducer getSource() {
+        return getBaseImage().getSource();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Graphics getGraphics() {
+        return getBaseImage().getGraphics();
+
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Object getProperty(String name, ImageObserver observer) {
+        return getBaseImage().getProperty(name, observer);
+    }
+
+    /**
+     * @return base image
+     */
+    protected abstract Image getBaseImage();
+}
diff --git a/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java b/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java
similarity index 79%
rename from src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
rename to src/share/classes/sun/awt/image/MultiResolutionCachedImage.java
index 74db827..b1c6dae 100644
--- a/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
+++ b/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java
@@ -26,9 +26,7 @@
 
 import java.awt.Dimension;
 import java.awt.Image;
-import java.awt.Graphics;
 import java.awt.geom.Dimension2D;
-import java.awt.image.BufferedImage;
 import java.awt.image.ImageObserver;
 import java.util.Arrays;
 import java.util.List;
@@ -36,50 +34,39 @@
 import java.util.function.BiFunction;
 import java.util.stream.Collectors;
 
-public class MultiResolutionBufferedImage extends BufferedImage
-        implements MultiResolutionImage {
+public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
 
-    private final BiFunction<Integer, Integer, Image> mapper;
+    private final int baseImageWidth;
+    private final int baseImageHeight;
     private final Dimension2D[] sizes;
+    private final BiFunction<Integer, Integer, Image> mapper;
     private int availableInfo;
 
-    public MultiResolutionBufferedImage(Image baseImage,
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
             BiFunction<Integer, Integer, Image> mapper) {
-        this(baseImage, new Dimension[]{new Dimension(
-            baseImage.getWidth(null), baseImage.getHeight(null))
+        this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension(
+            baseImageWidth, baseImageHeight)
         }, mapper);
     }
 
-    public MultiResolutionBufferedImage(Image baseImage,
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
             Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
-        super(baseImage.getWidth(null), baseImage.getHeight(null),
-                BufferedImage.TYPE_INT_ARGB_PRE);
-        this.sizes = sizes;
+        this.baseImageWidth = baseImageWidth;
+        this.baseImageHeight = baseImageHeight;
+        this.sizes = (sizes == null) ? null : Arrays.copyOf(sizes, sizes.length);
         this.mapper = mapper;
-        this.availableInfo = getInfo(baseImage);
-        Graphics g = getGraphics();
-        g.drawImage(baseImage, 0, 0, null);
-        g.dispose();
     }
 
     @Override
     public Image getResolutionVariant(int width, int height) {
-        int baseWidth = getWidth();
-        int baseHeight = getHeight();
-
-        if (baseWidth == width && baseHeight == height) {
-            return this;
-        }
-
         ImageCache cache = ImageCache.getInstance();
         ImageCacheKey key = new ImageCacheKey(this, width, height);
         Image resolutionVariant = cache.getImage(key);
         if (resolutionVariant == null) {
             resolutionVariant = mapper.apply(width, height);
             cache.setImage(key, resolutionVariant);
-            preload(resolutionVariant, availableInfo);
         }
-
+        preload(resolutionVariant, availableInfo);
         return resolutionVariant;
     }
 
@@ -90,30 +77,39 @@
                         (int) size.getHeight())).collect(Collectors.toList());
     }
 
-    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
-        return new MultiResolutionBufferedImage(mapper.apply(this), sizes,
-                (width, height) ->
+    public MultiResolutionCachedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionCachedImage(baseImageWidth, baseImageHeight,
+                sizes, (width, height) ->
                         mapper.apply(getResolutionVariant(width, height)));
     }
 
     @Override
     public int getWidth(ImageObserver observer) {
-        availableInfo |= ImageObserver.WIDTH;
+        updateInfo(observer, ImageObserver.WIDTH);
         return super.getWidth(observer);
     }
 
     @Override
     public int getHeight(ImageObserver observer) {
-        availableInfo |= ImageObserver.HEIGHT;
+        updateInfo(observer, ImageObserver.HEIGHT);
         return super.getHeight(observer);
     }
 
     @Override
     public Object getProperty(String name, ImageObserver observer) {
-        availableInfo |= ImageObserver.PROPERTIES;
+        updateInfo(observer, ImageObserver.PROPERTIES);
         return super.getProperty(name, observer);
     }
 
+    @Override
+    protected Image getBaseImage() {
+        return getResolutionVariant(baseImageWidth, baseImageHeight);
+    }
+
+    private void updateInfo(ImageObserver observer, int info) {
+        availableInfo |= (observer == null) ? ImageObserver.ALLBITS : info;
+    }
+
     private static int getInfo(Image image) {
         if (image instanceof ToolkitImage) {
             return ((ToolkitImage) image).getImageRep().check(
diff --git a/src/share/classes/sun/font/SunFontManager.java b/src/share/classes/sun/font/SunFontManager.java
index f972362..ec6b4d8 100644
--- a/src/share/classes/sun/font/SunFontManager.java
+++ b/src/share/classes/sun/font/SunFontManager.java
@@ -3182,7 +3182,7 @@
      * Returns an array of two strings. The first element is the
      * name of the font. The second element is the file name.
      */
-    public abstract String[] getDefaultPlatformFont();
+    protected abstract String[] getDefaultPlatformFont();
 
     // Begin: Refactored from SunGraphicsEnviroment.
 
diff --git a/src/share/classes/sun/invoke/util/ValueConversions.java b/src/share/classes/sun/invoke/util/ValueConversions.java
index e3095fc..64b52f4 100644
--- a/src/share/classes/sun/invoke/util/ValueConversions.java
+++ b/src/share/classes/sun/invoke/util/ValueConversions.java
@@ -29,38 +29,34 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.EnumMap;
-import java.util.List;
 
 public class ValueConversions {
     private static final Class<?> THIS_CLASS = ValueConversions.class;
-    // Do not adjust this except for special platforms:
-    private static final int MAX_ARITY;
-    static {
-        final Object[] values = { 255 };
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                @Override
-                public Void run() {
-                    values[0] = Integer.getInteger(THIS_CLASS.getName()+".MAX_ARITY", 255);
-                    return null;
-                }
-            });
-        MAX_ARITY = (Integer) values[0];
-    }
-
     private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
 
-    private static EnumMap<Wrapper, MethodHandle>[] newWrapperCaches(int n) {
-        @SuppressWarnings("unchecked")  // generic array creation
-        EnumMap<Wrapper, MethodHandle>[] caches
-                = (EnumMap<Wrapper, MethodHandle>[]) new EnumMap<?,?>[n];
+    /** Thread-safe canonicalized mapping from Wrapper to MethodHandle
+     * with unsynchronized reads and synchronized writes.
+     * It's safe to publish MethodHandles by data race because they are immutable. */
+    private static class WrapperCache {
+        /** EnumMap uses preconstructed array internally, which is constant during it's lifetime. */
+        private final EnumMap<Wrapper, MethodHandle> map = new EnumMap<>(Wrapper.class);
+
+        public MethodHandle get(Wrapper w) {
+            return map.get(w);
+        }
+        public synchronized MethodHandle put(final Wrapper w, final MethodHandle mh) {
+            // Simulate CAS to avoid racy duplication
+            MethodHandle prev = map.putIfAbsent(w, mh);
+            if (prev != null)  return prev;
+            return mh;
+        }
+    }
+
+    private static WrapperCache[] newWrapperCaches(int n) {
+        WrapperCache[] caches = new WrapperCache[n];
         for (int i = 0; i < n; i++)
-            caches[i] = new EnumMap<>(Wrapper.class);
+            caches[i] = new WrapperCache();
         return caches;
     }
 
@@ -71,63 +67,92 @@
     //   implicit conversions sanctioned by JLS 5.1.2, etc.
     //   explicit conversions as allowed by explicitCastArguments
 
+    static int unboxInteger(Integer x) {
+        return x;
+    }
     static int unboxInteger(Object x, boolean cast) {
         if (x instanceof Integer)
-            return ((Integer) x).intValue();
+            return (Integer) x;
         return primitiveConversion(Wrapper.INT, x, cast).intValue();
     }
 
+    static byte unboxByte(Byte x) {
+        return x;
+    }
     static byte unboxByte(Object x, boolean cast) {
         if (x instanceof Byte)
-            return ((Byte) x).byteValue();
+            return (Byte) x;
         return primitiveConversion(Wrapper.BYTE, x, cast).byteValue();
     }
 
+    static short unboxShort(Short x) {
+        return x;
+    }
     static short unboxShort(Object x, boolean cast) {
         if (x instanceof Short)
-            return ((Short) x).shortValue();
+            return (Short) x;
         return primitiveConversion(Wrapper.SHORT, x, cast).shortValue();
     }
 
+    static boolean unboxBoolean(Boolean x) {
+        return x;
+    }
     static boolean unboxBoolean(Object x, boolean cast) {
         if (x instanceof Boolean)
-            return ((Boolean) x).booleanValue();
+            return (Boolean) x;
         return (primitiveConversion(Wrapper.BOOLEAN, x, cast).intValue() & 1) != 0;
     }
 
+    static char unboxCharacter(Character x) {
+        return x;
+    }
     static char unboxCharacter(Object x, boolean cast) {
         if (x instanceof Character)
-            return ((Character) x).charValue();
+            return (Character) x;
         return (char) primitiveConversion(Wrapper.CHAR, x, cast).intValue();
     }
 
+    static long unboxLong(Long x) {
+        return x;
+    }
     static long unboxLong(Object x, boolean cast) {
         if (x instanceof Long)
-            return ((Long) x).longValue();
+            return (Long) x;
         return primitiveConversion(Wrapper.LONG, x, cast).longValue();
     }
 
+    static float unboxFloat(Float x) {
+        return x;
+    }
     static float unboxFloat(Object x, boolean cast) {
         if (x instanceof Float)
-            return ((Float) x).floatValue();
+            return (Float) x;
         return primitiveConversion(Wrapper.FLOAT, x, cast).floatValue();
     }
 
+    static double unboxDouble(Double x) {
+        return x;
+    }
     static double unboxDouble(Object x, boolean cast) {
         if (x instanceof Double)
-            return ((Double) x).doubleValue();
+            return (Double) x;
         return primitiveConversion(Wrapper.DOUBLE, x, cast).doubleValue();
     }
 
-    private static MethodType unboxType(Wrapper wrap) {
+    private static MethodType unboxType(Wrapper wrap, int kind) {
+        if (kind == 0)
+            return MethodType.methodType(wrap.primitiveType(), wrap.wrapperType());
         return MethodType.methodType(wrap.primitiveType(), Object.class, boolean.class);
     }
 
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            UNBOX_CONVERSIONS = newWrapperCaches(2);
+    private static final WrapperCache[] UNBOX_CONVERSIONS = newWrapperCaches(4);
 
-    private static MethodHandle unbox(Wrapper wrap, boolean cast) {
-        EnumMap<Wrapper, MethodHandle> cache = UNBOX_CONVERSIONS[(cast?1:0)];
+    private static MethodHandle unbox(Wrapper wrap, int kind) {
+        // kind 0 -> strongly typed with NPE
+        // kind 1 -> strongly typed but zero for null,
+        // kind 2 -> asType rules: accept multiple box types but only widening conversions with NPE
+        // kind 3 -> explicitCastArguments rules: allow narrowing conversions, zero for null
+        WrapperCache cache = UNBOX_CONVERSIONS[kind];
         MethodHandle mh = cache.get(wrap);
         if (mh != null) {
             return mh;
@@ -135,41 +160,59 @@
         // slow path
         switch (wrap) {
             case OBJECT:
-                mh = IDENTITY; break;
             case VOID:
-                mh = IGNORE; break;
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
+                throw new IllegalArgumentException("unbox "+wrap);
         }
         // look up the method
         String name = "unbox" + wrap.wrapperSimpleName();
-        MethodType type = unboxType(wrap);
+        MethodType type = unboxType(wrap, kind);
         try {
             mh = IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
         } catch (ReflectiveOperationException ex) {
             mh = null;
         }
         if (mh != null) {
-            mh = MethodHandles.insertArguments(mh, 1, cast);
-            cache.put(wrap, mh);
-            return mh;
+            if (kind > 0) {
+                boolean cast = (kind != 2);
+                mh = MethodHandles.insertArguments(mh, 1, cast);
+            }
+            if (kind == 1) {  // casting but exact (null -> zero)
+                mh = mh.asType(unboxType(wrap, 0));
+            }
+            return cache.put(wrap, mh);
         }
         throw new IllegalArgumentException("cannot find unbox adapter for " + wrap
-                + (cast ? " (cast)" : ""));
+                + (kind <= 1 ? " (exact)" : kind == 3 ? " (cast)" : ""));
     }
 
+    /** Return an exact unboxer for the given primitive type. */
+    public static MethodHandle unboxExact(Wrapper type) {
+        return unbox(type, 0);
+    }
+
+    /** Return an exact unboxer for the given primitive type, with optional null-to-zero conversion.
+     *  The boolean says whether to throw an NPE on a null value (false means unbox a zero).
+     *  The type of the unboxer is of a form like (Integer)int.
+     */
+    public static MethodHandle unboxExact(Wrapper type, boolean throwNPE) {
+        return unbox(type, throwNPE ? 0 : 1);
+    }
+
+    /** Return a widening unboxer for the given primitive type.
+     *  Widen narrower primitive boxes to the given type.
+     *  Do not narrow any primitive values or convert null to zero.
+     *  The type of the unboxer is of a form like (Object)int.
+     */
+    public static MethodHandle unboxWiden(Wrapper type) {
+        return unbox(type, 2);
+    }
+
+    /** Return a casting unboxer for the given primitive type.
+     *  Widen or narrow primitive values to the given type, or convert null to zero, as needed.
+     *  The type of the unboxer is of a form like (Object)int.
+     */
     public static MethodHandle unboxCast(Wrapper type) {
-        return unbox(type, true);
-    }
-
-    public static MethodHandle unbox(Class<?> type) {
-        return unbox(Wrapper.forPrimitiveType(type), false);
-    }
-
-    public static MethodHandle unboxCast(Class<?> type) {
-        return unbox(Wrapper.forPrimitiveType(type), true);
+        return unbox(type, 3);
     }
 
     static private final Integer ZERO_INT = 0, ONE_INT = 1;
@@ -266,57 +309,26 @@
         return MethodType.methodType(boxType, wrap.primitiveType());
     }
 
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            BOX_CONVERSIONS = newWrapperCaches(2);
+    private static final WrapperCache[] BOX_CONVERSIONS = newWrapperCaches(1);
 
-    private static MethodHandle box(Wrapper wrap, boolean exact) {
-        EnumMap<Wrapper, MethodHandle> cache = BOX_CONVERSIONS[(exact?1:0)];
+    public static MethodHandle boxExact(Wrapper wrap) {
+        WrapperCache cache = BOX_CONVERSIONS[0];
         MethodHandle mh = cache.get(wrap);
         if (mh != null) {
             return mh;
         }
-        // slow path
-        switch (wrap) {
-            case OBJECT:
-                mh = IDENTITY; break;
-            case VOID:
-                mh = ZERO_OBJECT;
-                break;
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
         // look up the method
         String name = "box" + wrap.wrapperSimpleName();
         MethodType type = boxType(wrap);
-        if (exact) {
-            try {
-                mh = IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
-            } catch (ReflectiveOperationException ex) {
-                mh = null;
-            }
-        } else {
-            mh = box(wrap, !exact).asType(type.erase());
+        try {
+            mh = IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
+        } catch (ReflectiveOperationException ex) {
+            mh = null;
         }
         if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
+            return cache.put(wrap, mh);
         }
-        throw new IllegalArgumentException("cannot find box adapter for "
-                + wrap + (exact ? " (exact)" : ""));
-    }
-
-    public static MethodHandle box(Class<?> type) {
-        boolean exact = false;
-        // e.g., boxShort(short)Short if exact,
-        // e.g., boxShort(short)Object if !exact
-        return box(Wrapper.forPrimitiveType(type), exact);
-    }
-
-    public static MethodHandle box(Wrapper type) {
-        boolean exact = false;
-        return box(type, exact);
+        throw new IllegalArgumentException("cannot find box adapter for " + wrap);
     }
 
     /// Constant functions
@@ -348,11 +360,10 @@
         return 0;
     }
 
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            CONSTANT_FUNCTIONS = newWrapperCaches(2);
+    private static final WrapperCache[] CONSTANT_FUNCTIONS = newWrapperCaches(2);
 
     public static MethodHandle zeroConstantFunction(Wrapper wrap) {
-        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[0];
+        WrapperCache cache = CONSTANT_FUNCTIONS[0];
         MethodHandle mh = cache.get(wrap);
         if (mh != null) {
             return mh;
@@ -373,184 +384,37 @@
                 break;
         }
         if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
+            return cache.put(wrap, mh);
         }
 
         // use zeroInt and cast the result
         if (wrap.isSubwordOrInt() && wrap != Wrapper.INT) {
             mh = MethodHandles.explicitCastArguments(zeroConstantFunction(Wrapper.INT), type);
-            cache.put(wrap, mh);
-            return mh;
+            return cache.put(wrap, mh);
         }
         throw new IllegalArgumentException("cannot find zero constant for " + wrap);
     }
 
-    /// Converting references to references.
-
-    /**
-     * Identity function.
-     * @param x an arbitrary reference value
-     * @return the same value x
-     */
-    static <T> T identity(T x) {
-        return x;
-    }
-
-    static <T> T[] identity(T[] x) {
-        return x;
-    }
-
-    /**
-     * Identity function on ints.
-     * @param x an arbitrary int value
-     * @return the same value x
-     */
-    static int identity(int x) {
-        return x;
-    }
-
-    static byte identity(byte x) {
-        return x;
-    }
-
-    static short identity(short x) {
-        return x;
-    }
-
-    static boolean identity(boolean x) {
-        return x;
-    }
-
-    static char identity(char x) {
-        return x;
-    }
-
-    /**
-     * Identity function on longs.
-     * @param x an arbitrary long value
-     * @return the same value x
-     */
-    static long identity(long x) {
-        return x;
-    }
-
-    static float identity(float x) {
-        return x;
-    }
-
-    static double identity(double x) {
-        return x;
-    }
-
-    private static ClassCastException newClassCastException(Class<?> t, Object obj) {
-        return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName());
-    }
-
-    private static final MethodHandle IDENTITY, CAST_REFERENCE, ZERO_OBJECT, IGNORE, EMPTY,
-            ARRAY_IDENTITY, FILL_NEW_TYPED_ARRAY, FILL_NEW_ARRAY;
+    private static final MethodHandle CAST_REFERENCE, IGNORE, EMPTY;
     static {
         try {
             MethodType idType = MethodType.genericMethodType(1);
             MethodType ignoreType = idType.changeReturnType(void.class);
-            MethodType zeroObjectType = MethodType.genericMethodType(0);
-            IDENTITY = IMPL_LOOKUP.findStatic(THIS_CLASS, "identity", idType);
             CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType);
-            ZERO_OBJECT = IMPL_LOOKUP.findStatic(THIS_CLASS, "zeroObject", zeroObjectType);
             IGNORE = IMPL_LOOKUP.findStatic(THIS_CLASS, "ignore", ignoreType);
             EMPTY = IMPL_LOOKUP.findStatic(THIS_CLASS, "empty", ignoreType.dropParameterTypes(0, 1));
-            ARRAY_IDENTITY = IMPL_LOOKUP.findStatic(THIS_CLASS, "identity", MethodType.methodType(Object[].class, Object[].class));
-            FILL_NEW_ARRAY = IMPL_LOOKUP
-                    .findStatic(THIS_CLASS, "fillNewArray",
-                          MethodType.methodType(Object[].class, Integer.class, Object[].class));
-            FILL_NEW_TYPED_ARRAY = IMPL_LOOKUP
-                    .findStatic(THIS_CLASS, "fillNewTypedArray",
-                          MethodType.methodType(Object[].class, Object[].class, Integer.class, Object[].class));
         } catch (NoSuchMethodException | IllegalAccessException ex) {
             throw newInternalError("uncaught exception", ex);
         }
     }
 
-    // Varargs methods need to be in a separately initialized class, to avoid bootstrapping problems.
-    static class LazyStatics {
-        private static final MethodHandle COPY_AS_REFERENCE_ARRAY, COPY_AS_PRIMITIVE_ARRAY, MAKE_LIST;
-        static {
-            try {
-                //MAKE_ARRAY = IMPL_LOOKUP.findStatic(THIS_CLASS, "makeArray", MethodType.methodType(Object[].class, Object[].class));
-                COPY_AS_REFERENCE_ARRAY = IMPL_LOOKUP.findStatic(THIS_CLASS, "copyAsReferenceArray", MethodType.methodType(Object[].class, Class.class, Object[].class));
-                COPY_AS_PRIMITIVE_ARRAY = IMPL_LOOKUP.findStatic(THIS_CLASS, "copyAsPrimitiveArray", MethodType.methodType(Object.class, Wrapper.class, Object[].class));
-                MAKE_LIST = IMPL_LOOKUP.findStatic(THIS_CLASS, "makeList", MethodType.methodType(List.class, Object[].class));
-            } catch (ReflectiveOperationException ex) {
-                throw newInternalError("uncaught exception", ex);
-            }
-        }
+    public static MethodHandle ignore() {
+        return IGNORE;
     }
 
-    private static final EnumMap<Wrapper, MethodHandle>[] WRAPPER_CASTS
-            = newWrapperCaches(1);
-
-    /** Return a method that casts its sole argument (an Object) to the given type
-     *  and returns it as the given type.
-     */
-    public static MethodHandle cast(Class<?> type) {
-        return cast(type, CAST_REFERENCE);
-    }
-    public static MethodHandle cast(Class<?> type, MethodHandle castReference) {
-        if (type.isPrimitive())  throw new IllegalArgumentException("cannot cast primitive type "+type);
-        MethodHandle mh;
-        Wrapper wrap = null;
-        EnumMap<Wrapper, MethodHandle> cache = null;
-        if (Wrapper.isWrapperType(type)) {
-            wrap = Wrapper.forWrapperType(type);
-            cache = WRAPPER_CASTS[0];
-            mh = cache.get(wrap);
-            if (mh != null)  return mh;
-        }
-        mh = MethodHandles.insertArguments(castReference, 0, type);
-        if (cache != null)
-            cache.put(wrap, mh);
-        return mh;
-    }
-
-    public static MethodHandle identity() {
-        return IDENTITY;
-    }
-
-    public static MethodHandle identity(Class<?> type) {
-        if (!type.isPrimitive())
-            // Reference identity has been moved into MethodHandles:
-            return MethodHandles.identity(type);
-        return identity(Wrapper.findPrimitiveType(type));
-    }
-
-    public static MethodHandle identity(Wrapper wrap) {
-        EnumMap<Wrapper, MethodHandle> cache = CONSTANT_FUNCTIONS[1];
-        MethodHandle mh = cache.get(wrap);
-        if (mh != null) {
-            return mh;
-        }
-        // slow path
-        MethodType type = MethodType.methodType(wrap.primitiveType());
-        if (wrap != Wrapper.VOID)
-            type = type.appendParameterTypes(wrap.primitiveType());
-        try {
-            mh = IMPL_LOOKUP.findStatic(THIS_CLASS, "identity", type);
-        } catch (ReflectiveOperationException ex) {
-            mh = null;
-        }
-        if (mh == null && wrap == Wrapper.VOID) {
-            mh = EMPTY;  // #(){} : #()void
-        }
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-
-        if (mh != null) {
-            cache.put(wrap, mh);
-            return mh;
-        }
-        throw new IllegalArgumentException("cannot find identity for " + wrap);
+    /** Return a method that casts its second argument (an Object) to the given type (a Class). */
+    public static MethodHandle cast() {
+        return CAST_REFERENCE;
     }
 
     /// Primitive conversions.
@@ -759,11 +623,10 @@
         return (x ? (byte)1 : (byte)0);
     }
 
-    private static final EnumMap<Wrapper, MethodHandle>[]
-            CONVERT_PRIMITIVE_FUNCTIONS = newWrapperCaches(Wrapper.values().length);
+    private static final WrapperCache[] CONVERT_PRIMITIVE_FUNCTIONS = newWrapperCaches(Wrapper.values().length);
 
     public static MethodHandle convertPrimitive(Wrapper wsrc, Wrapper wdst) {
-        EnumMap<Wrapper, MethodHandle> cache = CONVERT_PRIMITIVE_FUNCTIONS[wsrc.ordinal()];
+        WrapperCache cache = CONVERT_PRIMITIVE_FUNCTIONS[wsrc.ordinal()];
         MethodHandle mh = cache.get(wdst);
         if (mh != null) {
             return mh;
@@ -771,17 +634,9 @@
         // slow path
         Class<?> src = wsrc.primitiveType();
         Class<?> dst = wdst.primitiveType();
-        MethodType type = src == void.class ? MethodType.methodType(dst) : MethodType.methodType(dst, src);
+        MethodType type = MethodType.methodType(dst, src);
         if (wsrc == wdst) {
-            mh = identity(src);
-        } else if (wsrc == Wrapper.VOID) {
-            mh = zeroConstantFunction(wdst);
-        } else if (wdst == Wrapper.VOID) {
-            mh = MethodHandles.dropArguments(EMPTY, 0, src);  // Defer back to MethodHandles.
-        } else if (wsrc == Wrapper.OBJECT) {
-            mh = unboxCast(dst);
-        } else if (wdst == Wrapper.OBJECT) {
-            mh = box(src);
+            mh = MethodHandles.identity(src);
         } else {
             assert(src.isPrimitive() && dst.isPrimitive());
             try {
@@ -792,8 +647,7 @@
         }
         if (mh != null) {
             assert(mh.type() == type) : mh;
-            cache.put(wdst, mh);
-            return mh;
+            return cache.put(wdst, mh);
         }
 
         throw new IllegalArgumentException("cannot find primitive conversion function for " +
@@ -808,363 +662,6 @@
         return Character.toUpperCase(x.charAt(0))+x.substring(1);
     }
 
-    /// Collection of multiple arguments.
-
-    public static Object convertArrayElements(Class<?> arrayType, Object array) {
-        Class<?> src = array.getClass().getComponentType();
-        Class<?> dst = arrayType.getComponentType();
-        if (src == null || dst == null)  throw new IllegalArgumentException("not array type");
-        Wrapper sw = (src.isPrimitive() ? Wrapper.forPrimitiveType(src) : null);
-        Wrapper dw = (dst.isPrimitive() ? Wrapper.forPrimitiveType(dst) : null);
-        int length;
-        if (sw == null) {
-            Object[] a = (Object[]) array;
-            length = a.length;
-            if (dw == null)
-                return Arrays.copyOf(a, length, arrayType.asSubclass(Object[].class));
-            Object res = dw.makeArray(length);
-            dw.copyArrayUnboxing(a, 0, res, 0, length);
-            return res;
-        }
-        length = java.lang.reflect.Array.getLength(array);
-        Object[] res;
-        if (dw == null) {
-            res = Arrays.copyOf(NO_ARGS_ARRAY, length, arrayType.asSubclass(Object[].class));
-        } else {
-            res = new Object[length];
-        }
-        sw.copyArrayBoxing(array, 0, res, 0, length);
-        if (dw == null)  return res;
-        Object a = dw.makeArray(length);
-        dw.copyArrayUnboxing(res, 0, a, 0, length);
-        return a;
-    }
-
-    private static MethodHandle findCollector(String name, int nargs, Class<?> rtype, Class<?>... ptypes) {
-        MethodType type = MethodType.genericMethodType(nargs)
-                .changeReturnType(rtype)
-                .insertParameterTypes(0, ptypes);
-        try {
-            return IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
-        } catch (ReflectiveOperationException ex) {
-            return null;
-        }
-    }
-
-    private static final Object[] NO_ARGS_ARRAY = {};
-    private static Object[] makeArray(Object... args) { return args; }
-    private static Object[] array() { return NO_ARGS_ARRAY; }
-    private static Object[] array(Object a0)
-                { return makeArray(a0); }
-    private static Object[] array(Object a0, Object a1)
-                { return makeArray(a0, a1); }
-    private static Object[] array(Object a0, Object a1, Object a2)
-                { return makeArray(a0, a1, a2); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3)
-                { return makeArray(a0, a1, a2, a3); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4)
-                { return makeArray(a0, a1, a2, a3, a4); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5)
-                { return makeArray(a0, a1, a2, a3, a4, a5); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static Object[] array(Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8, Object a9)
-                { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    private static MethodHandle[] makeArrays() {
-        ArrayList<MethodHandle> mhs = new ArrayList<>();
-        for (;;) {
-            MethodHandle mh = findCollector("array", mhs.size(), Object[].class);
-            if (mh == null)  break;
-            mhs.add(mh);
-        }
-        assert(mhs.size() == 11);  // current number of methods
-        return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
-    }
-    private static final MethodHandle[] ARRAYS = makeArrays();
-
-    // filling versions of the above:
-    // using Integer len instead of int len and no varargs to avoid bootstrapping problems
-    private static Object[] fillNewArray(Integer len, Object[] /*not ...*/ args) {
-        Object[] a = new Object[len];
-        fillWithArguments(a, 0, args);
-        return a;
-    }
-    private static Object[] fillNewTypedArray(Object[] example, Integer len, Object[] /*not ...*/ args) {
-        Object[] a = Arrays.copyOf(example, len);
-        fillWithArguments(a, 0, args);
-        return a;
-    }
-    private static void fillWithArguments(Object[] a, int pos, Object... args) {
-        System.arraycopy(args, 0, a, pos, args.length);
-    }
-    // using Integer pos instead of int pos to avoid bootstrapping problems
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0)
-                { fillWithArguments(a, pos, a0); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1)
-                { fillWithArguments(a, pos, a0, a1); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2)
-                { fillWithArguments(a, pos, a0, a1, a2); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3)
-                { fillWithArguments(a, pos, a0, a1, a2, a3); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7, a8); return a; }
-    private static Object[] fillArray(Integer pos, Object[] a, Object a0, Object a1, Object a2, Object a3,
-                                  Object a4, Object a5, Object a6, Object a7,
-                                  Object a8, Object a9)
-                { fillWithArguments(a, pos, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); return a; }
-    private static MethodHandle[] makeFillArrays() {
-        ArrayList<MethodHandle> mhs = new ArrayList<>();
-        mhs.add(null);  // there is no empty fill; at least a0 is required
-        for (;;) {
-            MethodHandle mh = findCollector("fillArray", mhs.size(), Object[].class, Integer.class, Object[].class);
-            if (mh == null)  break;
-            mhs.add(mh);
-        }
-        assert(mhs.size() == 11);  // current number of methods
-        return mhs.toArray(new MethodHandle[0]);
-    }
-    private static final MethodHandle[] FILL_ARRAYS = makeFillArrays();
-
-    private static Object[] copyAsReferenceArray(Class<? extends Object[]> arrayType, Object... a) {
-        return Arrays.copyOf(a, a.length, arrayType);
-    }
-    private static Object copyAsPrimitiveArray(Wrapper w, Object... boxes) {
-        Object a = w.makeArray(boxes.length);
-        w.copyArrayUnboxing(boxes, 0, a, 0, boxes.length);
-        return a;
-    }
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns an Object array of them, as if for varargs.
-     */
-    public static MethodHandle varargsArray(int nargs) {
-        MethodHandle mh = ARRAYS[nargs];
-        if (mh != null)  return mh;
-        mh = findCollector("array", nargs, Object[].class);
-        if (mh != null)  return ARRAYS[nargs] = mh;
-        mh = buildVarargsArray(FILL_NEW_ARRAY, ARRAY_IDENTITY, nargs);
-        assert(assertCorrectArity(mh, nargs));
-        return ARRAYS[nargs] = mh;
-    }
-
-    private static boolean assertCorrectArity(MethodHandle mh, int arity) {
-        assert(mh.type().parameterCount() == arity) : "arity != "+arity+": "+mh;
-        return true;
-    }
-
-    private static MethodHandle buildVarargsArray(MethodHandle newArray, MethodHandle finisher, int nargs) {
-        // Build up the result mh as a sequence of fills like this:
-        //   finisher(fill(fill(newArrayWA(23,x1..x10),10,x11..x20),20,x21..x23))
-        // The various fill(_,10*I,___*[J]) are reusable.
-        int leftLen = Math.min(nargs, LEFT_ARGS);  // absorb some arguments immediately
-        int rightLen = nargs - leftLen;
-        MethodHandle leftCollector = newArray.bindTo(nargs);
-        leftCollector = leftCollector.asCollector(Object[].class, leftLen);
-        MethodHandle mh = finisher;
-        if (rightLen > 0) {
-            MethodHandle rightFiller = fillToRight(LEFT_ARGS + rightLen);
-            if (mh == ARRAY_IDENTITY)
-                mh = rightFiller;
-            else
-                mh = MethodHandles.collectArguments(mh, 0, rightFiller);
-        }
-        if (mh == ARRAY_IDENTITY)
-            mh = leftCollector;
-        else
-            mh = MethodHandles.collectArguments(mh, 0, leftCollector);
-        return mh;
-    }
-
-    private static final int LEFT_ARGS = (FILL_ARRAYS.length - 1);
-    private static final MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
-    /** fill_array_to_right(N).invoke(a, argL..arg[N-1])
-     *  fills a[L]..a[N-1] with corresponding arguments,
-     *  and then returns a.  The value L is a global constant (LEFT_ARGS).
-     */
-    private static MethodHandle fillToRight(int nargs) {
-        MethodHandle filler = FILL_ARRAY_TO_RIGHT[nargs];
-        if (filler != null)  return filler;
-        filler = buildFiller(nargs);
-        assert(assertCorrectArity(filler, nargs - LEFT_ARGS + 1));
-        return FILL_ARRAY_TO_RIGHT[nargs] = filler;
-    }
-    private static MethodHandle buildFiller(int nargs) {
-        if (nargs <= LEFT_ARGS)
-            return ARRAY_IDENTITY;  // no args to fill; return the array unchanged
-        // we need room for both mh and a in mh.invoke(a, arg*[nargs])
-        final int CHUNK = LEFT_ARGS;
-        int rightLen = nargs % CHUNK;
-        int midLen = nargs - rightLen;
-        if (rightLen == 0) {
-            midLen = nargs - (rightLen = CHUNK);
-            if (FILL_ARRAY_TO_RIGHT[midLen] == null) {
-                // build some precursors from left to right
-                for (int j = LEFT_ARGS % CHUNK; j < midLen; j += CHUNK)
-                    if (j > LEFT_ARGS)  fillToRight(j);
-            }
-        }
-        if (midLen < LEFT_ARGS) rightLen = nargs - (midLen = LEFT_ARGS);
-        assert(rightLen > 0);
-        MethodHandle midFill = fillToRight(midLen);  // recursive fill
-        MethodHandle rightFill = FILL_ARRAYS[rightLen].bindTo(midLen);  // [midLen..nargs-1]
-        assert(midFill.type().parameterCount()   == 1 + midLen - LEFT_ARGS);
-        assert(rightFill.type().parameterCount() == 1 + rightLen);
-
-        // Combine the two fills:
-        //   right(mid(a, x10..x19), x20..x23)
-        // The final product will look like this:
-        //   right(mid(newArrayLeft(24, x0..x9), x10..x19), x20..x23)
-        if (midLen == LEFT_ARGS)
-            return rightFill;
-        else
-            return MethodHandles.collectArguments(rightFill, 0, midFill);
-    }
-
-    // Type-polymorphic version of varargs maker.
-    private static final ClassValue<MethodHandle[]> TYPED_COLLECTORS
-        = new ClassValue<MethodHandle[]>() {
-            @Override
-            protected MethodHandle[] computeValue(Class<?> type) {
-                return new MethodHandle[256];
-            }
-    };
-
-    static final int MAX_JVM_ARITY = 255;  // limit imposed by the JVM
-
-    /** Return a method handle that takes the indicated number of
-     *  typed arguments and returns an array of them.
-     *  The type argument is the array type.
-     */
-    public static MethodHandle varargsArray(Class<?> arrayType, int nargs) {
-        Class<?> elemType = arrayType.getComponentType();
-        if (elemType == null)  throw new IllegalArgumentException("not an array: "+arrayType);
-        // FIXME: Need more special casing and caching here.
-        if (nargs >= MAX_JVM_ARITY/2 - 1) {
-            int slots = nargs;
-            final int MAX_ARRAY_SLOTS = MAX_JVM_ARITY - 1;  // 1 for receiver MH
-            if (arrayType == double[].class || arrayType == long[].class)
-                slots *= 2;
-            if (slots > MAX_ARRAY_SLOTS)
-                throw new IllegalArgumentException("too many arguments: "+arrayType.getSimpleName()+", length "+nargs);
-        }
-        if (elemType == Object.class)
-            return varargsArray(nargs);
-        // other cases:  primitive arrays, subtypes of Object[]
-        MethodHandle cache[] = TYPED_COLLECTORS.get(elemType);
-        MethodHandle mh = nargs < cache.length ? cache[nargs] : null;
-        if (mh != null)  return mh;
-        if (elemType.isPrimitive()) {
-            MethodHandle builder = FILL_NEW_ARRAY;
-            MethodHandle producer = buildArrayProducer(arrayType);
-            mh = buildVarargsArray(builder, producer, nargs);
-        } else {
-            @SuppressWarnings("unchecked")
-            Class<? extends Object[]> objArrayType = (Class<? extends Object[]>) arrayType;
-            Object[] example = Arrays.copyOf(NO_ARGS_ARRAY, 0, objArrayType);
-            MethodHandle builder = FILL_NEW_TYPED_ARRAY.bindTo(example);
-            MethodHandle producer = ARRAY_IDENTITY;
-            mh = buildVarargsArray(builder, producer, nargs);
-        }
-        mh = mh.asType(MethodType.methodType(arrayType, Collections.<Class<?>>nCopies(nargs, elemType)));
-        assert(assertCorrectArity(mh, nargs));
-        if (nargs < cache.length)
-            cache[nargs] = mh;
-        return mh;
-    }
-
-    private static MethodHandle buildArrayProducer(Class<?> arrayType) {
-        Class<?> elemType = arrayType.getComponentType();
-        if (elemType.isPrimitive())
-            return LazyStatics.COPY_AS_PRIMITIVE_ARRAY.bindTo(Wrapper.forPrimitiveType(elemType));
-        else
-            return LazyStatics.COPY_AS_REFERENCE_ARRAY.bindTo(arrayType);
-    }
-
-    // List version of varargs maker.
-
-    private static final List<Object> NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY);
-    private static List<Object> makeList(Object... args) { return Arrays.asList(args); }
-    private static List<Object> list() { return NO_ARGS_LIST; }
-    private static List<Object> list(Object a0)
-                { return makeList(a0); }
-    private static List<Object> list(Object a0, Object a1)
-                { return makeList(a0, a1); }
-    private static List<Object> list(Object a0, Object a1, Object a2)
-                { return makeList(a0, a1, a2); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3)
-                { return makeList(a0, a1, a2, a3); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4)
-                { return makeList(a0, a1, a2, a3, a4); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5)
-                { return makeList(a0, a1, a2, a3, a4, a5); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); }
-    private static List<Object> list(Object a0, Object a1, Object a2, Object a3,
-                                     Object a4, Object a5, Object a6, Object a7,
-                                     Object a8, Object a9)
-                { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
-    private static MethodHandle[] makeLists() {
-        ArrayList<MethodHandle> mhs = new ArrayList<>();
-        for (;;) {
-            MethodHandle mh = findCollector("list", mhs.size(), List.class);
-            if (mh == null)  break;
-            mhs.add(mh);
-        }
-        assert(mhs.size() == 11);  // current number of methods
-        return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
-    }
-    private static final MethodHandle[] LISTS = makeLists();
-
-    /** Return a method handle that takes the indicated number of Object
-     *  arguments and returns a List.
-     */
-    public static MethodHandle varargsList(int nargs) {
-        MethodHandle mh = LISTS[nargs];
-        if (mh != null)  return mh;
-        mh = findCollector("list", nargs, List.class);
-        if (mh != null)  return LISTS[nargs] = mh;
-        return LISTS[nargs] = buildVarargsList(nargs);
-    }
-    private static MethodHandle buildVarargsList(int nargs) {
-        return MethodHandles.filterReturnValue(varargsArray(nargs), LazyStatics.MAKE_LIST);
-    }
-
     // handy shared exception makers (they simplify the common case code)
     private static InternalError newInternalError(String message, Throwable cause) {
         return new InternalError(message, cause);
diff --git a/src/share/classes/sun/invoke/util/VerifyType.java b/src/share/classes/sun/invoke/util/VerifyType.java
index 52b32c4..ce37b88 100644
--- a/src/share/classes/sun/invoke/util/VerifyType.java
+++ b/src/share/classes/sun/invoke/util/VerifyType.java
@@ -40,18 +40,38 @@
     /**
      * True if a value can be stacked as the source type and unstacked as the
      * destination type, without violating the JVM's type consistency.
+     * <p>
+     * If both types are references, we apply the verifier's subclass check
+     * (or subtyping, if keepInterfaces).
+     * If the src type is a type guaranteed to be null (Void) it can be converted
+     * to any other reference type.
+     * <p>
+     * If both types are primitives, we apply the verifier's primitive conversions.
+     * These do not include Java conversions such as long to double, since those
+     * require computation and (in general) stack depth changes.
+     * But very simple 32-bit viewing changes, such as byte to int,
+     * are null conversions, because they do not require any computation.
+     * These conversions are from any type to a wider type up to 32 bits,
+     * as long as the conversion is not signed to unsigned (byte to char).
+     * <p>
+     * The primitive type 'void' does not interconvert with any other type,
+     * even though it is legal to drop any type from the stack and "return void".
+     * The stack effects, though are different between void and any other type,
+     * so it is safer to report a non-trivial conversion.
      *
      * @param src the type of a stacked value
      * @param dst the type by which we'd like to treat it
+     * @param keepInterfaces if false, we treat any interface as if it were Object
      * @return whether the retyping can be done without motion or reformatting
      */
-    public static boolean isNullConversion(Class<?> src, Class<?> dst) {
+    public static boolean isNullConversion(Class<?> src, Class<?> dst, boolean keepInterfaces) {
         if (src == dst)            return true;
         // Verifier allows any interface to be treated as Object:
-        if (dst.isInterface())     dst = Object.class;
-        if (src.isInterface())     src = Object.class;
-        if (src == dst)            return true;  // check again
-        if (dst == void.class)     return true;  // drop any return value
+        if (!keepInterfaces) {
+            if (dst.isInterface())  dst = Object.class;
+            if (src.isInterface())  src = Object.class;
+            if (src == dst)         return true;  // check again
+        }
         if (isNullType(src))       return !dst.isPrimitive();
         if (!src.isPrimitive())    return dst.isAssignableFrom(src);
         if (!dst.isPrimitive())    return false;
@@ -82,25 +102,13 @@
      * Is the given type java.lang.Null or an equivalent null-only type?
      */
     public static boolean isNullType(Class<?> type) {
-        if (type == null)  return false;
-        return type == NULL_CLASS
-            // This one may also be used as a null type.
-            // TO DO: Decide if we really want to legitimize it here.
-            // Probably we do, unless java.lang.Null really makes it into Java 7
-            //|| type == Void.class
-            // Locally known null-only class:
-            || type == Empty.class
-            ;
-    }
-    private static final Class<?> NULL_CLASS;
-    static {
-        Class<?> nullClass = null;
-        try {
-            nullClass = Class.forName("java.lang.Null");
-        } catch (ClassNotFoundException ex) {
-            // OK, we'll cope
-        }
-        NULL_CLASS = nullClass;
+        // Any reference statically typed as Void is guaranteed to be null.
+        // Therefore, it can be safely treated as a value of any
+        // other type that admits null, i.e., a reference type.
+        if (type == Void.class)  return true;
+        // Locally known null-only class:
+        if (type == Empty.class)  return true;
+        return false;
     }
 
     /**
@@ -111,14 +119,14 @@
      * @param recv the type of the method handle receiving the call
      * @return whether the retyping can be done without motion or reformatting
      */
-    public static boolean isNullConversion(MethodType call, MethodType recv) {
+    public static boolean isNullConversion(MethodType call, MethodType recv, boolean keepInterfaces) {
         if (call == recv)  return true;
         int len = call.parameterCount();
         if (len != recv.parameterCount())  return false;
         for (int i = 0; i < len; i++)
-            if (!isNullConversion(call.parameterType(i), recv.parameterType(i)))
+            if (!isNullConversion(call.parameterType(i), recv.parameterType(i), keepInterfaces))
                 return false;
-        return isNullConversion(recv.returnType(), call.returnType());
+        return isNullConversion(recv.returnType(), call.returnType(), keepInterfaces);
     }
 
     /**
diff --git a/src/share/classes/sun/invoke/util/Wrapper.java b/src/share/classes/sun/invoke/util/Wrapper.java
index 6c4be45..0a0d04b 100644
--- a/src/share/classes/sun/invoke/util/Wrapper.java
+++ b/src/share/classes/sun/invoke/util/Wrapper.java
@@ -26,19 +26,19 @@
 package sun.invoke.util;
 
 public enum Wrapper {
-    BOOLEAN(Boolean.class, boolean.class, 'Z', (Boolean)false, new boolean[0], Format.unsigned(1)),
+    //        wrapperType    primitiveType  char            zero         emptyArray          format
+    BOOLEAN(  Boolean.class, boolean.class, 'Z',      (Boolean)false, new boolean[0], Format.unsigned( 1)),
     // These must be in the order defined for widening primitive conversions in JLS 5.1.2
-    BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed(8)),
-    SHORT(Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed(16)),
-    CHAR(Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)),
-    INT(Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed(32)),
-    LONG(Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed(64)),
-    FLOAT(Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)),
-    DOUBLE(Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)),
-    //NULL(Null.class, null.class, 'N', null, null, Format.other(1)),
-    OBJECT(Object.class, Object.class, 'L', null, new Object[0], Format.other(1)),
+    BYTE   (     Byte.class,    byte.class, 'B',       (Byte)(byte)0, new    byte[0], Format.signed(   8)),
+    SHORT  (    Short.class,   short.class, 'S',     (Short)(short)0, new   short[0], Format.signed(  16)),
+    CHAR   (Character.class,    char.class, 'C',  (Character)(char)0, new    char[0], Format.unsigned(16)),
+    INT    (  Integer.class,     int.class, 'I', (Integer)/*(int)*/0, new     int[0], Format.signed(  32)),
+    LONG   (     Long.class,    long.class, 'J',       (Long)(long)0, new    long[0], Format.signed(  64)),
+    FLOAT  (    Float.class,   float.class, 'F',     (Float)(float)0, new   float[0], Format.floating(32)),
+    DOUBLE (   Double.class,  double.class, 'D',   (Double)(double)0, new  double[0], Format.floating(64)),
+    OBJECT (   Object.class,  Object.class, 'L',                null, new  Object[0], Format.other(    1)),
     // VOID must be the last type, since it is "assignable" from any other type:
-    VOID(Void.class, void.class, 'V', null, null, Format.other(0)),
+    VOID   (     Void.class,    void.class, 'V',                null,           null, Format.other(    0)),
     ;
 
     private final Class<?> wrapperType;
@@ -230,14 +230,6 @@
      */
     public <T> T zero(Class<T> type) { return convert(zero, type); }
 
-//    /** Produce a wrapper for the given wrapper or primitive type. */
-//    public static Wrapper valueOf(Class<?> type) {
-//        if (isPrimitiveType(type))
-//            return forPrimitiveType(type);
-//        else
-//            return forWrapperType(type);
-//    }
-
     /** Return the wrapper that wraps values of the given type.
      *  The type may be {@code Object}, meaning the {@code OBJECT} wrapper.
      *  Otherwise, the type must be a primitive.
diff --git a/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
index 7fdab9b..89578cc 100644
--- a/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
+++ b/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
@@ -383,7 +383,8 @@
     }
     public static LCMSImageLayout createImageLayout(Raster r) {
         LCMSImageLayout l = new LCMSImageLayout();
-        if (r instanceof ByteComponentRaster) {
+        if (r instanceof ByteComponentRaster &&
+                r.getSampleModel() instanceof ComponentSampleModel) {
             ByteComponentRaster br = (ByteComponentRaster)r;
 
             ComponentSampleModel csm = (ComponentSampleModel)r.getSampleModel();
diff --git a/src/share/classes/sun/java2d/pipe/DrawImage.java b/src/share/classes/sun/java2d/pipe/DrawImage.java
index ac40164..d27ee47 100644
--- a/src/share/classes/sun/java2d/pipe/DrawImage.java
+++ b/src/share/classes/sun/java2d/pipe/DrawImage.java
@@ -278,18 +278,34 @@
                                      Color bgColor, int interpType,
                                      double coords[])
     {
-        double dx = coords[0];
-        double dy = coords[1];
-        double dw = coords[2] - dx;
-        double dh = coords[3] - dy;
+        double dx1 = coords[0];
+        double dy1 = coords[1];
+        double dx2 = coords[2];
+        double dy2 = coords[3];
+        double dw = dx2 - dx1;
+        double dh = dy2 - dy1;
+
+        /* If any of the destination coordinates exceed the integer range,
+         * then the calculations performed in calls made here cannot be
+         * guaranteed to be correct, or to converge (terminate).
+         * So return out of here, deferring to code that can handle this.
+         */
+        if (dx1 < Integer.MIN_VALUE || dx1 > Integer.MAX_VALUE ||
+            dy1 < Integer.MIN_VALUE || dy1 > Integer.MAX_VALUE ||
+            dx2 < Integer.MIN_VALUE || dx2 > Integer.MAX_VALUE ||
+            dy2 < Integer.MIN_VALUE || dy2 > Integer.MAX_VALUE)
+        {
+            return false;
+        }
+
         // First check if width and height are very close to img w&h.
         if (closeToInteger(sx2-sx1, dw) && closeToInteger(sy2-sy1, dh)) {
             // Round location to nearest pixel and then test
             // if it will cause interpolation anomalies.
-            int idx = (int) Math.floor(dx + 0.5);
-            int idy = (int) Math.floor(dy + 0.5);
+            int idx = (int) Math.floor(dx1 + 0.5);
+            int idy = (int) Math.floor(dy1 + 0.5);
             if (interpType == AffineTransformOp.TYPE_NEAREST_NEIGHBOR ||
-                (closeToInteger(idx, dx) && closeToInteger(idy, dy)))
+                (closeToInteger(idx, dx1) && closeToInteger(idy, dy1)))
             {
                 renderImageCopy(sg, img, bgColor,
                                 idx, idy,
@@ -302,7 +318,7 @@
         if (dw > 0 && dh > 0) {
             if (renderImageScale(sg, img, bgColor, interpType,
                                  sx1, sy1, sx2, sy2,
-                                 coords[0], coords[1], coords[2], coords[3]))
+                                 dx1, dy1, dx2, dy2))
             {
                 return true;
             }
diff --git a/src/share/classes/sun/management/ExtendedPlatformComponent.java b/src/share/classes/sun/management/ExtendedPlatformComponent.java
new file mode 100644
index 0000000..ff33ff9
--- /dev/null
+++ b/src/share/classes/sun/management/ExtendedPlatformComponent.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.management;
+
+import java.util.Collections;
+import java.util.List;
+import java.lang.management.PlatformManagedObject;
+
+/**
+ * Class to allow for an extended set of platform MXBeans
+ */
+public final class ExtendedPlatformComponent {
+    private ExtendedPlatformComponent() {} // Don't create any instances
+
+    /**
+     * Get the extended set of platform MXBeans that should be registered in the
+     * platform MBeanServer, or an empty list if there are no such MXBeans.
+     */
+    public static List<? extends PlatformManagedObject> getMXBeans() {
+        return Collections.emptyList();
+    }
+
+    /**
+     * Returns the extended platform MXBean implementing the given
+     * mxbeanInterface, or null if there is no such MXBean.
+     */
+    public static <T extends PlatformManagedObject>
+            T getMXBean(Class<T> mxbeanInterface) {
+        return null;
+    }
+}
diff --git a/src/share/classes/sun/misc/Launcher.java b/src/share/classes/sun/misc/Launcher.java
index 71b3d3b..f72f60e 100644
--- a/src/share/classes/sun/misc/Launcher.java
+++ b/src/share/classes/sun/misc/Launcher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -162,6 +162,8 @@
          */
         public ExtClassLoader(File[] dirs) throws IOException {
             super(getExtURLs(dirs), null, factory);
+            SharedSecrets.getJavaNetAccess().
+                getURLClassPath(this).initLookupCache(this);
         }
 
         private static File[] getExtDirs() {
@@ -285,11 +287,15 @@
             });
         }
 
+        final URLClassPath ucp;
+
         /*
          * Creates a new AppClassLoader
          */
         AppClassLoader(URL[] urls, ClassLoader parent) {
             super(urls, parent, factory);
+            ucp = SharedSecrets.getJavaNetAccess().getURLClassPath(this);
+            ucp.initLookupCache(this);
         }
 
         /**
@@ -305,6 +311,23 @@
                     sm.checkPackageAccess(name.substring(0, i));
                 }
             }
+
+            if (ucp.knownToNotExist(name)) {
+                // The class of the given name is not found in the parent
+                // class loader as well as its local URLClassPath.
+                // Check if this class has already been defined dynamically;
+                // if so, return the loaded class; otherwise, skip the parent
+                // delegation and findClass.
+                Class<?> c = findLoadedClass(name);
+                if (c != null) {
+                    if (resolve) {
+                        resolveClass(c);
+                    }
+                    return c;
+                }
+                throw new ClassNotFoundException(name);
+            }
+
             return (super.loadClass(name, resolve));
         }
 
@@ -386,6 +409,7 @@
                 urls = new URL[0];
             }
             bcp = new URLClassPath(urls, factory);
+            bcp.initLookupCache(null);
         }
     }
 
diff --git a/src/share/classes/sun/misc/URLClassPath.java b/src/share/classes/sun/misc/URLClassPath.java
index 11dae81..f92b1de 100644
--- a/src/share/classes/sun/misc/URLClassPath.java
+++ b/src/share/classes/sun/misc/URLClassPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLClassLoader;
 import java.net.URLConnection;
 import java.net.HttpURLConnection;
 import java.net.URLStreamHandler;
@@ -52,6 +53,7 @@
 import java.security.cert.Certificate;
 import sun.misc.FileURLMapper;
 import sun.net.util.URLUtil;
+import sun.security.action.GetPropertyAction;
 
 /**
  * This class is used to maintain a search path of URLs for loading classes
@@ -63,15 +65,18 @@
     final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
     final static String JAVA_VERSION;
     private static final boolean DEBUG;
+    private static final boolean DEBUG_LOOKUP_CACHE;
     private static final boolean DISABLE_JAR_CHECKING;
 
     static {
         JAVA_VERSION = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("java.version"));
+            new GetPropertyAction("java.version"));
         DEBUG        = (java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
+            new GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
+        DEBUG_LOOKUP_CACHE = (java.security.AccessController.doPrivileged(
+            new GetPropertyAction("sun.misc.URLClassPath.debugLookupCache")) != null);
         String p = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
+            new GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
         DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
     }
 
@@ -149,6 +154,12 @@
 
             urls.add(0, url);
             path.add(url);
+
+            if (lookupCacheURLs != null) {
+                // The lookup cache is no longer valid, since getLookupCache()
+                // does not consider the newly added url.
+                disableAllLookupCaches();
+            }
         }
     }
 
@@ -172,7 +183,8 @@
      */
     public URL findResource(String name, boolean check) {
         Loader loader;
-        for (int i = 0; (loader = getLoader(i)) != null; i++) {
+        int[] cache = getLookupCache(name);
+        for (int i = 0; (loader = getNextLoader(cache, i)) != null; i++) {
             URL url = loader.findResource(name, check);
             if (url != null) {
                 return url;
@@ -195,7 +207,8 @@
         }
 
         Loader loader;
-        for (int i = 0; (loader = getLoader(i)) != null; i++) {
+        int[] cache = getLookupCache(name);
+        for (int i = 0; (loader = getNextLoader(cache, i)) != null; i++) {
             Resource res = loader.getResource(name, check);
             if (res != null) {
                 return res;
@@ -215,6 +228,7 @@
                                      final boolean check) {
         return new Enumeration<URL>() {
             private int index = 0;
+            private int[] cache = getLookupCache(name);
             private URL url = null;
 
             private boolean next() {
@@ -222,7 +236,7 @@
                     return true;
                 } else {
                     Loader loader;
-                    while ((loader = getLoader(index++)) != null) {
+                    while ((loader = getNextLoader(cache, index++)) != null) {
                         url = loader.findResource(name, check);
                         if (url != null) {
                             return true;
@@ -262,6 +276,7 @@
                                     final boolean check) {
         return new Enumeration<Resource>() {
             private int index = 0;
+            private int[] cache = getLookupCache(name);
             private Resource res = null;
 
             private boolean next() {
@@ -269,7 +284,7 @@
                     return true;
                 } else {
                     Loader loader;
-                    while ((loader = getLoader(index++)) != null) {
+                    while ((loader = getNextLoader(cache, index++)) != null) {
                         res = loader.getResource(name, check);
                         if (res != null) {
                             return true;
@@ -298,6 +313,151 @@
         return getResources(name, true);
     }
 
+    private static volatile boolean lookupCacheEnabled
+        = "true".equals(VM.getSavedProperty("sun.cds.enableSharedLookupCache"));
+    private URL[] lookupCacheURLs;
+    private ClassLoader lookupCacheLoader;
+
+    synchronized void initLookupCache(ClassLoader loader) {
+        if ((lookupCacheURLs = getLookupCacheURLs(loader)) != null) {
+            lookupCacheLoader = loader;
+        } else {
+            // This JVM instance does not support lookup cache.
+            disableAllLookupCaches();
+        }
+    }
+
+    static void disableAllLookupCaches() {
+        lookupCacheEnabled = false;
+    }
+
+    private static native URL[] getLookupCacheURLs(ClassLoader loader);
+    private static native int[] getLookupCacheForClassLoader(ClassLoader loader,
+                                                             String name);
+    private static native boolean knownToNotExist0(ClassLoader loader,
+                                                   String className);
+
+    synchronized boolean knownToNotExist(String className) {
+        if (lookupCacheURLs != null && lookupCacheEnabled) {
+            return knownToNotExist0(lookupCacheLoader, className);
+        }
+
+        // Don't know if this class exists or not -- need to do a full search.
+        return false;
+    }
+
+    /**
+     * Returns an array of the index to lookupCacheURLs that may
+     * contain the specified resource. The values in the returned
+     * array are in strictly ascending order and must be a valid index
+     * to lookupCacheURLs array.
+     *
+     * This method returns an empty array if the specified resource
+     * cannot be found in this URLClassPath. If there is no lookup
+     * cache or it's disabled, this method returns null and the lookup
+     * should search the entire classpath.
+     *
+     * Example: if lookupCacheURLs contains {a.jar, b.jar, c.jar, d.jar}
+     * and package "foo" only exists in a.jar and c.jar,
+     * getLookupCache("foo/Bar.class") will return {0, 2}
+     *
+     * @param name the resource name
+     * @return an array of the index to lookupCacheURLs that may contain the
+     *         specified resource; or null if no lookup cache is used.
+     */
+    private synchronized int[] getLookupCache(String name) {
+        if (lookupCacheURLs == null || !lookupCacheEnabled) {
+            return null;
+        }
+
+        int[] cache = getLookupCacheForClassLoader(lookupCacheLoader, name);
+        if (cache != null && cache.length > 0) {
+            int maxindex = cache[cache.length - 1]; // cache[] is strictly ascending.
+            if (!ensureLoaderOpened(maxindex)) {
+                if (DEBUG_LOOKUP_CACHE) {
+                    System.out.println("Expanded loaders FAILED " +
+                                       loaders.size() + " for maxindex=" + maxindex);
+                }
+                return null;
+            }
+        }
+
+        return cache;
+    }
+
+    private boolean ensureLoaderOpened(int index) {
+        if (loaders.size() <= index) {
+            // Open all Loaders up to, and including, index
+            if (getLoader(index) == null) {
+                return false;
+            }
+            if (!lookupCacheEnabled) {
+                // cache was invalidated as the result of the above call.
+                return false;
+            }
+            if (DEBUG_LOOKUP_CACHE) {
+                System.out.println("Expanded loaders " + loaders.size() +
+                                   " to index=" + index);
+            }
+        }
+        return true;
+    }
+
+    /*
+     * The CLASS-PATH attribute was expanded by the VM when building
+     * the resource lookup cache in the same order as the getLoader
+     * method does. This method validates if the URL from the lookup
+     * cache matches the URL of the Loader at the given index;
+     * otherwise, this method disables the lookup cache.
+     */
+    private synchronized void validateLookupCache(int index,
+                                                  String urlNoFragString) {
+        if (lookupCacheURLs != null && lookupCacheEnabled) {
+            if (index < lookupCacheURLs.length &&
+                urlNoFragString.equals(
+                    URLUtil.urlNoFragString(lookupCacheURLs[index]))) {
+                return;
+            }
+            if (DEBUG || DEBUG_LOOKUP_CACHE) {
+                System.out.println("WARNING: resource lookup cache invalidated "
+                                   + "for lookupCacheLoader at " + index);
+            }
+            disableAllLookupCaches();
+        }
+    }
+
+    /**
+     * Returns the next Loader that may contain the resource to
+     * lookup. If the given cache is null, return loaders.get(index)
+     * that may be lazily created; otherwise, cache[index] is the next
+     * Loader that may contain the resource to lookup and so returns
+     * loaders.get(cache[index]).
+     *
+     * If cache is non-null, loaders.get(cache[index]) must be present.
+     *
+     * @param cache lookup cache. If null, search the entire class path
+     * @param index index to the given cache array; or to the loaders list.
+     */
+    private synchronized Loader getNextLoader(int[] cache, int index) {
+        if (closed) {
+            return null;
+        }
+        if (cache != null) {
+            if (index < cache.length) {
+                Loader loader = loaders.get(cache[index]);
+                if (DEBUG_LOOKUP_CACHE) {
+                    System.out.println("HASCACHE: Loading from : " + cache[index]
+                                       + " = " + loader.getBaseURL());
+                }
+                return loader;
+            } else {
+                return null; // finished iterating over cache[]
+            }
+        } else {
+            return getLoader(index);
+        }
+    }
+
     /*
      * Returns the Loader at the specified position in the URL search
      * path. The URLs are opened and expanded as needed. Returns null
@@ -341,9 +501,13 @@
                 continue;
             }
             // Finally, add the Loader to the search path.
+            validateLookupCache(loaders.size(), urlNoFragString);
             loaders.add(loader);
             lmap.put(urlNoFragString, loader);
         }
+        if (DEBUG_LOOKUP_CACHE) {
+            System.out.println("NOCACHE: Loading from : " + index );
+        }
         return loaders.get(index);
     }
 
diff --git a/src/share/classes/sun/misc/VM.java b/src/share/classes/sun/misc/VM.java
index f317b5d..4ae2664 100644
--- a/src/share/classes/sun/misc/VM.java
+++ b/src/share/classes/sun/misc/VM.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -313,6 +313,9 @@
 
         // used by sun.launcher.LauncherHelper
         props.remove("sun.java.launcher.diag");
+
+        // used by sun.misc.URLClassPath
+        props.remove("sun.cds.enableSharedLookupCache");
     }
 
     // Initialize any miscellenous operating system settings that need to be
diff --git a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
index ee7684d..d787ab3 100644
--- a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
+++ b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
@@ -301,7 +301,7 @@
             throw new IOException(fe);
         }
         try {
-            ftp.login(user, password.toCharArray());
+            ftp.login(user, password == null ? null : password.toCharArray());
         } catch (sun.net.ftp.FtpProtocolException e) {
             ftp.close();
             // Backward compatibility
diff --git a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
index 31fdad8..77c2e88 100644
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
@@ -1046,7 +1046,7 @@
             try {
                 URI uri = ParseUtil.toURI(url);
                 if (uri != null) {
-                    cachedResponse = cacheHandler.get(uri, getRequestMethod(), requests.getHeaders(EXCLUDE_HEADERS));
+                    cachedResponse = cacheHandler.get(uri, getRequestMethod(), getUserSetHeaders().getHeaders());
                     if ("https".equalsIgnoreCase(uri.getScheme())
                         && !(cachedResponse instanceof SecureCacheResponse)) {
                         cachedResponse = null;
diff --git a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index 0022e30..53e84d4 100644
--- a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -195,15 +195,8 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; no-op for IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    Net.setSocketOption(fd, family, name, value);
-                }
-                return this;
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 // options are protocol dependent
@@ -256,16 +249,8 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; always return 0 on IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    return (T) Net.getSocketOption(fd, family, name);
-                } else {
-                    return (T) Integer.valueOf(0);
-                }
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 return (T) Net.getSocketOption(fd, family, name);
diff --git a/src/share/classes/sun/nio/ch/Net.java b/src/share/classes/sun/nio/ch/Net.java
index 753e541..37823e9 100644
--- a/src/share/classes/sun/nio/ch/Net.java
+++ b/src/share/classes/sun/nio/ch/Net.java
@@ -352,7 +352,8 @@
         }
 
         boolean mayNeedConversion = (family == UNSPEC);
-        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
+        boolean isIPv6 = (family == StandardProtocolFamily.INET6);
+        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg, isIPv6);
     }
 
     static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
@@ -499,7 +500,7 @@
         throws IOException;
 
     private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
-                                             int level, int opt, int arg)
+                                             int level, int opt, int arg, boolean isIPv6)
         throws IOException;
 
     static native int poll(FileDescriptor fd, int events, long timeout)
diff --git a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
index 6b7d51b..ee5ff76 100644
--- a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
@@ -133,6 +133,14 @@
         synchronized (stateLock) {
             if (!isOpen())
                 throw new ClosedChannelException();
+
+            if (name == StandardSocketOptions.IP_TOS) {
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
+                return this;
+            }
+
             if (name == StandardSocketOptions.SO_REUSEADDR &&
                     Net.useExclusiveBind())
             {
@@ -177,6 +185,7 @@
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
             set.add(StandardSocketOptions.SO_RCVBUF);
             set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.IP_TOS);
             return Collections.unmodifiableSet(set);
         }
     }
@@ -238,7 +247,7 @@
                     return null;
                 thread = NativeThread.current();
                 for (;;) {
-                    n = accept0(this.fd, newfd, isaa);
+                    n = accept(this.fd, newfd, isaa);
                     if ((n == IOStatus.INTERRUPTED) && isOpen())
                         continue;
                     break;
@@ -401,6 +410,18 @@
         return sb.toString();
     }
 
+    /**
+     * Accept a connection on a socket.
+     *
+     * @implNote Wrap native call to allow instrumentation.
+     */
+    private int accept(FileDescriptor ssfd, FileDescriptor newfd,
+                       InetSocketAddress[] isaa)
+        throws IOException
+    {
+        return accept0(ssfd, newfd, isaa);
+    }
+
     // -- Native methods --
 
     // Accepts a new connection, setting the given file descriptor to refer to
diff --git a/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index 1e36aed..7b694ef 100644
--- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -173,14 +173,14 @@
             if (!isOpen())
                 throw new ClosedChannelException();
 
-            // special handling for IP_TOS: no-op when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                if (!Net.isIPv6Available())
-                    Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
                 return this;
-            } else if (name == StandardSocketOptions.SO_REUSEADDR &&
-                           Net.useExclusiveBind())
-            {
+            }
+
+            if (name == StandardSocketOptions.SO_REUSEADDR && Net.useExclusiveBind()) {
                 // SO_REUSEADDR emulated when using exclusive bind
                 isReuseAddress = (Boolean)value;
                 return this;
@@ -215,8 +215,9 @@
 
             // special handling for IP_TOS: always return 0 when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
-                    (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                return (T) Net.getSocketOption(fd, family, name);
             }
 
             // no options that require special handling
diff --git a/src/share/classes/sun/nio/fs/AbstractPoller.java b/src/share/classes/sun/nio/fs/AbstractPoller.java
index fd3503c..34d4ea4 100644
--- a/src/share/classes/sun/nio/fs/AbstractPoller.java
+++ b/src/share/classes/sun/nio/fs/AbstractPoller.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,8 +100,6 @@
         // validate arguments before request to poller
         if (dir == null)
             throw new NullPointerException();
-        if (events.length == 0)
-            throw new IllegalArgumentException("No events to register");
         Set<WatchEvent.Kind<?>> eventSet = new HashSet<>(events.length);
         for (WatchEvent.Kind<?> event: events) {
             // standard events
@@ -114,17 +112,16 @@
             }
 
             // OVERFLOW is ignored
-            if (event == StandardWatchEventKinds.OVERFLOW) {
-                if (events.length == 1)
-                    throw new IllegalArgumentException("No events to register");
+            if (event == StandardWatchEventKinds.OVERFLOW)
                 continue;
-            }
 
             // null/unsupported
             if (event == null)
                 throw new NullPointerException("An element in event set is 'null'");
             throw new UnsupportedOperationException(event.name());
         }
+        if (eventSet.isEmpty())
+            throw new IllegalArgumentException("No events to register");
         return (WatchKey)invoke(RequestType.REGISTER, dir, eventSet, modifiers);
     }
 
@@ -192,14 +189,17 @@
          * the request.
          */
         Object awaitResult() {
+            boolean interrupted = false;
             synchronized (this) {
                 while (!completed) {
                     try {
                         wait();
                     } catch (InterruptedException x) {
-                        // ignore
+                        interrupted = true;
                     }
                 }
+                if (interrupted)
+                    Thread.currentThread().interrupt();
                 return result;
             }
         }
diff --git a/src/share/classes/sun/nio/fs/PollingWatchService.java b/src/share/classes/sun/nio/fs/PollingWatchService.java
index 30de247..d3d9891 100644
--- a/src/share/classes/sun/nio/fs/PollingWatchService.java
+++ b/src/share/classes/sun/nio/fs/PollingWatchService.java
@@ -74,8 +74,6 @@
          throws IOException
     {
         // check events - CCE will be thrown if there are invalid elements
-        if (events.length == 0)
-            throw new IllegalArgumentException("No events to register");
         final Set<WatchEvent.Kind<?>> eventSet =
             new HashSet<WatchEvent.Kind<?>>(events.length);
         for (WatchEvent.Kind<?> event: events) {
@@ -90,8 +88,6 @@
 
             // OVERFLOW is ignored
             if (event == StandardWatchEventKinds.OVERFLOW) {
-                if (events.length == 1)
-                    throw new IllegalArgumentException("No events to register");
                 continue;
             }
 
@@ -100,6 +96,8 @@
                 throw new NullPointerException("An element in event set is 'null'");
             throw new UnsupportedOperationException(event.name());
         }
+        if (eventSet.isEmpty())
+            throw new IllegalArgumentException("No events to register");
 
         // A modifier may be used to specify the sensitivity level
         SensitivityWatchEventModifier sensivity = SensitivityWatchEventModifier.MEDIUM;
diff --git a/src/share/classes/sun/print/CustomMediaSizeName.java b/src/share/classes/sun/print/CustomMediaSizeName.java
index e1df990..7ba0e4f 100644
--- a/src/share/classes/sun/print/CustomMediaSizeName.java
+++ b/src/share/classes/sun/print/CustomMediaSizeName.java
@@ -67,6 +67,22 @@
                                             MediaSize.INCH);
         } catch (IllegalArgumentException iae) {
         }
+        // The public API method finds a closest match even if it not
+        // all that close. Here we want to be sure its *really* close.
+        if (mediaName != null) {
+            MediaSize sz = MediaSize.getMediaSizeForName(mediaName);
+            if (sz == null) {
+                mediaName = null;
+            } else {
+                float w = sz.getX(MediaSize.INCH);
+                float h = sz.getY(MediaSize.INCH);
+                float dw = Math.abs(w - width);
+                float dh = Math.abs(h - length);
+                if (dw > 0.1 || dh > 0.1) {
+                    mediaName = null;
+                }
+            }
+        }
     }
 
     /**
diff --git a/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java b/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
index 71a34bb..fb939f4 100644
--- a/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
+++ b/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
@@ -45,8 +45,8 @@
  * core reflection (java.lang.reflect).
  */
 public class CoreReflectionFactory implements GenericsFactory {
-    private GenericDeclaration decl;
-    private Scope scope;
+    private final GenericDeclaration decl;
+    private final Scope scope;
 
     private CoreReflectionFactory(GenericDeclaration d, Scope s) {
         decl = d;
diff --git a/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java b/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java
index 7cedafd..0bc6f60 100644
--- a/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java
+++ b/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java
@@ -40,7 +40,7 @@
  *
 */
 public abstract class LazyReflectiveObjectGenerator {
-    private GenericsFactory factory; // cached factory
+    private final GenericsFactory factory; // cached factory
 
     protected LazyReflectiveObjectGenerator(GenericsFactory f) {
         factory = f;
diff --git a/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java b/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java
index a28d88d..42f9446 100644
--- a/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java
+++ b/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java
@@ -40,9 +40,9 @@
 
     // A factory used to produce reflective objects. Provided when the
     //repository is created. Will vary across implementations.
-    private GenericsFactory factory;
+    private final GenericsFactory factory;
 
-    private T tree; // the AST for the generic type info
+    private final T tree; // the AST for the generic type info
 
     //accessors
     private GenericsFactory getFactory() { return factory;}
diff --git a/src/share/classes/sun/reflect/generics/repository/ClassRepository.java b/src/share/classes/sun/reflect/generics/repository/ClassRepository.java
index f60f033..d3b5451 100644
--- a/src/share/classes/sun/reflect/generics/repository/ClassRepository.java
+++ b/src/share/classes/sun/reflect/generics/repository/ClassRepository.java
@@ -42,8 +42,8 @@
 
     public static final ClassRepository NONE = ClassRepository.make("Ljava/lang/Object;", null);
 
-    private Type superclass; // caches the generic superclass info
-    private Type[] superInterfaces; // caches the generic superinterface info
+    private volatile Type superclass; // caches the generic superclass info
+    private volatile Type[] superInterfaces; // caches the generic superinterface info
 
  // private, to enforce use of static factory
     private ClassRepository(String rawSig, GenericsFactory f) {
@@ -80,17 +80,20 @@
  */
 
     public Type getSuperclass(){
+        Type superclass = this.superclass;
         if (superclass == null) { // lazily initialize superclass
             Reifier r = getReifier(); // obtain visitor
             // Extract superclass subtree from AST and reify
             getTree().getSuperclass().accept(r);
             // extract result from visitor and cache it
             superclass = r.getResult();
+            this.superclass = superclass;
             }
         return superclass; // return cached result
     }
 
     public Type[] getSuperInterfaces(){
+        Type[] superInterfaces = this.superInterfaces;
         if (superInterfaces == null) { // lazily initialize super interfaces
             // first, extract super interface subtree(s) from AST
             TypeTree[] ts  = getTree().getSuperInterfaces();
@@ -104,6 +107,7 @@
                 sis[i] = r.getResult();
             }
             superInterfaces = sis; // cache overall result
+            this.superInterfaces = superInterfaces;
         }
         return superInterfaces.clone(); // return cached result
     }
diff --git a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
index 28cb4b4..38af520 100644
--- a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
+++ b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
@@ -42,7 +42,7 @@
 public abstract class GenericDeclRepository<S extends Signature>
     extends AbstractRepository<S> {
 
-    private TypeVariable<?>[] typeParams; // caches the formal type parameters
+    private volatile TypeVariable<?>[] typeParams; // caches the formal type parameters
 
     protected GenericDeclRepository(String rawSig, GenericsFactory f) {
         super(rawSig, f);
@@ -65,6 +65,7 @@
      * @return the formal type parameters of this generic declaration
      */
     public TypeVariable<?>[] getTypeParameters(){
+        TypeVariable[] typeParams = this.typeParams;
         if (typeParams == null) { // lazily initialize type parameters
             // first, extract type parameter subtree(s) from AST
             FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
@@ -78,6 +79,7 @@
                 tps[i] = (TypeVariable<?>) r.getResult();
             }
             typeParams = tps; // cache overall result
+            this.typeParams = typeParams;
         }
         return typeParams.clone(); // return cached result
     }
diff --git a/src/share/classes/sun/reflect/generics/scope/AbstractScope.java b/src/share/classes/sun/reflect/generics/scope/AbstractScope.java
index bc0132e..872360b 100644
--- a/src/share/classes/sun/reflect/generics/scope/AbstractScope.java
+++ b/src/share/classes/sun/reflect/generics/scope/AbstractScope.java
@@ -41,8 +41,8 @@
 public abstract class AbstractScope<D extends GenericDeclaration>
     implements Scope {
 
-    private D recvr; // the declaration whose scope this instance represents
-    private Scope enclosingScope; // the enclosing scope of this scope
+    private final D recvr; // the declaration whose scope this instance represents
+    private volatile Scope enclosingScope; // the enclosing scope of this scope
 
     /**
      * Constructor. Takes a reflective object whose scope the newly
@@ -71,7 +71,11 @@
      * @return the enclosing scope
      */
     protected Scope getEnclosingScope(){
-        if (enclosingScope == null) {enclosingScope = computeEnclosingScope();}
+        Scope enclosingScope = this.enclosingScope;
+        if (enclosingScope == null) {
+            enclosingScope = computeEnclosingScope();
+            this.enclosingScope = enclosingScope;
+        }
         return enclosingScope;
     }
 
diff --git a/src/share/classes/sun/reflect/generics/tree/ClassSignature.java b/src/share/classes/sun/reflect/generics/tree/ClassSignature.java
index ca77d9f..9347f97 100644
--- a/src/share/classes/sun/reflect/generics/tree/ClassSignature.java
+++ b/src/share/classes/sun/reflect/generics/tree/ClassSignature.java
@@ -28,9 +28,9 @@
 import sun.reflect.generics.visitor.Visitor;
 
 public class ClassSignature implements Signature {
-    private FormalTypeParameter[] formalTypeParams;
-    private ClassTypeSignature superclass;
-    private ClassTypeSignature[] superInterfaces;
+    private final FormalTypeParameter[] formalTypeParams;
+    private final ClassTypeSignature superclass;
+    private final ClassTypeSignature[] superInterfaces;
 
     private ClassSignature(FormalTypeParameter[] ftps,
                                       ClassTypeSignature sc,
diff --git a/src/share/classes/sun/security/jgss/krb5/Krb5Context.java b/src/share/classes/sun/security/jgss/krb5/Krb5Context.java
index 2230c75..e7c9d6f 100644
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Context.java
+++ b/src/share/classes/sun/security/jgss/krb5/Krb5Context.java
@@ -241,8 +241,11 @@
      * establishment.
      */
     public final void requestCredDeleg(boolean value) throws GSSException {
-        if (state == STATE_NEW && isInitiator())
-            credDelegState  = value;
+        if (state == STATE_NEW && isInitiator()) {
+            if (myCred == null || !(myCred instanceof Krb5ProxyCredential)) {
+                credDelegState  = value;
+            }
+        }
     }
 
     /**
diff --git a/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java b/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java
index 1c66bf5..2390639 100644
--- a/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java
+++ b/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java
@@ -523,13 +523,6 @@
                     valid = false;
                 }
 
-                // get the mechanism token
-                byte[] mechToken = initToken.getMechToken();
-                if (mechToken == null) {
-                    throw new GSSException(GSSException.FAILURE, -1,
-                            "mechToken is missing");
-                }
-
                 /*
                  * Select the best match between the list of mechs
                  * that the initiator requested and the list that
@@ -545,7 +538,19 @@
                 internal_mech = mech_wanted;
 
                 // get the token for mechanism
-                byte[] accept_token = GSS_acceptSecContext(mechToken);
+                byte[] accept_token;
+
+                if (mechList[0].equals(mech_wanted)) {
+                    // get the mechanism token
+                    byte[] mechToken = initToken.getMechToken();
+                    if (mechToken == null) {
+                        throw new GSSException(GSSException.FAILURE, -1,
+                                "mechToken is missing");
+                    }
+                    accept_token = GSS_acceptSecContext(mechToken);
+                } else {
+                    accept_token = null;
+                }
 
                 // verify MIC
                 if (!GSSUtil.useMSInterop() && valid) {
@@ -594,9 +599,27 @@
                 retVal = targToken.getEncoded();
 
             } else if (state == STATE_IN_PROCESS) {
+                // read data
+                byte[] token = new byte[is.available()];
+                SpNegoToken.readFully(is, token);
+                if (DEBUG) {
+                    System.out.println("SpNegoContext.acceptSecContext: " +
+                            "receiving token = " +
+                            SpNegoToken.getHexBytes(token));
+                }
+
+                // read the SPNEGO token
+                // token will be validated when parsing
+                NegTokenTarg inputToken = new NegTokenTarg(token);
+
+                if (DEBUG) {
+                    System.out.println("SpNegoContext.acceptSecContext: " +
+                            "received token of type = " +
+                            SpNegoToken.getTokenName(inputToken.getType()));
+                }
+
                 // read the token
-                byte[] client_token = new byte[is.available()];
-                SpNegoToken.readFully(is, client_token);
+                byte[] client_token = inputToken.getResponseToken();
                 byte[] accept_token = GSS_acceptSecContext(client_token);
                 if (accept_token == null) {
                     valid = false;
@@ -1055,7 +1078,7 @@
      * This is only valid on the acceptor side of the context.
      * @return GSSCredentialSpi object for the delegated credential
      * @exception GSSException
-     * @see GSSContext#getDelegCredState
+     * @see GSSContext#getCredDelegState
      */
     public final GSSCredentialSpi getDelegCred() throws GSSException {
         if (state != STATE_IN_PROCESS && state != STATE_DONE)
diff --git a/src/share/classes/sun/security/jgss/wrapper/GSSLibStub.java b/src/share/classes/sun/security/jgss/wrapper/GSSLibStub.java
index 47861f8..9005324 100644
--- a/src/share/classes/sun/security/jgss/wrapper/GSSLibStub.java
+++ b/src/share/classes/sun/security/jgss/wrapper/GSSLibStub.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,10 +48,11 @@
     /**
      * Initialization routine to dynamically load function pointers.
      *
-     * @param library name to dlopen
+     * @param lib library name to dlopen
+     * @param debug set to true for reporting native debugging info
      * @return true if succeeded, false otherwise.
      */
-    static native boolean init(String lib);
+    static native boolean init(String lib, boolean debug);
     private static native long getMechPtr(byte[] oidDerEncoding);
 
     // Miscellaneous routines
diff --git a/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
index b0bb15d..25da168 100644
--- a/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
+++ b/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,7 @@
                             gssLibs = new String[]{ defaultLib };
                         }
                         for (String libName: gssLibs) {
-                            if (GSSLibStub.init(libName)) {
+                            if (GSSLibStub.init(libName, DEBUG)) {
                                 debug("Loaded GSS library: " + libName);
                                 Oid[] mechs = GSSLibStub.indicateMechs();
                                 HashMap<String, String> map =
diff --git a/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java b/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
index 057885d..8ca6e11 100644
--- a/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
+++ b/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
@@ -32,9 +32,11 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.StringTokenizer;
+
+import sun.misc.IOUtils;
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.util.KrbDataInputStream;
@@ -74,7 +76,6 @@
     // this needs to be public for Kinit.
     public Tag readTag() throws IOException {
         char[] buf = new char[1024];
-        byte[] bytes;
         int len;
         int tag = -1;
         int taglen;
@@ -85,7 +86,6 @@
         if (len < 0) {
             throw new IOException("stop.");
         }
-        bytes = new byte[len + 2];
         if (len > buf.length) {
             throw new IOException("Invalid tag length.");
         }
@@ -101,11 +101,7 @@
             }
             len = len - (4 + taglen);
         }
-        Tag result;
-        if (tag == -1) {
-        }
-        result = new Tag(len, tag, time_offset, usec_offset);
-        return result;
+        return new Tag(len, tag, time_offset, usec_offset);
     }
     /*
      * In file-based credential cache, the realm name is stored as part of
@@ -123,7 +119,7 @@
             type = read(4);
         }
         length = readLength4();
-        String[] result = new String[length + 1];
+        List<String> result = new ArrayList<String>();
         /*
          * DCE includes the principal's realm in the count; the new format
          * does not.
@@ -132,21 +128,26 @@
             length--;
         for (int i = 0; i <= length; i++) {
             namelength = readLength4();
-            if (namelength > MAXNAMELENGTH) {
-                throw new IOException("Invalid name length in principal name.");
-            }
-            byte[] bytes = new byte[namelength];
-            read(bytes, 0, namelength);
-            result[i] = new String(bytes);
+            byte[] bytes = IOUtils.readFully(this, namelength, true);
+            result.add(new String(bytes));
         }
-        if (isRealm(result[0])) {
-            realm = result[0];
-            pname = new String[length];
-            System.arraycopy(result, 1, pname, 0, length);
-            return new PrincipalName(type, pname, new Realm(realm));
+        if (result.isEmpty()) {
+            throw new IOException("No realm or principal");
+        }
+        if (isRealm(result.get(0))) {
+            realm = result.remove(0);
+            if (result.isEmpty()) {
+                throw new IOException("No principal name components");
+            }
+            return new PrincipalName(
+                    type,
+                    result.toArray(new String[result.size()]),
+                    new Realm(realm));
         }
         try {
-            return new PrincipalName(result, type);
+            return new PrincipalName(
+                    result.toArray(new String[result.size()]),
+                    type);
         } catch (RealmException re) {
             return null;
         }
@@ -184,10 +185,7 @@
         if (version == KRB5_FCC_FVNO_3)
             read(2); /* keytype recorded twice in fvno 3 */
         keyLen = readLength4();
-        byte[] bytes = new byte[keyLen];
-        for (int i = 0; i < keyLen; i++) {
-            bytes[i] = (byte)read();
-        }
+        byte[] bytes = IOUtils.readFully(this, keyLen, true);
         return new EncryptionKey(bytes, keyType, new Integer(version));
     }
 
@@ -211,7 +209,7 @@
         int numAddrs, addrType, addrLength;
         numAddrs = readLength4();
         if (numAddrs > 0) {
-            HostAddress[] addrs = new HostAddress[numAddrs];
+            List<HostAddress> addrs = new ArrayList<>();
             for (int i = 0; i < numAddrs; i++) {
                 addrType = read(2);
                 addrLength = readLength4();
@@ -224,9 +222,9 @@
                 byte[] result = new byte[addrLength];
                 for (int j = 0; j < addrLength; j++)
                     result[j] = (byte)read(1);
-                addrs[i] = new HostAddress(addrType, result);
+                addrs.add(new HostAddress(addrType, result));
             }
-            return addrs;
+            return addrs.toArray(new HostAddress[addrs.size()]);
         }
         return null;
     }
@@ -235,18 +233,15 @@
         int num, adtype, adlength;
         num = readLength4();
         if (num > 0) {
-            AuthorizationDataEntry[] auData = new AuthorizationDataEntry[num];
+            List<AuthorizationDataEntry> auData = new ArrayList<>();
             byte[] data = null;
             for (int i = 0; i < num; i++) {
                 adtype = read(2);
                 adlength = readLength4();
-                data = new byte[adlength];
-                for (int j = 0; j < adlength; j++) {
-                    data[j] = (byte)read();
-                }
-                auData[i] = new AuthorizationDataEntry(adtype, data);
+                data = IOUtils.readFully(this, adlength, true);
+                auData.add(new AuthorizationDataEntry(adtype, data));
             }
-            return auData;
+            return auData.toArray(new AuthorizationDataEntry[auData.size()]);
         }
         else return null;
     }
@@ -257,9 +252,7 @@
         if (length == 0) {
             return null;
         } else {
-            byte[] bytes = new byte[length];
-            read(bytes, 0, length);
-            return bytes;
+            return IOUtils.readFully(this, length, true);
         }
     }
 
@@ -341,15 +334,29 @@
      * returns null.
      */
     Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
-        PrincipalName cpname = readPrincipal(version);
-        if (DEBUG)
+        PrincipalName cpname = null;
+        try {
+            cpname = readPrincipal(version);
+        } catch (Exception e) {
+            // Do not return here. All data for this cred should be fully
+            // consumed so that we can read the next one.
+        }
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream>  client principal is " + cpname);
-        PrincipalName spname = readPrincipal(version);
-        if (DEBUG)
+        }
+        PrincipalName spname = null;
+        try {
+            spname = readPrincipal(version);
+        } catch (Exception e) {
+            // same as above
+        }
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname);
+        }
         EncryptionKey key = readKey(version);
-        if (DEBUG)
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
+        }
         long times[] = readTimes();
         KerberosTime authtime = new KerberosTime(times[0]);
         KerberosTime starttime =
@@ -382,6 +389,11 @@
         byte[] ticketData = readData();
         byte[] ticketData2 = readData();
 
+        // Skip this cred if either cpname or spname isn't created.
+        if (cpname == null || spname == null) {
+            return null;
+        }
+
         try {
             return new Credentials(cpname, spname, key, authtime, starttime,
                 endtime, renewTill, skey, tFlags,
diff --git a/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java b/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java
index ffca35e..c01ec62 100644
--- a/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java
+++ b/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java
@@ -49,7 +49,6 @@
     public final int KRB5_FCC_FVNO_4 = 0x504;
     public final int FCC_TAG_DELTATIME = 1;
     public final int KRB5_NT_UNKNOWN = 0;
-    public final int MAXNAMELENGTH = 1024;
     public final int TKT_FLG_FORWARDABLE = 0x40000000;
     public final int TKT_FLG_FORWARDED  =  0x20000000;
     public final int TKT_FLG_PROXIABLE   = 0x10000000;
diff --git a/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java b/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
index 73b0bb2..05ed6a2 100644
--- a/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
+++ b/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
@@ -402,8 +402,7 @@
             String uidStr = null;
             long uid = 0;
 
-            if (osname.startsWith("SunOS") ||
-                (osname.startsWith("Linux"))) {
+            if (!osname.startsWith("Windows")) {
                 try {
                     Class<?> c = Class.forName
                         ("com.sun.security.auth.module.UnixSystem");
diff --git a/src/share/classes/sun/security/pkcs11/P11Signature.java b/src/share/classes/sun/security/pkcs11/P11Signature.java
index 4a0733d..1bac22c 100644
--- a/src/share/classes/sun/security/pkcs11/P11Signature.java
+++ b/src/share/classes/sun/security/pkcs11/P11Signature.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -340,7 +340,10 @@
         }
         int minKeySize = (int) mechInfo.ulMinKeySize;
         int maxKeySize = (int) mechInfo.ulMaxKeySize;
-
+        // need to override the MAX keysize for SHA1withDSA
+        if (md != null && mechanism == CKM_DSA && maxKeySize > 1024) {
+               maxKeySize = 1024;
+        }
         int keySize = 0;
         if (key instanceof P11Key) {
             keySize = ((P11Key) key).length();
diff --git a/src/share/classes/sun/security/pkcs11/SessionManager.java b/src/share/classes/sun/security/pkcs11/SessionManager.java
index 348de3a..798624c 100644
--- a/src/share/classes/sun/security/pkcs11/SessionManager.java
+++ b/src/share/classes/sun/security/pkcs11/SessionManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,9 @@
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.atomic.AtomicInteger;
+
 /**
  * Session manager. There is one session manager object per PKCS#11
  * provider. It allows code to checkout a session, release it
@@ -77,7 +80,7 @@
     private final int maxSessions;
 
     // total number of active sessions
-    private int activeSessions;
+    private AtomicInteger activeSessions = new AtomicInteger();
 
     // pool of available object sessions
     private final Pool objSessions;
@@ -118,7 +121,7 @@
         return (maxSessions <= DEFAULT_MAX_SESSIONS);
     }
 
-    synchronized Session getObjSession() throws PKCS11Exception {
+    Session getObjSession() throws PKCS11Exception {
         Session session = objSessions.poll();
         if (session != null) {
             return ensureValid(session);
@@ -131,7 +134,7 @@
         return ensureValid(session);
     }
 
-    synchronized Session getOpSession() throws PKCS11Exception {
+    Session getOpSession() throws PKCS11Exception {
         Session session = opSessions.poll();
         if (session != null) {
             return ensureValid(session);
@@ -139,7 +142,7 @@
         // create a new session rather than re-using an obj session
         // that avoids potential expensive cancels() for Signatures & RSACipher
         if (maxSessions == Integer.MAX_VALUE ||
-                activeSessions < maxSessions) {
+                activeSessions.get() < maxSessions) {
             session = openSession();
             return ensureValid(session);
         }
@@ -155,20 +158,20 @@
         return session;
     }
 
-    synchronized Session killSession(Session session) {
+    Session killSession(Session session) {
         if ((session == null) || (token.isValid() == false)) {
             return null;
         }
         if (debug != null) {
             String location = new Exception().getStackTrace()[2].toString();
             System.out.println("Killing session (" + location + ") active: "
-                + activeSessions);
+                + activeSessions.get());
         }
         closeSession(session);
         return null;
     }
 
-    synchronized Session releaseSession(Session session) {
+    Session releaseSession(Session session) {
         if ((session == null) || (token.isValid() == false)) {
             return null;
         }
@@ -181,13 +184,13 @@
         return null;
     }
 
-    synchronized void demoteObjSession(Session session) {
+    void demoteObjSession(Session session) {
         if (token.isValid() == false) {
             return;
         }
         if (debug != null) {
             System.out.println("Demoting session, active: " +
-                activeSessions);
+                activeSessions.get());
         }
         boolean present = objSessions.remove(session);
         if (present == false) {
@@ -200,18 +203,21 @@
 
     private Session openSession() throws PKCS11Exception {
         if ((maxSessions != Integer.MAX_VALUE) &&
-                (activeSessions >= maxSessions)) {
+                (activeSessions.get() >= maxSessions)) {
             throw new ProviderException("No more sessions available");
         }
+
         long id = token.p11.C_OpenSession
                     (token.provider.slotID, openSessionFlags, null, null);
         Session session = new Session(token, id);
-        activeSessions++;
+        activeSessions.incrementAndGet();
         if (debug != null) {
-            if (activeSessions > maxActiveSessions) {
-                maxActiveSessions = activeSessions;
-                if (maxActiveSessions % 10 == 0) {
-                    System.out.println("Open sessions: " + maxActiveSessions);
+            synchronized(this) {
+                if (activeSessions.get() > maxActiveSessions) {
+                    maxActiveSessions = activeSessions.get();
+                    if (maxActiveSessions % 10 == 0) {
+                        System.out.println("Open sessions: " + maxActiveSessions);
+                    }
                 }
             }
         }
@@ -220,18 +226,18 @@
 
     private void closeSession(Session session) {
         session.close();
-        activeSessions--;
+        activeSessions.decrementAndGet();
     }
 
-    private static final class Pool {
+    public static final class Pool {
 
         private final SessionManager mgr;
 
-        private final List<Session> pool;
+        private final ConcurrentLinkedDeque<Session> pool;
 
         Pool(SessionManager mgr) {
-            this.mgr = mgr;
-            pool = new ArrayList<Session>();
+           this.mgr = mgr;
+           pool = new ConcurrentLinkedDeque<Session>();
         }
 
         boolean remove(Session session) {
@@ -239,45 +245,40 @@
         }
 
         Session poll() {
-            int n = pool.size();
-            if (n == 0) {
-                return null;
-            }
-            Session session = pool.remove(n - 1);
-            return session;
+            return pool.pollLast();
         }
 
         void release(Session session) {
-            pool.add(session);
-            // if there are idle sessions, close them
+            pool.offer(session);
             if (session.hasObjects()) {
                 return;
             }
+
             int n = pool.size();
             if (n < 5) {
                 return;
             }
-            Session oldestSession = pool.get(0);
+
+            Session oldestSession;
             long time = System.currentTimeMillis();
-            if (session.isLive(time) && oldestSession.isLive(time)) {
-                return;
-            }
-            Collections.sort(pool);
             int i = 0;
-            while (i < n - 1) { // always keep at least 1 session open
-                oldestSession = pool.get(i);
-                if (oldestSession.isLive(time)) {
+            // Check if the session head is too old and continue through queue
+            // until only one is left.
+            do {
+                oldestSession = pool.peek();
+                if (oldestSession == null || oldestSession.isLive(time) ||
+                        !pool.remove(oldestSession)) {
                     break;
                 }
+
                 i++;
                 mgr.closeSession(oldestSession);
-            }
+            } while ((n - i) > 1);
+
             if (debug != null) {
                 System.out.println("Closing " + i + " idle sessions, active: "
                         + mgr.activeSessions);
             }
-            List<Session> subList = pool.subList(0, i);
-            subList.clear();
         }
 
     }
diff --git a/src/share/classes/sun/security/provider/DigestBase.java b/src/share/classes/sun/security/provider/DigestBase.java
index 58812f3..98af71a 100644
--- a/src/share/classes/sun/security/provider/DigestBase.java
+++ b/src/share/classes/sun/security/provider/DigestBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,10 +122,10 @@
             }
         }
         // compress complete blocks
-        while (len >= blockSize) {
-            implCompress(b, ofs);
-            len -= blockSize;
-            ofs += blockSize;
+        if (len >= blockSize) {
+            int limit = ofs + len;
+            ofs = implCompressMultiBlock(b, ofs, limit - blockSize);
+            len = limit - ofs;
         }
         // copy remainder to buffer
         if (len > 0) {
@@ -134,6 +134,14 @@
         }
     }
 
+    // compress complete blocks
+    private int implCompressMultiBlock(byte[] b, int ofs, int limit) {
+        for (; ofs <= limit; ofs += blockSize) {
+            implCompress(b, ofs);
+        }
+        return ofs;
+    }
+
     // reset this object. See JCA doc.
     protected final void engineReset() {
         if (bytesProcessed == 0) {
diff --git a/src/share/classes/sun/security/provider/X509Factory.java b/src/share/classes/sun/security/provider/X509Factory.java
index d59e1d5..46b1a3c 100644
--- a/src/share/classes/sun/security/provider/X509Factory.java
+++ b/src/share/classes/sun/security/provider/X509Factory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,7 @@
      *
      * @exception CertificateException on parsing errors.
      */
+    @Override
     public Certificate engineGenerateCertificate(InputStream is)
         throws CertificateException
     {
@@ -103,8 +104,8 @@
                 throw new IOException("Empty input");
             }
         } catch (IOException ioe) {
-            throw (CertificateException)new CertificateException
-            ("Could not parse certificate: " + ioe.toString()).initCause(ioe);
+            throw new CertificateException("Could not parse certificate: " +
+                    ioe.toString(), ioe);
         }
     }
 
@@ -140,6 +141,12 @@
      * It is useful for certificates that cannot be created via
      * generateCertificate() and for converting other X509Certificate
      * implementations to an X509CertImpl.
+     *
+     * @param c The source X509Certificate
+     * @return An X509CertImpl object that is either a cached certificate or a
+     *      newly built X509CertImpl from the provided X509Certificate
+     * @throws CertificateException if failures occur while obtaining the DER
+     *      encoding for certificate data.
      */
     public static synchronized X509CertImpl intern(X509Certificate c)
             throws CertificateException {
@@ -170,6 +177,12 @@
     /**
      * Return an interned X509CRLImpl for the given certificate.
      * For more information, see intern(X509Certificate).
+     *
+     * @param c The source X509CRL
+     * @return An X509CRLImpl object that is either a cached CRL or a
+     *      newly built X509CRLImpl from the provided X509CRL
+     * @throws CRLException if failures occur while obtaining the DER
+     *      encoding for CRL data.
      */
     public static synchronized X509CRLImpl intern(X509CRL c)
             throws CRLException {
@@ -229,6 +242,7 @@
      * @exception CertificateException if an exception occurs while decoding
      * @since 1.4
      */
+    @Override
     public CertPath engineGenerateCertPath(InputStream inStream)
         throws CertificateException
     {
@@ -260,6 +274,7 @@
      *   the encoding requested is not supported
      * @since 1.4
      */
+    @Override
     public CertPath engineGenerateCertPath(InputStream inStream,
         String encoding) throws CertificateException
     {
@@ -292,6 +307,7 @@
      * @exception CertificateException if an exception occurs
      * @since 1.4
      */
+    @Override
     public CertPath
         engineGenerateCertPath(List<? extends Certificate> certificates)
         throws CertificateException
@@ -311,6 +327,7 @@
      *         <code>CertPath</code> encodings (as <code>String</code>s)
      * @since 1.4
      */
+    @Override
     public Iterator<String> engineGetCertPathEncodings() {
         return(X509CertPath.getEncodingsStatic());
     }
@@ -326,6 +343,7 @@
      *
      * @exception CertificateException on parsing errors.
      */
+    @Override
     public Collection<? extends java.security.cert.Certificate>
             engineGenerateCertificates(InputStream is)
             throws CertificateException {
@@ -351,6 +369,7 @@
      *
      * @exception CRLException on parsing errors.
      */
+    @Override
     public CRL engineGenerateCRL(InputStream is)
         throws CRLException
     {
@@ -388,6 +407,7 @@
      *
      * @exception CRLException on parsing errors.
      */
+    @Override
     public Collection<? extends java.security.cert.CRL> engineGenerateCRLs(
             InputStream is) throws CRLException
     {
@@ -410,11 +430,30 @@
         parseX509orPKCS7Cert(InputStream is)
         throws CertificateException, IOException
     {
+        int peekByte;
+        byte[] data;
+        PushbackInputStream pbis = new PushbackInputStream(is);
         Collection<X509CertImpl> coll = new ArrayList<>();
-        byte[] data = readOneBlock(is);
-        if (data == null) {
+
+        // Test the InputStream for end-of-stream.  If the stream's
+        // initial state is already at end-of-stream then return
+        // an empty collection.  Otherwise, push the byte back into the
+        // stream and let readOneBlock look for the first certificate.
+        peekByte = pbis.read();
+        if (peekByte == -1) {
             return new ArrayList<>(0);
+        } else {
+            pbis.unread(peekByte);
+            data = readOneBlock(pbis);
         }
+
+        // If we end up with a null value after reading the first block
+        // then we know the end-of-stream has been reached and no certificate
+        // data has been found.
+        if (data == null) {
+            throw new CertificateException("No certificate data found");
+        }
+
         try {
             PKCS7 pkcs7 = new PKCS7(data);
             X509Certificate[] certs = pkcs7.getCertificates();
@@ -422,13 +461,13 @@
             if (certs != null) {
                 return Arrays.asList(certs);
             } else {
-                // no crls provided
+                // no certificates provided
                 return new ArrayList<>(0);
             }
         } catch (ParsingException e) {
             while (data != null) {
                 coll.add(new X509CertImpl(data));
-                data = readOneBlock(is);
+                data = readOneBlock(pbis);
             }
         }
         return coll;
@@ -443,11 +482,30 @@
         parseX509orPKCS7CRL(InputStream is)
         throws CRLException, IOException
     {
+        int peekByte;
+        byte[] data;
+        PushbackInputStream pbis = new PushbackInputStream(is);
         Collection<X509CRLImpl> coll = new ArrayList<>();
-        byte[] data = readOneBlock(is);
-        if (data == null) {
+
+        // Test the InputStream for end-of-stream.  If the stream's
+        // initial state is already at end-of-stream then return
+        // an empty collection.  Otherwise, push the byte back into the
+        // stream and let readOneBlock look for the first CRL.
+        peekByte = pbis.read();
+        if (peekByte == -1) {
             return new ArrayList<>(0);
+        } else {
+            pbis.unread(peekByte);
+            data = readOneBlock(pbis);
         }
+
+        // If we end up with a null value after reading the first block
+        // then we know the end-of-stream has been reached and no CRL
+        // data has been found.
+        if (data == null) {
+            throw new CRLException("No CRL data found");
+        }
+
         try {
             PKCS7 pkcs7 = new PKCS7(data);
             X509CRL[] crls = pkcs7.getCRLs();
@@ -461,7 +519,7 @@
         } catch (ParsingException e) {
             while (data != null) {
                 coll.add(new X509CRLImpl(data));
-                data = readOneBlock(is);
+                data = readOneBlock(pbis);
             }
         }
         return coll;
@@ -519,7 +577,7 @@
 
             // Step 2: Read the rest of header, determine the line end
             int end;
-            StringBuffer header = new StringBuffer("-----");
+            StringBuilder header = new StringBuilder("-----");
             while (true) {
                 int next = is.read();
                 if (next == -1) {
@@ -562,7 +620,7 @@
             }
 
             // Step 4: Consume the footer
-            StringBuffer footer = new StringBuffer("-");
+            StringBuilder footer = new StringBuilder("-");
             while (true) {
                 int next = is.read();
                 // Add next == '\n' for maximum safety, in case endline
@@ -623,7 +681,7 @@
 
         int n = is.read();
         if (n == -1) {
-            throw new IOException("BER/DER length info ansent");
+            throw new IOException("BER/DER length info absent");
         }
         bout.write(n);
 
diff --git a/src/share/classes/sun/security/smartcardio/CardImpl.java b/src/share/classes/sun/security/smartcardio/CardImpl.java
index 1c14ea7..69ffb46 100644
--- a/src/share/classes/sun/security/smartcardio/CardImpl.java
+++ b/src/share/classes/sun/security/smartcardio/CardImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,9 @@
 package sun.security.smartcardio;
 
 import java.nio.ByteBuffer;
-
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import javax.smartcardio.*;
-
 import static sun.security.smartcardio.PCSC.*;
 
 /**
@@ -62,6 +62,15 @@
     // thread holding exclusive access to the card, or null
     private volatile Thread exclusiveThread;
 
+    // used for platform specific logic
+    private static final boolean isWindows;
+
+    static {
+        final String osName = AccessController.doPrivileged(
+            (PrivilegedAction<String>) () -> System.getProperty("os.name"));
+        isWindows = osName.startsWith("Windows");
+    }
+
     CardImpl(TerminalImpl terminal, String protocol) throws PCSCException {
         this.terminal = terminal;
         int sharingMode = SCARD_SHARE_SHARED;
@@ -74,7 +83,12 @@
             connectProtocol = SCARD_PROTOCOL_T1;
         } else if (protocol.equalsIgnoreCase("direct")) {
             // testing
-            connectProtocol = 0;
+
+            // MSDN states that the preferred protocol can be zero, but doesn't
+            //     specify whether other values are allowed.
+            // pcsc-lite implementation expects the preferred protocol to be non zero.
+            connectProtocol = isWindows ? 0 : SCARD_PROTOCOL_RAW;
+
             sharingMode = SCARD_SHARE_DIRECT;
         } else {
             throw new IllegalArgumentException("Unsupported protocol " + protocol);
diff --git a/src/share/classes/sun/security/ssl/DHCrypt.java b/src/share/classes/sun/security/ssl/DHCrypt.java
index ae9118f..6deae7e 100644
--- a/src/share/classes/sun/security/ssl/DHCrypt.java
+++ b/src/share/classes/sun/security/ssl/DHCrypt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -188,7 +188,7 @@
      *         the same size as the Diffie-Hellman modulus.
      */
     SecretKey getAgreedSecret(BigInteger peerPublicValue,
-            boolean keyIsValidated) throws IOException {
+            boolean keyIsValidated) throws SSLHandshakeException {
         try {
             KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
             DHPublicKeySpec spec =
@@ -211,7 +211,8 @@
             ka.doPhase(publicKey, true);
             return ka.generateSecret("TlsPremasterSecret");
         } catch (GeneralSecurityException e) {
-            throw new RuntimeException("Could not generate secret", e);
+            throw (SSLHandshakeException) new SSLHandshakeException(
+                "Could not generate secret").initCause(e);
         }
     }
 
diff --git a/src/share/classes/sun/security/ssl/ECDHCrypt.java b/src/share/classes/sun/security/ssl/ECDHCrypt.java
index df52bc5..c1ce4e9 100644
--- a/src/share/classes/sun/security/ssl/ECDHCrypt.java
+++ b/src/share/classes/sun/security/ssl/ECDHCrypt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 
 import javax.crypto.SecretKey;
 import javax.crypto.KeyAgreement;
+import javax.net.ssl.SSLHandshakeException;
 
 /**
  * Helper class for the ECDH key exchange. It generates the appropriate
@@ -88,19 +89,20 @@
     }
 
     // called by ClientHandshaker with either the server's static or ephemeral public key
-    SecretKey getAgreedSecret(PublicKey peerPublicKey) {
+    SecretKey getAgreedSecret(PublicKey peerPublicKey) throws SSLHandshakeException {
         try {
             KeyAgreement ka = JsseJce.getKeyAgreement("ECDH");
             ka.init(privateKey);
             ka.doPhase(peerPublicKey, true);
             return ka.generateSecret("TlsPremasterSecret");
         } catch (GeneralSecurityException e) {
-            throw new RuntimeException("Could not generate secret", e);
+            throw (SSLHandshakeException) new SSLHandshakeException(
+                "Could not generate secret").initCause(e);
         }
     }
 
     // called by ServerHandshaker
-    SecretKey getAgreedSecret(byte[] encodedPoint) {
+    SecretKey getAgreedSecret(byte[] encodedPoint) throws SSLHandshakeException {
         try {
             ECParameterSpec params = publicKey.getParams();
             ECPoint point = JsseJce.decodePoint(encodedPoint, params.getCurve());
@@ -108,10 +110,9 @@
             ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
             PublicKey peerPublicKey = kf.generatePublic(spec);
             return getAgreedSecret(peerPublicKey);
-        } catch (GeneralSecurityException e) {
-            throw new RuntimeException("Could not generate secret", e);
-        } catch (java.io.IOException e) {
-            throw new RuntimeException("Could not generate secret", e);
+        } catch (GeneralSecurityException | java.io.IOException e) {
+            throw (SSLHandshakeException) new SSLHandshakeException(
+                "Could not generate secret").initCause(e);
         }
     }
 
diff --git a/src/share/classes/sun/security/ssl/Handshaker.java b/src/share/classes/sun/security/ssl/Handshaker.java
index 092c125..7bda564 100644
--- a/src/share/classes/sun/security/ssl/Handshaker.java
+++ b/src/share/classes/sun/security/ssl/Handshaker.java
@@ -678,18 +678,15 @@
      */
     ProtocolList getActiveProtocols() {
         if (activeProtocols == null) {
+            boolean enabledSSL20Hello = false;
             ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
             for (ProtocolVersion protocol : enabledProtocols.collection()) {
-                if (!algorithmConstraints.permits(
-                        EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
-                        protocol.name, null)) {
-                    if (debug != null && Debug.isOn("verbose")) {
-                        System.out.println(
-                            "Ignoring disabled protocol: " + protocol);
-                    }
-
+                // Need not to check the SSL20Hello protocol.
+                if (protocol.v == ProtocolVersion.SSL20Hello.v) {
+                    enabledSSL20Hello = true;
                     continue;
                 }
+
                 boolean found = false;
                 for (CipherSuite suite : enabledCipherSuites.collection()) {
                     if (suite.isAvailable() && suite.obsoleted > protocol.v &&
@@ -716,6 +713,11 @@
                         "No available cipher suite for " + protocol);
                 }
             }
+
+            if (!protocols.isEmpty() && enabledSSL20Hello) {
+                protocols.add(ProtocolVersion.SSL20Hello);
+            }
+
             activeProtocols = new ProtocolList(protocols);
         }
 
diff --git a/src/share/classes/sun/security/tools/keytool/Resources.java b/src/share/classes/sun/security/tools/keytool/Resources.java
index 6199927..73eac26 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources.java
@@ -336,7 +336,7 @@
         {"New.prompt.", "New {0}: "},
         {"Passwords.must.differ", "Passwords must differ"},
         {"Re.enter.new.prompt.", "Re-enter new {0}: "},
-        {"Re.enter.passpword.", "Re-enter password: "},
+        {"Re.enter.password.", "Re-enter password: "},
         {"Re.enter.new.password.", "Re-enter new password: "},
         {"They.don.t.match.Try.again", "They don't match. Try again"},
         {"Enter.prompt.alias.name.", "Enter {0} alias name:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_de.java b/src/share/classes/sun/security/tools/keytool/Resources_de.java
index 2a80245..a024795 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_de.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_de.java
@@ -336,7 +336,7 @@
         {"New.prompt.", "Neues {0}: "},
         {"Passwords.must.differ", "Kennw\u00F6rter m\u00FCssen sich unterscheiden"},
         {"Re.enter.new.prompt.", "Neues {0} erneut eingeben: "},
-        {"Re.enter.passpword.", "Geben Sie das Kennwort erneut ein: "},
+        {"Re.enter.password.", "Geben Sie das Kennwort erneut ein: "},
         {"Re.enter.new.password.", "Neues Kennwort erneut eingeben: "},
         {"They.don.t.match.Try.again", "Keine \u00DCbereinstimmung. Wiederholen Sie den Vorgang"},
         {"Enter.prompt.alias.name.", "{0}-Aliasnamen eingeben:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_es.java b/src/share/classes/sun/security/tools/keytool/Resources_es.java
index 4c0bd34..5348d1a 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_es.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_es.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "Nuevo {0}: "},
         {"Passwords.must.differ", "Las contrase\u00F1as deben ser distintas"},
         {"Re.enter.new.prompt.", "Vuelva a escribir el nuevo {0}: "},
-        {"Re.enter.passpword.", "Vuelva a introducir la contrase\u00F1a: "},
+        {"Re.enter.password.", "Vuelva a introducir la contrase\u00F1a: "},
         {"Re.enter.new.password.", "Volver a escribir la contrase\u00F1a nueva: "},
         {"They.don.t.match.Try.again", "No coinciden. Int\u00E9ntelo de nuevo"},
         {"Enter.prompt.alias.name.", "Escriba el nombre de alias de {0}:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_fr.java b/src/share/classes/sun/security/tools/keytool/Resources_fr.java
index 6ba2985..6b22844 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_fr.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_fr.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "Nouveau {0} : "},
         {"Passwords.must.differ", "Les mots de passe doivent diff\u00E9rer"},
         {"Re.enter.new.prompt.", "Indiquez encore le nouveau {0} : "},
-        {"Re.enter.passpword.", "R\u00E9p\u00E9tez le mot de passe : "},
+        {"Re.enter.password.", "R\u00E9p\u00E9tez le mot de passe : "},
         {"Re.enter.new.password.", "Ressaisissez le nouveau mot de passe : "},
         {"They.don.t.match.Try.again", "Ils sont diff\u00E9rents. R\u00E9essayez."},
         {"Enter.prompt.alias.name.", "Indiquez le nom d''alias {0} :  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_it.java b/src/share/classes/sun/security/tools/keytool/Resources_it.java
index 68b64ce..2a49fe6 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_it.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_it.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "Nuova {0}: "},
         {"Passwords.must.differ", "Le password non devono coincidere"},
         {"Re.enter.new.prompt.", "Reimmettere un nuovo valore per {0}: "},
-        {"Re.enter.passpword.", "Reimmettere la password: "},
+        {"Re.enter.password.", "Reimmettere la password: "},
         {"Re.enter.new.password.", "Immettere nuovamente la nuova password: "},
         {"They.don.t.match.Try.again", "Non corrispondono. Riprovare."},
         {"Enter.prompt.alias.name.", "Immettere nome alias {0}:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_ja.java b/src/share/classes/sun/security/tools/keytool/Resources_ja.java
index 34906db..d910203 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_ja.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_ja.java
@@ -336,7 +336,7 @@
         {"New.prompt.", "\u65B0\u898F{0}: "},
         {"Passwords.must.differ", "\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u7570\u306A\u3063\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
         {"Re.enter.new.prompt.", "\u65B0\u898F{0}\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
-        {"Re.enter.passpword.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
+        {"Re.enter.password.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
         {"Re.enter.new.password.", "\u65B0\u898F\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
         {"They.don.t.match.Try.again", "\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044"},
         {"Enter.prompt.alias.name.", "{0}\u306E\u5225\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_ko.java b/src/share/classes/sun/security/tools/keytool/Resources_ko.java
index d0bed5c..40ede29 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_ko.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_ko.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "\uC0C8 {0}: "},
         {"Passwords.must.differ", "\uBE44\uBC00\uBC88\uD638\uB294 \uB2EC\uB77C\uC57C \uD569\uB2C8\uB2E4."},
         {"Re.enter.new.prompt.", "\uC0C8 {0} \uB2E4\uC2DC \uC785\uB825: "},
-        {"Re.enter.passpword.", "\uBE44\uBC00\uBC88\uD638  \uB2E4\uC2DC \uC785\uB825: "},
+        {"Re.enter.password.", "\uBE44\uBC00\uBC88\uD638  \uB2E4\uC2DC \uC785\uB825: "},
         {"Re.enter.new.password.", "\uC0C8 \uBE44\uBC00\uBC88\uD638 \uB2E4\uC2DC \uC785\uB825: "},
         {"They.don.t.match.Try.again", "\uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624."},
         {"Enter.prompt.alias.name.", "{0} \uBCC4\uCE6D \uC774\uB984 \uC785\uB825:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java b/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java
index 2f6b6ee..0b976a3 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java
@@ -336,7 +336,7 @@
         {"New.prompt.", "Nova {0}: "},
         {"Passwords.must.differ", "As senhas devem ser diferentes"},
         {"Re.enter.new.prompt.", "Informe novamente a nova {0}: "},
-        {"Re.enter.passpword.", "Redigite a senha: "},
+        {"Re.enter.password.", "Redigite a senha: "},
         {"Re.enter.new.password.", "Informe novamente a nova senha: "},
         {"They.don.t.match.Try.again", "Elas n\u00E3o correspondem. Tente novamente"},
         {"Enter.prompt.alias.name.", "Informe o nome do alias {0}:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_sv.java b/src/share/classes/sun/security/tools/keytool/Resources_sv.java
index effa0d6..c6b4a84 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_sv.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_sv.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "Nytt {0}: "},
         {"Passwords.must.differ", "L\u00F6senorden m\u00E5ste vara olika"},
         {"Re.enter.new.prompt.", "Ange nytt {0} igen: "},
-        {"Re.enter.passpword.", "Ange l\u00F6senord igen: "},
+        {"Re.enter.password.", "Ange l\u00F6senord igen: "},
         {"Re.enter.new.password.", "Ange det nya l\u00F6senordet igen: "},
         {"They.don.t.match.Try.again", "De matchar inte. F\u00F6rs\u00F6k igen"},
         {"Enter.prompt.alias.name.", "Ange aliasnamn f\u00F6r {0}:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java b/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java
index 99f85df..6ae574e 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "\u65B0{0}: "},
         {"Passwords.must.differ", "\u53E3\u4EE4\u4E0D\u80FD\u76F8\u540C"},
         {"Re.enter.new.prompt.", "\u91CD\u65B0\u8F93\u5165\u65B0{0}: "},
-        {"Re.enter.passpword.", "\u518D\u6B21\u8F93\u5165\u53E3\u4EE4: "},
+        {"Re.enter.password.", "\u518D\u6B21\u8F93\u5165\u53E3\u4EE4: "},
         {"Re.enter.new.password.", "\u518D\u6B21\u8F93\u5165\u65B0\u53E3\u4EE4: "},
         {"They.don.t.match.Try.again", "\u5B83\u4EEC\u4E0D\u5339\u914D\u3002\u8BF7\u91CD\u8BD5"},
         {"Enter.prompt.alias.name.", "\u8F93\u5165{0}\u522B\u540D:  "},
diff --git a/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java b/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java
index 9f6ec38..1f0bb68 100644
--- a/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java
+++ b/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,7 +336,7 @@
         {"New.prompt.", "\u65B0 {0}: "},
         {"Passwords.must.differ", "\u5FC5\u9808\u662F\u4E0D\u540C\u7684\u5BC6\u78BC"},
         {"Re.enter.new.prompt.", "\u91CD\u65B0\u8F38\u5165\u65B0 {0}: "},
-        {"Re.enter.passpword.", "\u91CD\u65B0\u8F38\u5165\u5BC6\u78BC:"},
+        {"Re.enter.password.", "\u91CD\u65B0\u8F38\u5165\u5BC6\u78BC:"},
         {"Re.enter.new.password.", "\u91CD\u65B0\u8F38\u5165\u65B0\u5BC6\u78BC: "},
         {"They.don.t.match.Try.again", "\u5B83\u5011\u4E0D\u76F8\u7B26\u3002\u8ACB\u91CD\u8A66"},
         {"Enter.prompt.alias.name.", "\u8F38\u5165 {0} \u5225\u540D\u540D\u7A31:  "},
diff --git a/src/share/classes/sun/security/util/Debug.java b/src/share/classes/sun/security/util/Debug.java
index f4005a4..8dd0c3b 100644
--- a/src/share/classes/sun/security/util/Debug.java
+++ b/src/share/classes/sun/security/util/Debug.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,15 @@
         System.err.println("codebase=<URL>");
         System.err.println("              only dump output if specified codebase");
         System.err.println("              is being checked");
-
+        System.err.println();
+        System.err.println("The following can be used with provider:");
+        System.err.println();
+        System.err.println("engine=<engines>");
+        System.err.println("              only dump output for the specified list");
+        System.err.println("              of JCA engines. Supported values:");
+        System.err.println("              Cipher, KeyAgreement, KeyGenerator,");
+        System.err.println("              KeyPairGenerator, KeyStore, Mac,");
+        System.err.println("              MessageDigest, SecureRandom, Signature.");
         System.err.println();
         System.err.println("Note: Separate multiple options with a comma");
         System.exit(0);
diff --git a/src/share/classes/sun/swing/JLightweightFrame.java b/src/share/classes/sun/swing/JLightweightFrame.java
index 6566741..c8882e4 100644
--- a/src/share/classes/sun/swing/JLightweightFrame.java
+++ b/src/share/classes/sun/swing/JLightweightFrame.java
@@ -37,6 +37,13 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Window;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.InvalidDnDOperationException;
+import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
@@ -470,4 +477,27 @@
             content.setCursor(target.getCursor());
         }
     }
+
+    public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
+            Class<T> abstractRecognizerClass,
+            DragSource ds, Component c, int srcActions,
+            DragGestureListener dgl)
+    {
+        return content == null ? null : content.createDragGestureRecognizer(
+                abstractRecognizerClass, ds, c, srcActions, dgl);
+    }
+
+    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
+        return content == null ? null : content.createDragSourceContextPeer(dge);
+    }
+
+    public void addDropTarget(DropTarget dt) {
+        if (content == null) return;
+        content.addDropTarget(dt);
+    }
+
+    public void removeDropTarget(DropTarget dt) {
+        if (content == null) return;
+        content.removeDropTarget(dt);
+    }
 }
diff --git a/src/share/classes/sun/swing/LightweightContent.java b/src/share/classes/sun/swing/LightweightContent.java
index 2296a17..d90d43f 100644
--- a/src/share/classes/sun/swing/LightweightContent.java
+++ b/src/share/classes/sun/swing/LightweightContent.java
@@ -26,7 +26,15 @@
 package sun.swing;
 
 import javax.swing.JComponent;
+import java.awt.Component;
 import java.awt.Cursor;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.InvalidDnDOperationException;
+import java.awt.dnd.peer.DragSourceContextPeer;
 
 /**
  * The interface by means of which the {@link JLightweightFrame} class
@@ -209,4 +217,33 @@
      * @param cursor a cursor to set
      */
     default public void setCursor(Cursor cursor) { }
+
+    /**
+     * Create a drag gesture recognizer for the lightweight frame.
+     */
+    default public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
+            Class<T> abstractRecognizerClass,
+            DragSource ds, Component c, int srcActions,
+            DragGestureListener dgl)
+    {
+        return null;
+    }
+
+    /**
+     * Create a drag source context peer for the lightweight frame.
+     */
+    default public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
+    {
+        return null;
+    }
+
+    /**
+     * Adds a drop target to the lightweight frame.
+     */
+    default public void addDropTarget(DropTarget dt) {}
+
+    /**
+     * Removes a drop target from the lightweight frame.
+     */
+    default public void removeDropTarget(DropTarget dt) {}
 }
diff --git a/src/share/classes/sun/text/resources/FormatData.java b/src/share/classes/sun/text/resources/FormatData.java
index 971177f..bcb328d 100644
--- a/src/share/classes/sun/text/resources/FormatData.java
+++ b/src/share/classes/sun/text/resources/FormatData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -154,18 +154,18 @@
             },
             { "MonthNarrows",
                 new String[] {
-                    "J",
-                    "F",
-                    "M",
-                    "A",
-                    "M",
-                    "J",
-                    "J",
-                    "A",
-                    "S",
-                    "O",
-                    "N",
-                    "D",
+                    "1",
+                    "2",
+                    "3",
+                    "4",
+                    "5",
+                    "6",
+                    "7",
+                    "8",
+                    "9",
+                    "10",
+                    "11",
+                    "12",
                     "",
                 }
             },
diff --git a/src/share/classes/sun/text/resources/en/FormatData_en.java b/src/share/classes/sun/text/resources/en/FormatData_en.java
index d51c9f3..85ae55d 100644
--- a/src/share/classes/sun/text/resources/en/FormatData_en.java
+++ b/src/share/classes/sun/text/resources/en/FormatData_en.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,23 @@
         // define this method as follows:
         //    return new Object[][] { };
         return new Object[][] {
+            { "MonthNarrows",
+                new String[] {
+                    "J",
+                    "F",
+                    "M",
+                    "A",
+                    "M",
+                    "J",
+                    "J",
+                    "A",
+                    "S",
+                    "O",
+                    "N",
+                    "D",
+                    "",
+                }
+            },
             { "NumberPatterns",
                 new String[] {
                     "#,##0.###;-#,##0.###", // decimal pattern
diff --git a/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
index 4b858bb..bf2e951 100644
--- a/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
+++ b/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.util.Properties;
-import java.util.Map;
+import java.util.stream.Collectors;
 
 /*
  * The HotSpot implementation of com.sun.tools.attach.VirtualMachine.
@@ -161,6 +161,50 @@
         return props;
     }
 
+    private static final String MANAGMENT_PREFIX = "com.sun.management.";
+
+    private static boolean checkedKeyName(Object key) {
+        if (!(key instanceof String)) {
+            throw new IllegalArgumentException("Invalid option (not a String): "+key);
+        }
+        if (!((String)key).startsWith(MANAGMENT_PREFIX)) {
+            throw new IllegalArgumentException("Invalid option: "+key);
+        }
+        return true;
+    }
+
+    private static String stripKeyName(Object key) {
+        return ((String)key).substring(MANAGMENT_PREFIX.length());
+    }
+
+    @Override
+    public void startManagementAgent(Properties agentProperties) throws IOException {
+        if (agentProperties == null) {
+            throw new NullPointerException("agentProperties cannot be null");
+        }
+        // Convert the arguments into arguments suitable for the Diagnostic Command:
+        // "ManagementAgent.start jmxremote.port=5555 jmxremote.authenticate=false"
+        String args = agentProperties.entrySet().stream()
+            .filter(entry -> checkedKeyName(entry.getKey()))
+            .map(entry -> stripKeyName(entry.getKey()) + "=" + escape(entry.getValue()))
+            .collect(Collectors.joining(" "));
+        executeJCmd("ManagementAgent.start " + args);
+    }
+
+    private String escape(Object arg) {
+        String value = arg.toString();
+        if (value.contains(" ")) {
+            return "'" + value + "'";
+        }
+        return value;
+    }
+
+    @Override
+    public String startLocalManagementAgent() throws IOException {
+        executeJCmd("ManagementAgent.start_local");
+        return getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
+    }
+
     // --- HotSpot specific methods ---
 
     // same as SIGQUIT
@@ -257,6 +301,20 @@
         return value;
     }
 
+    /*
+     * Utility method to read data into a String.
+     */
+    String readErrorMessage(InputStream sis) throws IOException {
+        byte b[] = new byte[1024];
+        int n;
+        StringBuffer message = new StringBuffer();
+        while ((n = sis.read(b)) != -1) {
+            message.append(new String(b, 0, n, "UTF-8"));
+        }
+        return message.toString();
+    }
+
+
     // -- attach timeout support
 
     private static long defaultAttachTimeout = 5000;
diff --git a/src/share/classes/sun/tools/jcmd/JCmd.java b/src/share/classes/sun/tools/jcmd/JCmd.java
index 8c5a2c5..0ff4632 100644
--- a/src/share/classes/sun/tools/jcmd/JCmd.java
+++ b/src/share/classes/sun/tools/jcmd/JCmd.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,10 +33,12 @@
 import java.util.Comparator;
 import java.net.URISyntaxException;
 
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
+
 import sun.tools.attach.HotSpotVirtualMachine;
 import sun.tools.jstat.JStatLogger;
 import sun.jvmstat.monitor.Monitor;
@@ -119,6 +121,7 @@
             pids.add(arg.getPid() + "");
         }
 
+        boolean success = true;
         for (String pid : pids) {
             System.out.println(pid + ":");
             if (arg.isListCounters()) {
@@ -126,11 +129,16 @@
             } else {
                 try {
                     executeCommandForPid(pid, arg.getCommand());
+                } catch(AttachOperationFailedException ex) {
+                    System.err.println(ex.getMessage());
+                    success = false;
                 } catch(Exception ex) {
                     ex.printStackTrace();
+                    success = false;
                 }
             }
         }
+        System.exit(success ? 0 : 1);
     }
 
     private static void executeCommandForPid(String pid, String command)
@@ -150,13 +158,18 @@
                 // read to EOF and just print output
                 byte b[] = new byte[256];
                 int n;
+                boolean messagePrinted = false;
                 do {
                     n = in.read(b);
                     if (n > 0) {
                         String s = new String(b, 0, n, "UTF-8");
                         System.out.print(s);
+                        messagePrinted = true;
                     }
                 } while (n > 0);
+                if (!messagePrinted) {
+                    System.out.println("Command executed successfully");
+                }
             }
         }
         vm.detach();
diff --git a/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java b/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
index 65b03e0..e6c827b 100644
--- a/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
+++ b/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,6 @@
 // Sun specific
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
-import com.sun.tools.attach.AgentInitializationException;
-import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 
 // Sun private
@@ -238,35 +236,7 @@
             throw ioe;
         }
 
-        String home = vm.getSystemProperties().getProperty("java.home");
-
-        // Normally in ${java.home}/jre/lib/management-agent.jar but might
-        // be in ${java.home}/lib in build environments.
-
-        String agent = home + File.separator + "jre" + File.separator +
-                           "lib" + File.separator + "management-agent.jar";
-        File f = new File(agent);
-        if (!f.exists()) {
-            agent = home + File.separator +  "lib" + File.separator +
-                        "management-agent.jar";
-            f = new File(agent);
-            if (!f.exists()) {
-                throw new IOException("Management agent not found");
-            }
-        }
-
-        agent = f.getCanonicalPath();
-        try {
-            vm.loadAgent(agent, "com.sun.management.jmxremote");
-        } catch (AgentLoadException x) {
-            IOException ioe = new IOException(x.getMessage());
-            ioe.initCause(x);
-            throw ioe;
-        } catch (AgentInitializationException x) {
-            IOException ioe = new IOException(x.getMessage());
-            ioe.initCause(x);
-            throw ioe;
-        }
+        vm.startLocalManagementAgent();
 
         // get the connector address
         Properties agentProps = vm.getAgentProperties();
diff --git a/src/share/demo/README b/src/share/demo/README
index ae56b64..e70be01 100644
--- a/src/share/demo/README
+++ b/src/share/demo/README
@@ -4,3 +4,12 @@
 production-quality application, such as security checks, input
 validation, and proper error handling, might not be present in the
 sample code.
+
+In some cases, the default security settings may block an execution
+of demo applets in a browser. To adjust the security settings, please
+refer to the following resource:
+
+http://java.com/en/download/help/java_blocked.xml
+
+Some demo applets need to be accessed through the HTTP or HTTPS
+protocols to enable access to the required resources.
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources.properties
deleted file mode 100644
index 1bbea03..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=This is Java 2D! (Default)
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_de.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_de.properties
deleted file mode 100644
index d38794c..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_de.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=This is Java 2D! (German) \u00f6 \u00df \u00dc
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_en.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_en.properties
deleted file mode 100644
index efff7d0..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_en.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=This is Java 2D! (English) A B C
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_en_GB.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_en_GB.properties
deleted file mode 100644
index be4261d..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_en_GB.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=This is Java 2D! (English in Great Britain) \u0075 \u006b Z
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_ja.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_ja.properties
deleted file mode 100644
index f5cb9d7..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_ja.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=Java 2D\u3067\u3059\u3002(\u30C7\u30D5\u30A9\u30EB\u30C8)
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_ko.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_ko.properties
deleted file mode 100644
index 819d2c3..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_ko.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=This is Java 2D! (Korean)
diff --git a/src/share/demo/jfc/Font2DTest/resources/TextResources_zh_CN.properties b/src/share/demo/jfc/Font2DTest/resources/TextResources_zh_CN.properties
deleted file mode 100644
index 7f7fa0d..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/TextResources_zh_CN.properties
+++ /dev/null
@@ -1 +0,0 @@
-string=\u8FD9\u662F Java 2D! (\u9ED8\u8BA4\u503C)
diff --git a/src/share/demo/jfc/Font2DTest/resources/resource.data b/src/share/demo/jfc/Font2DTest/resources/resource.data
deleted file mode 100644
index f18b78e..0000000
--- a/src/share/demo/jfc/Font2DTest/resources/resource.data
+++ /dev/null
@@ -1,5 +0,0 @@
-en US
-en GB
-ko KO
-ab KO
-de DE
diff --git a/src/share/javavm/export/jvm.h b/src/share/javavm/export/jvm.h
index 2d67c13..611120f 100644
--- a/src/share/javavm/export/jvm.h
+++ b/src/share/javavm/export/jvm.h
@@ -439,9 +439,6 @@
 JNIEXPORT jobjectArray JNICALL
 JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
 
-JNIEXPORT jobject JNICALL
-JVM_GetClassLoader(JNIEnv *env, jclass cls);
-
 JNIEXPORT jboolean JNICALL
 JVM_IsInterface(JNIEnv *env, jclass cls);
 
@@ -1394,6 +1391,31 @@
 JNIEXPORT jobjectArray JNICALL
 JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
 
+/*
+ * Returns true if the JVM's lookup cache indicates that this class is
+ * known to NOT exist for the given loader.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_KnownToNotExist(JNIEnv *env, jobject loader, const char *classname);
+
+/*
+ * Returns an array of all URLs that are stored in the JVM's lookup cache
+ * for the given loader. NULL if the lookup cache is unavailable.
+ */
+JNIEXPORT jobjectArray JNICALL
+JVM_GetResourceLookupCacheURLs(JNIEnv *env, jobject loader);
+
+/*
+ * Returns an array of all URLs that *may* contain the resource_name for the
+ * given loader. This function returns an integer array, each element
+ * of which can be used to index into the array returned by
+ * JVM_GetResourceLookupCacheURLs of the same loader to determine the
+ * URLs.
+ */
+JNIEXPORT jintArray JNICALL
+JVM_GetResourceLookupCache(JNIEnv *env, jobject loader, const char *resource_name);
+
+
 /* =========================================================================
  * The following defines a private JVM interface that the JDK can query
  * for the JVM version and capabilities.  sun.misc.Version defines
diff --git a/src/share/lib/security/sunpkcs11-solaris.cfg b/src/share/lib/security/sunpkcs11-solaris.cfg
index a2233d8..4cade8e 100644
--- a/src/share/lib/security/sunpkcs11-solaris.cfg
+++ b/src/share/lib/security/sunpkcs11-solaris.cfg
@@ -18,16 +18,6 @@
 
 disabledMechanisms = {
   CKM_DSA_KEY_PAIR_GEN
-# the following mechanisms are disabled due to CKR_SAVED_STATE_INVALID bug
-# (Solaris bug 7058108)
-  CKM_MD2
-  CKM_MD5
-  CKM_SHA_1
-# the following mechanisms are disabled due to no cloning support
-# (Solaris bug 7050617)
-  CKM_SHA256
-  CKM_SHA384
-  CKM_SHA512
 # the following mechanisms are disabled due to performance issues
 # (Solaris bug 6337157)
   CKM_DSA_SHA1
@@ -36,10 +26,5 @@
   CKM_SHA256_RSA_PKCS
   CKM_SHA384_RSA_PKCS
   CKM_SHA512_RSA_PKCS
-# the following mechanisms are disabled to ensure backward compatibility
-# (Solaris bug 6545046)
-  CKM_DES_CBC_PAD
-  CKM_DES3_CBC_PAD
-  CKM_AES_CBC_PAD
 }
 
diff --git a/src/share/native/common/check_code.c b/src/share/native/common/check_code.c
index 92d96b1..4ffbd67 100644
--- a/src/share/native/common/check_code.c
+++ b/src/share/native/common/check_code.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1357,16 +1357,9 @@
                 }
                 (*env)->DeleteLocalRef(env, super);
 
-                /* The optimizer make cause this to happen on local code */
+                /* The optimizer may cause this to happen on local code */
                 if (not_found) {
-#ifdef BROKEN_JAVAC
-                    jobject loader = JVM_GetClassLoader(env, context->class);
-                    int has_loader = (loader != 0);
-                    (*env)->DeleteLocalRef(env, loader);
-                    if (has_loader)
-#endif /* BROKEN_JAVAC */
-                        CCerror(context,
-                                "Illegal use of nonvirtual function call");
+                    CCerror(context, "Illegal use of nonvirtual function call");
                 }
             }
         }
diff --git a/src/share/native/java/io/FileInputStream.c b/src/share/native/java/io/FileInputStream.c
index 092ddbf..dc1aea5 100644
--- a/src/share/native/java/io/FileInputStream.c
+++ b/src/share/native/java/io/FileInputStream.c
@@ -57,7 +57,7 @@
  */
 
 JNIEXPORT void JNICALL
-Java_java_io_FileInputStream_open(JNIEnv *env, jobject this, jstring path) {
+Java_java_io_FileInputStream_open0(JNIEnv *env, jobject this, jstring path) {
     fileOpen(env, this, path, fis_fd, O_RDONLY);
 }
 
diff --git a/src/share/native/java/io/RandomAccessFile.c b/src/share/native/java/io/RandomAccessFile.c
index 53b5f1a..a44d8f3 100644
--- a/src/share/native/java/io/RandomAccessFile.c
+++ b/src/share/native/java/io/RandomAccessFile.c
@@ -47,8 +47,8 @@
 
 
 JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_open(JNIEnv *env,
-                                   jobject this, jstring path, jint mode)
+Java_java_io_RandomAccessFile_open0(JNIEnv *env,
+                                    jobject this, jstring path, jint mode)
 {
     int flags = 0;
     if (mode & java_io_RandomAccessFile_O_RDONLY)
diff --git a/src/share/native/java/lang/Class.c b/src/share/native/java/lang/Class.c
index 2f5e6b5..b80b717 100644
--- a/src/share/native/java/lang/Class.c
+++ b/src/share/native/java/lang/Class.c
@@ -45,7 +45,6 @@
 #define CLS "Ljava/lang/Class;"
 #define CPL "Lsun/reflect/ConstantPool;"
 #define STR "Ljava/lang/String;"
-#define JCL "Ljava/lang/ClassLoader;"
 #define FLD "Ljava/lang/reflect/Field;"
 #define MHD "Ljava/lang/reflect/Method;"
 #define CTR "Ljava/lang/reflect/Constructor;"
@@ -56,7 +55,6 @@
     {"getName0",         "()" STR,          (void *)&JVM_GetClassName},
     {"getSuperclass",    "()" CLS,          NULL},
     {"getInterfaces0",   "()[" CLS,         (void *)&JVM_GetClassInterfaces},
-    {"getClassLoader0",  "()" JCL,          (void *)&JVM_GetClassLoader},
     {"isInterface",      "()Z",             (void *)&JVM_IsInterface},
     {"getSigners",       "()[" OBJ,         (void *)&JVM_GetClassSigners},
     {"setSigners",       "([" OBJ ")V",     (void *)&JVM_SetClassSigners},
@@ -81,7 +79,6 @@
 #undef OBJ
 #undef CLS
 #undef STR
-#undef JCL
 #undef FLD
 #undef MHD
 #undef CTR
diff --git a/src/share/native/java/lang/ClassLoader.c b/src/share/native/java/lang/ClassLoader.c
index f6d0583..9a4c5db 100644
--- a/src/share/native/java/lang/ClassLoader.c
+++ b/src/share/native/java/lang/ClassLoader.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
 
 /* Convert java string to UTF char*. Use local buffer if possible,
    otherwise malloc new memory. Returns null IFF malloc failed. */
-static char*
+char*
 getUTF(JNIEnv *env, jstring str, char* localBuf, int bufSize)
 {
     char* utfStr = NULL;
diff --git a/src/share/native/java/lang/java_props.h b/src/share/native/java/lang/java_props.h
index 21207d9..98caf63 100644
--- a/src/share/native/java/lang/java_props.h
+++ b/src/share/native/java/lang/java_props.h
@@ -117,7 +117,7 @@
 
     char *exceptionList;
 
-    char *awt_headless  /* java.awt.headless setting, if NULL (default) will not be set */
+    char *awt_headless;  /* java.awt.headless setting, if NULL (default) will not be set */
 #endif
 
 } java_props_t;
diff --git a/src/share/native/java/util/TimeZone.c b/src/share/native/java/util/TimeZone.c
index d061b33..95e4e0a 100644
--- a/src/share/native/java/util/TimeZone.c
+++ b/src/share/native/java/util/TimeZone.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,42 +38,28 @@
  */
 JNIEXPORT jstring JNICALL
 Java_java_util_TimeZone_getSystemTimeZoneID(JNIEnv *env, jclass ign,
-                                            jstring java_home, jstring country)
+                                            jstring java_home)
 {
-    const char *cname;
     const char *java_home_dir;
     char *javaTZ;
+    jstring jstrJavaTZ = NULL;
 
-    if (java_home == NULL)
-        return NULL;
+    CHECK_NULL_RETURN(java_home, NULL);
 
     java_home_dir = JNU_GetStringPlatformChars(env, java_home, 0);
-    if (java_home_dir == NULL)
-        return NULL;
-
-    if (country != NULL) {
-        cname = JNU_GetStringPlatformChars(env, country, 0);
-        /* ignore error cases for cname */
-    } else {
-        cname = NULL;
-    }
+    CHECK_NULL_RETURN(java_home_dir, NULL);
 
     /*
      * Invoke platform dependent mapping function
      */
-    javaTZ = findJavaTZ_md(java_home_dir, cname);
-
-    free((void *)java_home_dir);
-    if (cname != NULL) {
-        free((void *)cname);
-    }
-
+    javaTZ = findJavaTZ_md(java_home_dir);
     if (javaTZ != NULL) {
-        jstring jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
+        jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
         free((void *)javaTZ);
-        return jstrJavaTZ;
     }
-    return NULL;
+
+    JNU_ReleaseStringPlatformChars(env, java_home, java_home_dir);
+    return jstrJavaTZ;
 }
 
 /*
diff --git a/src/share/native/sun/awt/image/BufImgSurfaceData.c b/src/share/native/sun/awt/image/BufImgSurfaceData.c
index 6dc99ab..e51f53a 100644
--- a/src/share/native/sun/awt/image/BufImgSurfaceData.c
+++ b/src/share/native/sun/awt/image/BufImgSurfaceData.c
@@ -291,7 +291,12 @@
             = (*env)->GetBooleanField(env, bisdo->icm, allGrayID);
         int *pRgb = (int *)
             ((*env)->GetPrimitiveArrayCritical(env, bisdo->lutarray, NULL));
-        CHECK_NULL_RETURN(pRgb, (ColorData*)NULL);
+
+        if (pRgb == NULL) {
+            free(cData);
+            return (ColorData*)NULL;
+        }
+
         cData->img_clr_tbl = initCubemap(pRgb, bisdo->lutsize, 32);
         if (allGray == JNI_TRUE) {
             initInverseGrayLut(pRgb, bisdo->lutsize, cData);
@@ -304,7 +309,13 @@
         if (JNU_IsNull(env, colorData)) {
             jlong pData = ptr_to_jlong(cData);
             colorData = (*env)->NewObjectA(env, clsICMCD, initICMCDmID, (jvalue *)&pData);
-            JNU_CHECK_EXCEPTION_RETURN(env, (ColorData*)NULL);
+
+            if ((*env)->ExceptionCheck(env))
+            {
+                free(cData);
+                return (ColorData*)NULL;
+            }
+
             (*env)->SetObjectField(env, bisdo->icm, colorDataID, colorData);
         }
     }
diff --git a/src/share/native/sun/awt/image/awt_parseImage.c b/src/share/native/sun/awt/image/awt_parseImage.c
index 9cb03be..882c799 100644
--- a/src/share/native/sun/awt/image/awt_parseImage.c
+++ b/src/share/native/sun/awt/image/awt_parseImage.c
@@ -508,6 +508,7 @@
     cmP->csType = (*env)->GetIntField(env, cmP->jcmodel, g_CMcsTypeID);
 
     cmP->cmType = getColorModelType(env, jcmodel);
+    JNU_CHECK_EXCEPTION_RETURN(env, -1);
 
     cmP->isDefaultCM = FALSE;
     cmP->isDefaultCompatCM = FALSE;
diff --git a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index f108dde..5f7a036 100644
--- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -56,6 +56,12 @@
 #undef MAX
 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* Cached Java method ids */
 static jmethodID JPEGImageReader_readInputDataID;
 static jmethodID JPEGImageReader_skipInputBytesID;
diff --git a/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
index ba8405c..37b743a 100644
--- a/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
+++ b/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
@@ -47,6 +47,12 @@
 #include <jpeglib.h>
 #include "jerror.h"
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* The method IDs we cache. Note that the last two belongs to the
  * java.io.InputStream class.
  */
diff --git a/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c b/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
index 86f6837..eb63c49 100644
--- a/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
+++ b/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
@@ -220,3 +220,18 @@
     (*env)->ReleaseByteArrayElements(env, data, pBytes, JNI_ABORT);
     return rc ? JNI_TRUE : JNI_FALSE;
 }
+
+/*
+ * Class:     java_awt_SplashScreen
+ * Method:    _getScaleFactor
+ * Signature: (J)F
+ */
+JNIEXPORT jfloat JNICALL Java_java_awt_SplashScreen__1getScaleFactor
+(JNIEnv *env, jclass thisClass, jlong jsplash)
+{
+    Splash *splash = (Splash *) jlong_to_ptr(jsplash);
+    if (!splash) {
+        return 1;
+    }
+    return splash->scaleFactor;
+}
\ No newline at end of file
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_impl.c b/src/share/native/sun/awt/splashscreen/splashscreen_impl.c
index 021447e..ad30a9a 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_impl.c
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_impl.c
@@ -59,6 +59,7 @@
 
     memset(splash, 0, sizeof(Splash));
     splash->currentFrame = -1;
+    splash->scaleFactor = 1;
     initFormat(&splash->imageFormat, QUAD_RED_MASK, QUAD_GREEN_MASK,
         QUAD_BLUE_MASK, QUAD_ALPHA_MASK);
     SplashInitPlatform(splash);
@@ -101,6 +102,13 @@
     SplashSetFileJarName(NULL, NULL);
 }
 
+SPLASHEXPORT void
+SplashSetScaleFactor(float scaleFactor)
+{
+    Splash *splash = SplashGetInstance();
+    splash->scaleFactor = scaleFactor;
+}
+
 void
 SplashDone(Splash * splash)
 {
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_impl.h b/src/share/native/sun/awt/splashscreen/splashscreen_impl.h
index 21f09ce..d26a4cb 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_impl.h
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_impl.h
@@ -35,6 +35,9 @@
 SPLASHEXPORT void SplashInit(void);
 SPLASHEXPORT void SplashClose(void);
 
+SPLASHEXPORT void SplashSetScaleFactor(float);
+SPLASHEXPORT char* SplashGetScaledImageName(const char*, const char*, float*);
+
 SPLASHEXPORT void
 SplashSetFileJarName(const char* fileName, const char* jarName);
 
@@ -79,6 +82,7 @@
     int         fileNameLen;
     char*       jarName;        /* stored in 16-bit unicode (jchars) */
     int         jarNameLen;
+    float       scaleFactor;
 #if defined(WITH_WIN32)
     BOOL isLayered;
     HWND hWnd;
@@ -115,6 +119,8 @@
 
 unsigned SplashTime();
 char* SplashConvertStringAlloc(const char* in, int *size);
+char* SplashGetScaledImageName(const char* jarName,
+                               const char* fileName, float *scaleFactor);
 
 void SplashLock(Splash * splash);
 void SplashUnlock(Splash * splash);
@@ -138,6 +144,7 @@
 void SplashUpdateScreenData(Splash * splash);
 
 void SplashCleanup(Splash * splash);
+void SplashSetScaleFactor(float scaleFactor);
 
 
 typedef struct SplashStream {
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c b/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
index f9cb899..356e3a6 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
@@ -31,6 +31,12 @@
 
 #include <setjmp.h>
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* stream input handling */
 
 typedef struct
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_png.c b/src/share/native/sun/awt/splashscreen/splashscreen_png.c
index 08e381b..873f91f 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_png.c
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_png.c
@@ -71,7 +71,12 @@
         goto done;
     }
 
+#ifdef __APPLE__
+    /* use setjmp/longjmp versions that do not save/restore the signal mask */
+    if (_setjmp(png_set_longjmp_fn(png_ptr, _longjmp, sizeof(jmp_buf)))) {
+#else
     if (setjmp(png_jmpbuf(png_ptr))) {
+#endif
         goto done;
     }
 
diff --git a/src/share/native/sun/font/DrawGlyphList.c b/src/share/native/sun/font/DrawGlyphList.c
index 483e3fe..c4dcdf9 100644
--- a/src/share/native/sun/font/DrawGlyphList.c
+++ b/src/share/native/sun/font/DrawGlyphList.c
@@ -52,7 +52,8 @@
 
 GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist) {
 
-    int g, bytesNeeded;
+    int g;
+    size_t bytesNeeded;
     jlong *imagePtrs;
     jfloat* positions = NULL;
     GlyphInfo *ginfo;
@@ -71,6 +72,9 @@
 
     bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
     gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+    if (gbv == NULL) {
+        return NULL;
+    }
     gbv->numGlyphs = len;
     gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
 
@@ -479,7 +483,8 @@
  */
 GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist) {
 
-    int g, bytesNeeded;
+    int g;
+    size_t bytesNeeded;
     jlong *imagePtrs;
     jfloat* positions = NULL;
     GlyphInfo *ginfo;
@@ -500,6 +505,9 @@
 
     bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
     gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+    if (gbv == NULL) {
+        return NULL;
+    }
     gbv->numGlyphs = len;
     gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
 
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmscam02.c b/src/share/native/sun/java2d/cmm/lcms/cmscam02.c
index 38d164a..86ec167 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmscam02.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscam02.c
@@ -467,11 +467,12 @@
     CAM02COLOR clr;
     cmsCIECAM02* lpMod = (cmsCIECAM02*) hModel;
 
-    memset(&clr, 0, sizeof(clr));
     _cmsAssert(lpMod != NULL);
     _cmsAssert(pIn != NULL);
     _cmsAssert(pOut != NULL);
 
+    memset(&clr, 0, sizeof(clr));
+
     clr.XYZ[0] = pIn ->X;
     clr.XYZ[1] = pIn ->Y;
     clr.XYZ[2] = pIn ->Z;
@@ -492,11 +493,12 @@
     CAM02COLOR clr;
     cmsCIECAM02* lpMod = (cmsCIECAM02*) hModel;
 
-    memset(&clr, 0, sizeof(clr));
     _cmsAssert(lpMod != NULL);
     _cmsAssert(pIn != NULL);
     _cmsAssert(pOut != NULL);
 
+    memset(&clr, 0, sizeof(clr));
+
     clr.J = pIn -> J;
     clr.C = pIn -> C;
     clr.h = pIn -> h;
@@ -511,4 +513,3 @@
     pOut ->Y = clr.XYZ[1];
     pOut ->Z = clr.XYZ[2];
 }
-
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmscgats.c b/src/share/native/sun/java2d/cmm/lcms/cmscgats.c
index 11fe36e..e3079d1 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmscgats.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscgats.c
@@ -77,7 +77,7 @@
 // Symbols
 typedef enum {
 
-        SNONE,
+        SUNDEFINED,
         SINUM,      // Integer
         SDNUM,      // Real
         SIDENT,     // Identifier
@@ -550,7 +550,7 @@
         else l = x + 1;
     }
 
-    return SNONE;
+    return SUNDEFINED;
 }
 
 
@@ -735,7 +735,7 @@
 
 
             key = BinSrchKey(it8->id);
-            if (key == SNONE) it8->sy = SIDENT;
+            if (key == SUNDEFINED) it8->sy = SIDENT;
             else it8->sy = key;
 
         }
@@ -1326,7 +1326,7 @@
     it8->ValidKeywords = NULL;
     it8->ValidSampleID = NULL;
 
-    it8 -> sy = SNONE;
+    it8 -> sy = SUNDEFINED;
     it8 -> ch = ' ';
     it8 -> Source = NULL;
     it8 -> inum = 0;
@@ -2179,9 +2179,9 @@
 
         if (cmsstrcasecmp(Fld, "SAMPLE_ID") == 0) {
 
-                    t -> SampleID = idField;
+            t -> SampleID = idField;
 
-        for (i=0; i < t -> nPatches; i++) {
+            for (i=0; i < t -> nPatches; i++) {
 
                 char *Data = GetData(it8, i, idField);
                 if (Data) {
@@ -2196,7 +2196,7 @@
                         SetData(it8, i, idField, Buffer);
 
                 }
-                }
+            }
 
         }
 
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c b/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c
index cea3b8b..bc2b0da 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c
@@ -137,15 +137,68 @@
 
 
 // A pointer to the begining of the list
-static cmsIntentsList *Intents = DefaultIntents;
+_cmsIntentsPluginChunkType _cmsIntentsPluginChunk = { NULL };
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupPluginIntentsList(struct _cmsContext_struct* ctx,
+                                               const struct _cmsContext_struct* src)
+{
+   _cmsIntentsPluginChunkType newHead = { NULL };
+   cmsIntentsList*  entry;
+   cmsIntentsList*  Anterior = NULL;
+   _cmsIntentsPluginChunkType* head = (_cmsIntentsPluginChunkType*) src->chunks[IntentPlugin];
+
+    // Walk the list copying all nodes
+   for (entry = head->Intents;
+        entry != NULL;
+        entry = entry ->Next) {
+
+            cmsIntentsList *newEntry = ( cmsIntentsList *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(cmsIntentsList));
+
+            if (newEntry == NULL)
+                return;
+
+            // We want to keep the linked list order, so this is a little bit tricky
+            newEntry -> Next = NULL;
+            if (Anterior)
+                Anterior -> Next = newEntry;
+
+            Anterior = newEntry;
+
+            if (newHead.Intents == NULL)
+                newHead.Intents = newEntry;
+    }
+
+  ctx ->chunks[IntentPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsIntentsPluginChunkType));
+}
+
+void  _cmsAllocIntentsPluginChunk(struct _cmsContext_struct* ctx,
+                                         const struct _cmsContext_struct* src)
+{
+    if (src != NULL) {
+
+        // Copy all linked list
+        DupPluginIntentsList(ctx, src);
+    }
+    else {
+        static _cmsIntentsPluginChunkType IntentsPluginChunkType = { NULL };
+        ctx ->chunks[IntentPlugin] = _cmsSubAllocDup(ctx ->MemPool, &IntentsPluginChunkType, sizeof(_cmsIntentsPluginChunkType));
+    }
+}
+
 
 // Search the list for a suitable intent. Returns NULL if not found
 static
-cmsIntentsList* SearchIntent(cmsUInt32Number Intent)
+cmsIntentsList* SearchIntent(cmsContext ContextID, cmsUInt32Number Intent)
 {
+    _cmsIntentsPluginChunkType* ctx = ( _cmsIntentsPluginChunkType*) _cmsContextGetClientChunk(ContextID, IntentPlugin);
     cmsIntentsList* pt;
 
-    for (pt = Intents; pt != NULL; pt = pt -> Next)
+    for (pt = ctx -> Intents; pt != NULL; pt = pt -> Next)
+        if (pt ->Intent == Intent) return pt;
+
+    for (pt = DefaultIntents; pt != NULL; pt = pt -> Next)
         if (pt ->Intent == Intent) return pt;
 
     return NULL;
@@ -1031,7 +1084,7 @@
     // this case would present some issues if the custom intent tries to do things like
     // preserve primaries. This solution is not perfect, but works well on most cases.
 
-    Intent = SearchIntent(TheIntents[0]);
+    Intent = SearchIntent(ContextID, TheIntents[0]);
     if (Intent == NULL) {
         cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported intent '%d'", TheIntents[0]);
         return NULL;
@@ -1046,12 +1099,14 @@
 // Get information about available intents. nMax is the maximum space for the supplied "Codes"
 // and "Descriptions" the function returns the total number of intents, which may be greater
 // than nMax, although the matrices are not populated beyond this level.
-cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions)
+cmsUInt32Number CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions)
 {
+    _cmsIntentsPluginChunkType* ctx = ( _cmsIntentsPluginChunkType*) _cmsContextGetClientChunk(ContextID, IntentPlugin);
     cmsIntentsList* pt;
     cmsUInt32Number nIntents;
 
-    for (nIntents=0, pt = Intents; pt != NULL; pt = pt -> Next)
+
+    for (nIntents=0, pt = ctx->Intents; pt != NULL; pt = pt -> Next)
     {
         if (nIntents < nMax) {
             if (Codes != NULL)
@@ -1064,37 +1119,52 @@
         nIntents++;
     }
 
+    for (nIntents=0, pt = DefaultIntents; pt != NULL; pt = pt -> Next)
+    {
+        if (nIntents < nMax) {
+            if (Codes != NULL)
+                Codes[nIntents] = pt ->Intent;
+
+            if (Descriptions != NULL)
+                Descriptions[nIntents] = pt ->Description;
+        }
+
+        nIntents++;
+    }
     return nIntents;
 }
 
+cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions)
+{
+    return cmsGetSupportedIntentsTHR(NULL, nMax, Codes, Descriptions);
+}
+
 // The plug-in registration. User can add new intents or override default routines
 cmsBool  _cmsRegisterRenderingIntentPlugin(cmsContext id, cmsPluginBase* Data)
 {
+    _cmsIntentsPluginChunkType* ctx = ( _cmsIntentsPluginChunkType*) _cmsContextGetClientChunk(id, IntentPlugin);
     cmsPluginRenderingIntent* Plugin = (cmsPluginRenderingIntent*) Data;
     cmsIntentsList* fl;
 
-    // Do we have to reset the intents?
+    // Do we have to reset the custom intents?
     if (Data == NULL) {
 
-       Intents = DefaultIntents;
-       return TRUE;
+        ctx->Intents = NULL;
+        return TRUE;
     }
 
-    fl = SearchIntent(Plugin ->Intent);
+    fl = (cmsIntentsList*) _cmsPluginMalloc(id, sizeof(cmsIntentsList));
+    if (fl == NULL) return FALSE;
 
-    if (fl == NULL) {
-        fl = (cmsIntentsList*) _cmsPluginMalloc(id, sizeof(cmsIntentsList));
-        if (fl == NULL) return FALSE;
-    }
 
     fl ->Intent  = Plugin ->Intent;
-    strncpy(fl ->Description, Plugin ->Description, 255);
-    fl ->Description[255] = 0;
+    strncpy(fl ->Description, Plugin ->Description, sizeof(fl ->Description)-1);
+    fl ->Description[sizeof(fl ->Description)-1] = 0;
 
     fl ->Link    = Plugin ->Link;
 
-    fl ->Next = Intents;
-    Intents = fl;
+    fl ->Next = ctx ->Intents;
+    ctx ->Intents = fl;
 
     return TRUE;
 }
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmserr.c b/src/share/native/sun/java2d/cmm/lcms/cmserr.c
index bf1e260..306d036 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmserr.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmserr.c
@@ -60,13 +60,14 @@
 // compare two strings ignoring case
 int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2)
 {
-         register const unsigned char *us1 = (const unsigned char *)s1,
-                                      *us2 = (const unsigned char *)s2;
+    register const unsigned char *us1 = (const unsigned char *)s1,
+                                 *us2 = (const unsigned char *)s2;
 
-        while (toupper(*us1) == toupper(*us2++))
-                if (*us1++ == '\0')
-                        return (0);
-        return (toupper(*us1) - toupper(*--us2));
+    while (toupper(*us1) == toupper(*us2++))
+        if (*us1++ == '\0')
+            return 0;
+
+    return (toupper(*us1) - toupper(*--us2));
 }
 
 // long int because C99 specifies ftell in such way (7.19.9.2)
@@ -91,9 +92,8 @@
 //
 // This is the interface to low-level memory management routines. By default a simple
 // wrapping to malloc/free/realloc is provided, although there is a limit on the max
-// amount of memoy that can be reclaimed. This is mostly as a safety feature to
-// prevent bogus or malintentionated code to allocate huge blocks that otherwise lcms
-// would never need.
+// amount of memoy that can be reclaimed. This is mostly as a safety feature to prevent
+// bogus or evil code to allocate huge blocks that otherwise lcms would never need.
 
 #define MAX_MEMORY_FOR_ALLOC  ((cmsUInt32Number)(1024U*1024U*512U))
 
@@ -103,7 +103,7 @@
 // required to be implemented: malloc, realloc and free, although the user may want to
 // replace the optional mallocZero, calloc and dup as well.
 
-cmsBool   _cmsRegisterMemHandlerPlugin(cmsPluginBase* Plugin);
+cmsBool   _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
 // *********************************************************************************
 
@@ -143,7 +143,7 @@
     cmsUNUSED_PARAMETER(ContextID);
 }
 
-// The default realloc function. Again it check for exploits. If Ptr is NULL,
+// The default realloc function. Again it checks for exploits. If Ptr is NULL,
 // realloc behaves the same way as malloc and allocates a new block of size bytes.
 static
 void* _cmsReallocDefaultFn(cmsContext ContextID, void* Ptr, cmsUInt32Number size)
@@ -196,28 +196,73 @@
     return mem;
 }
 
-// Pointers to malloc and _cmsFree functions in current environment
-static void * (* MallocPtr)(cmsContext ContextID, cmsUInt32Number size)                     = _cmsMallocDefaultFn;
-static void * (* MallocZeroPtr)(cmsContext ContextID, cmsUInt32Number size)                 = _cmsMallocZeroDefaultFn;
-static void   (* FreePtr)(cmsContext ContextID, void *Ptr)                                  = _cmsFreeDefaultFn;
-static void * (* ReallocPtr)(cmsContext ContextID, void *Ptr, cmsUInt32Number NewSize)      = _cmsReallocDefaultFn;
-static void * (* CallocPtr)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size)= _cmsCallocDefaultFn;
-static void * (* DupPtr)(cmsContext ContextID, const void* Org, cmsUInt32Number size)       = _cmsDupDefaultFn;
+
+// Pointers to memory manager functions in Context0
+_cmsMemPluginChunkType _cmsMemPluginChunk = { _cmsMallocDefaultFn, _cmsMallocZeroDefaultFn, _cmsFreeDefaultFn,
+                                              _cmsReallocDefaultFn, _cmsCallocDefaultFn,    _cmsDupDefaultFn
+                                            };
+
+
+// Reset and duplicate memory manager
+void _cmsAllocMemPluginChunk(struct _cmsContext_struct* ctx, const struct _cmsContext_struct* src)
+{
+    _cmsAssert(ctx != NULL);
+
+    if (src != NULL) {
+
+        // Duplicate
+        ctx ->chunks[MemPlugin] = _cmsSubAllocDup(ctx ->MemPool, src ->chunks[MemPlugin], sizeof(_cmsMemPluginChunkType));
+    }
+    else {
+
+        // To reset it, we use the default allocators, which cannot be overriden
+        ctx ->chunks[MemPlugin] = &ctx ->DefaultMemoryManager;
+    }
+}
+
+// Auxiliar to fill memory management functions from plugin (or context 0 defaults)
+void _cmsInstallAllocFunctions(cmsPluginMemHandler* Plugin, _cmsMemPluginChunkType* ptr)
+{
+    if (Plugin == NULL) {
+
+        memcpy(ptr, &_cmsMemPluginChunk, sizeof(_cmsMemPluginChunk));
+    }
+    else {
+
+        ptr ->MallocPtr  = Plugin -> MallocPtr;
+        ptr ->FreePtr    = Plugin -> FreePtr;
+        ptr ->ReallocPtr = Plugin -> ReallocPtr;
+
+        // Make sure we revert to defaults
+        ptr ->MallocZeroPtr= _cmsMallocZeroDefaultFn;
+        ptr ->CallocPtr    = _cmsCallocDefaultFn;
+        ptr ->DupPtr       = _cmsDupDefaultFn;
+
+        if (Plugin ->MallocZeroPtr != NULL) ptr ->MallocZeroPtr = Plugin -> MallocZeroPtr;
+        if (Plugin ->CallocPtr != NULL)     ptr ->CallocPtr     = Plugin -> CallocPtr;
+        if (Plugin ->DupPtr != NULL)        ptr ->DupPtr        = Plugin -> DupPtr;
+
+    }
+}
+
 
 // Plug-in replacement entry
-cmsBool  _cmsRegisterMemHandlerPlugin(cmsPluginBase *Data)
+cmsBool  _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase *Data)
 {
     cmsPluginMemHandler* Plugin = (cmsPluginMemHandler*) Data;
+    _cmsMemPluginChunkType* ptr;
 
-    // NULL forces to reset to defaults
+    // NULL forces to reset to defaults. In this special case, the defaults are stored in the context structure.
+    // Remaining plug-ins does NOT have any copy in the context structure, but this is somehow special as the
+    // context internal data should be malloce'd by using those functions.
     if (Data == NULL) {
 
-        MallocPtr    = _cmsMallocDefaultFn;
-        MallocZeroPtr= _cmsMallocZeroDefaultFn;
-        FreePtr      = _cmsFreeDefaultFn;
-        ReallocPtr   = _cmsReallocDefaultFn;
-        CallocPtr    = _cmsCallocDefaultFn;
-        DupPtr       = _cmsDupDefaultFn;
+       struct _cmsContext_struct* ctx = ( struct _cmsContext_struct*) ContextID;
+
+       // Return to the default allocators
+        if (ContextID != NULL) {
+            ctx->chunks[MemPlugin] = (void*) &ctx->DefaultMemoryManager;
+        }
         return TRUE;
     }
 
@@ -227,51 +272,56 @@
         Plugin -> ReallocPtr == NULL) return FALSE;
 
     // Set replacement functions
-    MallocPtr  = Plugin -> MallocPtr;
-    FreePtr    = Plugin -> FreePtr;
-    ReallocPtr = Plugin -> ReallocPtr;
+    ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    if (ptr == NULL)
+        return FALSE;
 
-    if (Plugin ->MallocZeroPtr != NULL) MallocZeroPtr = Plugin ->MallocZeroPtr;
-    if (Plugin ->CallocPtr != NULL)     CallocPtr     = Plugin -> CallocPtr;
-    if (Plugin ->DupPtr != NULL)        DupPtr        = Plugin -> DupPtr;
-
+    _cmsInstallAllocFunctions(Plugin, ptr);
     return TRUE;
 }
 
 // Generic allocate
 void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size)
 {
-    return MallocPtr(ContextID, size);
+    _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    return ptr ->MallocPtr(ContextID, size);
 }
 
 // Generic allocate & zero
 void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size)
 {
-    return MallocZeroPtr(ContextID, size);
+    _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    return ptr->MallocZeroPtr(ContextID, size);
 }
 
 // Generic calloc
 void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size)
 {
-    return CallocPtr(ContextID, num, size);
+    _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    return ptr->CallocPtr(ContextID, num, size);
 }
 
 // Generic reallocate
 void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number size)
 {
-    return ReallocPtr(ContextID, Ptr, size);
+    _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    return ptr->ReallocPtr(ContextID, Ptr, size);
 }
 
 // Generic free memory
 void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr)
 {
-    if (Ptr != NULL) FreePtr(ContextID, Ptr);
+    if (Ptr != NULL) {
+        _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+        ptr ->FreePtr(ContextID, Ptr);
+    }
 }
 
 // Generic block duplication
 void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size)
 {
-    return DupPtr(ContextID, Org, size);
+    _cmsMemPluginChunkType* ptr = (_cmsMemPluginChunkType*) _cmsContextGetClientChunk(ContextID, MemPlugin);
+    return ptr ->DupPtr(ContextID, Org, size);
 }
 
 // ********************************************************************************************
@@ -380,6 +430,26 @@
     return (void*) ptr;
 }
 
+// Duplicate in pool
+void* _cmsSubAllocDup(_cmsSubAllocator* s, const void *ptr, cmsUInt32Number size)
+{
+    void *NewPtr;
+
+    // Dup of null pointer is also NULL
+    if (ptr == NULL)
+        return NULL;
+
+    NewPtr = _cmsSubAlloc(s, size);
+
+    if (ptr != NULL && NewPtr != NULL) {
+        memcpy(NewPtr, ptr, size);
+    }
+
+    return NewPtr;
+}
+
+
+
 // Error logging ******************************************************************
 
 // There is no error handling at all. When a funtion fails, it returns proper value.
@@ -401,8 +471,26 @@
 // This is our default log error
 static void DefaultLogErrorHandlerFunction(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text);
 
-// The current handler in actual environment
-static cmsLogErrorHandlerFunction LogErrorHandler   = DefaultLogErrorHandlerFunction;
+// Context0 storage, which is global
+_cmsLogErrorChunkType _cmsLogErrorChunk = { DefaultLogErrorHandlerFunction };
+
+// Allocates and inits error logger container for a given context. If src is NULL, only initializes the value
+// to the default. Otherwise, it duplicates the value. The interface is standard across all context clients
+void _cmsAllocLogErrorChunk(struct _cmsContext_struct* ctx,
+                            const struct _cmsContext_struct* src)
+{
+    static _cmsLogErrorChunkType LogErrorChunk = { DefaultLogErrorHandlerFunction };
+    void* from;
+
+     if (src != NULL) {
+        from = src ->chunks[Logger];
+    }
+    else {
+       from = &LogErrorChunk;
+    }
+
+    ctx ->chunks[Logger] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsLogErrorChunkType));
+}
 
 // The default error logger does nothing.
 static
@@ -416,13 +504,24 @@
      cmsUNUSED_PARAMETER(Text);
 }
 
-// Change log error
+// Change log error, context based
+void CMSEXPORT cmsSetLogErrorHandlerTHR(cmsContext ContextID, cmsLogErrorHandlerFunction Fn)
+{
+    _cmsLogErrorChunkType* lhg = (_cmsLogErrorChunkType*) _cmsContextGetClientChunk(ContextID, Logger);
+
+    if (lhg != NULL) {
+
+        if (Fn == NULL)
+            lhg -> LogErrorHandler = DefaultLogErrorHandlerFunction;
+        else
+            lhg -> LogErrorHandler = Fn;
+    }
+}
+
+// Change log error, legacy
 void CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn)
 {
-    if (Fn == NULL)
-        LogErrorHandler = DefaultLogErrorHandlerFunction;
-    else
-        LogErrorHandler = Fn;
+    cmsSetLogErrorHandlerTHR(NULL, Fn);
 }
 
 // Log an error
@@ -431,13 +530,18 @@
 {
     va_list args;
     char Buffer[MAX_ERROR_MESSAGE_LEN];
+    _cmsLogErrorChunkType* lhg;
+
 
     va_start(args, ErrorText);
     vsnprintf(Buffer, MAX_ERROR_MESSAGE_LEN-1, ErrorText, args);
     va_end(args);
 
-    // Call handler
-    LogErrorHandler(ContextID, ErrorCode, Buffer);
+    // Check for the context, if specified go there. If not, go for the global
+    lhg = (_cmsLogErrorChunkType*) _cmsContextGetClientChunk(ContextID, Logger);
+    if (lhg ->LogErrorHandler) {
+        lhg ->LogErrorHandler(ContextID, ErrorCode, Buffer);
+    }
 }
 
 // Utility function to print signatures
@@ -455,3 +559,125 @@
     String[4] = 0;
 }
 
+//--------------------------------------------------------------------------------------------------
+
+
+static
+void* defMtxCreate(cmsContext id)
+{
+    _cmsMutex* ptr_mutex = (_cmsMutex*) _cmsMalloc(id, sizeof(_cmsMutex));
+    _cmsInitMutexPrimitive(ptr_mutex);
+    return (void*) ptr_mutex;
+}
+
+static
+void defMtxDestroy(cmsContext id, void* mtx)
+{
+    _cmsDestroyMutexPrimitive((_cmsMutex *) mtx);
+    _cmsFree(id, mtx);
+}
+
+static
+cmsBool defMtxLock(cmsContext id, void* mtx)
+{
+    cmsUNUSED_PARAMETER(id);
+    return _cmsLockPrimitive((_cmsMutex *) mtx) == 0;
+}
+
+static
+void defMtxUnlock(cmsContext id, void* mtx)
+{
+    cmsUNUSED_PARAMETER(id);
+    _cmsUnlockPrimitive((_cmsMutex *) mtx);
+}
+
+
+
+// Pointers to memory manager functions in Context0
+_cmsMutexPluginChunkType _cmsMutexPluginChunk = { defMtxCreate, defMtxDestroy, defMtxLock, defMtxUnlock };
+
+// Allocate and init mutex container.
+void _cmsAllocMutexPluginChunk(struct _cmsContext_struct* ctx,
+                                        const struct _cmsContext_struct* src)
+{
+    static _cmsMutexPluginChunkType MutexChunk = {defMtxCreate, defMtxDestroy, defMtxLock, defMtxUnlock };
+    void* from;
+
+     if (src != NULL) {
+        from = src ->chunks[MutexPlugin];
+    }
+    else {
+       from = &MutexChunk;
+    }
+
+    ctx ->chunks[MutexPlugin] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsMutexPluginChunkType));
+}
+
+// Register new ways to transform
+cmsBool  _cmsRegisterMutexPlugin(cmsContext ContextID, cmsPluginBase* Data)
+{
+    cmsPluginMutex* Plugin = (cmsPluginMutex*) Data;
+    _cmsMutexPluginChunkType* ctx = ( _cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);
+
+    if (Data == NULL) {
+
+        // No lock routines
+        ctx->CreateMutexPtr = NULL;
+        ctx->DestroyMutexPtr = NULL;
+        ctx->LockMutexPtr = NULL;
+        ctx ->UnlockMutexPtr = NULL;
+        return TRUE;
+    }
+
+    // Factory callback is required
+    if (Plugin ->CreateMutexPtr == NULL || Plugin ->DestroyMutexPtr == NULL ||
+        Plugin ->LockMutexPtr == NULL || Plugin ->UnlockMutexPtr == NULL) return FALSE;
+
+
+    ctx->CreateMutexPtr  = Plugin->CreateMutexPtr;
+    ctx->DestroyMutexPtr = Plugin ->DestroyMutexPtr;
+    ctx ->LockMutexPtr   = Plugin ->LockMutexPtr;
+    ctx ->UnlockMutexPtr = Plugin ->UnlockMutexPtr;
+
+    // All is ok
+    return TRUE;
+}
+
+// Generic Mutex fns
+void* CMSEXPORT _cmsCreateMutex(cmsContext ContextID)
+{
+    _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);
+
+    if (ptr ->CreateMutexPtr == NULL) return NULL;
+
+    return ptr ->CreateMutexPtr(ContextID);
+}
+
+void CMSEXPORT _cmsDestroyMutex(cmsContext ContextID, void* mtx)
+{
+    _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);
+
+    if (ptr ->DestroyMutexPtr != NULL) {
+
+        ptr ->DestroyMutexPtr(ContextID, mtx);
+    }
+}
+
+cmsBool CMSEXPORT _cmsLockMutex(cmsContext ContextID, void* mtx)
+{
+    _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);
+
+    if (ptr ->LockMutexPtr == NULL) return TRUE;
+
+    return ptr ->LockMutexPtr(ContextID, mtx);
+}
+
+void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx)
+{
+    _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);
+
+    if (ptr ->UnlockMutexPtr != NULL) {
+
+        ptr ->UnlockMutexPtr(ContextID, mtx);
+    }
+}
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c b/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c
index 79affb0..e68f258 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c
@@ -82,7 +82,6 @@
 
 } _cmsParametricCurvesCollection;
 
-
 // This is the default (built-in) evaluator
 static cmsFloat64Number DefaultEvalParametricFn(cmsInt32Number Type, const cmsFloat64Number Params[], cmsFloat64Number R);
 
@@ -95,22 +94,77 @@
     NULL                                // Next in chain
 };
 
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupPluginCurvesList(struct _cmsContext_struct* ctx,
+                                               const struct _cmsContext_struct* src)
+{
+   _cmsCurvesPluginChunkType newHead = { NULL };
+   _cmsParametricCurvesCollection*  entry;
+   _cmsParametricCurvesCollection*  Anterior = NULL;
+   _cmsCurvesPluginChunkType* head = (_cmsCurvesPluginChunkType*) src->chunks[CurvesPlugin];
+
+    _cmsAssert(head != NULL);
+
+    // Walk the list copying all nodes
+   for (entry = head->ParametricCurves;
+        entry != NULL;
+        entry = entry ->Next) {
+
+            _cmsParametricCurvesCollection *newEntry = ( _cmsParametricCurvesCollection *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsParametricCurvesCollection));
+
+            if (newEntry == NULL)
+                return;
+
+            // We want to keep the linked list order, so this is a little bit tricky
+            newEntry -> Next = NULL;
+            if (Anterior)
+                Anterior -> Next = newEntry;
+
+            Anterior = newEntry;
+
+            if (newHead.ParametricCurves == NULL)
+                newHead.ParametricCurves = newEntry;
+    }
+
+  ctx ->chunks[CurvesPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsCurvesPluginChunkType));
+}
+
+// The allocator have to follow the chain
+void _cmsAllocCurvesPluginChunk(struct _cmsContext_struct* ctx,
+                                const struct _cmsContext_struct* src)
+{
+    _cmsAssert(ctx != NULL);
+
+    if (src != NULL) {
+
+        // Copy all linked list
+       DupPluginCurvesList(ctx, src);
+    }
+    else {
+        static _cmsCurvesPluginChunkType CurvesPluginChunk = { NULL };
+        ctx ->chunks[CurvesPlugin] = _cmsSubAllocDup(ctx ->MemPool, &CurvesPluginChunk, sizeof(_cmsCurvesPluginChunkType));
+    }
+}
+
+
 // The linked list head
-static _cmsParametricCurvesCollection* ParametricCurves = &DefaultCurves;
+_cmsCurvesPluginChunkType _cmsCurvesPluginChunk = { NULL };
 
 // As a way to install new parametric curves
-cmsBool _cmsRegisterParametricCurvesPlugin(cmsContext id, cmsPluginBase* Data)
+cmsBool _cmsRegisterParametricCurvesPlugin(cmsContext ContextID, cmsPluginBase* Data)
 {
+    _cmsCurvesPluginChunkType* ctx = ( _cmsCurvesPluginChunkType*) _cmsContextGetClientChunk(ContextID, CurvesPlugin);
     cmsPluginParametricCurves* Plugin = (cmsPluginParametricCurves*) Data;
     _cmsParametricCurvesCollection* fl;
 
     if (Data == NULL) {
 
-          ParametricCurves =  &DefaultCurves;
+          ctx -> ParametricCurves =  NULL;
           return TRUE;
     }
 
-    fl = (_cmsParametricCurvesCollection*) _cmsPluginMalloc(id, sizeof(_cmsParametricCurvesCollection));
+    fl = (_cmsParametricCurvesCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsParametricCurvesCollection));
     if (fl == NULL) return FALSE;
 
     // Copy the parameters
@@ -126,8 +180,8 @@
     memmove(fl->ParameterCount, Plugin ->ParameterCount,  fl->nFunctions * sizeof(cmsUInt32Number));
 
     // Keep linked list
-    fl ->Next = ParametricCurves;
-    ParametricCurves = fl;
+    fl ->Next = ctx->ParametricCurves;
+    ctx->ParametricCurves = fl;
 
     // All is ok
     return TRUE;
@@ -149,12 +203,24 @@
 
 // Search for the collection which contains a specific type
 static
-_cmsParametricCurvesCollection *GetParametricCurveByType(int Type, int* index)
+_cmsParametricCurvesCollection *GetParametricCurveByType(cmsContext ContextID, int Type, int* index)
 {
     _cmsParametricCurvesCollection* c;
     int Position;
+    _cmsCurvesPluginChunkType* ctx = ( _cmsCurvesPluginChunkType*) _cmsContextGetClientChunk(ContextID, CurvesPlugin);
 
-    for (c = ParametricCurves; c != NULL; c = c ->Next) {
+    for (c = ctx->ParametricCurves; c != NULL; c = c ->Next) {
+
+        Position = IsInSet(Type, c);
+
+        if (Position != -1) {
+            if (index != NULL)
+                *index = Position;
+            return c;
+        }
+    }
+    // If none found, revert for defaults
+    for (c = &DefaultCurves; c != NULL; c = c ->Next) {
 
         Position = IsInSet(Type, c);
 
@@ -251,7 +317,7 @@
                 p ->Segments[i].SampledPoints = NULL;
 
 
-            c = GetParametricCurveByType(Segments[i].Type, NULL);
+            c = GetParametricCurveByType(ContextID, Segments[i].Type, NULL);
             if (c != NULL)
                     p ->Evals[i] = c ->Evaluator;
         }
@@ -677,12 +743,12 @@
     cmsCurveSegment Seg0;
     int Pos = 0;
     cmsUInt32Number size;
-    _cmsParametricCurvesCollection* c = GetParametricCurveByType(Type, &Pos);
+    _cmsParametricCurvesCollection* c = GetParametricCurveByType(ContextID, Type, &Pos);
 
     _cmsAssert(Params != NULL);
 
     if (c == NULL) {
-         cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Invalid parametric curve type %d", Type);
+        cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Invalid parametric curve type %d", Type);
         return NULL;
     }
 
@@ -872,7 +938,10 @@
     _cmsAssert(InCurve != NULL);
 
     // Try to reverse it analytically whatever possible
-    if (InCurve ->nSegments == 1 && InCurve ->Segments[0].Type > 0 && InCurve -> Segments[0].Type <= 5) {
+
+    if (InCurve ->nSegments == 1 && InCurve ->Segments[0].Type > 0 &&
+        /* InCurve -> Segments[0].Type <= 5 */
+        GetParametricCurveByType(InCurve ->InterpParams->ContextID, InCurve ->Segments[0].Type, NULL) != NULL) {
 
         return cmsBuildParametricToneCurve(InCurve ->InterpParams->ContextID,
                                        -(InCurve -> Segments[0].Type),
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c b/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c
index 8ace203..0be9173 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c
@@ -191,7 +191,7 @@
 
     out = ComputeKToLstar(ContextID, nPoints, 1,
                             Intents + (nProfiles - 1),
-                            hProfiles + (nProfiles - 1),
+                            &hProfiles [nProfiles - 1],
                             BPC + (nProfiles - 1),
                             AdaptationStates + (nProfiles - 1),
                             dwFlags);
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c b/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c
index ad971b5..e57e6ea 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c
@@ -62,31 +62,57 @@
 static cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags);
 
 // This is the default factory
-static cmsInterpFnFactory Interpolators = DefaultInterpolatorsFactory;
+_cmsInterpPluginChunkType _cmsInterpPluginChunk = { NULL };
+
+// The interpolation plug-in memory chunk allocator/dup
+void _cmsAllocInterpPluginChunk(struct _cmsContext_struct* ctx, const struct _cmsContext_struct* src)
+{
+    void* from;
+
+    _cmsAssert(ctx != NULL);
+
+    if (src != NULL) {
+        from = src ->chunks[InterpPlugin];
+    }
+    else {
+        static _cmsInterpPluginChunkType InterpPluginChunk = { NULL };
+
+        from = &InterpPluginChunk;
+    }
+
+    _cmsAssert(from != NULL);
+    ctx ->chunks[InterpPlugin] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsInterpPluginChunkType));
+}
 
 
 // Main plug-in entry
-cmsBool  _cmsRegisterInterpPlugin(cmsPluginBase* Data)
+cmsBool  _cmsRegisterInterpPlugin(cmsContext ContextID, cmsPluginBase* Data)
 {
     cmsPluginInterpolation* Plugin = (cmsPluginInterpolation*) Data;
+    _cmsInterpPluginChunkType* ptr = (_cmsInterpPluginChunkType*) _cmsContextGetClientChunk(ContextID, InterpPlugin);
 
     if (Data == NULL) {
 
-        Interpolators = DefaultInterpolatorsFactory;
+        ptr ->Interpolators = NULL;
         return TRUE;
     }
 
     // Set replacement functions
-    Interpolators = Plugin ->InterpolatorsFactory;
+    ptr ->Interpolators = Plugin ->InterpolatorsFactory;
     return TRUE;
 }
 
 
 // Set the interpolation method
-cmsBool _cmsSetInterpolationRoutine(cmsInterpParams* p)
+cmsBool _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p)
 {
-    // Invoke factory, possibly in the Plug-in
-    p ->Interpolation = Interpolators(p -> nInputs, p ->nOutputs, p ->dwFlags);
+    _cmsInterpPluginChunkType* ptr = (_cmsInterpPluginChunkType*) _cmsContextGetClientChunk(ContextID, InterpPlugin);
+
+    p ->Interpolation.Lerp16 = NULL;
+
+   // Invoke factory, possibly in the Plug-in
+    if (ptr ->Interpolators != NULL)
+        p ->Interpolation = ptr->Interpolators(p -> nInputs, p ->nOutputs, p ->dwFlags);
 
     // If unsupported by the plug-in, go for the LittleCMS default.
     // If happens only if an extern plug-in is being used
@@ -97,6 +123,7 @@
     if (p ->Interpolation.Lerp16 == NULL) {
             return FALSE;
     }
+
     return TRUE;
 }
 
@@ -141,7 +168,7 @@
         p ->opta[i] = p ->opta[i-1] * nSamples[InputChan-i];
 
 
-    if (!_cmsSetInterpolationRoutine(p)) {
+    if (!_cmsSetInterpolationRoutine(ContextID, p)) {
          cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported interpolation (%d->%d channels)", InputChan, OutputChan);
         _cmsFree(ContextID, p);
         return NULL;
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsio0.c b/src/share/native/sun/java2d/cmm/lcms/cmsio0.c
index 8f421c2..d4dc1b0 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio0.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsio0.c
@@ -229,15 +229,14 @@
     if (ResData == NULL) return FALSE; // Housekeeping
 
     // Check for available space. Clip.
-    if (iohandler ->UsedSpace + size > ResData->Size) {
-        size = ResData ->Size - iohandler ->UsedSpace;
+    if (ResData->Pointer + size > ResData->Size) {
+        size = ResData ->Size - ResData->Pointer;
     }
 
     if (size == 0) return TRUE;     // Write zero bytes is ok, but does nothing
 
     memmove(ResData ->Block + ResData ->Pointer, Ptr, size);
     ResData ->Pointer += size;
-    iohandler->UsedSpace += size;
 
     if (ResData ->Pointer > iohandler->UsedSpace)
         iohandler->UsedSpace = ResData ->Pointer;
@@ -371,7 +370,7 @@
 static
 cmsUInt32Number FileTell(cmsIOHANDLER* iohandler)
 {
-    return ftell((FILE*)iohandler ->stream);
+    return (cmsUInt32Number) ftell((FILE*)iohandler ->stream);
 }
 
 // Writes data to stream, also keeps used space for further reference. Returns TRUE on success, FALSE on error
@@ -414,7 +413,7 @@
              cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' not found", FileName);
             return NULL;
         }
-        iohandler -> ReportedSize = cmsfilelength(fm);
+        iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(fm);
         break;
 
     case 'w':
@@ -461,7 +460,7 @@
     iohandler -> ContextID = ContextID;
     iohandler -> stream = (void*) Stream;
     iohandler -> UsedSpace = 0;
-    iohandler -> ReportedSize = cmsfilelength(Stream);
+    iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(Stream);
     iohandler -> PhysicalFile[0] = 0;
 
     iohandler ->Read    = FileRead;
@@ -501,6 +500,9 @@
     // Set creation date/time
     memmove(&Icc ->Created, gmtime(&now), sizeof(Icc ->Created));
 
+    // Create a mutex if the user provided proper plugin. NULL otherwise
+    Icc ->UsrMutex = _cmsCreateMutex(ContextID);
+
     // Return the handle
     return (cmsHPROFILE) Icc;
 }
@@ -579,9 +581,39 @@
     return n;
 }
 
+// Deletes a tag entry
 
-// Create a new tag entry
+static
+void _cmsDeleteTagByPos(_cmsICCPROFILE* Icc, int i)
+{
+    _cmsAssert(Icc != NULL);
+    _cmsAssert(i >= 0);
 
+
+    if (Icc -> TagPtrs[i] != NULL) {
+
+        // Free previous version
+        if (Icc ->TagSaveAsRaw[i]) {
+            _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]);
+        }
+        else {
+            cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i];
+
+            if (TypeHandler != NULL) {
+
+                cmsTagTypeHandler LocalTypeHandler = *TypeHandler;
+                LocalTypeHandler.ContextID = Icc ->ContextID;              // As an additional parameter
+                LocalTypeHandler.ICCVersion = Icc ->Version;
+                LocalTypeHandler.FreePtr(&LocalTypeHandler, Icc -> TagPtrs[i]);
+                Icc ->TagPtrs[i] = NULL;
+            }
+        }
+
+    }
+}
+
+
+// Creates a new tag entry
 static
 cmsBool _cmsNewTag(_cmsICCPROFILE* Icc, cmsTagSignature sig, int* NewPos)
 {
@@ -589,15 +621,15 @@
 
     // Search for the tag
     i = _cmsSearchTag(Icc, sig, FALSE);
-
-    // Now let's do it easy. If the tag has been already written, that's an error
     if (i >= 0) {
-        cmsSignalError(Icc ->ContextID, cmsERROR_ALREADY_DEFINED, "Tag '%x' already exists", sig);
-        return FALSE;
+
+        // Already exists? delete it
+        _cmsDeleteTagByPos(Icc, i);
+        *NewPos = i;
     }
     else  {
 
-        // New one
+        // No, make a new one
 
         if (Icc -> TagCount >= MAX_TABLE_TAG) {
             cmsSignalError(Icc ->ContextID, cmsERROR_RANGE, "Too many tags (%d)", MAX_TABLE_TAG);
@@ -979,7 +1011,7 @@
 
     // 4.2 -> 0x4200000
 
-    Icc -> Version = BaseToBase((cmsUInt32Number) floor(Version * 100.0), 10, 16) << 16;
+    Icc -> Version = BaseToBase((cmsUInt32Number) floor(Version * 100.0 + 0.5), 10, 16) << 16;
 }
 
 cmsFloat64Number CMSEXPORT cmsGetProfileVersion(cmsHPROFILE hProfile)
@@ -1011,6 +1043,32 @@
     return NULL;
 }
 
+// Create profile from IOhandler
+cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandler2THR(cmsContext ContextID, cmsIOHANDLER* io, cmsBool write)
+{
+    _cmsICCPROFILE* NewIcc;
+    cmsHPROFILE hEmpty = cmsCreateProfilePlaceholder(ContextID);
+
+    if (hEmpty == NULL) return NULL;
+
+    NewIcc = (_cmsICCPROFILE*) hEmpty;
+
+    NewIcc ->IOhandler = io;
+    if (write) {
+
+        NewIcc -> IsWrite = TRUE;
+        return hEmpty;
+    }
+
+    if (!_cmsReadHeader(NewIcc)) goto Error;
+    return hEmpty;
+
+Error:
+    cmsCloseProfile(hEmpty);
+    return NULL;
+}
+
+
 // Create profile from disk file
 cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *lpFileName, const char *sAccess)
 {
@@ -1202,7 +1260,7 @@
         else {
 
             // Search for support on this tag
-            TagDescriptor = _cmsGetTagDescriptor(Icc -> TagNames[i]);
+            TagDescriptor = _cmsGetTagDescriptor(Icc-> ContextID, Icc -> TagNames[i]);
             if (TagDescriptor == NULL) continue;                        // Unsupported, ignore it
 
             if (TagDescriptor ->DecideType != NULL) {
@@ -1214,7 +1272,7 @@
                 Type = TagDescriptor ->SupportedTypes[0];
             }
 
-            TypeHandler =  _cmsGetTagTypeHandler(Type);
+            TypeHandler =  _cmsGetTagTypeHandler(Icc->ContextID, Type);
 
             if (TypeHandler == NULL) {
                 cmsSignalError(Icc ->ContextID, cmsERROR_INTERNAL, "(Internal) no handler for tag %x", Icc -> TagNames[i]);
@@ -1282,10 +1340,12 @@
 {
     _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile;
     _cmsICCPROFILE Keep;
-    cmsIOHANDLER* PrevIO;
+    cmsIOHANDLER* PrevIO = NULL;
     cmsUInt32Number UsedSpace;
     cmsContext ContextID;
 
+    _cmsAssert(hProfile != NULL);
+
     memmove(&Keep, Icc, sizeof(_cmsICCPROFILE));
 
     ContextID = cmsGetProfileContextID(hProfile);
@@ -1294,18 +1354,19 @@
 
     // Pass #1 does compute offsets
 
-    if (!_cmsWriteHeader(Icc, 0)) return 0;
-    if (!SaveTags(Icc, &Keep)) return 0;
+    if (!_cmsWriteHeader(Icc, 0)) goto Error;
+    if (!SaveTags(Icc, &Keep)) goto Error;
 
     UsedSpace = PrevIO ->UsedSpace;
 
     // Pass #2 does save to iohandler
 
     if (io != NULL) {
+
         Icc ->IOhandler = io;
-        if (!SetLinks(Icc)) goto CleanUp;
-        if (!_cmsWriteHeader(Icc, UsedSpace)) goto CleanUp;
-        if (!SaveTags(Icc, &Keep)) goto CleanUp;
+        if (!SetLinks(Icc)) goto Error;
+        if (!_cmsWriteHeader(Icc, UsedSpace)) goto Error;
+        if (!SaveTags(Icc, &Keep)) goto Error;
     }
 
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
@@ -1314,7 +1375,7 @@
     return UsedSpace;
 
 
-CleanUp:
+Error:
     cmsCloseIOhandler(PrevIO);
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
     return 0;
@@ -1362,11 +1423,13 @@
     cmsIOHANDLER* io;
     cmsContext ContextID = cmsGetProfileContextID(hProfile);
 
+    _cmsAssert(BytesNeeded != NULL);
+
     // Should we just calculate the needed space?
     if (MemPtr == NULL) {
 
            *BytesNeeded =  cmsSaveProfileToIOhandler(hProfile, NULL);
-            return (*BytesNeeded == 0 ? FALSE : TRUE);
+            return (*BytesNeeded == 0) ? FALSE : TRUE;
     }
 
     // That is a real write operation
@@ -1419,6 +1482,8 @@
         rc &= cmsCloseIOhandler(Icc->IOhandler);
     }
 
+    _cmsDestroyMutex(Icc->ContextID, Icc->UsrMutex);
+
     _cmsFree(Icc ->ContextID, Icc);   // Free placeholder memory
 
     return rc;
@@ -1459,14 +1524,18 @@
     cmsUInt32Number ElemCount;
     int n;
 
+    if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return NULL;
+
     n = _cmsSearchTag(Icc, sig, TRUE);
-    if (n < 0) return NULL;                 // Not found, return NULL
+    if (n < 0) goto Error;               // Not found, return NULL
 
 
     // If the element is already in memory, return the pointer
     if (Icc -> TagPtrs[n]) {
 
-        if (Icc ->TagSaveAsRaw[n]) return NULL;  // We don't support read raw tags as cooked
+        if (Icc ->TagSaveAsRaw[n]) goto Error;  // We don't support read raw tags as cooked
+
+        _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
         return Icc -> TagPtrs[n];
     }
 
@@ -1476,23 +1545,32 @@
 
     // Seek to its location
     if (!io -> Seek(io, Offset))
-        return NULL;
+        goto Error;
 
     // Search for support on this tag
-    TagDescriptor = _cmsGetTagDescriptor(sig);
-    if (TagDescriptor == NULL) return NULL;     // Unsupported.
+    TagDescriptor = _cmsGetTagDescriptor(Icc-> ContextID, sig);
+    if (TagDescriptor == NULL) {
+
+        char String[5];
+
+        _cmsTagSignature2String(String, sig);
+
+        // An unknown element was found.
+        cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown tag type '%s' found.", String);
+        goto Error;     // Unsupported.
+    }
 
     // if supported, get type and check if in list
     BaseType = _cmsReadTypeBase(io);
-    if (BaseType == 0) return NULL;
+    if (BaseType == 0) goto Error;
 
-    if (!IsTypeSupported(TagDescriptor, BaseType)) return NULL;
+    if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
 
     TagSize  -= 8;                      // Alredy read by the type base logic
 
     // Get type handler
-    TypeHandler = _cmsGetTagTypeHandler(BaseType);
-    if (TypeHandler == NULL) return NULL;
+    TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType);
+    if (TypeHandler == NULL) goto Error;
     LocalTypeHandler = *TypeHandler;
 
 
@@ -1511,7 +1589,7 @@
 
         _cmsTagSignature2String(String, sig);
         cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "Corrupted tag '%s'", String);
-        return NULL;
+        goto Error;
     }
 
     // This is a weird error that may be a symptom of something more serious, the number of
@@ -1527,7 +1605,14 @@
 
 
     // Return the data
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     return Icc -> TagPtrs[n];
+
+
+    // Return error and unlock tha data
+Error:
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+    return NULL;
 }
 
 
@@ -1561,49 +1646,26 @@
     cmsFloat64Number Version;
     char TypeString[5], SigString[5];
 
+    if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return FALSE;
 
+    // To delete tags.
     if (data == NULL) {
 
+         // Delete the tag
          i = _cmsSearchTag(Icc, sig, FALSE);
-         if (i >= 0)
+         if (i >= 0) {
+
+             // Use zero as a mark of deleted
+             _cmsDeleteTagByPos(Icc, i);
              Icc ->TagNames[i] = (cmsTagSignature) 0;
-         // Unsupported by now, reserved for future ampliations (delete)
-         return FALSE;
+             _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+             return TRUE;
+         }
+         // Didn't find the tag
+        goto Error;
     }
 
-    i = _cmsSearchTag(Icc, sig, FALSE);
-    if (i >=0) {
-
-        if (Icc -> TagPtrs[i] != NULL) {
-
-            // Already exists. Free previous version
-            if (Icc ->TagSaveAsRaw[i]) {
-                _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]);
-            }
-            else {
-                TypeHandler = Icc ->TagTypeHandlers[i];
-
-                if (TypeHandler != NULL) {
-
-                    LocalTypeHandler = *TypeHandler;
-                    LocalTypeHandler.ContextID = Icc ->ContextID;              // As an additional parameter
-                    LocalTypeHandler.ICCVersion = Icc ->Version;
-                    LocalTypeHandler.FreePtr(&LocalTypeHandler, Icc -> TagPtrs[i]);
-                }
-            }
-        }
-    }
-    else  {
-        // New one
-        i = Icc -> TagCount;
-
-        if (i >= MAX_TABLE_TAG) {
-            cmsSignalError(Icc ->ContextID, cmsERROR_RANGE, "Too many tags (%d)", MAX_TABLE_TAG);
-            return FALSE;
-        }
-
-        Icc -> TagCount++;
-    }
+    if (!_cmsNewTag(Icc, sig, &i)) goto Error;
 
     // This is not raw
     Icc ->TagSaveAsRaw[i] = FALSE;
@@ -1612,10 +1674,10 @@
     Icc ->TagLinked[i] = (cmsTagSignature) 0;
 
     // Get information about the TAG.
-    TagDescriptor = _cmsGetTagDescriptor(sig);
+    TagDescriptor = _cmsGetTagDescriptor(Icc-> ContextID, sig);
     if (TagDescriptor == NULL){
          cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported tag '%x'", sig);
-        return FALSE;
+        goto Error;
     }
 
 
@@ -1633,7 +1695,6 @@
     }
     else {
 
-
         Type = TagDescriptor ->SupportedTypes[0];
     }
 
@@ -1644,18 +1705,18 @@
         _cmsTagSignature2String(SigString,  sig);
 
         cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%s' for tag '%s'", TypeString, SigString);
-        return FALSE;
+        goto Error;
     }
 
     // Does we have a handler for this type?
-    TypeHandler =  _cmsGetTagTypeHandler(Type);
+    TypeHandler =  _cmsGetTagTypeHandler(Icc->ContextID, Type);
     if (TypeHandler == NULL) {
 
         _cmsTagSignature2String(TypeString, (cmsTagSignature) Type);
         _cmsTagSignature2String(SigString,  sig);
 
         cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%s' for tag '%s'", TypeString, SigString);
-        return FALSE;           // Should never happen
+        goto Error;           // Should never happen
     }
 
 
@@ -1668,7 +1729,7 @@
     LocalTypeHandler = *TypeHandler;
     LocalTypeHandler.ContextID  = Icc ->ContextID;
     LocalTypeHandler.ICCVersion = Icc ->Version;
-    Icc ->TagPtrs[i]         = LocalTypeHandler.DupPtr(&LocalTypeHandler, data, TagDescriptor ->ElemCount);
+    Icc ->TagPtrs[i]            = LocalTypeHandler.DupPtr(&LocalTypeHandler, data, TagDescriptor ->ElemCount);
 
     if (Icc ->TagPtrs[i] == NULL)  {
 
@@ -1676,10 +1737,16 @@
         _cmsTagSignature2String(SigString,  sig);
         cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "Malformed struct in type '%s' for tag '%s'", TypeString, SigString);
 
-        return FALSE;
+        goto Error;
     }
 
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     return TRUE;
+
+Error:
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+    return FALSE;
+
 }
 
 // Read and write raw data. The only way those function would work and keep consistence with normal read and write
@@ -1700,9 +1767,11 @@
     cmsUInt32Number rc;
     cmsUInt32Number Offset, TagSize;
 
+    if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0;
+
     // Search for given tag in ICC profile directory
     i = _cmsSearchTag(Icc, sig, TRUE);
-    if (i < 0) return 0;                 // Not found, return 0
+    if (i < 0) goto Error;                 // Not found,
 
     // It is already read?
     if (Icc -> TagPtrs[i] == NULL) {
@@ -1717,12 +1786,14 @@
             if (BufferSize < TagSize)
                 TagSize = BufferSize;
 
-            if (!Icc ->IOhandler ->Seek(Icc ->IOhandler, Offset)) return 0;
-            if (!Icc ->IOhandler ->Read(Icc ->IOhandler, data, 1, TagSize)) return 0;
+            if (!Icc ->IOhandler ->Seek(Icc ->IOhandler, Offset)) goto Error;
+            if (!Icc ->IOhandler ->Read(Icc ->IOhandler, data, 1, TagSize)) goto Error;
 
+            _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
             return TagSize;
         }
 
+        _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
         return Icc ->TagSizes[i];
     }
 
@@ -1738,16 +1809,22 @@
 
             memmove(data, Icc ->TagPtrs[i], TagSize);
 
+            _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
             return TagSize;
         }
 
+        _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
         return Icc ->TagSizes[i];
     }
 
     // Already readed, or previously set by cmsWriteTag(). We need to serialize that
     // data to raw in order to maintain consistency.
+
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     Object = cmsReadTag(hProfile, sig);
-    if (Object == NULL) return 0;
+    if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0;
+
+    if (Object == NULL) goto Error;
 
     // Now we need to serialize to a memory block: just use a memory iohandler
 
@@ -1756,17 +1833,18 @@
     } else{
         MemIO = cmsOpenIOhandlerFromMem(cmsGetProfileContextID(hProfile), data, BufferSize, "w");
     }
-    if (MemIO == NULL) return 0;
+    if (MemIO == NULL) goto Error;
 
     // Obtain type handling for the tag
     TypeHandler = Icc ->TagTypeHandlers[i];
-    TagDescriptor = _cmsGetTagDescriptor(sig);
+    TagDescriptor = _cmsGetTagDescriptor(Icc-> ContextID, sig);
     if (TagDescriptor == NULL) {
         cmsCloseIOhandler(MemIO);
-        return 0;
+        goto Error;
     }
 
-    // FIXME: No handling for TypeHandler == NULL here?
+    if (TypeHandler == NULL) goto Error;
+
     // Serialize
     LocalTypeHandler = *TypeHandler;
     LocalTypeHandler.ContextID  = Icc ->ContextID;
@@ -1774,19 +1852,24 @@
 
     if (!_cmsWriteTypeBase(MemIO, TypeHandler ->Signature)) {
         cmsCloseIOhandler(MemIO);
-        return 0;
+        goto Error;
     }
 
     if (!LocalTypeHandler.WritePtr(&LocalTypeHandler, MemIO, Object, TagDescriptor ->ElemCount)) {
         cmsCloseIOhandler(MemIO);
-        return 0;
+        goto Error;
     }
 
     // Get Size and close
     rc = MemIO ->Tell(MemIO);
     cmsCloseIOhandler(MemIO);      // Ignore return code this time
 
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     return rc;
+
+Error:
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+    return 0;
 }
 
 // Similar to the anterior. This function allows to write directly to the ICC profile any data, without
@@ -1798,7 +1881,12 @@
     _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile;
     int i;
 
-    if (!_cmsNewTag(Icc, sig, &i)) return FALSE;
+    if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0;
+
+    if (!_cmsNewTag(Icc, sig, &i)) {
+        _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+         return FALSE;
+    }
 
     // Mark the tag as being written as RAW
     Icc ->TagSaveAsRaw[i] = TRUE;
@@ -1809,6 +1897,7 @@
     Icc ->TagPtrs[i]  = _cmsDupMem(Icc ->ContextID, data, Size);
     Icc ->TagSizes[i] = Size;
 
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     return TRUE;
 }
 
@@ -1818,7 +1907,12 @@
     _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile;
     int i;
 
-    if (!_cmsNewTag(Icc, sig, &i)) return FALSE;
+     if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return FALSE;
+
+    if (!_cmsNewTag(Icc, sig, &i)) {
+        _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
+        return FALSE;
+    }
 
     // Keep necessary information
     Icc ->TagSaveAsRaw[i] = FALSE;
@@ -1829,6 +1923,7 @@
     Icc ->TagSizes[i]   = 0;
     Icc ->TagOffsets[i] = 0;
 
+    _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
     return TRUE;
 }
 
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsio1.c b/src/share/native/sun/java2d/cmm/lcms/cmsio1.c
index efdc6bf..61c2ca5 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio1.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsio1.c
@@ -334,7 +334,8 @@
 
 
 // Read and create a BRAND NEW MPE LUT from a given profile. All stuff dependent of version, etc
-// is adjusted here in order to create a LUT that takes care of all those details
+// is adjusted here in order to create a LUT that takes care of all those details.
+// We add intent = -1 as a way to read matrix shaper always, no matter of other LUT
 cmsPipeline* _cmsReadInputLUT(cmsHPROFILE hProfile, int Intent)
 {
     cmsTagTypeSignature OriginalType;
@@ -364,49 +365,54 @@
         return Lut;
     }
 
-    if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
+    // This is an attempt to reuse this funtion to retrieve the matrix-shaper as pipeline no
+    // matter other LUT are present and have precedence. Intent = -1 means just this.
+    if (Intent != -1) {
 
-        // Floating point LUT are always V4, but the encoding range is no
-        // longer 0..1.0, so we need to add an stage depending on the color space
-         return _cmsReadFloatInputTag(hProfile, tagFloat);
-    }
+        if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
 
-    // Revert to perceptual if no tag is found
-    if (!cmsIsTag(hProfile, tag16)) {
-        tag16 = Device2PCS16[0];
-    }
+            // Floating point LUT are always V4, but the encoding range is no
+            // longer 0..1.0, so we need to add an stage depending on the color space
+            return _cmsReadFloatInputTag(hProfile, tagFloat);
+        }
 
-    if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
+        // Revert to perceptual if no tag is found
+        if (!cmsIsTag(hProfile, tag16)) {
+            tag16 = Device2PCS16[0];
+        }
 
-        // Check profile version and LUT type. Do the necessary adjustments if needed
+        if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
 
-        // First read the tag
-        cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
-        if (Lut == NULL) return NULL;
+            // Check profile version and LUT type. Do the necessary adjustments if needed
 
-        // After reading it, we have now info about the original type
-        OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
+            // First read the tag
+            cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
+            if (Lut == NULL) return NULL;
 
-        // The profile owns the Lut, so we need to copy it
-        Lut = cmsPipelineDup(Lut);
+            // After reading it, we have now info about the original type
+            OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
 
-        // We need to adjust data only for Lab16 on output
-        if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
+            // The profile owns the Lut, so we need to copy it
+            Lut = cmsPipelineDup(Lut);
+
+            // We need to adjust data only for Lab16 on output
+            if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
+                return Lut;
+
+            // If the input is Lab, add also a conversion at the begin
+            if (cmsGetColorSpace(hProfile) == cmsSigLabData &&
+                !cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
+                goto Error;
+
+            // Add a matrix for conversion V2 to V4 Lab PCS
+            if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
+                goto Error;
+
             return Lut;
-
-        // If the input is Lab, add also a conversion at the begin
-        if (cmsGetColorSpace(hProfile) == cmsSigLabData &&
-            !cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
-            goto Error;
-
-        // Add a matrix for conversion V2 to V4 Lab PCS
-        if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
-            goto Error;
-
-        return Lut;
 Error:
-        cmsPipelineFree(Lut);
-        return NULL;
+            cmsPipelineFree(Lut);
+            return NULL;
+        }
     }
 
     // Lut was not found, try to create a matrix-shaper
@@ -551,7 +557,7 @@
                 _cmsStageCLutData* CLUT = (_cmsStageCLutData*) Stage ->Data;
 
                 CLUT ->Params->dwFlags |= CMS_LERP_FLAGS_TRILINEAR;
-                _cmsSetInterpolationRoutine(CLUT ->Params);
+                _cmsSetInterpolationRoutine(Lut->ContextID, CLUT ->Params);
             }
     }
 }
@@ -609,54 +615,58 @@
     cmsTagSignature tagFloat = PCS2DeviceFloat[Intent];
     cmsContext ContextID     = cmsGetProfileContextID(hProfile);
 
-    if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
 
-        // Floating point LUT are always V4
-        return _cmsReadFloatOutputTag(hProfile, tagFloat);
-    }
+    if (Intent != -1) {
 
-    // Revert to perceptual if no tag is found
-    if (!cmsIsTag(hProfile, tag16)) {
-        tag16 = PCS2Device16[0];
-    }
+        if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
 
-    if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
+            // Floating point LUT are always V4
+            return _cmsReadFloatOutputTag(hProfile, tagFloat);
+        }
 
-        // Check profile version and LUT type. Do the necessary adjustments if needed
+        // Revert to perceptual if no tag is found
+        if (!cmsIsTag(hProfile, tag16)) {
+            tag16 = PCS2Device16[0];
+        }
 
-        // First read the tag
-        cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
-        if (Lut == NULL) return NULL;
+        if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
 
-        // After reading it, we have info about the original type
-        OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
+            // Check profile version and LUT type. Do the necessary adjustments if needed
 
-        // The profile owns the Lut, so we need to copy it
-        Lut = cmsPipelineDup(Lut);
-        if (Lut == NULL) return NULL;
+            // First read the tag
+            cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
+            if (Lut == NULL) return NULL;
 
-        // Now it is time for a controversial stuff. I found that for 3D LUTS using
-        // Lab used as indexer space,  trilinear interpolation should be used
-        if (cmsGetPCS(hProfile) == cmsSigLabData)
-            ChangeInterpolationToTrilinear(Lut);
+            // After reading it, we have info about the original type
+            OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
 
-        // We need to adjust data only for Lab and Lut16 type
-        if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
-            return Lut;
+            // The profile owns the Lut, so we need to copy it
+            Lut = cmsPipelineDup(Lut);
+            if (Lut == NULL) return NULL;
 
-        // Add a matrix for conversion V4 to V2 Lab PCS
-        if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
-            goto Error;
+            // Now it is time for a controversial stuff. I found that for 3D LUTS using
+            // Lab used as indexer space,  trilinear interpolation should be used
+            if (cmsGetPCS(hProfile) == cmsSigLabData)
+                ChangeInterpolationToTrilinear(Lut);
 
-        // If the output is Lab, add also a conversion at the end
-        if (cmsGetColorSpace(hProfile) == cmsSigLabData)
-            if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
+            // We need to adjust data only for Lab and Lut16 type
+            if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
+                return Lut;
+
+            // Add a matrix for conversion V4 to V2 Lab PCS
+            if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
                 goto Error;
 
-        return Lut;
+            // If the output is Lab, add also a conversion at the end
+            if (cmsGetColorSpace(hProfile) == cmsSigLabData)
+                if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
+                    goto Error;
+
+            return Lut;
 Error:
-        cmsPipelineFree(Lut);
-        return NULL;
+            cmsPipelineFree(Lut);
+            return NULL;
+        }
     }
 
     // Lut not found, try to create a matrix-shaper
@@ -782,7 +792,7 @@
 
     // Now it is time for a controversial stuff. I found that for 3D LUTS using
     // Lab used as indexer space,  trilinear interpolation should be used
-    if (cmsGetColorSpace(hProfile) == cmsSigLabData)
+    if (cmsGetPCS(hProfile) == cmsSigLabData)
         ChangeInterpolationToTrilinear(Lut);
 
     // After reading it, we have info about the original type
@@ -793,12 +803,12 @@
 
     // Here it is possible to get Lab on both sides
 
-    if (cmsGetPCS(hProfile) == cmsSigLabData) {
+    if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
         if(!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
             goto Error2;
     }
 
-    if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
+    if (cmsGetPCS(hProfile) == cmsSigLabData) {
         if(!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
             goto Error2;
     }
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsopt.c b/src/share/native/sun/java2d/cmm/lcms/cmsopt.c
index d184ed7..b9d6951 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsopt.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsopt.c
@@ -542,11 +542,13 @@
 
             cmsToneCurve* InversePostLin = cmsReverseToneCurve(Curves[i]);
             if (InversePostLin == NULL) {
-                WhiteOut[i] = 0;
-                continue;
+                WhiteOut[i] = WhitePointOut[i];
+
+            } else {
+
+                WhiteOut[i] = cmsEvalToneCurve16(InversePostLin, WhitePointOut[i]);
+                cmsFreeToneCurve(InversePostLin);
             }
-            WhiteOut[i] = cmsEvalToneCurve16(InversePostLin, WhitePointOut[i]);
-            cmsFreeToneCurve(InversePostLin);
         }
     }
     else {
@@ -1666,44 +1668,102 @@
 };
 
 // The linked list head
-static _cmsOptimizationCollection* OptimizationCollection = DefaultOptimization;
+_cmsOptimizationPluginChunkType _cmsOptimizationPluginChunk = { NULL };
+
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupPluginOptimizationList(struct _cmsContext_struct* ctx,
+                               const struct _cmsContext_struct* src)
+{
+   _cmsOptimizationPluginChunkType newHead = { NULL };
+   _cmsOptimizationCollection*  entry;
+   _cmsOptimizationCollection*  Anterior = NULL;
+   _cmsOptimizationPluginChunkType* head = (_cmsOptimizationPluginChunkType*) src->chunks[OptimizationPlugin];
+
+    _cmsAssert(ctx != NULL);
+    _cmsAssert(head != NULL);
+
+    // Walk the list copying all nodes
+   for (entry = head->OptimizationCollection;
+        entry != NULL;
+        entry = entry ->Next) {
+
+            _cmsOptimizationCollection *newEntry = ( _cmsOptimizationCollection *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsOptimizationCollection));
+
+            if (newEntry == NULL)
+                return;
+
+            // We want to keep the linked list order, so this is a little bit tricky
+            newEntry -> Next = NULL;
+            if (Anterior)
+                Anterior -> Next = newEntry;
+
+            Anterior = newEntry;
+
+            if (newHead.OptimizationCollection == NULL)
+                newHead.OptimizationCollection = newEntry;
+    }
+
+  ctx ->chunks[OptimizationPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsOptimizationPluginChunkType));
+}
+
+void  _cmsAllocOptimizationPluginChunk(struct _cmsContext_struct* ctx,
+                                         const struct _cmsContext_struct* src)
+{
+  if (src != NULL) {
+
+        // Copy all linked list
+       DupPluginOptimizationList(ctx, src);
+    }
+    else {
+        static _cmsOptimizationPluginChunkType OptimizationPluginChunkType = { NULL };
+        ctx ->chunks[OptimizationPlugin] = _cmsSubAllocDup(ctx ->MemPool, &OptimizationPluginChunkType, sizeof(_cmsOptimizationPluginChunkType));
+    }
+}
+
 
 // Register new ways to optimize
-cmsBool  _cmsRegisterOptimizationPlugin(cmsContext id, cmsPluginBase* Data)
+cmsBool  _cmsRegisterOptimizationPlugin(cmsContext ContextID, cmsPluginBase* Data)
 {
     cmsPluginOptimization* Plugin = (cmsPluginOptimization*) Data;
+    _cmsOptimizationPluginChunkType* ctx = ( _cmsOptimizationPluginChunkType*) _cmsContextGetClientChunk(ContextID, OptimizationPlugin);
     _cmsOptimizationCollection* fl;
 
     if (Data == NULL) {
 
-        OptimizationCollection = DefaultOptimization;
+        ctx->OptimizationCollection = NULL;
         return TRUE;
     }
 
     // Optimizer callback is required
     if (Plugin ->OptimizePtr == NULL) return FALSE;
 
-    fl = (_cmsOptimizationCollection*) _cmsPluginMalloc(id, sizeof(_cmsOptimizationCollection));
+    fl = (_cmsOptimizationCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsOptimizationCollection));
     if (fl == NULL) return FALSE;
 
     // Copy the parameters
     fl ->OptimizePtr = Plugin ->OptimizePtr;
 
     // Keep linked list
-    fl ->Next = OptimizationCollection;
-    OptimizationCollection = fl;
+    fl ->Next = ctx->OptimizationCollection;
+
+    // Set the head
+    ctx ->OptimizationCollection = fl;
 
     // All is ok
     return TRUE;
 }
 
 // The entry point for LUT optimization
-cmsBool _cmsOptimizePipeline(cmsPipeline**    PtrLut,
+cmsBool _cmsOptimizePipeline(cmsContext ContextID,
+                             cmsPipeline**    PtrLut,
                              int              Intent,
                              cmsUInt32Number* InputFormat,
                              cmsUInt32Number* OutputFormat,
                              cmsUInt32Number* dwFlags)
 {
+    _cmsOptimizationPluginChunkType* ctx = ( _cmsOptimizationPluginChunkType*) _cmsContextGetClientChunk(ContextID, OptimizationPlugin);
     _cmsOptimizationCollection* Opts;
     cmsBool AnySuccess = FALSE;
 
@@ -1733,8 +1793,8 @@
     if (*dwFlags & cmsFLAGS_NOOPTIMIZE)
         return FALSE;
 
-    // Try built-in optimizations and plug-in
-    for (Opts = OptimizationCollection;
+    // Try plug-in optimizations
+    for (Opts = ctx->OptimizationCollection;
          Opts != NULL;
          Opts = Opts ->Next) {
 
@@ -1745,6 +1805,17 @@
             }
     }
 
+   // Try built-in optimizations
+    for (Opts = DefaultOptimization;
+         Opts != NULL;
+         Opts = Opts ->Next) {
+
+            if (Opts ->OptimizePtr(PtrLut, Intent, InputFormat, OutputFormat, dwFlags)) {
+
+                return TRUE;
+            }
+    }
+
     // Only simple optimizations succeeded
     return AnySuccess;
 }
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmspack.c b/src/share/native/sun/java2d/cmm/lcms/cmspack.c
index b89830c..6659774 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmspack.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmspack.c
@@ -883,6 +883,42 @@
     }
 }
 
+// This is a conversion of XYZ float to 16 bits
+static
+cmsUInt8Number* UnrollXYZFloatTo16(register _cmsTRANSFORM* info,
+                                   register cmsUInt16Number wIn[],
+                                   register cmsUInt8Number* accum,
+                                   register cmsUInt32Number Stride)
+{
+    if (T_PLANAR(info -> InputFormat)) {
+
+        cmsFloat32Number* Pt = (cmsFloat32Number*) accum;
+        cmsCIEXYZ XYZ;
+
+        XYZ.X = Pt[0];
+        XYZ.Y = Pt[Stride];
+        XYZ.Z = Pt[Stride*2];
+        cmsFloat2XYZEncoded(wIn, &XYZ);
+
+        return accum + sizeof(cmsFloat32Number);
+
+    }
+
+    else {
+        cmsFloat32Number* Pt = (cmsFloat32Number*) accum;
+        cmsCIEXYZ XYZ;
+
+        XYZ.X = Pt[0];
+        XYZ.Y = Pt[1];
+        XYZ.Z = Pt[2];
+        cmsFloat2XYZEncoded(wIn, &XYZ);
+
+        accum += 3 * sizeof(cmsFloat32Number) + T_EXTRA(info ->InputFormat) * sizeof(cmsFloat32Number);
+
+        return accum;
+    }
+}
+
 // Check if space is marked as ink
 cmsINLINE cmsBool IsInkSpace(cmsUInt32Number Type)
 {
@@ -2334,6 +2370,39 @@
 }
 
 static
+cmsUInt8Number* PackXYZFloatFrom16(register _cmsTRANSFORM* Info,
+                                   register cmsUInt16Number wOut[],
+                                   register cmsUInt8Number* output,
+                                   register cmsUInt32Number Stride)
+{
+    if (T_PLANAR(Info -> OutputFormat)) {
+
+        cmsCIEXYZ XYZ;
+        cmsFloat32Number* Out = (cmsFloat32Number*) output;
+        cmsXYZEncoded2Float(&XYZ, wOut);
+
+        Out[0]        = (cmsFloat32Number) XYZ.X;
+        Out[Stride]   = (cmsFloat32Number) XYZ.Y;
+        Out[Stride*2] = (cmsFloat32Number) XYZ.Z;
+
+        return output + sizeof(cmsFloat32Number);
+
+    }
+    else {
+
+        cmsCIEXYZ XYZ;
+        cmsFloat32Number* Out = (cmsFloat32Number*) output;
+        cmsXYZEncoded2Float(&XYZ, wOut);
+
+        Out[0] = (cmsFloat32Number) XYZ.X;
+        Out[1] = (cmsFloat32Number) XYZ.Y;
+        Out[2] = (cmsFloat32Number) XYZ.Z;
+
+        return output + (3 * sizeof(cmsFloat32Number) + T_EXTRA(Info ->OutputFormat) * sizeof(cmsFloat32Number));
+    }
+}
+
+static
 cmsUInt8Number* PackDoubleFrom16(register _cmsTRANSFORM* info,
                                 register cmsUInt16Number wOut[],
                                 register cmsUInt8Number* output,
@@ -2893,6 +2962,7 @@
     { TYPE_Lab_DBL,                                 ANYPLANAR|ANYEXTRA,   UnrollLabDoubleTo16},
     { TYPE_XYZ_DBL,                                 ANYPLANAR|ANYEXTRA,   UnrollXYZDoubleTo16},
     { TYPE_Lab_FLT,                                 ANYPLANAR|ANYEXTRA,   UnrollLabFloatTo16},
+    { TYPE_XYZ_FLT,                                 ANYPLANAR|ANYEXTRA,   UnrollXYZFloatTo16},
     { TYPE_GRAY_DBL,                                                 0,   UnrollDouble1Chan},
     { FLOAT_SH(1)|BYTES_SH(0), ANYCHANNELS|ANYPLANAR|ANYSWAPFIRST|ANYFLAVOR|
                                              ANYSWAP|ANYEXTRA|ANYSPACE,   UnrollDoubleTo16},
@@ -3027,6 +3097,7 @@
     { TYPE_XYZ_DBL,                                      ANYPLANAR|ANYEXTRA,  PackXYZDoubleFrom16},
 
     { TYPE_Lab_FLT,                                      ANYPLANAR|ANYEXTRA,  PackLabFloatFrom16},
+    { TYPE_XYZ_FLT,                                      ANYPLANAR|ANYEXTRA,  PackXYZFloatFrom16},
 
     { FLOAT_SH(1)|BYTES_SH(0),      ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|
                                     ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE,  PackDoubleFrom16},
@@ -3182,40 +3253,98 @@
 
 } cmsFormattersFactoryList;
 
-static cmsFormattersFactoryList* FactoryList = NULL;
+_cmsFormattersPluginChunkType _cmsFormattersPluginChunk = { NULL };
+
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupFormatterFactoryList(struct _cmsContext_struct* ctx,
+                                               const struct _cmsContext_struct* src)
+{
+   _cmsFormattersPluginChunkType newHead = { NULL };
+   cmsFormattersFactoryList*  entry;
+   cmsFormattersFactoryList*  Anterior = NULL;
+   _cmsFormattersPluginChunkType* head = (_cmsFormattersPluginChunkType*) src->chunks[FormattersPlugin];
+
+     _cmsAssert(head != NULL);
+
+   // Walk the list copying all nodes
+   for (entry = head->FactoryList;
+       entry != NULL;
+       entry = entry ->Next) {
+
+           cmsFormattersFactoryList *newEntry = ( cmsFormattersFactoryList *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(cmsFormattersFactoryList));
+
+           if (newEntry == NULL)
+               return;
+
+           // We want to keep the linked list order, so this is a little bit tricky
+           newEntry -> Next = NULL;
+           if (Anterior)
+               Anterior -> Next = newEntry;
+
+           Anterior = newEntry;
+
+           if (newHead.FactoryList == NULL)
+               newHead.FactoryList = newEntry;
+   }
+
+   ctx ->chunks[FormattersPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsFormattersPluginChunkType));
+}
+
+// The interpolation plug-in memory chunk allocator/dup
+void _cmsAllocFormattersPluginChunk(struct _cmsContext_struct* ctx,
+                                    const struct _cmsContext_struct* src)
+{
+      _cmsAssert(ctx != NULL);
+
+     if (src != NULL) {
+
+         // Duplicate the LIST
+         DupFormatterFactoryList(ctx, src);
+     }
+     else {
+          static _cmsFormattersPluginChunkType FormattersPluginChunk = { NULL };
+          ctx ->chunks[FormattersPlugin] = _cmsSubAllocDup(ctx ->MemPool, &FormattersPluginChunk, sizeof(_cmsFormattersPluginChunkType));
+     }
+}
+
 
 
 // Formatters management
-cmsBool  _cmsRegisterFormattersPlugin(cmsContext id, cmsPluginBase* Data)
+cmsBool  _cmsRegisterFormattersPlugin(cmsContext ContextID, cmsPluginBase* Data)
 {
+    _cmsFormattersPluginChunkType* ctx = ( _cmsFormattersPluginChunkType*) _cmsContextGetClientChunk(ContextID, FormattersPlugin);
     cmsPluginFormatters* Plugin = (cmsPluginFormatters*) Data;
     cmsFormattersFactoryList* fl ;
 
-    // Reset
+    // Reset to built-in defaults
     if (Data == NULL) {
 
-          FactoryList = NULL;
+          ctx ->FactoryList = NULL;
           return TRUE;
     }
 
-    fl = (cmsFormattersFactoryList*) _cmsPluginMalloc(id, sizeof(cmsFormattersFactoryList));
+    fl = (cmsFormattersFactoryList*) _cmsPluginMalloc(ContextID, sizeof(cmsFormattersFactoryList));
     if (fl == NULL) return FALSE;
 
     fl ->Factory    = Plugin ->FormattersFactory;
 
-    fl ->Next = FactoryList;
-    FactoryList = fl;
+    fl ->Next = ctx -> FactoryList;
+    ctx ->FactoryList = fl;
 
     return TRUE;
 }
 
-cmsFormatter _cmsGetFormatter(cmsUInt32Number Type,         // Specific type, i.e. TYPE_RGB_8
+cmsFormatter _cmsGetFormatter(cmsContext ContextID,
+                             cmsUInt32Number Type,         // Specific type, i.e. TYPE_RGB_8
                              cmsFormatterDirection Dir,
                              cmsUInt32Number dwFlags)
 {
+    _cmsFormattersPluginChunkType* ctx = ( _cmsFormattersPluginChunkType*) _cmsContextGetClientChunk(ContextID, FormattersPlugin);
     cmsFormattersFactoryList* f;
 
-    for (f = FactoryList; f != NULL; f = f ->Next) {
+    for (f =ctx->FactoryList; f != NULL; f = f ->Next) {
 
         cmsFormatter fn = f ->Factory(Type, Dir, dwFlags);
         if (fn.Fmt16 != NULL) return fn;
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c b/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c
index 3d43485..ef75e13 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c
@@ -544,22 +544,31 @@
 
 // Plugin memory management -------------------------------------------------------------------------------------------------
 
-static _cmsSubAllocator* PluginPool = NULL;
-
 // Specialized malloc for plug-ins, that is freed upon exit.
-void* _cmsPluginMalloc(cmsContext id, cmsUInt32Number size)
+void* _cmsPluginMalloc(cmsContext ContextID, cmsUInt32Number size)
 {
-    if (PluginPool == NULL)
-        PluginPool = _cmsCreateSubAlloc(id, 4*1024);
+    struct _cmsContext_struct* ctx = _cmsGetContext(ContextID);
 
-    return _cmsSubAlloc(PluginPool, size);
+    if (ctx ->MemPool == NULL) {
+
+        if (ContextID == NULL) {
+
+            ctx->MemPool = _cmsCreateSubAlloc(0, 2*1024);
+        }
+        else {
+            cmsSignalError(ContextID, cmsERROR_CORRUPTION_DETECTED, "NULL memory pool on context");
+            return NULL;
+        }
+    }
+
+    return _cmsSubAlloc(ctx->MemPool, size);
 }
 
 
 // Main plug-in dispatcher
 cmsBool CMSEXPORT cmsPlugin(void* Plug_in)
 {
-  return cmsPluginTHR(NULL, Plug_in);
+    return cmsPluginTHR(NULL, Plug_in);
 }
 
 cmsBool CMSEXPORT cmsPluginTHR(cmsContext id, void* Plug_in)
@@ -571,12 +580,12 @@
          Plugin = Plugin -> Next) {
 
             if (Plugin -> Magic != cmsPluginMagicNumber) {
-                cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin");
+                cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin");
                 return FALSE;
             }
 
             if (Plugin ->ExpectedVersion > LCMS_VERSION) {
-                cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "plugin needs Little CMS %d, current  version is %d",
+                cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "plugin needs Little CMS %d, current version is %d",
                     Plugin ->ExpectedVersion, LCMS_VERSION);
                 return FALSE;
             }
@@ -584,11 +593,11 @@
             switch (Plugin -> Type) {
 
                 case cmsPluginMemHandlerSig:
-                    if (!_cmsRegisterMemHandlerPlugin(Plugin)) return FALSE;
+                    if (!_cmsRegisterMemHandlerPlugin(id, Plugin)) return FALSE;
                     break;
 
                 case cmsPluginInterpolationSig:
-                    if (!_cmsRegisterInterpPlugin(Plugin)) return FALSE;
+                    if (!_cmsRegisterInterpPlugin(id, Plugin)) return FALSE;
                     break;
 
                 case cmsPluginTagTypeSig:
@@ -623,8 +632,12 @@
                     if (!_cmsRegisterTransformPlugin(id, Plugin)) return FALSE;
                     break;
 
+                case cmsPluginMutexSig:
+                    if (!_cmsRegisterMutexPlugin(id, Plugin)) return FALSE;
+                    break;
+
                 default:
-                    cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin type '%X'", Plugin -> Type);
+                    cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin type '%X'", Plugin -> Type);
                     return FALSE;
             }
     }
@@ -637,19 +650,337 @@
 // Revert all plug-ins to default
 void CMSEXPORT cmsUnregisterPlugins(void)
 {
-    _cmsRegisterMemHandlerPlugin(NULL);
-    _cmsRegisterInterpPlugin(NULL);
-    _cmsRegisterTagTypePlugin(NULL, NULL);
-    _cmsRegisterTagPlugin(NULL, NULL);
-    _cmsRegisterFormattersPlugin(NULL, NULL);
-    _cmsRegisterRenderingIntentPlugin(NULL, NULL);
-    _cmsRegisterParametricCurvesPlugin(NULL, NULL);
-    _cmsRegisterMultiProcessElementPlugin(NULL, NULL);
-    _cmsRegisterOptimizationPlugin(NULL, NULL);
-    _cmsRegisterTransformPlugin(NULL, NULL);
-
-    if (PluginPool != NULL)
-        _cmsSubAllocDestroy(PluginPool);
-
-    PluginPool = NULL;
+    cmsUnregisterPluginsTHR(NULL);
 }
+
+
+// The Global storage for system context. This is the one and only global variable
+// pointers structure. All global vars are referenced here.
+static struct _cmsContext_struct globalContext = {
+
+    NULL,                              // Not in the linked list
+    NULL,                              // No suballocator
+    {
+        NULL,                          //  UserPtr,
+        &_cmsLogErrorChunk,            //  Logger,
+        &_cmsAlarmCodesChunk,          //  AlarmCodes,
+        &_cmsAdaptationStateChunk,     //  AdaptationState,
+        &_cmsMemPluginChunk,           //  MemPlugin,
+        &_cmsInterpPluginChunk,        //  InterpPlugin,
+        &_cmsCurvesPluginChunk,        //  CurvesPlugin,
+        &_cmsFormattersPluginChunk,    //  FormattersPlugin,
+        &_cmsTagTypePluginChunk,       //  TagTypePlugin,
+        &_cmsTagPluginChunk,           //  TagPlugin,
+        &_cmsIntentsPluginChunk,       //  IntentPlugin,
+        &_cmsMPETypePluginChunk,       //  MPEPlugin,
+        &_cmsOptimizationPluginChunk,  //  OptimizationPlugin,
+        &_cmsTransformPluginChunk,     //  TransformPlugin,
+        &_cmsMutexPluginChunk          //  MutexPlugin
+    },
+
+    { NULL, NULL, NULL, NULL, NULL, NULL } // The default memory allocator is not used for context 0
+};
+
+
+// The context pool (linked list head)
+static _cmsMutex _cmsContextPoolHeadMutex = CMS_MUTEX_INITIALIZER;
+static struct _cmsContext_struct* _cmsContextPoolHead = NULL;
+
+// Internal, get associated pointer, with guessing. Never returns NULL.
+struct _cmsContext_struct* _cmsGetContext(cmsContext ContextID)
+{
+    struct _cmsContext_struct* id = (struct _cmsContext_struct*) ContextID;
+    struct _cmsContext_struct* ctx;
+
+
+    // On 0, use global settings
+    if (id == NULL)
+        return &globalContext;
+
+    // Search
+    for (ctx = _cmsContextPoolHead;
+         ctx != NULL;
+         ctx = ctx ->Next) {
+
+            // Found it?
+            if (id == ctx)
+                return ctx; // New-style context,
+    }
+
+    return &globalContext;
+}
+
+
+// Internal: get the memory area associanted with each context client
+// Returns the block assigned to the specific zone.
+void* _cmsContextGetClientChunk(cmsContext ContextID, _cmsMemoryClient mc)
+{
+    struct _cmsContext_struct* ctx;
+    void *ptr;
+
+    if (mc < 0 || mc >= MemoryClientMax) {
+        cmsSignalError(ContextID, cmsERROR_RANGE, "Bad context client");
+        return NULL;
+    }
+
+    ctx = _cmsGetContext(ContextID);
+    ptr = ctx ->chunks[mc];
+
+    if (ptr != NULL)
+        return ptr;
+
+    // A null ptr means no special settings for that context, and this
+    // reverts to Context0 globals
+    return globalContext.chunks[mc];
+}
+
+
+// This function returns the given context its default pristine state,
+// as no plug-ins were declared. There is no way to unregister a single
+// plug-in, as a single call to cmsPluginTHR() function may register
+// many different plug-ins simultaneously, then there is no way to
+// identify which plug-in to unregister.
+void CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID)
+{
+    _cmsRegisterMemHandlerPlugin(ContextID, NULL);
+    _cmsRegisterInterpPlugin(ContextID, NULL);
+    _cmsRegisterTagTypePlugin(ContextID, NULL);
+    _cmsRegisterTagPlugin(ContextID, NULL);
+    _cmsRegisterFormattersPlugin(ContextID, NULL);
+    _cmsRegisterRenderingIntentPlugin(ContextID, NULL);
+    _cmsRegisterParametricCurvesPlugin(ContextID, NULL);
+    _cmsRegisterMultiProcessElementPlugin(ContextID, NULL);
+    _cmsRegisterOptimizationPlugin(ContextID, NULL);
+    _cmsRegisterTransformPlugin(ContextID, NULL);
+    _cmsRegisterMutexPlugin(ContextID, NULL);
+}
+
+
+// Returns the memory manager plug-in, if any, from the Plug-in bundle
+static
+cmsPluginMemHandler* _cmsFindMemoryPlugin(void* PluginBundle)
+{
+    cmsPluginBase* Plugin;
+
+    for (Plugin = (cmsPluginBase*) PluginBundle;
+        Plugin != NULL;
+        Plugin = Plugin -> Next) {
+
+            if (Plugin -> Magic == cmsPluginMagicNumber &&
+                Plugin -> ExpectedVersion <= LCMS_VERSION &&
+                Plugin -> Type == cmsPluginMemHandlerSig) {
+
+                    // Found!
+                    return (cmsPluginMemHandler*) Plugin;
+            }
+    }
+
+    // Nope, revert to defaults
+    return NULL;
+}
+
+
+// Creates a new context with optional associated plug-ins. Caller may also specify an optional pointer to user-defined
+// data that will be forwarded to plug-ins and logger.
+cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData)
+{
+    struct _cmsContext_struct* ctx;
+    struct _cmsContext_struct  fakeContext;
+
+    _cmsInstallAllocFunctions(_cmsFindMemoryPlugin(Plugin), &fakeContext.DefaultMemoryManager);
+
+    fakeContext.chunks[UserPtr]     = UserData;
+    fakeContext.chunks[MemPlugin]   = &fakeContext.DefaultMemoryManager;
+
+    // Create the context structure.
+    ctx = (struct _cmsContext_struct*) _cmsMalloc(&fakeContext, sizeof(struct _cmsContext_struct));
+    if (ctx == NULL)
+        return NULL;     // Something very wrong happened!
+
+    // Init the structure and the memory manager
+    memset(ctx, 0, sizeof(struct _cmsContext_struct));
+
+    // Keep memory manager
+    memcpy(&ctx->DefaultMemoryManager, &fakeContext.DefaultMemoryManager, sizeof(_cmsMemPluginChunk));
+
+    // Maintain the linked list (with proper locking)
+    _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+       ctx ->Next = _cmsContextPoolHead;
+       _cmsContextPoolHead = ctx;
+    _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+
+    ctx ->chunks[UserPtr]     = UserData;
+    ctx ->chunks[MemPlugin]   = &ctx->DefaultMemoryManager;
+
+    // Now we can allocate the pool by using default memory manager
+    ctx ->MemPool = _cmsCreateSubAlloc(ctx, 22 * sizeof(void*));  // default size about 32 pointers
+    if (ctx ->MemPool == NULL) {
+
+         cmsDeleteContext(ctx);
+        return NULL;
+    }
+
+    _cmsAllocLogErrorChunk(ctx, NULL);
+    _cmsAllocAlarmCodesChunk(ctx, NULL);
+    _cmsAllocAdaptationStateChunk(ctx, NULL);
+    _cmsAllocMemPluginChunk(ctx, NULL);
+    _cmsAllocInterpPluginChunk(ctx, NULL);
+    _cmsAllocCurvesPluginChunk(ctx, NULL);
+    _cmsAllocFormattersPluginChunk(ctx, NULL);
+    _cmsAllocTagTypePluginChunk(ctx, NULL);
+    _cmsAllocMPETypePluginChunk(ctx, NULL);
+    _cmsAllocTagPluginChunk(ctx, NULL);
+    _cmsAllocIntentsPluginChunk(ctx, NULL);
+    _cmsAllocOptimizationPluginChunk(ctx, NULL);
+    _cmsAllocTransformPluginChunk(ctx, NULL);
+    _cmsAllocMutexPluginChunk(ctx, NULL);
+
+    // Setup the plug-ins
+    if (!cmsPluginTHR(ctx, Plugin)) {
+
+        cmsDeleteContext(ctx);
+        return NULL;
+    }
+
+    return (cmsContext) ctx;
+}
+
+// Duplicates a context with all associated plug-ins.
+// Caller may specify an optional pointer to user-defined
+// data that will be forwarded to plug-ins and logger.
+cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData)
+{
+    int i;
+    struct _cmsContext_struct* ctx;
+    const struct _cmsContext_struct* src = _cmsGetContext(ContextID);
+
+    void* userData = (NewUserData != NULL) ? NewUserData : src -> chunks[UserPtr];
+
+
+    ctx = (struct _cmsContext_struct*) _cmsMalloc(ContextID, sizeof(struct _cmsContext_struct));
+    if (ctx == NULL)
+        return NULL;     // Something very wrong happened
+
+    // Setup default memory allocators
+    memcpy(&ctx->DefaultMemoryManager, &src->DefaultMemoryManager, sizeof(ctx->DefaultMemoryManager));
+
+    // Maintain the linked list
+    _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+       ctx ->Next = _cmsContextPoolHead;
+       _cmsContextPoolHead = ctx;
+    _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+
+    ctx ->chunks[UserPtr]    = userData;
+    ctx ->chunks[MemPlugin]  = &ctx->DefaultMemoryManager;
+
+    ctx ->MemPool = _cmsCreateSubAlloc(ctx, 22 * sizeof(void*));
+    if (ctx ->MemPool == NULL) {
+
+         cmsDeleteContext(ctx);
+        return NULL;
+    }
+
+    // Allocate all required chunks.
+    _cmsAllocLogErrorChunk(ctx, src);
+    _cmsAllocAlarmCodesChunk(ctx, src);
+    _cmsAllocAdaptationStateChunk(ctx, src);
+    _cmsAllocMemPluginChunk(ctx, src);
+    _cmsAllocInterpPluginChunk(ctx, src);
+    _cmsAllocCurvesPluginChunk(ctx, src);
+    _cmsAllocFormattersPluginChunk(ctx, src);
+    _cmsAllocTagTypePluginChunk(ctx, src);
+    _cmsAllocMPETypePluginChunk(ctx, src);
+    _cmsAllocTagPluginChunk(ctx, src);
+    _cmsAllocIntentsPluginChunk(ctx, src);
+    _cmsAllocOptimizationPluginChunk(ctx, src);
+    _cmsAllocTransformPluginChunk(ctx, src);
+    _cmsAllocMutexPluginChunk(ctx, src);
+
+    // Make sure no one failed
+    for (i=Logger; i < MemoryClientMax; i++) {
+
+        if (src ->chunks[i] == NULL) {
+            cmsDeleteContext((cmsContext) ctx);
+            return NULL;
+        }
+    }
+
+    return (cmsContext) ctx;
+}
+
+
+
+static
+struct _cmsContext_struct* FindPrev(struct _cmsContext_struct* id)
+{
+    struct _cmsContext_struct* prev;
+
+    // Search for previous
+    for (prev = _cmsContextPoolHead;
+             prev != NULL;
+             prev = prev ->Next)
+    {
+        if (prev ->Next == id)
+            return prev;
+    }
+
+    return NULL;  // List is empty or only one element!
+}
+
+// Frees any resources associated with the given context,
+// and destroys the context placeholder.
+// The ContextID can no longer be used in any THR operation.
+void CMSEXPORT cmsDeleteContext(cmsContext ContextID)
+{
+    if (ContextID != NULL) {
+
+        struct _cmsContext_struct* ctx = (struct _cmsContext_struct*) ContextID;
+        struct _cmsContext_struct  fakeContext;
+        struct _cmsContext_struct* prev;
+
+        memcpy(&fakeContext.DefaultMemoryManager, &ctx->DefaultMemoryManager, sizeof(ctx->DefaultMemoryManager));
+
+        fakeContext.chunks[UserPtr]     = ctx ->chunks[UserPtr];
+        fakeContext.chunks[MemPlugin]   = &fakeContext.DefaultMemoryManager;
+
+        // Get rid of plugins
+        cmsUnregisterPluginsTHR(ContextID);
+
+        // Since all memory is allocated in the private pool, all what we need to do is destroy the pool
+        if (ctx -> MemPool != NULL)
+              _cmsSubAllocDestroy(ctx ->MemPool);
+        ctx -> MemPool = NULL;
+
+        // Maintain list
+        _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+        if (_cmsContextPoolHead == ctx) {
+
+            _cmsContextPoolHead = ctx->Next;
+        }
+        else {
+
+            // Search for previous
+            for (prev = _cmsContextPoolHead;
+                prev != NULL;
+                prev = prev ->Next)
+            {
+                if (prev -> Next == ctx) {
+                    prev -> Next = ctx ->Next;
+                    break;
+                }
+            }
+        }
+        _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+
+        // free the memory block itself
+        _cmsFree(&fakeContext, ctx);
+    }
+}
+
+// Returns the user data associated to the given ContextID, or NULL if no user data was attached on context creation
+void* CMSEXPORT cmsGetContextUserData(cmsContext ContextID)
+{
+    return _cmsContextGetClientChunk(ContextID, UserPtr);
+}
+
+
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsps2.c b/src/share/native/sun/java2d/cmm/lcms/cmsps2.c
index 2da5a2b..22089d0 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsps2.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsps2.c
@@ -942,7 +942,7 @@
             if (DeviceLink == NULL) return 0;
 
             dwFlags |= cmsFLAGS_FORCE_CLUT;
-            _cmsOptimizePipeline(&DeviceLink, Intent, &InputFormat, &OutFrm, &dwFlags);
+            _cmsOptimizePipeline(m->ContextID, &DeviceLink, Intent, &InputFormat, &OutFrm, &dwFlags);
 
             rc = EmitCIEBasedDEF(m, DeviceLink, Intent, &BlackPointAdaptedToD50);
             cmsPipelineFree(DeviceLink);
@@ -1359,7 +1359,7 @@
 
     // We need a CLUT
     dwFlags |= cmsFLAGS_FORCE_CLUT;
-    _cmsOptimizePipeline(&DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags);
+    _cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags);
 
     _cmsIOPrintf(m, "<<\n");
     _cmsIOPrintf(m, "/ColorRenderingType 1\n");
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c
index f434cfd..08cad5e 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -61,7 +61,7 @@
 // are no profiles holding them. The programmer can also extend this list by defining his own types
 // by using the appropiate plug-in. There are three types of plug ins regarding that. First type
 // allows to define new tags using any existing type. Next plug-in type allows to define new types
-// and the third one is very specific: allows to extend the number of elements in the multiprofile
+// and the third one is very specific: allows to extend the number of elements in the multiprocessing
 // elements special type.
 //--------------------------------------------------------------------------------------------------
 
@@ -89,54 +89,49 @@
 // Helper macro to define a MPE handler. Callbacks do have a fixed naming convention
 #define TYPE_MPE_HANDLER(t, x)  { (t), READ_FN(x), WRITE_FN(x), GenericMPEdup, GenericMPEfree, NULL, 0 }
 
-// Register a new type handler. This routine is shared between normal types and MPE
+// Register a new type handler. This routine is shared between normal types and MPE. LinkedList points to the optional list head
 static
-cmsBool RegisterTypesPlugin(cmsContext id, cmsPluginBase* Data, _cmsTagTypeLinkedList* LinkedList, cmsUInt32Number DefaultListCount)
+cmsBool RegisterTypesPlugin(cmsContext id, cmsPluginBase* Data, _cmsMemoryClient pos)
 {
     cmsPluginTagType* Plugin = (cmsPluginTagType*) Data;
-    _cmsTagTypeLinkedList *pt, *Anterior = NULL;
+    _cmsTagTypePluginChunkType* ctx = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(id, pos);
+    _cmsTagTypeLinkedList *pt;
 
     // Calling the function with NULL as plug-in would unregister the plug in.
     if (Data == NULL) {
 
-        LinkedList[DefaultListCount-1].Next = NULL;
+        // There is no need to set free the memory, as pool is destroyed as a whole.
+        ctx ->TagTypes = NULL;
         return TRUE;
     }
 
-    pt = Anterior = LinkedList;
-    while (pt != NULL) {
-
-        if (Plugin->Handler.Signature == pt -> Handler.Signature) {
-            pt ->Handler = Plugin ->Handler;    // Replace old behaviour.
-            // Note that since no memory is allocated, unregister does not
-            // reset this action.
-            return TRUE;
-        }
-
-        Anterior = pt;
-        pt = pt ->Next;
-    }
-
-    // Registering happens in plug-in memory pool
+    // Registering happens in plug-in memory pool.
     pt = (_cmsTagTypeLinkedList*) _cmsPluginMalloc(id, sizeof(_cmsTagTypeLinkedList));
     if (pt == NULL) return FALSE;
 
     pt ->Handler   = Plugin ->Handler;
-    pt ->Next      = NULL;
+    pt ->Next      = ctx ->TagTypes;
 
-    if (Anterior)
-        Anterior -> Next = pt;
+    ctx ->TagTypes = pt;
 
     return TRUE;
 }
 
-// Return handler for a given type or NULL if not found. Shared between normal types and MPE
+// Return handler for a given type or NULL if not found. Shared between normal types and MPE. It first tries the additons
+// made by plug-ins and then the built-in defaults.
 static
-cmsTagTypeHandler* GetHandler(cmsTagTypeSignature sig, _cmsTagTypeLinkedList* LinkedList)
+cmsTagTypeHandler* GetHandler(cmsTagTypeSignature sig, _cmsTagTypeLinkedList* PluginLinkedList, _cmsTagTypeLinkedList* DefaultLinkedList)
 {
     _cmsTagTypeLinkedList* pt;
 
-    for (pt = LinkedList;
+    for (pt = PluginLinkedList;
+         pt != NULL;
+         pt = pt ->Next) {
+
+            if (sig == pt -> Handler.Signature) return &pt ->Handler;
+    }
+
+    for (pt = DefaultLinkedList;
          pt != NULL;
          pt = pt ->Next) {
 
@@ -163,6 +158,7 @@
     return TRUE;
 }
 
+// Auxiliar to read an array of wchar_t
 static
 cmsBool _cmsReadWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, wchar_t* Array)
 {
@@ -777,6 +773,8 @@
 
     // Create memory
     Text = (char*) _cmsMalloc(self ->ContextID, size);
+    if (Text == NULL) return FALSE;
+
     cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, Text, size);
 
     // Write it, including separator
@@ -1783,7 +1781,6 @@
     if (!_cmsReadUInt8Number(io, NULL)) goto Error;
 
     // Do some checking
-
     if (InputChannels > cmsMAXCHANNELS)  goto Error;
     if (OutputChannels > cmsMAXCHANNELS) goto Error;
 
@@ -1824,9 +1821,16 @@
         if (T  == NULL) goto Error;
 
         Temp = (cmsUInt8Number*) _cmsMalloc(self ->ContextID, nTabSize);
-        if (Temp == NULL) goto Error;
+        if (Temp == NULL) {
+            _cmsFree(self ->ContextID, T);
+            goto Error;
+        }
 
-        if (io ->Read(io, Temp, nTabSize, 1) != 1) goto Error;
+        if (io ->Read(io, Temp, nTabSize, 1) != 1) {
+            _cmsFree(self ->ContextID, T);
+            _cmsFree(self ->ContextID, Temp);
+            goto Error;
+        }
 
         for (i = 0; i < nTabSize; i++) {
 
@@ -2371,27 +2375,30 @@
     // Precision can be 1 or 2 bytes
     if (Precision == 1) {
 
-       cmsUInt8Number  v;
+        cmsUInt8Number  v;
 
         for (i=0; i < Data ->nEntries; i++) {
 
-                if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) return NULL;
-                Data ->Tab.T[i] = FROM_8_TO_16(v);
+            if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) return NULL;
+            Data ->Tab.T[i] = FROM_8_TO_16(v);
         }
 
     }
     else
         if (Precision == 2) {
 
-            if (!_cmsReadUInt16Array(io, Data->nEntries, Data ->Tab.T)) return NULL;
-    }
-    else {
-        cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown precision of '%d'", Precision);
-        return NULL;
-    }
+            if (!_cmsReadUInt16Array(io, Data->nEntries, Data ->Tab.T)) {
+                cmsStageFree(CLUT);
+                return NULL;
+            }
+        }
+        else {
+            cmsStageFree(CLUT);
+            cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown precision of '%d'", Precision);
+            return NULL;
+        }
 
-
-    return CLUT;
+        return CLUT;
 }
 
 static
@@ -4374,7 +4381,7 @@
 {TYPE_MPE_HANDLER((cmsTagTypeSignature) cmsSigCLutElemType,         MPEclut),        NULL },
 };
 
-#define DEFAULT_MPE_TYPE_COUNT  (sizeof(SupportedMPEtypes) / sizeof(_cmsTagTypeLinkedList))
+_cmsTagTypePluginChunkType _cmsMPETypePluginChunk = { NULL };
 
 static
 cmsBool ReadMPEElem(struct _cms_typehandler_struct* self,
@@ -4387,6 +4394,8 @@
     cmsTagTypeHandler* TypeHandler;
     cmsUInt32Number nItems;
     cmsPipeline *NewLUT = (cmsPipeline *) Cargo;
+    _cmsTagTypePluginChunkType* MPETypePluginChunk  = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(self->ContextID, MPEPlugin);
+
 
     // Take signature and channels for each element.
     if (!_cmsReadUInt32Number(io, (cmsUInt32Number*) &ElementSig)) return FALSE;
@@ -4395,7 +4404,7 @@
     if (!_cmsReadUInt32Number(io, NULL)) return FALSE;
 
     // Read diverse MPE types
-    TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, SupportedMPEtypes);
+    TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, MPETypePluginChunk ->TagTypes, SupportedMPEtypes);
     if (TypeHandler == NULL)  {
 
         char String[5];
@@ -4472,6 +4481,7 @@
     cmsPipeline* Lut = (cmsPipeline*) Ptr;
     cmsStage* Elem = Lut ->Elements;
     cmsTagTypeHandler* TypeHandler;
+    _cmsTagTypePluginChunkType* MPETypePluginChunk  = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(self->ContextID, MPEPlugin);
 
     BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase);
 
@@ -4505,7 +4515,7 @@
 
         ElementSig = Elem ->Type;
 
-        TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, SupportedMPEtypes);
+        TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, MPETypePluginChunk->TagTypes, SupportedMPEtypes);
         if (TypeHandler == NULL)  {
 
                 char String[5];
@@ -5125,7 +5135,7 @@
         }
         else {
 
-        rc = cmsDictAddEntry(hDict, NameWCS, ValueWCS, DisplayNameMLU, DisplayValueMLU);
+            rc = cmsDictAddEntry(hDict, NameWCS, ValueWCS, DisplayNameMLU, DisplayValueMLU);
         }
 
         if (NameWCS != NULL) _cmsFree(self ->ContextID, NameWCS);
@@ -5282,24 +5292,95 @@
 {TYPE_HANDLER(cmsSigVcgtType,                  vcgt),                NULL }
 };
 
-#define DEFAULT_TAG_TYPE_COUNT  (sizeof(SupportedTagTypes) / sizeof(_cmsTagTypeLinkedList))
+
+_cmsTagTypePluginChunkType _cmsTagTypePluginChunk = { NULL };
+
+
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupTagTypeList(struct _cmsContext_struct* ctx,
+                    const struct _cmsContext_struct* src,
+                    int loc)
+{
+   _cmsTagTypePluginChunkType newHead = { NULL };
+   _cmsTagTypeLinkedList*  entry;
+   _cmsTagTypeLinkedList*  Anterior = NULL;
+   _cmsTagTypePluginChunkType* head = (_cmsTagTypePluginChunkType*) src->chunks[loc];
+
+   // Walk the list copying all nodes
+   for (entry = head->TagTypes;
+       entry != NULL;
+       entry = entry ->Next) {
+
+           _cmsTagTypeLinkedList *newEntry = ( _cmsTagTypeLinkedList *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsTagTypeLinkedList));
+
+           if (newEntry == NULL)
+               return;
+
+           // We want to keep the linked list order, so this is a little bit tricky
+           newEntry -> Next = NULL;
+           if (Anterior)
+               Anterior -> Next = newEntry;
+
+           Anterior = newEntry;
+
+           if (newHead.TagTypes == NULL)
+               newHead.TagTypes = newEntry;
+   }
+
+   ctx ->chunks[loc] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTagTypePluginChunkType));
+}
+
+
+void _cmsAllocTagTypePluginChunk(struct _cmsContext_struct* ctx,
+                                 const struct _cmsContext_struct* src)
+{
+    if (src != NULL) {
+
+        // Duplicate the LIST
+        DupTagTypeList(ctx, src, TagTypePlugin);
+    }
+    else {
+        static _cmsTagTypePluginChunkType TagTypePluginChunk = { NULL };
+        ctx ->chunks[TagTypePlugin] = _cmsSubAllocDup(ctx ->MemPool, &TagTypePluginChunk, sizeof(_cmsTagTypePluginChunkType));
+    }
+}
+
+void _cmsAllocMPETypePluginChunk(struct _cmsContext_struct* ctx,
+                               const struct _cmsContext_struct* src)
+{
+    if (src != NULL) {
+
+        // Duplicate the LIST
+        DupTagTypeList(ctx, src, MPEPlugin);
+    }
+    else {
+        static _cmsTagTypePluginChunkType TagTypePluginChunk = { NULL };
+        ctx ->chunks[MPEPlugin] = _cmsSubAllocDup(ctx ->MemPool, &TagTypePluginChunk, sizeof(_cmsTagTypePluginChunkType));
+    }
+
+}
+
 
 // Both kind of plug-ins share same structure
 cmsBool  _cmsRegisterTagTypePlugin(cmsContext id, cmsPluginBase* Data)
 {
-    return RegisterTypesPlugin(id, Data, SupportedTagTypes, DEFAULT_TAG_TYPE_COUNT);
+    return RegisterTypesPlugin(id, Data, TagTypePlugin);
 }
 
 cmsBool  _cmsRegisterMultiProcessElementPlugin(cmsContext id, cmsPluginBase* Data)
 {
-    return RegisterTypesPlugin(id, Data, SupportedMPEtypes, DEFAULT_MPE_TYPE_COUNT);
+    return RegisterTypesPlugin(id, Data,MPEPlugin);
 }
 
 
 // Wrapper for tag types
-cmsTagTypeHandler* _cmsGetTagTypeHandler(cmsTagTypeSignature sig)
+cmsTagTypeHandler* _cmsGetTagTypeHandler(cmsContext ContextID, cmsTagTypeSignature sig)
 {
-    return GetHandler(sig, SupportedTagTypes);
+    _cmsTagTypePluginChunkType* ctx = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(ContextID, TagTypePlugin);
+
+    return GetHandler(sig, ctx->TagTypes, SupportedTagTypes);
 }
 
 // ********************************************************************************
@@ -5414,48 +5495,94 @@
     cmsSigDeviceSettingsTag   ==> Deprecated, useless
 */
 
-#define DEFAULT_TAG_COUNT  (sizeof(SupportedTags) / sizeof(_cmsTagLinkedList))
+
+_cmsTagPluginChunkType _cmsTagPluginChunk = { NULL };
+
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupTagList(struct _cmsContext_struct* ctx,
+                    const struct _cmsContext_struct* src)
+{
+   _cmsTagPluginChunkType newHead = { NULL };
+   _cmsTagLinkedList*  entry;
+   _cmsTagLinkedList*  Anterior = NULL;
+   _cmsTagPluginChunkType* head = (_cmsTagPluginChunkType*) src->chunks[TagPlugin];
+
+   // Walk the list copying all nodes
+   for (entry = head->Tag;
+       entry != NULL;
+       entry = entry ->Next) {
+
+           _cmsTagLinkedList *newEntry = ( _cmsTagLinkedList *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsTagLinkedList));
+
+           if (newEntry == NULL)
+               return;
+
+           // We want to keep the linked list order, so this is a little bit tricky
+           newEntry -> Next = NULL;
+           if (Anterior)
+               Anterior -> Next = newEntry;
+
+           Anterior = newEntry;
+
+           if (newHead.Tag == NULL)
+               newHead.Tag = newEntry;
+   }
+
+   ctx ->chunks[TagPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTagPluginChunkType));
+}
+
+void _cmsAllocTagPluginChunk(struct _cmsContext_struct* ctx,
+                                 const struct _cmsContext_struct* src)
+{
+    if (src != NULL) {
+
+        DupTagList(ctx, src);
+    }
+    else {
+        static _cmsTagPluginChunkType TagPluginChunk = { NULL };
+        ctx ->chunks[TagPlugin] = _cmsSubAllocDup(ctx ->MemPool, &TagPluginChunk, sizeof(_cmsTagPluginChunkType));
+    }
+
+}
 
 cmsBool  _cmsRegisterTagPlugin(cmsContext id, cmsPluginBase* Data)
 {
     cmsPluginTag* Plugin = (cmsPluginTag*) Data;
-    _cmsTagLinkedList *pt, *Anterior;
-
+    _cmsTagLinkedList *pt;
+    _cmsTagPluginChunkType* TagPluginChunk = ( _cmsTagPluginChunkType*) _cmsContextGetClientChunk(id, TagPlugin);
 
     if (Data == NULL) {
 
-        SupportedTags[DEFAULT_TAG_COUNT-1].Next = NULL;
+        TagPluginChunk->Tag = NULL;
         return TRUE;
     }
 
-    pt = Anterior = SupportedTags;
-    while (pt != NULL) {
-
-        if (Plugin->Signature == pt -> Signature) {
-            pt ->Descriptor = Plugin ->Descriptor;  // Replace old behaviour
-            return TRUE;
-        }
-
-        Anterior = pt;
-        pt = pt ->Next;
-    }
-
     pt = (_cmsTagLinkedList*) _cmsPluginMalloc(id, sizeof(_cmsTagLinkedList));
     if (pt == NULL) return FALSE;
 
     pt ->Signature  = Plugin ->Signature;
     pt ->Descriptor = Plugin ->Descriptor;
-    pt ->Next       = NULL;
+    pt ->Next       = TagPluginChunk ->Tag;
 
-    if (Anterior != NULL) Anterior -> Next = pt;
+    TagPluginChunk ->Tag = pt;
 
     return TRUE;
 }
 
 // Return a descriptor for a given tag or NULL
-cmsTagDescriptor* _cmsGetTagDescriptor(cmsTagSignature sig)
+cmsTagDescriptor* _cmsGetTagDescriptor(cmsContext ContextID, cmsTagSignature sig)
 {
     _cmsTagLinkedList* pt;
+    _cmsTagPluginChunkType* TagPluginChunk = ( _cmsTagPluginChunkType*) _cmsContextGetClientChunk(ContextID, TagPlugin);
+
+    for (pt = TagPluginChunk->Tag;
+             pt != NULL;
+             pt = pt ->Next) {
+
+                if (sig == pt -> Signature) return &pt ->Descriptor;
+    }
 
     for (pt = SupportedTags;
             pt != NULL;
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c b/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c
index 699abcc..3598751 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1019,7 +1019,7 @@
 
 static const cmsAllowedLUT AllowedLUTTypes[] = {
 
-    { FALSE, 0,              cmsSigLut16Type,    4,  { cmsSigMatrixElemType,  cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}},
+    { FALSE, 0,              cmsSigLut16Type,    4,  { cmsSigMatrixElemType,   cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}},
     { FALSE, 0,              cmsSigLut16Type,    3,  { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}},
     { FALSE, 0,              cmsSigLut16Type,    2,  { cmsSigCurveSetElemType, cmsSigCLutElemType}},
     { TRUE , 0,              cmsSigLutAtoBType,  1,  { cmsSigCurveSetElemType }},
@@ -1150,7 +1150,7 @@
     if (AllowedLUT == NULL) {
 
         // Try to optimize
-        _cmsOptimizePipeline(&LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
+        _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
 
     }
@@ -1159,7 +1159,7 @@
     if (AllowedLUT == NULL) {
 
         dwFlags |= cmsFLAGS_FORCE_CLUT;
-        _cmsOptimizePipeline(&LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
+        _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
 
         // Put identity curves if needed
         if (cmsPipelineGetPtrToFirstStage(LUT) ->Type != cmsSigCurveSetElemType)
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c b/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c
index 71fb765..1eb9a87 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/share/native/sun/java2d/cmm/lcms/cmsxform.c b/src/share/native/sun/java2d/cmm/lcms/cmsxform.c
index 879056f..3e244c3 100644
--- a/src/share/native/sun/java2d/cmm/lcms/cmsxform.c
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsxform.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -58,44 +58,120 @@
 // Transformations stuff
 // -----------------------------------------------------------------------
 
-// Alarm codes for 16-bit transformations, because the fixed range of containers there are
-// no values left to mark out of gamut. volatile is C99 per 6.2.5
-static volatile cmsUInt16Number Alarm[cmsMAXCHANNELS] = { 0x7F00, 0x7F00, 0x7F00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-static volatile cmsFloat64Number GlobalAdaptationState = 1;
+#define DEFAULT_OBSERVER_ADAPTATION_STATE 1.0
+
+// The Context0 observer adaptation state.
+_cmsAdaptationStateChunkType _cmsAdaptationStateChunk = { DEFAULT_OBSERVER_ADAPTATION_STATE };
+
+// Init and duplicate observer adaptation state
+void _cmsAllocAdaptationStateChunk(struct _cmsContext_struct* ctx,
+                                   const struct _cmsContext_struct* src)
+{
+    static _cmsAdaptationStateChunkType AdaptationStateChunk = { DEFAULT_OBSERVER_ADAPTATION_STATE };
+    void* from;
+
+    if (src != NULL) {
+        from = src ->chunks[AdaptationStateContext];
+    }
+    else {
+       from = &AdaptationStateChunk;
+    }
+
+    ctx ->chunks[AdaptationStateContext] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsAdaptationStateChunkType));
+}
+
+
+// Sets adaptation state for absolute colorimetric intent in the given context.  Adaptation state applies on all
+// but cmsCreateExtendedTransformTHR().  Little CMS can handle incomplete adaptation states.
+cmsFloat64Number CMSEXPORT cmsSetAdaptationStateTHR(cmsContext ContextID, cmsFloat64Number d)
+{
+    cmsFloat64Number prev;
+    _cmsAdaptationStateChunkType* ptr = (_cmsAdaptationStateChunkType*) _cmsContextGetClientChunk(ContextID, AdaptationStateContext);
+
+    // Get previous value for return
+    prev = ptr ->AdaptationState;
+
+    // Set the value if d is positive or zero
+    if (d >= 0.0) {
+
+        ptr ->AdaptationState = d;
+    }
+
+    // Always return previous value
+    return prev;
+}
+
 
 // The adaptation state may be defaulted by this function. If you don't like it, use the extended transform routine
 cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d)
 {
-    cmsFloat64Number OldVal = GlobalAdaptationState;
-
-    if (d >= 0)
-        GlobalAdaptationState = d;
-
-    return OldVal;
+    return cmsSetAdaptationStateTHR(NULL, d);
 }
 
-// Alarm codes are always global
-void CMSEXPORT cmsSetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS])
-{
-    int i;
+// -----------------------------------------------------------------------
 
+// Alarm codes for 16-bit transformations, because the fixed range of containers there are
+// no values left to mark out of gamut.
+
+#define DEFAULT_ALARM_CODES_VALUE {0x7F00, 0x7F00, 0x7F00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+_cmsAlarmCodesChunkType _cmsAlarmCodesChunk = { DEFAULT_ALARM_CODES_VALUE };
+
+// Sets the codes used to mark out-out-gamut on Proofing transforms for a given context. Values are meant to be
+// encoded in 16 bits.
+void CMSEXPORT cmsSetAlarmCodesTHR(cmsContext ContextID, const cmsUInt16Number AlarmCodesP[cmsMAXCHANNELS])
+{
+    _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(ContextID, AlarmCodesContext);
+
+    _cmsAssert(ContextAlarmCodes != NULL); // Can't happen
+
+    memcpy(ContextAlarmCodes->AlarmCodes, AlarmCodesP, sizeof(ContextAlarmCodes->AlarmCodes));
+}
+
+// Gets the current codes used to mark out-out-gamut on Proofing transforms for the given context.
+// Values are meant to be encoded in 16 bits.
+void CMSEXPORT cmsGetAlarmCodesTHR(cmsContext ContextID, cmsUInt16Number AlarmCodesP[cmsMAXCHANNELS])
+{
+    _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(ContextID, AlarmCodesContext);
+
+    _cmsAssert(ContextAlarmCodes != NULL); // Can't happen
+
+    memcpy(AlarmCodesP, ContextAlarmCodes->AlarmCodes, sizeof(ContextAlarmCodes->AlarmCodes));
+}
+
+void CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS])
+{
     _cmsAssert(NewAlarm != NULL);
 
-    for (i=0; i < cmsMAXCHANNELS; i++)
-        Alarm[i] = NewAlarm[i];
+    cmsSetAlarmCodesTHR(NULL, NewAlarm);
 }
 
-// You can get the codes cas well
 void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number OldAlarm[cmsMAXCHANNELS])
 {
-    int i;
-
     _cmsAssert(OldAlarm != NULL);
-
-    for (i=0; i < cmsMAXCHANNELS; i++)
-        OldAlarm[i] = Alarm[i];
+    cmsGetAlarmCodesTHR(NULL, OldAlarm);
 }
 
+
+// Init and duplicate alarm codes
+void _cmsAllocAlarmCodesChunk(struct _cmsContext_struct* ctx,
+                              const struct _cmsContext_struct* src)
+{
+    static _cmsAlarmCodesChunkType AlarmCodesChunk = { DEFAULT_ALARM_CODES_VALUE };
+    void* from;
+
+    if (src != NULL) {
+        from = src ->chunks[AlarmCodesContext];
+    }
+    else {
+       from = &AlarmCodesChunk;
+    }
+
+    ctx ->chunks[AlarmCodesContext] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsAlarmCodesChunkType));
+}
+
+// -----------------------------------------------------------------------
+
 // Get rid of transform resources
 void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform)
 {
@@ -202,6 +278,30 @@
     }
 }
 
+
+static
+void NullFloatXFORM(_cmsTRANSFORM* p,
+                    const void* in,
+                    void* out,
+                    cmsUInt32Number Size,
+                    cmsUInt32Number Stride)
+{
+    cmsUInt8Number* accum;
+    cmsUInt8Number* output;
+    cmsFloat32Number fIn[cmsMAXCHANNELS];
+    cmsUInt32Number i, n;
+
+    accum  = (cmsUInt8Number*)  in;
+    output = (cmsUInt8Number*)  out;
+    n = Size;
+
+    for (i=0; i < n; i++) {
+
+        accum  = p -> FromInputFloat(p, fIn, accum, Stride);
+        output = p -> ToOutputFloat(p, fIn, output, Stride);
+    }
+}
+
 // 16 bit precision -----------------------------------------------------------------------------------------------------------
 
 // Null transformation, only applies formatters. No caché
@@ -252,7 +352,7 @@
 }
 
 
-// Auxiliar: Handle precalculated gamut check
+// Auxiliar: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
 static
 void TransformOnePixelWithGamutCheck(_cmsTRANSFORM* p,
                                      const cmsUInt16Number wIn[],
@@ -264,9 +364,12 @@
     if (wOutOfGamut >= 1) {
 
         cmsUInt16Number i;
+        _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(p->ContextID, AlarmCodesContext);
 
-        for (i=0; i < p ->Lut->OutputChannels; i++)
-            wOut[i] = Alarm[i];
+        for (i=0; i < p ->Lut->OutputChannels; i++) {
+
+            wOut[i] = ContextAlarmCodes ->AlarmCodes[i];
+        }
     }
     else
         p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
@@ -393,34 +496,86 @@
 } _cmsTransformCollection;
 
 // The linked list head
-static _cmsTransformCollection* TransformCollection = NULL;
+_cmsTransformPluginChunkType _cmsTransformPluginChunk = { NULL };
+
+
+// Duplicates the zone of memory used by the plug-in in the new context
+static
+void DupPluginTransformList(struct _cmsContext_struct* ctx,
+                                               const struct _cmsContext_struct* src)
+{
+   _cmsTransformPluginChunkType newHead = { NULL };
+   _cmsTransformCollection*  entry;
+   _cmsTransformCollection*  Anterior = NULL;
+   _cmsTransformPluginChunkType* head = (_cmsTransformPluginChunkType*) src->chunks[TransformPlugin];
+
+    // Walk the list copying all nodes
+   for (entry = head->TransformCollection;
+        entry != NULL;
+        entry = entry ->Next) {
+
+            _cmsTransformCollection *newEntry = ( _cmsTransformCollection *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsTransformCollection));
+
+            if (newEntry == NULL)
+                return;
+
+            // We want to keep the linked list order, so this is a little bit tricky
+            newEntry -> Next = NULL;
+            if (Anterior)
+                Anterior -> Next = newEntry;
+
+            Anterior = newEntry;
+
+            if (newHead.TransformCollection == NULL)
+                newHead.TransformCollection = newEntry;
+    }
+
+  ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTransformPluginChunkType));
+}
+
+void _cmsAllocTransformPluginChunk(struct _cmsContext_struct* ctx,
+                                        const struct _cmsContext_struct* src)
+{
+    if (src != NULL) {
+
+        // Copy all linked list
+        DupPluginTransformList(ctx, src);
+    }
+    else {
+        static _cmsTransformPluginChunkType TransformPluginChunkType = { NULL };
+        ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx ->MemPool, &TransformPluginChunkType, sizeof(_cmsTransformPluginChunkType));
+    }
+}
+
+
 
 // Register new ways to transform
-cmsBool  _cmsRegisterTransformPlugin(cmsContext id, cmsPluginBase* Data)
+cmsBool  _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Data)
 {
     cmsPluginTransform* Plugin = (cmsPluginTransform*) Data;
     _cmsTransformCollection* fl;
+    _cmsTransformPluginChunkType* ctx = ( _cmsTransformPluginChunkType*) _cmsContextGetClientChunk(ContextID,TransformPlugin);
 
-      if (Data == NULL) {
+    if (Data == NULL) {
 
         // Free the chain. Memory is safely freed at exit
-        TransformCollection = NULL;
+        ctx->TransformCollection = NULL;
         return TRUE;
     }
 
     // Factory callback is required
-   if (Plugin ->Factory == NULL) return FALSE;
+    if (Plugin ->Factory == NULL) return FALSE;
 
 
-    fl = (_cmsTransformCollection*) _cmsPluginMalloc(id, sizeof(_cmsTransformCollection));
+    fl = (_cmsTransformCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsTransformCollection));
     if (fl == NULL) return FALSE;
 
-      // Copy the parameters
+    // Copy the parameters
     fl ->Factory = Plugin ->Factory;
 
     // Keep linked list
-    fl ->Next = TransformCollection;
-    TransformCollection = fl;
+    fl ->Next = ctx->TransformCollection;
+    ctx->TransformCollection = fl;
 
     // All is ok
     return TRUE;
@@ -463,6 +618,7 @@
 _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
                                                cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags)
 {
+     _cmsTransformPluginChunkType* ctx = ( _cmsTransformPluginChunkType*) _cmsContextGetClientChunk(ContextID, TransformPlugin);
      _cmsTransformCollection* Plugin;
 
     // Allocate needed memory
@@ -473,7 +629,7 @@
     p ->Lut = lut;
 
     // Let's see if any plug-in want to do the transform by itself
-    for (Plugin = TransformCollection;
+    for (Plugin = ctx ->TransformCollection;
         Plugin != NULL;
         Plugin = Plugin ->Next) {
 
@@ -493,10 +649,10 @@
                 // Fill the formatters just in case the optimized routine is interested.
                 // No error is thrown if the formatter doesn't exist. It is up to the optimization
                 // factory to decide what to do in those cases.
-                p ->FromInput      = _cmsGetFormatter(*InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
-                p ->ToOutput       = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
-                p ->FromInputFloat = _cmsGetFormatter(*InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
-                p ->ToOutputFloat  = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+                p ->FromInput      = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
+                p ->ToOutput       = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
+                p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+                p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 
                 return p;
             }
@@ -504,14 +660,14 @@
 
     // Not suitable for the transform plug-in, let's check  the pipeline plug-in
     if (p ->Lut != NULL)
-        _cmsOptimizePipeline(&p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
+        _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
 
     // Check whatever this is a true floating point transform
     if (_cmsFormatterIsFloat(*InputFormat) && _cmsFormatterIsFloat(*OutputFormat)) {
 
         // Get formatter function always return a valid union, but the contents of this union may be NULL.
-        p ->FromInputFloat = _cmsGetFormatter(*InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
-        p ->ToOutputFloat  = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+        p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+        p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
         *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
 
         if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) {
@@ -521,8 +677,15 @@
             return NULL;
         }
 
-        // Float transforms don't use caché, always are non-NULL
-        p ->xform = FloatXFORM;
+        if (*dwFlags & cmsFLAGS_NULLTRANSFORM) {
+
+            p ->xform = NullFloatXFORM;
+        }
+        else {
+            // Float transforms don't use caché, always are non-NULL
+            p ->xform = FloatXFORM;
+        }
+
     }
     else {
 
@@ -534,8 +697,8 @@
 
             int BytesPerPixelInput;
 
-            p ->FromInput = _cmsGetFormatter(*InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
-            p ->ToOutput  = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
+            p ->FromInput = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
+            p ->ToOutput  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
 
             if (p ->FromInput == NULL || p ->ToOutput == NULL) {
 
@@ -727,6 +890,7 @@
     // Check channel count
     if ((cmsChannelsOf(EntryColorSpace) != cmsPipelineInputChannels(Lut)) ||
         (cmsChannelsOf(ExitColorSpace)  != cmsPipelineOutputChannels(Lut))) {
+        cmsPipelineFree(Lut);
         cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Channel count doesn't match. Profile is corrupted");
         return NULL;
     }
@@ -829,7 +993,7 @@
     for (i=0; i < nProfiles; i++) {
         BPC[i] = dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION ? TRUE : FALSE;
         Intents[i] = Intent;
-        AdaptationStates[i] = GlobalAdaptationState;
+        AdaptationStates[i] = cmsSetAdaptationStateTHR(ContextID, -1);
     }
 
 
@@ -909,7 +1073,7 @@
     Intents[0] = nIntent;      Intents[1] = nIntent;        Intents[2] = INTENT_RELATIVE_COLORIMETRIC;  Intents[3] = ProofingIntent;
     BPC[0]     = DoBPC;        BPC[1] = DoBPC;              BPC[2] = 0;                                 BPC[3] = 0;
 
-    Adaptation[0] = Adaptation[1] = Adaptation[2] = Adaptation[3] = GlobalAdaptationState;
+    Adaptation[0] = Adaptation[1] = Adaptation[2] = Adaptation[3] = cmsSetAdaptationStateTHR(ContextID, -1);
 
     if (!(dwFlags & (cmsFLAGS_SOFTPROOFING|cmsFLAGS_GAMUTCHECK)))
         return cmsCreateTransformTHR(ContextID, InputProfile, InputFormat, OutputProfile, OutputFormat, nIntent, dwFlags);
@@ -984,8 +1148,8 @@
         return FALSE;
     }
 
-    FromInput = _cmsGetFormatter(InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
-    ToOutput  = _cmsGetFormatter(OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
+    FromInput = _cmsGetFormatter(xform->ContextID, InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
+    ToOutput  = _cmsGetFormatter(xform->ContextID, OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
 
     if (FromInput == NULL || ToOutput == NULL) {
 
diff --git a/src/share/native/sun/java2d/cmm/lcms/lcms2.h b/src/share/native/sun/java2d/cmm/lcms/lcms2.h
index c6c35b1..2fd2b56 100644
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2.h
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2013 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.5
+// Version 2.6
 //
 
 #ifndef _lcms2_H
@@ -84,6 +84,9 @@
 // Uncomment to get rid of the tables for "half" float support
 // #define CMS_NO_HALF_SUPPORT 1
 
+// Uncomment to get rid of pthreads/windows dependency
+// #define CMS_NO_PTHREADS  1
+
 // ********** End of configuration toggles ******************************
 
 // Needed for streams
@@ -101,7 +104,7 @@
 #endif
 
 // Version/release
-#define LCMS_VERSION        2050
+#define LCMS_VERSION        2060
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
@@ -202,28 +205,42 @@
 // Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
 // you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
 
+#if defined(__sgi__) || defined(__sgi) || defined(sparc)
+#   define CMS_USE_BIG_ENDIAN      1
+#endif
+
+#if defined(__s390__) || defined(__s390x__)
+#   define CMS_USE_BIG_ENDIAN   1
+#endif
+
+#  ifdef TARGET_CPU_PPC
+#    if TARGET_CPU_PPC
+#      define CMS_USE_BIG_ENDIAN   1
+#    endif
+#  endif
+
+#if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_CPU_PPC)
+#   define CMS_USE_BIG_ENDIAN   1
+#   if defined (__GNUC__) && defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN)
+#       if __BYTE_ORDER  == __LITTLE_ENDIAN
+//               // Don't use big endian for PowerPC little endian mode
+#                undef CMS_USE_BIG_ENDIAN
+#       endif
+#   endif
+#endif
+
+// WORDS_BIGENDIAN takes precedence
 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
 #   define CMS_USE_BIG_ENDIAN      1
 #endif
 
-#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc)
-#   define CMS_USE_BIG_ENDIAN      1
-#endif
-
-#if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
-#   define CMS_USE_BIG_ENDIAN   1
-#endif
-
-#ifdef TARGET_CPU_PPC
-# if TARGET_CPU_PPC
-#   define CMS_USE_BIG_ENDIAN   1
-# endif
-#endif
-
 #ifdef macintosh
 # ifdef __BIG_ENDIAN__
 #   define CMS_USE_BIG_ENDIAN      1
 # endif
+# ifdef __LITTLE_ENDIAN__
+#   undef CMS_USE_BIG_ENDIAN
+# endif
 #endif
 
 // Calling convention -- this is hardly platform and compiler dependent
@@ -249,6 +266,14 @@
 # define CMSAPI
 #endif
 
+#ifdef HasTHREADS
+# if HasTHREADS == 1
+#    undef CMS_NO_PTHREADS
+# else
+#    define CMS_NO_PTHREADS 1
+# endif
+#endif
+
 // Some common definitions
 #define cmsMAX_PATH     256
 
@@ -642,7 +667,6 @@
 
 // Little CMS specific typedefs
 
-typedef void* cmsContext;              // Context identifier for multithreaded environments
 typedef void* cmsHANDLE ;              // Generic handle
 typedef void* cmsHPROFILE;             // Opaque typedefs to hide internals
 typedef void* cmsHTRANSFORM;
@@ -1012,11 +1036,25 @@
 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
 
-// Plug-In registering  ---------------------------------------------------------------------------------------------------
+
+// Context handling --------------------------------------------------------------------------------------------------------
+
+// Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
+// though using the global context is not recomended. Proper context handling makes lcms more thread-safe.
+
+typedef struct _cmsContext_struct* cmsContext;
+
+CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
+CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContexID);
+CMSAPI cmsContext       CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
+CMSAPI void*            CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
+
+// Plug-In registering  --------------------------------------------------------------------------------------------------
 
 CMSAPI cmsBool           CMSEXPORT cmsPlugin(void* Plugin);
 CMSAPI cmsBool           CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
 CMSAPI void              CMSEXPORT cmsUnregisterPlugins(void);
+CMSAPI void              CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID);
 
 // Error logging ----------------------------------------------------------------------------------------------------------
 
@@ -1053,6 +1091,7 @@
 
 // Allows user to set any specific logger
 CMSAPI void              CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn);
+CMSAPI void              CMSEXPORT cmsSetLogErrorHandlerTHR(cmsContext ContextID, cmsLogErrorHandlerFunction Fn);
 
 // Conversions --------------------------------------------------------------------------------------------------------------
 
@@ -1514,6 +1553,7 @@
 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromMem(const void * MemPtr, cmsUInt32Number dwSize);
 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void * MemPtr, cmsUInt32Number dwSize);
 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromIOhandlerTHR(cmsContext ContextID, cmsIOHANDLER* io);
+CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromIOhandler2THR(cmsContext ContextID, cmsIOHANDLER* io, cmsBool write);
 CMSAPI cmsBool          CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
 
 CMSAPI cmsBool          CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName);
@@ -1604,6 +1644,7 @@
 
 // Call with NULL as parameters to get the intent count
 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
+CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
 
 // Flags
 
@@ -1715,11 +1756,22 @@
                                                  cmsUInt32Number Stride);
 
 
-CMSAPI void             CMSEXPORT cmsSetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
+CMSAPI void             CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
 CMSAPI void             CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
 
+
+CMSAPI void             CMSEXPORT cmsSetAlarmCodesTHR(cmsContext ContextID,
+                                                          const cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
+CMSAPI void             CMSEXPORT cmsGetAlarmCodesTHR(cmsContext ContextID,
+                                                          cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
+
+
+
 // Adaptation state for absolute colorimetric intent
 CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d);
+CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationStateTHR(cmsContext ContextID, cmsFloat64Number d);
+
+
 
 // Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
 CMSAPI cmsContext       CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform);
diff --git a/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h b/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h
index 6fbbb95..7f28f3d 100644
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h
@@ -30,7 +30,7 @@
 
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2014 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -193,16 +193,171 @@
     return _cmsQuickFloorWord(d);
 }
 
-// Plug-In registering ---------------------------------------------------------------
+
+// Pthread support --------------------------------------------------------------------
+#ifndef CMS_NO_PTHREADS
+
+// This is the threading support. Unfortunately, it has to be platform-dependent because
+// windows does not support pthreads.
+
+#ifdef CMS_IS_WINDOWS_
+
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+
+
+// From: http://locklessinc.com/articles/pthreads_on_windows/
+// The pthreads API has an initialization macro that has no correspondence to anything in
+// the windows API. By investigating the internal definition of the critical section type,
+// one may work out how to initialize one without calling InitializeCriticalSection().
+// The trick here is that InitializeCriticalSection() is not allowed to fail. It tries
+// to allocate a critical section debug object, but if no memory is available, it sets
+// the pointer to a specific value. (One would expect that value to be NULL, but it is
+// actually (void *)-1 for some reason.) Thus we can use this special value for that
+// pointer, and the critical section code will work.
+
+// The other important part of the critical section type to initialize is the number
+// of waiters. This controls whether or not the mutex is locked. Fortunately, this
+// part of the critical section is unlikely to change. Apparently, many programs
+// already test critical sections to see if they are locked using this value, so
+// Microsoft felt that it was necessary to keep it set at -1 for an unlocked critical
+// section, even when they changed the underlying algorithm to be more scalable.
+// The final parts of the critical section object are unimportant, and can be set
+// to zero for their defaults. This yields an initialization macro:
+
+typedef CRITICAL_SECTION _cmsMutex;
+
+#define CMS_MUTEX_INITIALIZER {(void*) -1,-1,0,0,0,0}
+
+cmsINLINE int _cmsLockPrimitive(_cmsMutex *m)
+{
+        EnterCriticalSection(m);
+        return 0;
+}
+
+cmsINLINE int _cmsUnlockPrimitive(_cmsMutex *m)
+{
+        LeaveCriticalSection(m);
+        return 0;
+}
+
+cmsINLINE int _cmsInitMutexPrimitive(_cmsMutex *m)
+{
+        InitializeCriticalSection(m);
+        return 0;
+}
+
+cmsINLINE int _cmsDestroyMutexPrimitive(_cmsMutex *m)
+{
+        DeleteCriticalSection(m);
+        return 0;
+}
+
+cmsINLINE int _cmsEnterCriticalSectionPrimitive(_cmsMutex *m)
+{
+        EnterCriticalSection(m);
+        return 0;
+}
+
+cmsINLINE int _cmsLeaveCriticalSectionPrimitive(_cmsMutex *m)
+{
+        LeaveCriticalSection(m);
+        return 0;
+}
+
+#else
+
+// Rest of the wide world
+#include <pthread.h>
+
+#define CMS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+typedef pthread_mutex_t _cmsMutex;
+
+
+cmsINLINE int _cmsLockPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_lock(m);
+}
+
+cmsINLINE int _cmsUnlockPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_unlock(m);
+}
+
+cmsINLINE int _cmsInitMutexPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_init(m, NULL);
+}
+
+cmsINLINE int _cmsDestroyMutexPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_destroy(m);
+}
+
+cmsINLINE int _cmsEnterCriticalSectionPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_lock(m);
+}
+
+cmsINLINE int _cmsLeaveCriticalSectionPrimitive(_cmsMutex *m)
+{
+        return pthread_mutex_unlock(m);
+}
+
+#endif
+#else
+
+#define CMS_MUTEX_INITIALIZER 0
+typedef int _cmsMutex;
+
+
+cmsINLINE int _cmsLockPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+
+cmsINLINE int _cmsUnlockPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+
+cmsINLINE int _cmsInitMutexPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+
+cmsINLINE int _cmsDestroyMutexPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+
+cmsINLINE int _cmsEnterCriticalSectionPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+
+cmsINLINE int _cmsLeaveCriticalSectionPrimitive(_cmsMutex *m)
+{
+        return 0;
+    cmsUNUSED_PARAMETER(m);
+}
+#endif
+
+// Plug-In registration ---------------------------------------------------------------
 
 // Specialized function for plug-in memory management. No pairing free() since whole pool is freed at once.
 void* _cmsPluginMalloc(cmsContext ContextID, cmsUInt32Number size);
 
 // Memory management
-cmsBool   _cmsRegisterMemHandlerPlugin(cmsPluginBase* Plugin);
+cmsBool   _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
 // Interpolation
-cmsBool  _cmsRegisterInterpPlugin(cmsPluginBase* Plugin);
+cmsBool  _cmsRegisterInterpPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
 // Parametric curves
 cmsBool  _cmsRegisterParametricCurvesPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
@@ -228,9 +383,12 @@
 // Transform
 cmsBool  _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
+// Mutex
+cmsBool _cmsRegisterMutexPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
+
 // ---------------------------------------------------------------------------------------------------------
 
-// Suballocators. Those are blocks of memory that is freed at the end on whole block.
+// Suballocators.
 typedef struct _cmsSubAllocator_chunk_st {
 
     cmsUInt8Number* Block;
@@ -253,9 +411,264 @@
 _cmsSubAllocator* _cmsCreateSubAlloc(cmsContext ContextID, cmsUInt32Number Initial);
 void              _cmsSubAllocDestroy(_cmsSubAllocator* s);
 void*             _cmsSubAlloc(_cmsSubAllocator* s, cmsUInt32Number size);
+void*             _cmsSubAllocDup(_cmsSubAllocator* s, const void *ptr, cmsUInt32Number size);
 
 // ----------------------------------------------------------------------------------
 
+// The context clients.
+typedef enum {
+
+    UserPtr,            // User-defined pointer
+    Logger,
+    AlarmCodesContext,
+    AdaptationStateContext,
+    MemPlugin,
+    InterpPlugin,
+    CurvesPlugin,
+    FormattersPlugin,
+    TagTypePlugin,
+    TagPlugin,
+    IntentPlugin,
+    MPEPlugin,
+    OptimizationPlugin,
+    TransformPlugin,
+    MutexPlugin,
+
+    // Last in list
+    MemoryClientMax
+
+} _cmsMemoryClient;
+
+
+// Container for memory management plug-in.
+typedef struct {
+
+    _cmsMallocFnPtrType     MallocPtr;
+    _cmsMalloZerocFnPtrType MallocZeroPtr;
+    _cmsFreeFnPtrType       FreePtr;
+    _cmsReallocFnPtrType    ReallocPtr;
+    _cmsCallocFnPtrType     CallocPtr;
+    _cmsDupFnPtrType        DupPtr;
+
+} _cmsMemPluginChunkType;
+
+// Copy memory management function pointers from plug-in to chunk, taking care of missing routines
+void  _cmsInstallAllocFunctions(cmsPluginMemHandler* Plugin, _cmsMemPluginChunkType* ptr);
+
+// Internal structure for context
+struct _cmsContext_struct {
+
+    struct _cmsContext_struct* Next;  // Points to next context in the new style
+    _cmsSubAllocator* MemPool;        // The memory pool that stores context data
+
+    void* chunks[MemoryClientMax];    // array of pointers to client chunks. Memory itself is hold in the suballocator.
+                                      // If NULL, then it reverts to global Context0
+
+    _cmsMemPluginChunkType DefaultMemoryManager;  // The allocators used for creating the context itself. Cannot be overriden
+};
+
+// Returns a pointer to a valid context structure, including the global one if id is zero.
+// Verifies the magic number.
+struct _cmsContext_struct* _cmsGetContext(cmsContext ContextID);
+
+// Returns the block assigned to the specific zone.
+void*     _cmsContextGetClientChunk(cmsContext id, _cmsMemoryClient mc);
+
+
+// Chunks of context memory by plug-in client -------------------------------------------------------
+
+// Those structures encapsulates all variables needed by the several context clients (mostly plug-ins)
+
+// Container for error logger -- not a plug-in
+typedef struct {
+
+    cmsLogErrorHandlerFunction LogErrorHandler;  // Set to NULL for Context0 fallback
+
+} _cmsLogErrorChunkType;
+
+// The global Context0 storage for error logger
+extern  _cmsLogErrorChunkType  _cmsLogErrorChunk;
+
+// Allocate and init error logger container.
+void _cmsAllocLogErrorChunk(struct _cmsContext_struct* ctx,
+                            const struct _cmsContext_struct* src);
+
+// Container for alarm codes -- not a plug-in
+typedef struct {
+
+    cmsUInt16Number AlarmCodes[cmsMAXCHANNELS];
+
+} _cmsAlarmCodesChunkType;
+
+// The global Context0 storage for alarm codes
+extern  _cmsAlarmCodesChunkType _cmsAlarmCodesChunk;
+
+// Allocate and init alarm codes container.
+void _cmsAllocAlarmCodesChunk(struct _cmsContext_struct* ctx,
+                            const struct _cmsContext_struct* src);
+
+// Container for adaptation state -- not a plug-in
+typedef struct {
+
+    cmsFloat64Number  AdaptationState;
+
+} _cmsAdaptationStateChunkType;
+
+// The global Context0 storage for adaptation state
+extern  _cmsAdaptationStateChunkType    _cmsAdaptationStateChunk;
+
+// Allocate and init adaptation state container.
+void _cmsAllocAdaptationStateChunk(struct _cmsContext_struct* ctx,
+                                   const struct _cmsContext_struct* src);
+
+
+// The global Context0 storage for memory management
+extern  _cmsMemPluginChunkType _cmsMemPluginChunk;
+
+// Allocate and init memory management container.
+void _cmsAllocMemPluginChunk(struct _cmsContext_struct* ctx,
+                             const struct _cmsContext_struct* src);
+
+// Container for interpolation plug-in
+typedef struct {
+
+    cmsInterpFnFactory Interpolators;
+
+} _cmsInterpPluginChunkType;
+
+// The global Context0 storage for interpolation plug-in
+extern  _cmsInterpPluginChunkType _cmsInterpPluginChunk;
+
+// Allocate and init interpolation container.
+void _cmsAllocInterpPluginChunk(struct _cmsContext_struct* ctx,
+                                const struct _cmsContext_struct* src);
+
+// Container for parametric curves plug-in
+typedef struct {
+
+    struct _cmsParametricCurvesCollection_st* ParametricCurves;
+
+} _cmsCurvesPluginChunkType;
+
+// The global Context0 storage for tone curves plug-in
+extern  _cmsCurvesPluginChunkType _cmsCurvesPluginChunk;
+
+// Allocate and init parametric curves container.
+void _cmsAllocCurvesPluginChunk(struct _cmsContext_struct* ctx,
+                                                      const struct _cmsContext_struct* src);
+
+// Container for formatters plug-in
+typedef struct {
+
+    struct _cms_formatters_factory_list* FactoryList;
+
+} _cmsFormattersPluginChunkType;
+
+// The global Context0 storage for formatters plug-in
+extern  _cmsFormattersPluginChunkType _cmsFormattersPluginChunk;
+
+// Allocate and init formatters container.
+void _cmsAllocFormattersPluginChunk(struct _cmsContext_struct* ctx,
+                                                       const struct _cmsContext_struct* src);
+
+// This chunk type is shared by TagType plug-in and MPE Plug-in
+typedef struct {
+
+    struct _cmsTagTypeLinkedList_st* TagTypes;
+
+} _cmsTagTypePluginChunkType;
+
+
+// The global Context0 storage for tag types plug-in
+extern  _cmsTagTypePluginChunkType      _cmsTagTypePluginChunk;
+
+
+// The global Context0 storage for mult process elements plug-in
+extern  _cmsTagTypePluginChunkType      _cmsMPETypePluginChunk;
+
+// Allocate and init Tag types container.
+void _cmsAllocTagTypePluginChunk(struct _cmsContext_struct* ctx,
+                                                        const struct _cmsContext_struct* src);
+// Allocate and init MPE container.
+void _cmsAllocMPETypePluginChunk(struct _cmsContext_struct* ctx,
+                                                        const struct _cmsContext_struct* src);
+// Container for tag plug-in
+typedef struct {
+
+    struct _cmsTagLinkedList_st* Tag;
+
+} _cmsTagPluginChunkType;
+
+
+// The global Context0 storage for tag plug-in
+extern  _cmsTagPluginChunkType _cmsTagPluginChunk;
+
+// Allocate and init Tag container.
+void _cmsAllocTagPluginChunk(struct _cmsContext_struct* ctx,
+                                                      const struct _cmsContext_struct* src);
+
+// Container for intents plug-in
+typedef struct {
+
+    struct _cms_intents_list* Intents;
+
+} _cmsIntentsPluginChunkType;
+
+
+// The global Context0 storage for intents plug-in
+extern  _cmsIntentsPluginChunkType _cmsIntentsPluginChunk;
+
+// Allocate and init intents container.
+void _cmsAllocIntentsPluginChunk(struct _cmsContext_struct* ctx,
+                                                        const struct _cmsContext_struct* src);
+
+// Container for optimization plug-in
+typedef struct {
+
+    struct _cmsOptimizationCollection_st* OptimizationCollection;
+
+} _cmsOptimizationPluginChunkType;
+
+
+// The global Context0 storage for optimizers plug-in
+extern  _cmsOptimizationPluginChunkType _cmsOptimizationPluginChunk;
+
+// Allocate and init optimizers container.
+void _cmsAllocOptimizationPluginChunk(struct _cmsContext_struct* ctx,
+                                         const struct _cmsContext_struct* src);
+
+// Container for transform plug-in
+typedef struct {
+
+    struct _cmsTransformCollection_st* TransformCollection;
+
+} _cmsTransformPluginChunkType;
+
+// The global Context0 storage for full-transform replacement plug-in
+extern  _cmsTransformPluginChunkType _cmsTransformPluginChunk;
+
+// Allocate and init transform container.
+void _cmsAllocTransformPluginChunk(struct _cmsContext_struct* ctx,
+                                        const struct _cmsContext_struct* src);
+
+// Container for mutex plug-in
+typedef struct {
+
+    _cmsCreateMutexFnPtrType  CreateMutexPtr;
+    _cmsDestroyMutexFnPtrType DestroyMutexPtr;
+    _cmsLockMutexFnPtrType    LockMutexPtr;
+    _cmsUnlockMutexFnPtrType  UnlockMutexPtr;
+
+} _cmsMutexPluginChunkType;
+
+// The global Context0 storage for mutex plug-in
+extern  _cmsMutexPluginChunkType _cmsMutexPluginChunk;
+
+// Allocate and init mutex container.
+void _cmsAllocMutexPluginChunk(struct _cmsContext_struct* ctx,
+                                        const struct _cmsContext_struct* src);
+
+// ----------------------------------------------------------------------------------
 // MLU internal representation
 typedef struct {
 
@@ -347,10 +760,14 @@
     cmsBool                  TagSaveAsRaw[MAX_TABLE_TAG];        // True to write uncooked
     void *                   TagPtrs[MAX_TABLE_TAG];
     cmsTagTypeHandler*       TagTypeHandlers[MAX_TABLE_TAG];     // Same structure may be serialized on different types
-                                                                 // depending on profile version, so we keep track of the                                                             // type handler for each tag in the list.
+                                                                 // depending on profile version, so we keep track of the
+                                                                 // type handler for each tag in the list.
     // Special
     cmsBool                  IsWrite;
 
+    // Keep a mutex for cmsReadTag -- Note that this only works if the user includes a mutex plugin
+    void *                   UsrMutex;
+
 } _cmsICCPROFILE;
 
 // IO helpers for profiles
@@ -359,9 +776,9 @@
 int                  _cmsSearchTag(_cmsICCPROFILE* Icc, cmsTagSignature sig, cmsBool lFollowLinks);
 
 // Tag types
-cmsTagTypeHandler*   _cmsGetTagTypeHandler(cmsTagTypeSignature sig);
+cmsTagTypeHandler*   _cmsGetTagTypeHandler(cmsContext ContextID, cmsTagTypeSignature sig);
 cmsTagTypeSignature  _cmsGetTagTrueType(cmsHPROFILE hProfile, cmsTagSignature sig);
-cmsTagDescriptor*    _cmsGetTagDescriptor(cmsTagSignature sig);
+cmsTagDescriptor*    _cmsGetTagDescriptor(cmsContext ContextID, cmsTagSignature sig);
 
 // Error logging ---------------------------------------------------------------------------------------------------------
 
@@ -372,7 +789,7 @@
 cmsInterpParams*     _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags);
 cmsInterpParams*     _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags);
 void                 _cmsFreeInterpParams(cmsInterpParams* p);
-cmsBool              _cmsSetInterpolationRoutine(cmsInterpParams* p);
+cmsBool              _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p);
 
 // Curves ----------------------------------------------------------------------------------------------------------------
 
@@ -503,7 +920,8 @@
                                       cmsUInt16Number **Black,
                                       cmsUInt32Number *nOutputs);
 
-cmsBool          _cmsOptimizePipeline(cmsPipeline**    Lut,
+cmsBool          _cmsOptimizePipeline(cmsContext ContextID,
+                                      cmsPipeline**    Lut,
                                       int              Intent,
                                       cmsUInt32Number* InputFormat,
                                       cmsUInt32Number* OutputFormat,
@@ -528,7 +946,8 @@
 cmsBool         _cmsFormatterIsFloat(cmsUInt32Number Type);
 cmsBool         _cmsFormatterIs8bit(cmsUInt32Number Type);
 
-cmsFormatter    _cmsGetFormatter(cmsUInt32Number Type,          // Specific type, i.e. TYPE_RGB_8
+cmsFormatter    _cmsGetFormatter(cmsContext ContextID,
+                                 cmsUInt32Number Type,          // Specific type, i.e. TYPE_RGB_8
                                  cmsFormatterDirection Dir,
                                  cmsUInt32Number dwFlags);
 
diff --git a/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h b/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h
index 1df7cf7..77ff228 100644
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h
@@ -231,6 +231,7 @@
 #define cmsPluginMultiProcessElementSig      0x6D706548     // 'mpeH'
 #define cmsPluginOptimizationSig             0x6F707448     // 'optH'
 #define cmsPluginTransformSig                0x7A666D48     // 'xfmH'
+#define cmsPluginMutexSig                    0x6D747A48     // 'mtxH'
 
 typedef struct _cmsPluginBaseStruct {
 
@@ -247,19 +248,28 @@
 //----------------------------------------------------------------------------------------------------------
 
 // Memory handler. Each new plug-in type replaces current behaviour
+
+typedef void* (* _cmsMallocFnPtrType)(cmsContext ContextID, cmsUInt32Number size);
+typedef void  (* _cmsFreeFnPtrType)(cmsContext ContextID, void *Ptr);
+typedef void* (* _cmsReallocFnPtrType)(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
+
+typedef void* (* _cmsMalloZerocFnPtrType)(cmsContext ContextID, cmsUInt32Number size);
+typedef void* (* _cmsCallocFnPtrType)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
+typedef void* (* _cmsDupFnPtrType)(cmsContext ContextID, const void* Org, cmsUInt32Number size);
+
 typedef struct {
 
         cmsPluginBase base;
 
         // Required
-        void * (* MallocPtr)(cmsContext ContextID, cmsUInt32Number size);
-        void   (* FreePtr)(cmsContext ContextID, void *Ptr);
-        void * (* ReallocPtr)(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
+        _cmsMallocFnPtrType  MallocPtr;
+        _cmsFreeFnPtrType    FreePtr;
+        _cmsReallocFnPtrType ReallocPtr;
 
         // Optional
-        void * (* MallocZeroPtr)(cmsContext ContextID, cmsUInt32Number size);
-        void * (* CallocPtr)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
-        void * (* DupPtr)(cmsContext ContextID, const void* Org, cmsUInt32Number size);
+       _cmsMalloZerocFnPtrType MallocZeroPtr;
+       _cmsCallocFnPtrType     CallocPtr;
+       _cmsDupFnPtrType        DupPtr;
 
 } cmsPluginMemHandler;
 
@@ -622,6 +632,29 @@
 
 }  cmsPluginTransform;
 
+//----------------------------------------------------------------------------------------------------------
+// Mutex
+
+typedef void*    (* _cmsCreateMutexFnPtrType)(cmsContext ContextID);
+typedef void     (* _cmsDestroyMutexFnPtrType)(cmsContext ContextID, void* mtx);
+typedef cmsBool  (* _cmsLockMutexFnPtrType)(cmsContext ContextID, void* mtx);
+typedef void     (* _cmsUnlockMutexFnPtrType)(cmsContext ContextID, void* mtx);
+
+typedef struct {
+      cmsPluginBase     base;
+
+     _cmsCreateMutexFnPtrType  CreateMutexPtr;
+     _cmsDestroyMutexFnPtrType DestroyMutexPtr;
+     _cmsLockMutexFnPtrType    LockMutexPtr;
+     _cmsUnlockMutexFnPtrType  UnlockMutexPtr;
+
+}  cmsPluginMutex;
+
+CMSAPI void*   CMSEXPORT _cmsCreateMutex(cmsContext ContextID);
+CMSAPI void    CMSEXPORT _cmsDestroyMutex(cmsContext ContextID, void* mtx);
+CMSAPI cmsBool CMSEXPORT _cmsLockMutex(cmsContext ContextID, void* mtx);
+CMSAPI void    CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx);
+
 
 #ifndef CMS_USE_CPP_API
 #   ifdef __cplusplus
diff --git a/src/share/native/sun/java2d/opengl/OGLBufImgOps.c b/src/share/native/sun/java2d/opengl/OGLBufImgOps.c
index 046018c..b7e5934 100644
--- a/src/share/native/sun/java2d/opengl/OGLBufImgOps.c
+++ b/src/share/native/sun/java2d/opengl/OGLBufImgOps.c
@@ -636,6 +636,9 @@
                 "OGLBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d",
                 shortData, numBands, bandLength, offset);
 
+    for (i = 0; i < 4; i++) {
+        bands[i] = NULL;
+    }
     RETURN_IF_NULL(oglc);
     RETURN_IF_NULL(srcOps);
     RESET_PREVIOUS_OP();
diff --git a/src/share/native/sun/misc/URLClassPath.c b/src/share/native/sun/misc/URLClassPath.c
new file mode 100644
index 0000000..16380c9
--- /dev/null
+++ b/src/share/native/sun/misc/URLClassPath.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 <string.h>
+
+#include "jni.h"
+#include "jni_util.h"
+#include "jlong.h"
+#include "jvm.h"
+#include "jdk_util.h"
+
+#include "sun_misc_URLClassPath.h"
+
+extern char*
+getUTF(JNIEnv *env, jstring str, char* localBuf, int bufSize);
+
+
+JNIEXPORT jboolean JNICALL
+Java_sun_misc_URLClassPath_knownToNotExist0(JNIEnv *env, jclass cls, jobject loader,
+                                            jstring classname)
+{
+    char *clname;
+    jboolean result = JNI_FALSE;
+    char buf[128];
+
+    if (classname == NULL) {
+        JNU_ThrowNullPointerException(env, NULL);
+        return result;
+    }
+
+    clname = getUTF(env, classname, buf, sizeof(buf));
+    if (clname == NULL) {
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return result;
+    }
+    VerifyFixClassname(clname);
+
+    if (!VerifyClassname(clname, JNI_TRUE)) {  /* expects slashed name */
+        goto done;
+    }
+
+    result = JVM_KnownToNotExist(env, loader, clname);
+
+ done:
+    if (clname != buf) {
+        free(clname);
+    }
+
+    return result;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_sun_misc_URLClassPath_getLookupCacheURLs(JNIEnv *env, jclass cls, jobject loader)
+{
+    return JVM_GetResourceLookupCacheURLs(env, loader);
+}
+
+
+JNIEXPORT jintArray JNICALL
+Java_sun_misc_URLClassPath_getLookupCacheForClassLoader(JNIEnv *env, jclass cls,
+                                                        jobject loader,
+                                                        jstring resource_name)
+{
+    char *resname;
+    jintArray result = NULL;
+    char buf[128];
+
+    if (resource_name == NULL) {
+        JNU_ThrowNullPointerException(env, NULL);
+        return result;
+    }
+
+    resname = getUTF(env, resource_name, buf, sizeof(buf));
+    if (resname == NULL) {
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return result;
+    }
+    result = JVM_GetResourceLookupCache(env, loader, resname);
+
+ done:
+    if (resname != buf) {
+        free(resname);
+    }
+
+    return result;
+}
+
diff --git a/src/share/native/sun/nio/ch/genSocketOptionRegistry.c b/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
index d5ed5d7..41bd548 100644
--- a/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
+++ b/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
@@ -110,6 +110,7 @@
     emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
 
 #ifdef AF_INET6
+    emit_inet6("StandardSocketOptions.IP_TOS",            IPPROTO_IPV6,  IPV6_TCLASS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
diff --git a/src/share/native/sun/security/ec/ECC_JNI.cpp b/src/share/native/sun/security/ec/ECC_JNI.cpp
index f2612ad..5c07645 100644
--- a/src/share/native/sun/security/ec/ECC_JNI.cpp
+++ b/src/share/native/sun/security/ec/ECC_JNI.cpp
@@ -41,7 +41,9 @@
 void ThrowException(JNIEnv *env, const char *exceptionName)
 {
     jclass exceptionClazz = env->FindClass(exceptionName);
-    env->ThrowNew(exceptionClazz, NULL);
+    if (exceptionClazz != NULL) {
+        env->ThrowNew(exceptionClazz, NULL);
+    }
 }
 
 /*
@@ -80,7 +82,6 @@
     return jEncodedBytes;
 }
 
-
 /*
  * Class:     sun_security_ec_ECKeyPairGenerator
  * Method:    generateECKeyPair
@@ -103,6 +104,9 @@
     params_item.len = env->GetArrayLength(encodedParams);
     params_item.data =
         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+    if (params_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Fill a new ECParams using the supplied OID
     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
@@ -170,6 +174,7 @@
             SECITEM_FreeItem(&privKey->publicValue, B_FALSE);
             free(privKey);
         }
+
         if (pSeedBuffer) {
             delete [] pSeedBuffer;
         }
@@ -206,6 +211,7 @@
     digest_item.len = jDigestLength;
 
     ECPrivateKey privKey;
+    privKey.privateValue.data = NULL;
 
     // Initialize the ECParams struct
     ECParams *ecparams = NULL;
@@ -213,6 +219,9 @@
     params_item.len = env->GetArrayLength(encodedParams);
     params_item.data =
         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+    if (params_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Fill a new ECParams using the supplied OID
     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
@@ -226,6 +235,9 @@
     privKey.privateValue.len = env->GetArrayLength(privateKey);
     privKey.privateValue.data =
         (unsigned char *) env->GetByteArrayElements(privateKey, 0);
+    if (privKey.privateValue.data == NULL) {
+        goto cleanup;
+    }
 
     // Prepare a buffer for the signature (twice the key length)
     pSignedDigestBuffer = new jbyte[ecparams->order.len * 2];
@@ -245,6 +257,9 @@
 
     // Create new byte array
     temp = env->NewByteArray(signature_item.len);
+    if (temp == NULL) {
+        goto cleanup;
+    }
 
     // Copy data from native buffer
     env->SetByteArrayRegion(temp, 0, signature_item.len, pSignedDigestBuffer);
@@ -317,6 +332,9 @@
     params_item.len = env->GetArrayLength(encodedParams);
     params_item.data =
         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+    if (params_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Fill a new ECParams using the supplied OID
     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
@@ -369,25 +387,37 @@
   (JNIEnv *env, jclass clazz, jbyteArray privateKey, jbyteArray publicKey, jbyteArray encodedParams)
 {
     jbyteArray jSecret = NULL;
+    ECParams *ecparams = NULL;
+    SECItem privateValue_item;
+    privateValue_item.data = NULL;
+    SECItem publicValue_item;
+    publicValue_item.data = NULL;
+    SECKEYECParams params_item;
+    params_item.data = NULL;
 
     // Extract private key value
-    SECItem privateValue_item;
     privateValue_item.len = env->GetArrayLength(privateKey);
     privateValue_item.data =
             (unsigned char *) env->GetByteArrayElements(privateKey, 0);
+    if (privateValue_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Extract public key value
-    SECItem publicValue_item;
     publicValue_item.len = env->GetArrayLength(publicKey);
     publicValue_item.data =
         (unsigned char *) env->GetByteArrayElements(publicKey, 0);
+    if (publicValue_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Initialize the ECParams struct
-    ECParams *ecparams = NULL;
-    SECKEYECParams params_item;
     params_item.len = env->GetArrayLength(encodedParams);
     params_item.data =
         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);
+    if (params_item.data == NULL) {
+        goto cleanup;
+    }
 
     // Fill a new ECParams using the supplied OID
     if (EC_DecodeParams(&params_item, &ecparams, 0) != SECSuccess) {
@@ -409,6 +439,9 @@
 
     // Create new byte array
     jSecret = env->NewByteArray(secret_item.len);
+    if (jSecret == NULL) {
+        goto cleanup;
+    }
 
     // Copy bytes from the SECItem buffer to a Java byte array
     env->SetByteArrayRegion(jSecret, 0, secret_item.len,
diff --git a/src/share/native/sun/security/ec/impl/mpi.c b/src/share/native/sun/security/ec/impl/mpi.c
index 3149fa2..496916a 100644
--- a/src/share/native/sun/security/ec/impl/mpi.c
+++ b/src/share/native/sun/security/ec/impl/mpi.c
@@ -3376,7 +3376,7 @@
 #if !defined(MP_NO_MP_WORD) && !defined(MP_NO_DIV_WORD)
   mp_word   w = 0, q;
 #else
-  mp_digit  w, q;
+  mp_digit  w = 0, q;
 #endif
   int       ix;
   mp_err    res;
diff --git a/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c b/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
index 517f144..b9bfb92 100644
--- a/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
+++ b/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,19 +29,6 @@
 #include "jlong.h"
 #include <jni.h>
 
-/* Throws a Java Exception by name */
-
-void throwByName(JNIEnv *env, const char *name, const char *msg) {
-    jclass cls = (*env)->FindClass(env, name);
-
-    if (cls != 0) /* Otherwise an exception has already been thrown */
-        (*env)->ThrowNew(env, cls, msg);
-}
-
-void throwOutOfMemoryError(JNIEnv *env, const char *message) {
-    throwByName(env, "java/lang/OutOfMemoryError", message);
-}
-
 /* Constants for indicating what type of info is needed for inquiries */
 const int TYPE_CRED_NAME = 10;
 const int TYPE_CRED_TIME = 11;
@@ -50,23 +37,32 @@
 /*
  * Class:     sun_security_jgss_wrapper_GSSLibStub
  * Method:    init
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;Z)Z
  */
 JNIEXPORT jboolean JNICALL
 Java_sun_security_jgss_wrapper_GSSLibStub_init(JNIEnv *env,
                                                jclass jcls,
-                                               jstring jlibName) {
+                                               jstring jlibName,
+                                               jboolean jDebug) {
     const char *libName;
     char *error = NULL;
 
+    if (!jDebug) {
+      JGSS_DEBUG = 0;
+    } else {
+      JGSS_DEBUG = 1;
+    }
+
     if (jlibName == NULL) {
-        debug(env, "[GSSLibStub_init] GSS lib name is NULL");
+        TRACE0("[GSSLibStub_init] GSS lib name is NULL");
         return JNI_FALSE;
     }
 
     libName = (*env)->GetStringUTFChars(env, jlibName, NULL);
-    sprintf(debugBuf, "[GSSLibStub_init] libName=%s", libName);
-    debug(env, debugBuf);
+    if (libName == NULL) {
+        return JNI_FALSE;
+    }
+    TRACE1("[GSSLibStub_init] libName=%s", libName);
 
     /* initialize global function table */
     error = loadNative(libName);
@@ -75,7 +71,7 @@
     if (error == NULL) {
         return JNI_TRUE;
     } else {
-        debug(env, error);
+        TRACE0(error);
         return JNI_FALSE;
     }
 }
@@ -93,129 +89,140 @@
   unsigned int i, len;
   jbyte* bytes;
   jthrowable gssEx;
-  jboolean found;
+  int found;
 
   if (jbytes != NULL) {
-    found = JNI_FALSE;
+    found = 0;
     len = (unsigned int)((*env)->GetArrayLength(env, jbytes) - 2);
     bytes = (*env)->GetByteArrayElements(env, jbytes, NULL);
-    if (bytes != NULL) {
-      for (i = 0; i < ftab->mechs->count; i++) {
-        cOid = &(ftab->mechs->elements[i]);
-        if (len == cOid->length &&
-            (memcmp(cOid->elements, (bytes + 2), len) == 0)) {
-          // Found a match
-          found = JNI_TRUE;
-          break;
-        }
-      }
-      (*env)->ReleaseByteArrayElements(env, jbytes, bytes, 0);
+    if (bytes == NULL) {
+      return ptr_to_jlong(NULL);
     }
-    if (found != JNI_TRUE) {
+    for (i = 0; i < ftab->mechs->count; i++) {
+      cOid = &(ftab->mechs->elements[i]);
+      if (len == cOid->length &&
+          (memcmp(cOid->elements, (bytes + 2), len) == 0)) {
+        // Found a match
+        found = 1;
+        break;
+      }
+    }
+    (*env)->ReleaseByteArrayElements(env, jbytes, bytes, 0);
+
+    if (found != 1) {
       checkStatus(env, NULL, GSS_S_BAD_MECH, 0, "[GSSLibStub_getMechPtr]");
       return ptr_to_jlong(NULL);
-    } else return ptr_to_jlong(cOid);
-  } else return ptr_to_jlong(GSS_C_NO_OID);
-}
-
-
-/*
- * Utility routine which creates a gss_channel_bindings_t structure
- * using the specified org.ietf.jgss.ChannelBinding object.
- */
-gss_channel_bindings_t getGSSCB(JNIEnv *env, jobject jcb) {
-  gss_channel_bindings_t cb;
-  jobject jinetAddr;
-  jbyteArray value;
-
-  if (jcb == NULL) {
-    return GSS_C_NO_CHANNEL_BINDINGS;
-  }
-
-  cb = malloc(sizeof(struct gss_channel_bindings_struct));
-
-  if (cb == NULL) {
-    throwOutOfMemoryError(env,NULL);
-    return NULL;
-  }
-
-  /* set up initiator address */
-  jinetAddr =
-    (*env)->CallObjectMethod(env, jcb,
-                             MID_ChannelBinding_getInitiatorAddr);
-  if (jinetAddr != NULL) {
-    cb->initiator_addrtype = GSS_C_AF_INET;
-    value = (*env)->CallObjectMethod(env, jinetAddr,
-                                     MID_InetAddress_getAddr);
-    initGSSBuffer(env, value, &(cb->initiator_address));
+    } else {
+      return ptr_to_jlong(cOid);
+    }
   } else {
-    cb->initiator_addrtype = GSS_C_AF_NULLADDR;
-    cb->initiator_address.length = 0;
-    cb->initiator_address.value = NULL;
+    return ptr_to_jlong(GSS_C_NO_OID);
   }
-  /* set up acceptor address */
-  jinetAddr =
-    (*env)->CallObjectMethod(env, jcb,
-                             MID_ChannelBinding_getAcceptorAddr);
-  if (jinetAddr != NULL) {
-    cb->acceptor_addrtype = GSS_C_AF_INET;
-    value = (*env)->CallObjectMethod(env, jinetAddr,
-                                     MID_InetAddress_getAddr);
-    initGSSBuffer(env, value, &(cb->acceptor_address));
-  } else {
-    cb->acceptor_addrtype = GSS_C_AF_NULLADDR;
-    cb->acceptor_address.length = 0;
-    cb->acceptor_address.value = NULL;
-  }
-  /* set up application data */
-  value = (*env)->CallObjectMethod(env, jcb,
-                                   MID_ChannelBinding_getAppData);
-  if (value != NULL) {
-    initGSSBuffer(env, value, &(cb->application_data));
-  } else {
-    cb->application_data.length = 0;
-    cb->application_data.value = NULL;
-  }
-  return cb;
 }
 
 /*
  * Utility routine which releases the specified gss_channel_bindings_t
  * structure.
  */
-void releaseGSSCB(JNIEnv *env, jobject jcb, gss_channel_bindings_t cb) {
+void deleteGSSCB(gss_channel_bindings_t cb) {
   jobject jinetAddr;
   jbyteArray value;
 
   if (cb == GSS_C_NO_CHANNEL_BINDINGS) return;
+
   /* release initiator address */
   if (cb->initiator_addrtype != GSS_C_AF_NULLADDR) {
-    jinetAddr =
-      (*env)->CallObjectMethod(env, jcb,
-                               MID_ChannelBinding_getInitiatorAddr);
-    value = (*env)->CallObjectMethod(env, jinetAddr,
-                                     MID_InetAddress_getAddr);
-    resetGSSBuffer(env, value, &(cb->initiator_address));
+    resetGSSBuffer(&(cb->initiator_address));
   }
   /* release acceptor address */
   if (cb->acceptor_addrtype != GSS_C_AF_NULLADDR) {
-    jinetAddr =
-      (*env)->CallObjectMethod(env, jcb,
-                               MID_ChannelBinding_getAcceptorAddr);
-    value = (*env)->CallObjectMethod(env, jinetAddr,
-                                     MID_InetAddress_getAddr);
-    resetGSSBuffer(env, value, &(cb->acceptor_address));
+    resetGSSBuffer(&(cb->acceptor_address));
   }
   /* release application data */
   if (cb->application_data.length != 0) {
-    value = (*env)->CallObjectMethod(env, jcb,
-                                     MID_ChannelBinding_getAppData);
-    resetGSSBuffer(env, value, &(cb->application_data));
+    resetGSSBuffer(&(cb->application_data));
   }
   free(cb);
 }
 
 /*
+ * Utility routine which creates a gss_channel_bindings_t structure
+ * using the specified org.ietf.jgss.ChannelBinding object.
+ * NOTE: must call deleteGSSCB() to free up the resources.
+ */
+gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
+  gss_channel_bindings_t cb;
+  jobject jinetAddr;
+  jbyteArray value;
+  int i;
+
+  if (jcb == NULL) {
+    return GSS_C_NO_CHANNEL_BINDINGS;
+  }
+
+  cb = malloc(sizeof(struct gss_channel_bindings_struct));
+  if (cb == NULL) {
+    throwOutOfMemoryError(env,NULL);
+    return NULL;
+  }
+
+  // initialize addrtype in CB first
+  cb->initiator_addrtype = GSS_C_AF_NULLADDR;
+  cb->acceptor_addrtype = GSS_C_AF_NULLADDR;
+
+  /* set up initiator address */
+  jinetAddr = (*env)->CallObjectMethod(env, jcb,
+      MID_ChannelBinding_getInitiatorAddr);
+  if ((*env)->ExceptionCheck(env)) {
+    goto cleanup;
+  }
+  if (jinetAddr != NULL) {
+    value = (*env)->CallObjectMethod(env, jinetAddr,
+                                     MID_InetAddress_getAddr);
+    if ((*env)->ExceptionCheck(env)) {
+      goto cleanup;
+    }
+    cb->initiator_addrtype = GSS_C_AF_INET;
+    initGSSBuffer(env, value, &(cb->initiator_address));
+    if ((*env)->ExceptionCheck(env)) {
+      goto cleanup;
+    }
+  }
+  /* set up acceptor address */
+  jinetAddr = (*env)->CallObjectMethod(env, jcb,
+      MID_ChannelBinding_getAcceptorAddr);
+  if ((*env)->ExceptionCheck(env)) {
+    goto cleanup;
+  }
+  if (jinetAddr != NULL) {
+    value = (*env)->CallObjectMethod(env, jinetAddr,
+                                     MID_InetAddress_getAddr);
+    if ((*env)->ExceptionCheck(env)) {
+      goto cleanup;
+    }
+    cb->acceptor_addrtype = GSS_C_AF_INET;
+    initGSSBuffer(env, value, &(cb->acceptor_address));
+    if ((*env)->ExceptionCheck(env)) {
+      goto cleanup;
+    }
+  }
+  /* set up application data */
+  value = (*env)->CallObjectMethod(env, jcb,
+                                   MID_ChannelBinding_getAppData);
+  if ((*env)->ExceptionCheck(env)) {
+    goto cleanup;
+  }
+  initGSSBuffer(env, value, &(cb->application_data));
+  if ((*env)->ExceptionCheck(env)) {
+    goto cleanup;
+  }
+  return cb;
+cleanup:
+  deleteGSSCB(cb);
+  return NULL;
+}
+
+/*
  * Utility routine for storing the supplementary information
  * into the specified org.ietf.jgss.MessageProp object.
  */
@@ -230,6 +237,9 @@
     isUnseq = ((suppInfo & GSS_S_UNSEQ_TOKEN) != 0);
     hasGap = ((suppInfo & GSS_S_GAP_TOKEN) != 0);
     minorMsg = getMinorMessage(env, jstub, minor);
+    if ((*env)->ExceptionCheck(env)) {
+      return;
+    }
     (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setSupplementaryStates,
                            isDuplicate, isOld, isUnseq, hasGap, minor,
                            minorMsg);
@@ -265,21 +275,26 @@
   jobjectArray result;
 
   if (ftab->inquireNamesForMech != NULL) {
+    mech = (gss_OID)jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+    nameTypes = GSS_C_NO_OID_SET;
 
-  mech = (gss_OID)jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
-  nameTypes = GSS_C_NO_OID_SET;
+    /* gss_inquire_names_for_mech(...) => N/A */
+    major = (*ftab->inquireNamesForMech)(&minor, mech, &nameTypes);
 
-  /* gss_inquire_names_for_mech(...) => N/A */
-  major = (*ftab->inquireNamesForMech)(&minor, mech, &nameTypes);
+    /* release intermediate buffers before checking status */
+    result = getJavaOIDArray(env, nameTypes);
+    deleteGSSOIDSet(nameTypes);
+    if ((*env)->ExceptionCheck(env)) {
+      return NULL;
+    }
 
-  result = getJavaOIDArray(env, nameTypes);
-
-  /* release intermediate buffers */
-  deleteGSSOIDSet(nameTypes);
-
-  checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireNamesForMech]");
-  return result;
-  } else return NULL;
+    checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireNamesForMech]");
+    if ((*env)->ExceptionCheck(env)) {
+      return NULL;
+    }
+    return result;
+  }
+  return NULL;
 }
 
 /*
@@ -297,8 +312,7 @@
 
   nameHdl = (gss_name_t) jlong_to_ptr(pName);
 
-  sprintf(debugBuf, "[GSSLibStub_releaseName] %ld", (long) pName);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_releaseName] %ld", (long) pName);
 
   if (nameHdl != GSS_C_NO_NAME) {
     /* gss_release_name(...) => GSS_S_BAD_NAME */
@@ -324,13 +338,16 @@
   gss_name_t nameHdl;
   nameHdl = GSS_C_NO_NAME;
 
-  debug(env, "[GSSLibStub_importName]");
+  TRACE0("[GSSLibStub_importName]");
 
   initGSSBuffer(env, jnameVal, &nameVal);
+  if ((*env)->ExceptionCheck(env)) {
+      return jlong_zero;
+  }
+
   nameType = newGSSOID(env, jnameType);
   if ((*env)->ExceptionCheck(env)) {
-    deleteGSSOID(nameType);
-    resetGSSBuffer(env, jnameVal, &nameVal);
+    resetGSSBuffer(&nameVal);
     return jlong_zero;
   }
 
@@ -338,14 +355,16 @@
      GSS_S_BAD_MECH */
   major = (*ftab->importName)(&minor, &nameVal, nameType, &nameHdl);
 
-  sprintf(debugBuf, "[GSSLibStub_importName] %ld", (long) nameHdl);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_importName] %ld", (long) nameHdl);
 
   /* release intermediate buffers */
   deleteGSSOID(nameType);
-  resetGSSBuffer(env, jnameVal, &nameVal);
+  resetGSSBuffer(&nameVal);
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_importName]");
+  if ((*env)->ExceptionCheck(env)) {
+    return jlong_zero;
+  }
   return ptr_to_jlong(nameHdl);
 }
 
@@ -369,9 +388,7 @@
   nameHdl1 = (gss_name_t) jlong_to_ptr(pName1);
   nameHdl2 = (gss_name_t) jlong_to_ptr(pName2);
 
-  sprintf(debugBuf, "[GSSLibStub_compareName] %ld %ld", (long) pName1,
-    (long) pName2);
-  debug(env, debugBuf);
+  TRACE2("[GSSLibStub_compareName] %ld %ld", (long)pName1, (long)pName2);
 
   if ((nameHdl1 != GSS_C_NO_NAME) && (nameHdl2 != GSS_C_NO_NAME)) {
 
@@ -398,8 +415,8 @@
   gss_OID mech;
 
   nameHdl = (gss_name_t) jlong_to_ptr(pName);
-  sprintf(debugBuf, "[GSSLibStub_canonicalizeName] %ld", (long) pName);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_canonicalizeName] %ld", (long) pName);
 
   if (nameHdl != GSS_C_NO_NAME) {
     mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
@@ -409,16 +426,15 @@
        GSS_S_BAD_NAME, GSS_S_BAD_MECH */
     major = (*ftab->canonicalizeName)(&minor, nameHdl, mech, &mnNameHdl);
 
-    sprintf(debugBuf, "[GSSLibStub_canonicalizeName] MN=%ld",
-        (long)mnNameHdl);
-    debug(env, debugBuf);
-
-    /* release intermediate buffers */
+    TRACE1("[GSSLibStub_canonicalizeName] MN=%ld", (long)mnNameHdl);
 
     checkStatus(env, jobj, major, minor, "[GSSLibStub_canonicalizeName]");
-  } else mnNameHdl = GSS_C_NO_NAME;
-
-  return ptr_to_jlong(mnNameHdl);
+    if ((*env)->ExceptionCheck(env)) {
+      return (jlong) GSS_C_NO_NAME;
+    }
+    return ptr_to_jlong(mnNameHdl);
+  }
+  return (jlong) GSS_C_NO_NAME;
 }
 
 /*
@@ -436,8 +452,8 @@
   jbyteArray jresult;
 
   nameHdl = (gss_name_t) jlong_to_ptr(pName);
-  sprintf(debugBuf, "[GSSLibStub_exportName] %ld", (long) pName);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_exportName] %ld", (long) pName);
 
   /* gss_export_name(...) => GSS_S_NAME_NOT_MN, GSS_S_BAD_NAMETYPE,
      GSS_S_BAD_NAME */
@@ -445,28 +461,38 @@
 
   /* canonicalize the internal name to MN and retry */
   if (major == GSS_S_NAME_NOT_MN) {
-    debug(env, "[GSSLibStub_exportName] canonicalize and re-try");
+    /* release intermediate buffers before retrying */
+    (*ftab->releaseBuffer)(&minor, &outBuf);
+
+    TRACE0("[GSSLibStub_exportName] canonicalize and re-try");
 
     mNameHdl = (gss_name_t)jlong_to_ptr(
         Java_sun_security_jgss_wrapper_GSSLibStub_canonicalizeName
                                         (env, jobj, pName));
-    /* return immediately if an exception has occurred */
     if ((*env)->ExceptionCheck(env)) {
-      return NULL;
+        return NULL;
     }
+
     major = (*ftab->exportName)(&minor, mNameHdl, &outBuf);
     Java_sun_security_jgss_wrapper_GSSLibStub_releaseName
                                         (env, jobj, ptr_to_jlong(mNameHdl));
-    /* return immediately if an exception has occurred */
     if ((*env)->ExceptionCheck(env)) {
+      /* release intermediate buffers */
+      (*ftab->releaseBuffer)(&minor, &outBuf);
       return NULL;
     }
   }
 
-  /* release intermediate buffers */
+  /* release intermediate buffers before checking status */
   jresult = getJavaBuffer(env, &outBuf);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_exportName]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   return jresult;
 }
 
@@ -488,8 +514,8 @@
   jobjectArray jresult;
 
   nameHdl = (gss_name_t) jlong_to_ptr(pName);
-  sprintf(debugBuf, "[GSSLibStub_displayName] %ld", (long) pName);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_displayName] %ld", (long) pName);
 
   if (nameHdl == GSS_C_NO_NAME) {
     checkStatus(env, jobj, GSS_S_BAD_NAME, 0, "[GSSLibStub_displayName]");
@@ -499,21 +525,37 @@
   /* gss_display_name(...) => GSS_S_BAD_NAME */
   major = (*ftab->displayName)(&minor, nameHdl, &outNameBuf, &outNameType);
 
-  /* release intermediate buffers */
+  /* release intermediate buffers before checking status */
   jname = getJavaString(env, &outNameBuf);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
+  checkStatus(env, jobj, major, minor, "[GSSLibStub_displayName]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   jtype = getJavaOID(env, outNameType);
-  jresult = (*env)->NewObjectArray(env, 2, CLS_Object, NULL);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
+  jresult = (*env)->NewObjectArray(env, 2, CLS_Object, NULL);
   /* return immediately if an exception has occurred */
   if ((*env)->ExceptionCheck(env)) {
     return NULL;
   }
 
   (*env)->SetObjectArrayElement(env, jresult, 0, jname);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   (*env)->SetObjectArrayElement(env, jresult, 1, jtype);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
-  checkStatus(env, jobj, major, minor, "[GSSLibStub_displayName]");
   return jresult;
 }
 
@@ -537,20 +579,14 @@
   gss_cred_id_t credHdl;
   credHdl = GSS_C_NO_CREDENTIAL;
 
-  debug(env, "[GSSLibStub_acquireCred]");
-
+  TRACE0("[GSSLibStub_acquireCred]");
 
   mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
-  mechs = newGSSOIDSet(env, mech);
-  if ((*env)->ExceptionCheck(env)) {
-    return jlong_zero;
-  }
+  mechs = newGSSOIDSet(mech);
   credUsage = (gss_cred_usage_t) usage;
   nameHdl = (gss_name_t) jlong_to_ptr(pName);
 
-  sprintf(debugBuf, "[GSSLibStub_acquireCred] pName=%ld, usage=%d",
-    (long) pName, usage);
-  debug(env, debugBuf);
+  TRACE2("[GSSLibStub_acquireCred] pName=%ld, usage=%d", (long)pName, usage);
 
   /* gss_acquire_cred(...) => GSS_S_BAD_MECH, GSS_S_BAD_NAMETYPE,
      GSS_S_BAD_NAME, GSS_S_CREDENTIALS_EXPIRED, GSS_S_NO_CRED */
@@ -560,10 +596,12 @@
   /* release intermediate buffers */
   deleteGSSOIDSet(mechs);
 
-  sprintf(debugBuf, "[GSSLibStub_acquireCred] pCred=%ld", (long) credHdl);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_acquireCred] pCred=%ld", (long) credHdl);
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_acquireCred]");
+  if ((*env)->ExceptionCheck(env)) {
+    return jlong_zero;
+  }
   return ptr_to_jlong(credHdl);
 }
 
@@ -582,15 +620,16 @@
 
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
 
-  sprintf(debugBuf, "[GSSLibStub_releaseCred] %ld", (long int)pCred);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_releaseCred] %ld", (long int)pCred);
 
   if (credHdl != GSS_C_NO_CREDENTIAL) {
-
     /* gss_release_cred(...) => GSS_S_NO_CRED(!) */
     major = (*ftab->releaseCred)(&minor, &credHdl);
 
     checkStatus(env, jobj, major, minor, "[GSSLibStub_releaseCred]");
+    if ((*env)->ExceptionCheck(env)) {
+      return jlong_zero;
+    }
   }
   return ptr_to_jlong(credHdl);
 }
@@ -600,14 +639,13 @@
  */
 void inquireCred(JNIEnv *env, jobject jobj, gss_cred_id_t pCred,
                  jint type, void *result) {
-  OM_uint32 minor, major=0;
+  OM_uint32 minor=0, major=0;
   OM_uint32 routineErr;
   gss_cred_id_t credHdl;
 
   credHdl = pCred;
 
-  sprintf(debugBuf, "[gss_inquire_cred] %ld", (long) pCred);
-  debug(env, debugBuf);
+  TRACE1("[gss_inquire_cred] %ld", (long) pCred);
 
   /* gss_inquire_cred(...) => GSS_S_DEFECTIVE_CREDENTIAL(!),
      GSS_S_CREDENTIALS_EXPIRED(!), GSS_S_NO_CRED(!) */
@@ -619,8 +657,6 @@
     major = (*ftab->inquireCred)(&minor, credHdl, NULL, NULL, result, NULL);
   }
 
-  /* release intermediate buffers */
-
   routineErr = GSS_ROUTINE_ERROR(major);
   if (routineErr == GSS_S_CREDENTIALS_EXPIRED) {
     /* ignore GSS_S_CREDENTIALS_EXPIRED for query  */
@@ -649,20 +685,16 @@
 
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
 
-  sprintf(debugBuf, "[GSSLibStub_getCredName] %ld", (long int)pCred);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_getCredName] %ld", (long int)pCred);
 
   nameHdl = GSS_C_NO_NAME;
   inquireCred(env, jobj, credHdl, TYPE_CRED_NAME, &nameHdl);
-
   /* return immediately if an exception has occurred */
   if ((*env)->ExceptionCheck(env)) {
     return jlong_zero;
   }
 
-  sprintf(debugBuf, "[GSSLibStub_getCredName] pName=%ld", (long) nameHdl);
-  debug(env, debugBuf);
-
+  TRACE1("[GSSLibStub_getCredName] pName=%ld", (long) nameHdl);
   return ptr_to_jlong(nameHdl);
 }
 
@@ -681,12 +713,10 @@
 
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
 
-  sprintf(debugBuf, "[GSSLibStub_getCredTime] %ld", (long int)pCred);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_getCredTime] %ld", (long int)pCred);
 
   lifetime = 0;
   inquireCred(env, jobj, credHdl, TYPE_CRED_TIME, &lifetime);
-
   /* return immediately if an exception has occurred */
   if ((*env)->ExceptionCheck(env)) {
     return 0;
@@ -709,11 +739,9 @@
 
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
 
-  sprintf(debugBuf, "[GSSLibStub_getCredUsage] %ld", (long int)pCred);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_getCredUsage] %ld", (long int)pCred);
 
   inquireCred(env, jobj, credHdl, TYPE_CRED_USAGE, &usage);
-
   /* return immediately if an exception has occurred */
   if ((*env)->ExceptionCheck(env)) {
     return -1;
@@ -735,21 +763,22 @@
   gss_ctx_id_t contextHdl;
   gss_OID mech, mech2;
 
-  debug(env, "[GSSLibStub_importContext]");
+  TRACE0("[GSSLibStub_importContext]");
 
   contextHdl = GSS_C_NO_CONTEXT;
   initGSSBuffer(env, jctxtToken, &ctxtToken);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   /* gss_import_sec_context(...) => GSS_S_NO_CONTEXT, GSS_S_DEFECTIVE_TOKEN,
      GSS_S_UNAVAILABLE, GSS_S_UNAUTHORIZED */
   major = (*ftab->importSecContext)(&minor, &ctxtToken, &contextHdl);
 
-  sprintf(debugBuf, "[GSSLibStub_importContext] pContext=%ld",
-                                        (long) contextHdl);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_importContext] pContext=%ld", (long) contextHdl);
 
   /* release intermediate buffers */
-  resetGSSBuffer(env, jctxtToken, &ctxtToken);
+  resetGSSBuffer(&ctxtToken);
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_importContext]");
   /* return immediately if an exception has occurred */
@@ -768,9 +797,10 @@
     return NULL;
   }
 
-  mech2 = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+  mech2 = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj,
+      FID_GSSLibStub_pMech));
 
-  if (sameMech(env, mech, mech2) == JNI_TRUE) {
+  if (sameMech(mech, mech2) == JNI_TRUE) {
     /* mech match - return the context object */
     return (*env)->NewObject(env, CLS_NativeGSSContext,
                                  MID_NativeGSSContext_ctor,
@@ -779,10 +809,11 @@
     /* mech mismatch - clean up then return null */
     major = (*ftab->deleteSecContext)(&minor, &contextHdl, GSS_C_NO_BUFFER);
     checkStatus(env, jobj, major, minor,
-      "[GSSLibStub_importContext] cleanup");
+        "[GSSLibStub_importContext] cleanup");
     return NULL;
   }
 }
+
 /*
  * Class:     sun_security_jgss_wrapper_GSSLibStub
  * Method:    initContext
@@ -812,7 +843,8 @@
   gss_OID aMech;
   jobject jMech;
 */
-  debug(env, "[GSSLibStub_initContext]");
+
+  TRACE0("[GSSLibStub_initContext]");
 
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(
@@ -823,18 +855,19 @@
                                           FID_NativeGSSContext_flags);
   time = getGSSTime((*env)->GetIntField(env, jcontextSpi,
                                         FID_NativeGSSContext_lifetime));
-  cb = getGSSCB(env, jcb);
+  cb = newGSSCB(env, jcb);
   if ((*env)->ExceptionCheck(env)) {
-    free(cb);
     return NULL;
   }
 
   initGSSBuffer(env, jinToken, &inToken);
+  if ((*env)->ExceptionCheck(env)) {
+    deleteGSSCB(cb);
+    return NULL;
+  }
 
-  sprintf(debugBuf,
-          "[GSSLibStub_initContext] before: pCred=%ld, pContext=%ld",
+  TRACE2( "[GSSLibStub_initContext] before: pCred=%ld, pContext=%ld",
           (long)credHdl, (long)contextHdl);
-  debug(env, debugBuf);
 
   /* gss_init_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
      GSS_S_DEFECTIVE_TOKEN, GSS_S_NO_CRED, GSS_S_DEFECTIVE_CREDENTIAL(!),
@@ -842,29 +875,24 @@
      GSS_S_OLD_TOKEN, GSS_S_DUPLICATE_TOKEN, GSS_S_NO_CONTEXT(!),
      GSS_S_BAD_NAMETYPE, GSS_S_BAD_NAME(!), GSS_S_BAD_MECH */
   major = (*ftab->initSecContext)(&minor, credHdl,
-                               &contextHdl, targetName, mech,
-                               flags, time, cb, &inToken, NULL /*aMech*/,
-                               &outToken, &aFlags, &aTime);
+                                 &contextHdl, targetName, mech,
+                                 flags, time, cb, &inToken, NULL /*aMech*/,
+                                 &outToken, &aFlags, &aTime);
 
-  sprintf(debugBuf, "[GSSLibStub_initContext] after: pContext=%ld",
-          (long)contextHdl);
-  debug(env, debugBuf);
-  sprintf(debugBuf, "[GSSLibStub_initContext] outToken len=%ld",
-          (long)outToken.length);
-  debug(env, debugBuf);
+  TRACE2("[GSSLibStub_initContext] after: pContext=%ld, outToken len=%ld",
+            (long)contextHdl, (long)outToken.length);
 
   if (GSS_ERROR(major) == GSS_S_COMPLETE) {
     /* update member values if needed */
     (*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
                         ptr_to_jlong(contextHdl));
     (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_flags, aFlags);
-    sprintf(debugBuf, "[GSSLibStub_initContext] set flags=0x%x", aFlags);
-    debug(env, debugBuf);
+    TRACE1("[GSSLibStub_initContext] set flags=0x%x", aFlags);
 
     if (major == GSS_S_COMPLETE) {
       (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_lifetime,
                           getJavaTime(aTime));
-      debug(env, "[GSSLibStub_initContext] context established");
+      TRACE0("[GSSLibStub_initContext] context established");
 
       (*env)->SetBooleanField(env, jcontextSpi,
                               FID_NativeGSSContext_isEstablished,
@@ -876,16 +904,23 @@
                              FID_NativeGSSContext_actualMech, jMech);
 */
     } else if (major & GSS_S_CONTINUE_NEEDED) {
-      debug(env, "[GSSLibStub_initContext] context not established");
+      TRACE0("[GSSLibStub_initContext] context not established");
       major -= GSS_S_CONTINUE_NEEDED;
     }
   }
-  /* release intermediate buffers */
-  releaseGSSCB(env, jcb, cb);
-  resetGSSBuffer(env, jinToken, &inToken);
+
+  /* release intermediate buffers before checking status */
+  deleteGSSCB(cb);
+  resetGSSBuffer(&inToken);
   jresult = getJavaBuffer(env, &outToken);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_initContext]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   return jresult;
 }
 
@@ -922,27 +957,27 @@
   gss_name_t targetName;
   jobject jtargetName;
 
-  debug(env, "[GSSLibStub_acceptContext]");
+  TRACE0("[GSSLibStub_acceptContext]");
 
   contextHdl = (gss_ctx_id_t)jlong_to_ptr(
     (*env)->GetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext));
   credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
   initGSSBuffer(env, jinToken, &inToken);
-  cb = getGSSCB(env, jcb);
   if ((*env)->ExceptionCheck(env)) {
-    free(cb);
-    resetGSSBuffer(env, jinToken, &inToken);
     return NULL;
   }
-  srcName = GSS_C_NO_NAME;
+  cb = newGSSCB(env, jcb);
+  if ((*env)->ExceptionCheck(env)) {
+    resetGSSBuffer(&inToken);
+    return NULL;
+  }
+  srcName = targetName = GSS_C_NO_NAME;
   delCred = GSS_C_NO_CREDENTIAL;
   setTarget = (credHdl == GSS_C_NO_CREDENTIAL);
   aFlags = 0;
 
-  sprintf(debugBuf,
-          "[GSSLibStub_acceptContext] before: pCred=%ld, pContext=%ld",
+  TRACE2( "[GSSLibStub_acceptContext] before: pCred=%ld, pContext=%ld",
           (long) credHdl, (long) contextHdl);
-  debug(env, debugBuf);
 
   /* gss_accept_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
      GSS_S_DEFECTIVE_TOKEN, GSS_S_DEFECTIVE_CREDENTIAL(!),
@@ -953,91 +988,107 @@
     (*ftab->acceptSecContext)(&minor, &contextHdl, credHdl,
                            &inToken, cb, &srcName, &aMech, &outToken,
                            &aFlags, &aTime, &delCred);
+  /* release intermediate buffers before checking status */
 
-  sprintf(debugBuf,
-        "[GSSLibStub_acceptContext] after: pCred=%ld, pContext=%ld, pDelegCred=%ld",
+  deleteGSSCB(cb);
+  resetGSSBuffer(&inToken);
+
+  TRACE3("[GSSLibStub_acceptContext] after: pCred=%ld, pContext=%ld, pDelegCred=%ld",
         (long)credHdl, (long)contextHdl, (long) delCred);
-  debug(env, debugBuf);
 
   if (GSS_ERROR(major) == GSS_S_COMPLETE) {
     /* update member values if needed */
     (*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
                         ptr_to_jlong(contextHdl));
-    sprintf(debugBuf, "[GSSLibStub_acceptContext] set pContext=%ld",
+    TRACE1("[GSSLibStub_acceptContext] set pContext=%ld",
             (long)contextHdl);
-    debug(env, debugBuf);
+
     // WORKAROUND for a Heimdal bug
     if (delCred == GSS_C_NO_CREDENTIAL) {
         aFlags &= 0xfffffffe;
     }
     (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_flags, aFlags);
-    sprintf(debugBuf, "[GSSLibStub_acceptContext] set flags=0x%x",
-            aFlags);
-    debug(env, debugBuf);
+
+    TRACE1("[GSSLibStub_acceptContext] set flags=0x%x", aFlags);
+
     if (setTarget) {
       major2 = (*ftab->inquireContext)(&minor2, contextHdl, NULL,
                               &targetName, NULL, NULL, NULL,
                               NULL, NULL);
+      checkStatus(env, jobj, major2, minor2,
+                    "[GSSLibStub_acceptContext] inquire");
+      if ((*env)->ExceptionCheck(env)) {
+         goto error;
+      }
+
       jtargetName = (*env)->NewObject(env, CLS_GSSNameElement,
                                 MID_GSSNameElement_ctor,
                                 ptr_to_jlong(targetName), jobj);
-
-      /* return immediately if an exception has occurred */
       if ((*env)->ExceptionCheck(env)) {
-        resetGSSBuffer(env, jinToken, &inToken);
-        return NULL;
+        goto error;
       }
-      sprintf(debugBuf, "[GSSLibStub_acceptContext] set targetName=%ld",
+
+      TRACE1("[GSSLibStub_acceptContext] set targetName=%ld",
               (long)targetName);
-      debug(env, debugBuf);
+
       (*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_targetName,
                              jtargetName);
+      if ((*env)->ExceptionCheck(env)) {
+        goto error;
+      }
     }
     if (srcName != GSS_C_NO_NAME) {
       jsrcName = (*env)->NewObject(env, CLS_GSSNameElement,
                                    MID_GSSNameElement_ctor,
                                    ptr_to_jlong(srcName), jobj);
-      /* return immediately if an exception has occurred */
       if ((*env)->ExceptionCheck(env)) {
-        resetGSSBuffer(env, jinToken, &inToken);
-        return NULL;
+        goto error;
       }
-      sprintf(debugBuf, "[GSSLibStub_acceptContext] set srcName=%ld",
-              (long)srcName);
-      debug(env, debugBuf);
+
+      TRACE1("[GSSLibStub_acceptContext] set srcName=%ld", (long)srcName);
+
       (*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_srcName,
                              jsrcName);
+      if ((*env)->ExceptionCheck(env)) {
+        goto error;
+      }
     }
     if (major == GSS_S_COMPLETE) {
-      debug(env, "[GSSLibStub_acceptContext] context established");
+      TRACE0("[GSSLibStub_acceptContext] context established");
 
       (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_lifetime,
                           getJavaTime(aTime));
-
       (*env)->SetBooleanField(env, jcontextSpi,
                               FID_NativeGSSContext_isEstablished,
                               JNI_TRUE);
       jMech = getJavaOID(env, aMech);
+      if ((*env)->ExceptionCheck(env)) {
+        goto error;
+      }
       (*env)->SetObjectField(env, jcontextSpi,
                              FID_NativeGSSContext_actualMech, jMech);
+      if ((*env)->ExceptionCheck(env)) {
+        goto error;
+      }
       if (delCred != GSS_C_NO_CREDENTIAL) {
         jdelCred = (*env)->NewObject(env, CLS_GSSCredElement,
                                      MID_GSSCredElement_ctor,
                                      ptr_to_jlong(delCred), jsrcName, jMech);
-        /* return immediately if an exception has occurred */
         if ((*env)->ExceptionCheck(env)) {
-          resetGSSBuffer(env, jinToken, &inToken);
-          return NULL;
+          goto error;
         }
         (*env)->SetObjectField(env, jcontextSpi,
                                FID_NativeGSSContext_delegatedCred,
                                jdelCred);
-        sprintf(debugBuf, "[GSSLibStub_acceptContext] set delegatedCred=%ld",
+        TRACE1("[GSSLibStub_acceptContext] set delegatedCred=%ld",
                 (long) delCred);
-        debug(env, debugBuf);
+
+        if ((*env)->ExceptionCheck(env)) {
+          goto error;
+        }
       }
     } else if (major & GSS_S_CONTINUE_NEEDED) {
-      debug(env, "[GSSLibStub_acceptContext] context not established");
+      TRACE0("[GSSLibStub_acceptContext] context not established");
 
       if (aFlags & GSS_C_PROT_READY_FLAG) {
         (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_lifetime,
@@ -1046,13 +1097,20 @@
       major -= GSS_S_CONTINUE_NEEDED;
     }
   }
-  /* release intermediate buffers */
-  releaseGSSCB(env, jcb, cb);
-  resetGSSBuffer(env, jinToken, &inToken);
-  jresult = getJavaBuffer(env, &outToken);
+  return getJavaBuffer(env, &outToken);
 
-  checkStatus(env, jobj, major, minor, "[GSSLibStub_acceptContext]");
-  return jresult;
+error:
+  (*ftab->releaseBuffer)(&minor, &outToken);
+  if (srcName != GSS_C_NO_NAME) {
+    (*ftab->releaseName)(&minor, &srcName);
+  }
+  if (targetName != GSS_C_NO_NAME) {
+    (*ftab->releaseName)(&minor, &targetName);
+  }
+  if (delCred != GSS_C_NO_CREDENTIAL) {
+    (*ftab->releaseCred) (&minor, &delCred);
+  }
+  return NULL;
 }
 
 /*
@@ -1076,8 +1134,7 @@
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
 
-  sprintf(debugBuf, "[GSSLibStub_inquireContext] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_inquireContext] %ld", (long)contextHdl);
 
   srcName = targetName = GSS_C_NO_NAME;
   time = 0;
@@ -1088,12 +1145,13 @@
                               &targetName, &time, NULL, &flags,
                               &isInitiator, &isEstablished);
   /* update member values if needed */
-  sprintf(debugBuf, "[GSSLibStub_inquireContext] srcName %ld", (long)srcName);
-  debug(env, debugBuf);
-  sprintf(debugBuf, "[GSSLibStub_inquireContext] targetName %ld",
-                                                (long)targetName);
-  debug(env, debugBuf);
+  TRACE2("[GSSLibStub_inquireContext] srcName %ld, targetName %ld",
+      (long)srcName, (long)targetName);
 
+  checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireContext]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   result[0] = ptr_to_jlong(srcName);
   result[1] = ptr_to_jlong(targetName);
   result[2] = (jlong) isInitiator;
@@ -1102,11 +1160,13 @@
   result[5] = (jlong) getJavaTime(time);
 
   jresult = (*env)->NewLongArray(env, 6);
+  if (jresult == NULL) {
+    return NULL;
+  }
   (*env)->SetLongArrayRegion(env, jresult, 0, 6, result);
-
-  /* release intermediate buffers */
-
-  checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireContext]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   return jresult;
 }
 
@@ -1126,8 +1186,7 @@
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
 
-  sprintf(debugBuf, "[GSSLibStub_getContextMech] %ld", (long int)pContext);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_getContextMech] %ld", (long int)pContext);
 
   major = (*ftab->inquireContext)(&minor, contextHdl, NULL, NULL,
                                 NULL, &mech, NULL,  NULL, NULL);
@@ -1156,9 +1215,8 @@
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
 
-  sprintf(debugBuf, "[GSSLibStub_getContextName] %ld, isSrc=%d",
+  TRACE2("[GSSLibStub_getContextName] %ld, isSrc=%d",
           (long)contextHdl, isSrc);
-  debug(env, debugBuf);
 
   nameHdl = GSS_C_NO_NAME;
   if (isSrc == JNI_TRUE) {
@@ -1175,8 +1233,7 @@
     return jlong_zero;
   }
 
-  sprintf(debugBuf, "[GSSLibStub_getContextName] pName=%ld", (long) nameHdl);
-  debug(env, debugBuf);
+  TRACE1("[GSSLibStub_getContextName] pName=%ld", (long) nameHdl);
 
   return ptr_to_jlong(nameHdl);
 }
@@ -1195,8 +1252,8 @@
   OM_uint32 time;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_getContextTime] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_getContextTime] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) return 0;
 
@@ -1207,6 +1264,9 @@
     major = GSS_CALLING_ERROR(major) | GSS_SUPPLEMENTARY_INFO(major);
   }
   checkStatus(env, jobj, major, minor, "[GSSLibStub_getContextTime]");
+  if ((*env)->ExceptionCheck(env)) {
+    return 0;
+  }
   return getJavaTime(time);
 }
 
@@ -1224,8 +1284,8 @@
   gss_ctx_id_t contextHdl;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_deleteContext] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_deleteContext] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) return ptr_to_jlong(GSS_C_NO_CONTEXT);
 
@@ -1233,6 +1293,9 @@
   major = (*ftab->deleteSecContext)(&minor, &contextHdl, GSS_C_NO_BUFFER);
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_deleteContext]");
+  if ((*env)->ExceptionCheck(env)) {
+    return jlong_zero;
+  }
   return (jlong) ptr_to_jlong(contextHdl);
 }
 
@@ -1255,20 +1318,27 @@
   gss_qop_t qop;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_wrapSizeLimit] %ld", (long)contextHdl);
-  debug(env, debugBuf);
 
-  // Check context handle??
+  TRACE1("[GSSLibStub_wrapSizeLimit] %ld", (long)contextHdl);
+
+  if (contextHdl == GSS_C_NO_CONTEXT) {
+    // Twik per javadoc
+    checkStatus(env, jobj, GSS_S_NO_CONTEXT, 0,
+        "[GSSLibStub_wrapSizeLimit]");
+    return 0;
+  }
 
   qop = (gss_qop_t) jqop;
   outSize = (OM_uint32) joutSize;
-  maxInSize = 0;
   /* gss_wrap_size_limit(...) => GSS_S_NO_CONTEXT(!), GSS_S_CONTEXT_EXPIRED,
      GSS_S_BAD_QOP */
   major = (*ftab->wrapSizeLimit)(&minor, contextHdl, reqFlag,
                               qop, outSize, &maxInSize);
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_wrapSizeLimit]");
+  if ((*env)->ExceptionCheck(env)) {
+    return 0;
+  }
   return (jint) maxInSize;
 }
 
@@ -1288,8 +1358,8 @@
   jbyteArray jresult;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_exportContext] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_exportContext] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) {
     // Twik per javadoc
@@ -1303,7 +1373,14 @@
 
   /* release intermediate buffers */
   jresult = getJavaBuffer(env, &interProcToken);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   checkStatus(env, jobj, major, minor, "[GSSLibStub_exportContext]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   return jresult;
 }
 
@@ -1325,8 +1402,8 @@
   jbyteArray jresult;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_getMic] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_getMic] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) {
     // Twik per javadoc
@@ -1336,6 +1413,9 @@
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
   qop = (gss_qop_t) jqop;
   initGSSBuffer(env, jmsg, &msg);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   /* gss_get_mic(...) => GSS_S_CONTEXT_EXPIRED, GSS_S_NO_CONTEXT(!),
      GSS_S_BAD_QOP */
@@ -1343,10 +1423,16 @@
     (*ftab->getMic)(&minor, contextHdl, qop, &msg, &msgToken);
 
   /* release intermediate buffers */
-  resetGSSBuffer(env, jmsg, &msg);
+  resetGSSBuffer(&msg);
   jresult = getJavaBuffer(env, &msgToken);
-
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   checkStatus(env, jobj, major, minor, "[GSSLibStub_getMic]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   return jresult;
 }
 
@@ -1370,8 +1456,8 @@
   gss_qop_t qop;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_verifyMic] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_verifyMic] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) {
     // Twik per javadoc
@@ -1379,9 +1465,19 @@
         "[GSSLibStub_verifyMic]");
     return;
   }
-  initGSSBuffer(env, jmsg, &msg);
-  initGSSBuffer(env, jmsgToken, &msgToken);
+
   qop = (gss_qop_t) (*env)->CallIntMethod(env, jprop, MID_MessageProp_getQOP);
+  if ((*env)->ExceptionCheck(env)) { return; }
+
+  initGSSBuffer(env, jmsg, &msg);
+  if ((*env)->ExceptionCheck(env)) { return; }
+
+  initGSSBuffer(env, jmsgToken, &msgToken);
+  if ((*env)->ExceptionCheck(env)) {
+    resetGSSBuffer(&msg);
+    return;
+  }
+
   /* gss_verify_mic(...) => GSS_S_DEFECTIVE_TOKEN, GSS_S_BAD_MIC,
      GSS_S_CONTEXT_EXPIRED, GSS_S_DUPLICATE_TOKEN(!), GSS_S_OLD_TOKEN(!),
      GSS_S_UNSEQ_TOKEN(!), GSS_S_GAP_TOKEN(!), GSS_S_NO_CONTEXT(!) */
@@ -1389,13 +1485,24 @@
     (*ftab->verifyMic)(&minor, contextHdl, &msg, &msgToken, &qop);
 
   /* release intermediate buffers */
-  resetGSSBuffer(env, jmsg, &msg);
-  resetGSSBuffer(env, jmsgToken, &msgToken);
+  resetGSSBuffer(&msg);
+  resetGSSBuffer(&msgToken);
+
+  checkStatus(env, jobj, GSS_ERROR(major), minor, "[GSSLibStub_verifyMic]");
+  if ((*env)->ExceptionCheck(env)) {
+    return;
+  }
 
   (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setQOP, qop);
+  if ((*env)->ExceptionCheck(env)) {
+    return;
+  }
+
   setSupplementaryInfo(env, jobj, jprop, GSS_SUPPLEMENTARY_INFO(major),
                        minor);
-  checkStatus(env, jobj, GSS_ERROR(major), minor, "[GSSLibStub_verifyMic]");
+  if ((*env)->ExceptionCheck(env)) {
+    return;
+  }
 }
 
 /*
@@ -1420,8 +1527,8 @@
   jbyteArray jresult;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_wrap] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_wrap] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) {
     // Twik per javadoc
@@ -1431,22 +1538,43 @@
 
   confFlag =
     (*env)->CallBooleanMethod(env, jprop, MID_MessageProp_getPrivacy);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   qop = (gss_qop_t)
     (*env)->CallIntMethod(env, jprop, MID_MessageProp_getQOP);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   initGSSBuffer(env, jmsg, &msg);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   /* gss_wrap(...) => GSS_S_CONTEXT_EXPIRED, GSS_S_NO_CONTEXT(!),
      GSS_S_BAD_QOP */
   major = (*ftab->wrap)(&minor, contextHdl, confFlag, qop, &msg, &confState,
                    &msgToken);
 
-  (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setPrivacy,
-                         (confState? JNI_TRUE:JNI_FALSE));
-
   /* release intermediate buffers */
-  resetGSSBuffer(env, jmsg, &msg);
+  resetGSSBuffer(&msg);
   jresult = getJavaBuffer(env, &msgToken);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
   checkStatus(env, jobj, major, minor, "[GSSLibStub_wrap]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
+  (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setPrivacy,
+                         (confState? JNI_TRUE:JNI_FALSE));
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   return jresult;
 }
 
@@ -1471,15 +1599,20 @@
   jbyteArray jresult;
 
   contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
-  sprintf(debugBuf, "[GSSLibStub_unwrap] %ld", (long)contextHdl);
-  debug(env, debugBuf);
+
+  TRACE1("[GSSLibStub_unwrap] %ld", (long)contextHdl);
 
   if (contextHdl == GSS_C_NO_CONTEXT) {
     // Twik per javadoc
     checkStatus(env, jobj, GSS_S_CONTEXT_EXPIRED, 0, "[GSSLibStub_unwrap]");
     return NULL;
   }
+
   initGSSBuffer(env, jmsgToken, &msgToken);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   confState = 0;
   qop = GSS_C_QOP_DEFAULT;
   /* gss_unwrap(...) => GSS_S_DEFECTIVE_TOKEN, GSS_S_BAD_MIC,
@@ -1487,17 +1620,34 @@
      GSS_S_UNSEQ_TOKEN(!), GSS_S_GAP_TOKEN(!), GSS_S_NO_CONTEXT(!) */
   major =
     (*ftab->unwrap)(&minor, contextHdl, &msgToken, &msg, &confState, &qop);
+
+  /* release intermediate buffers */
+  resetGSSBuffer(&msgToken);
+  jresult = getJavaBuffer(env, &msg);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
+  checkStatus(env, jobj, GSS_ERROR(major), minor, "[GSSLibStub_unwrap]");
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
+
   /* update the message prop with relevant info */
   (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setPrivacy,
                          (confState != 0));
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   (*env)->CallVoidMethod(env, jprop, MID_MessageProp_setQOP, qop);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   setSupplementaryInfo(env, jobj, jprop, GSS_SUPPLEMENTARY_INFO(major),
-                       minor);
+                         minor);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
 
-  /* release intermediate buffers */
-  resetGSSBuffer(env, jmsgToken, &msgToken);
-  jresult = getJavaBuffer(env, &msg);
-
-  checkStatus(env, jobj, GSS_ERROR(major), minor, "[GSSLibStub_unwrap]");
   return jresult;
 }
diff --git a/src/share/native/sun/security/jgss/wrapper/NativeUtil.c b/src/share/native/sun/security/jgss/wrapper/NativeUtil.c
index 3abce20..7095af4 100644
--- a/src/share/native/sun/security/jgss/wrapper/NativeUtil.c
+++ b/src/share/native/sun/security/jgss/wrapper/NativeUtil.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
 #include "jlong.h"
 #include <jni.h>
 
-extern void throwOutOfMemoryError(JNIEnv *env, const char *message);
-
 const int JAVA_DUPLICATE_TOKEN_CODE = 19; /* DUPLICATE_TOKEN */
 const int JAVA_OLD_TOKEN_CODE = 20; /* OLD_TOKEN */
 const int JAVA_UNSEQ_TOKEN_CODE = 21; /* UNSEQ_TOKEN */
@@ -82,7 +80,6 @@
 jmethodID MID_GSSNameElement_ctor;
 jmethodID MID_GSSCredElement_ctor;
 jmethodID MID_NativeGSSContext_ctor;
-jmethodID MID_SunNativeProvider_debug;
 jfieldID FID_GSSLibStub_pMech;
 jfieldID FID_NativeGSSContext_pContext;
 jfieldID FID_NativeGSSContext_srcName;
@@ -93,7 +90,8 @@
 jfieldID FID_NativeGSSContext_flags;
 jfieldID FID_NativeGSSContext_lifetime;
 jfieldID FID_NativeGSSContext_actualMech;
-char debugBuf[256];
+
+int JGSS_DEBUG;
 
 JNIEXPORT jint JNICALL
 JNI_OnLoad(JavaVM *jvm, void *reserved) {
@@ -291,13 +289,6 @@
     printf("Couldn't find NativeGSSContext(long, GSSLibStub) constructor\n");
     return JNI_ERR;
   }
-  MID_SunNativeProvider_debug =
-    (*env)->GetStaticMethodID(env, CLS_SunNativeProvider, "debug",
-                              "(Ljava/lang/String;)V");
-  if (MID_SunNativeProvider_debug == NULL) {
-    printf("Couldn't find SunNativeProvider.debug(String) method\n");
-    return JNI_ERR;
-  }
   /* Compute and cache the field ID */
   cls = (*env)->FindClass(env, "sun/security/jgss/wrapper/GSSLibStub");
   if (cls == NULL) {
@@ -448,14 +439,28 @@
   }
   return GSS_S_COMPLETE;
 }
+
+
+/* Throws a Java Exception by name */
+void throwByName(JNIEnv *env, const char *name, const char *msg) {
+    jclass cls = (*env)->FindClass(env, name);
+
+    if (cls != NULL) {
+        (*env)->ThrowNew(env, cls, msg);
+    }
+}
+
+void throwOutOfMemoryError(JNIEnv *env, const char *message) {
+    throwByName(env, "java/lang/OutOfMemoryError", message);
+}
+
 /*
  * Utility routine for creating a java.lang.String object
- * using the specified gss_buffer_t structure. After the,
- * String object is created, the specified gss_buffer_t
- * structure is released.
+ * using the specified gss_buffer_t structure. The specified
+ * gss_buffer_t structure is always released.
  */
 jstring getJavaString(JNIEnv *env, gss_buffer_t bytes) {
-  jstring result;
+  jstring result = NULL;
   OM_uint32 minor;
   int len;
   jbyteArray jbytes;
@@ -465,9 +470,18 @@
        NOTE: do NOT include the trailing NULL */
     len = bytes->length;
     jbytes = (*env)->NewByteArray(env, len);
+    if (jbytes == NULL) {
+      goto finish;
+    }
+
     (*env)->SetByteArrayRegion(env, jbytes, 0, len, (jbyte *) bytes->value);
+    if ((*env)->ExceptionCheck(env)) {
+      goto finish;
+    }
+
     result = (*env)->NewObject(env, CLS_String, MID_String_ctor,
                                jbytes);
+  finish:
     (*env)->DeleteLocalRef(env, jbytes);
     (*ftab->releaseBuffer)(&minor, bytes);
     return result;
@@ -490,14 +504,15 @@
   } else {
     mech = GSS_C_NO_OID;
   }
+
   /* gss_display_status(...) => GSS_S_BAD_MECH, GSS_S_BAD_STATUS */
+  // TBD: check messageContext value and repeat the call if necessary
   major = (*ftab->displayStatus)(&minor, statusValue, GSS_C_MECH_CODE, mech,
-                             &messageContext, &statusString);
-  /* release intermediate buffers */
-  msg = getJavaString(env, &statusString);
-  (*ftab->releaseBuffer)(&minor, &statusString);
-  return msg;
+                                 &messageContext, &statusString);
+
+  return getJavaString(env, &statusString);
 }
+
 /*
  * Utility routine checking the specified major and minor
  * status codes. GSSExceptions will be thrown if they are
@@ -517,11 +532,9 @@
   routineErr = GSS_ROUTINE_ERROR(major);
   supplementaryInfo = GSS_SUPPLEMENTARY_INFO(major);
 
-  sprintf(debugBuf, "%s Status major/minor = %x/%d", methodName, major, minor);
-  debug(env, debugBuf);
-  sprintf(debugBuf, "%s Status c/r/s = %d/%d/%d ", methodName, callingErr>>24,
-          routineErr>>16, supplementaryInfo);
-  debug(env, debugBuf);
+  TRACE3("%s Status major/minor = %x/%d", methodName, major, minor);
+  TRACE3("c/r/s = %d/%d/%d ", callingErr>>24, routineErr>>16,
+          supplementaryInfo);
 
   jmajor = getJavaErrorCode(routineErr | supplementaryInfo);
   jminor = minor;
@@ -529,11 +542,17 @@
     jmsg = NULL;
     if (minor != 0) {
       jmsg = getMinorMessage(env, jstub, minor);
+      if ((*env)->ExceptionCheck(env)) {
+        return;
+      }
     }
+
     gssEx = (*env)->NewObject(env, CLS_GSSException,
                               MID_GSSException_ctor3,
                               jmajor, jminor, jmsg);
-    (*env)->Throw(env, gssEx);
+    if (gssEx != NULL) {
+      (*env)->Throw(env, gssEx);
+    }
   } else {
     /* Error in calling the GSS api */
     if (callingErr == GSS_S_CALL_INACCESSIBLE_READ) {
@@ -545,56 +564,88 @@
     }
     jmajor = 13; /* use GSSException.FAILURE for now */
     jmsg = (*env)->NewStringUTF(env, msg);
+    if (jmsg == NULL) {
+      return;
+    }
     gssEx = (*env)->NewObject(env, CLS_GSSException,
                               MID_GSSException_ctor3,
                               jmajor, jminor, jmsg);
-    (*env)->Throw(env, gssEx);
+    if (gssEx != NULL) {
+      (*env)->Throw(env, gssEx);
+    }
   }
 }
+
 /*
  * Utility routine for initializing gss_buffer_t structure
  * with the byte[] in the specified jbyteArray object.
- * NOTE: need to call resetGSSBuffer(...) to free up
- * the resources.
+ * NOTE: must call resetGSSBuffer() to free up the resources
+ * inside the gss_buffer_t structure.
  */
 void initGSSBuffer(JNIEnv *env, jbyteArray jbytes,
-                   gss_buffer_t cbytes) {
+                     gss_buffer_t cbytes) {
+
+  int len;
+  void* value;
+
   if (jbytes != NULL) {
-    cbytes->length = (*env)->GetArrayLength(env, jbytes);
-    cbytes->value = (*env)->GetByteArrayElements(env, jbytes, NULL);
+    len = (*env)->GetArrayLength(env, jbytes);
+    value = malloc(len);
+    if (value == NULL) {
+      throwOutOfMemoryError(env, NULL);
+      return;
+    } else {
+      (*env)->GetByteArrayRegion(env, jbytes, 0, len, value);
+      if ((*env)->ExceptionCheck(env)) {
+        free(value);
+        return;
+      } else {
+        cbytes->length = len;
+        cbytes->value = value;
+      }
+    }
   } else {
     cbytes->length = 0;
     cbytes->value = NULL;
   }
 }
+
 /*
- * Utility routine for unpinning/releasing the byte[]
- * associated with the specified jbyteArray object.
+ * Utility routine for freeing the bytes malloc'ed
+ * in initGSSBuffer() method.
  * NOTE: used in conjunction with initGSSBuffer(...).
  */
-void resetGSSBuffer(JNIEnv *env, jbyteArray jbytes,
-                    gss_buffer_t cbytes) {
-  if ((cbytes != NULL) && (cbytes != GSS_C_NO_BUFFER) &&
-      (cbytes->length != 0)) {
-    (*env)->ReleaseByteArrayElements(env, jbytes, cbytes->value,
-                                     JNI_ABORT);
+void resetGSSBuffer(gss_buffer_t cbytes) {
+  if ((cbytes != NULL) && (cbytes != GSS_C_NO_BUFFER)) {
+    free(cbytes->value);
+    cbytes->length = 0;
+    cbytes->value = NULL;
   }
 }
+
 /*
  * Utility routine for creating a jbyteArray object using
  * the byte[] value in specified gss_buffer_t structure.
- * NOTE: the specified gss_buffer_t structure will be
- * released in this routine.
+ * NOTE: the specified gss_buffer_t structure is always
+ * released.
  */
 jbyteArray getJavaBuffer(JNIEnv *env, gss_buffer_t cbytes) {
-  jbyteArray result;
+  jbyteArray result = NULL;
   OM_uint32 minor; // don't care, just so it compiles
 
-  if ((cbytes != NULL) && (cbytes != GSS_C_NO_BUFFER) &&
-      (cbytes->length != 0)) {
-    result = (*env)->NewByteArray(env, cbytes->length);
-    (*env)->SetByteArrayRegion(env, result, 0, cbytes->length,
-                               cbytes->value);
+  if (cbytes != NULL) {
+    if ((cbytes != GSS_C_NO_BUFFER) && (cbytes->length != 0)) {
+      result = (*env)->NewByteArray(env, cbytes->length);
+      if (result == NULL) {
+        goto finish;
+      }
+      (*env)->SetByteArrayRegion(env, result, 0, cbytes->length,
+                                 cbytes->value);
+      if ((*env)->ExceptionCheck(env)) {
+        result = NULL;
+      }
+    }
+  finish:
     (*ftab->releaseBuffer)(&minor, cbytes);
     return result;
   }
@@ -604,8 +655,7 @@
 /*
  * Utility routine for creating a non-mech gss_OID using
  * the specified org.ietf.jgss.Oid object.
- * NOTE: need to call deleteGSSOID(...) afterwards to
- * release the created gss_OID structure.
+ * NOTE: must call deleteGSSOID(...) to free up the gss_OID.
  */
 gss_OID newGSSOID(JNIEnv *env, jobject jOid) {
   jbyteArray jbytes;
@@ -614,8 +664,7 @@
   if (jOid != NULL) {
     jbytes = (*env)->CallObjectMethod(env, jOid, MID_Oid_getDER);
     if ((*env)->ExceptionCheck(env)) {
-      gssEx = (*env)->ExceptionOccurred(env);
-      (*env)->Throw(env, gssEx);
+      return GSS_C_NO_OID;
     }
     cOid = malloc(sizeof(struct gss_OID_desc_struct));
     if (cOid == NULL) {
@@ -626,17 +675,24 @@
     cOid->elements = malloc(cOid->length);
     if (cOid->elements == NULL) {
       throwOutOfMemoryError(env,NULL);
-      free(cOid);
-      return GSS_C_NO_OID;
+      goto cleanup;
     }
     (*env)->GetByteArrayRegion(env, jbytes, 2, cOid->length,
                                cOid->elements);
-    (*env)->DeleteLocalRef(env, jbytes);
+    if ((*env)->ExceptionCheck(env)) {
+      goto cleanup;
+    }
     return cOid;
   } else {
     return GSS_C_NO_OID;
   }
+  cleanup:
+    (*env)->DeleteLocalRef(env, jbytes);
+    free(cOid->elements);
+    free(cOid);
+    return GSS_C_NO_OID;
 }
+
 /*
  * Utility routine for releasing the specified gss_OID
  * structure.
@@ -648,6 +704,7 @@
     free(oid);
   }
 }
+
 /*
  * Utility routine for creating a org.ietf.jgss.Oid
  * object using the specified gss_OID structure.
@@ -656,7 +713,7 @@
   int cLen;
   char oidHdr[2];
   jbyteArray jbytes;
-  jobject result;
+  jobject result = NULL;
 
   if ((cOid == NULL) || (cOid == GSS_C_NO_OID)) {
     return NULL;
@@ -665,12 +722,20 @@
   oidHdr[0] = 6;
   oidHdr[1] = cLen;
   jbytes = (*env)->NewByteArray(env, cLen+2);
+  if (jbytes == NULL) {
+    return NULL;
+  }
   (*env)->SetByteArrayRegion(env, jbytes, 0, 2, (jbyte *) oidHdr);
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   (*env)->SetByteArrayRegion(env, jbytes, 2, cLen, (jbyte *) cOid->elements);
-
+  if ((*env)->ExceptionCheck(env)) {
+    return NULL;
+  }
   result = (*env)->NewObject(env, CLS_Oid, MID_Oid_ctor1, jbytes);
   if ((*env)->ExceptionCheck(env)) {
-    (*env)->Throw(env, (*env)->ExceptionOccurred(env));
+    return NULL;
   }
   (*env)->DeleteLocalRef(env, jbytes);
   return result;
@@ -681,7 +746,7 @@
  * NOTE: need to call deleteGSSOIDSet(...) afterwards
  * to release the created gss_OID_set structure.
  */
-gss_OID_set newGSSOIDSet(JNIEnv *env, gss_OID oid) {
+gss_OID_set newGSSOIDSet(gss_OID oid) {
   gss_OID_set oidSet;
   OM_uint32 minor; // don't care; just so it compiles
 
@@ -722,26 +787,26 @@
   if (cOidSet != NULL && cOidSet != GSS_C_NO_OID_SET) {
     numOfOids = cOidSet->count;
     jOidSet = (*env)->NewObjectArray(env, numOfOids, CLS_Oid, NULL);
-    if (jOidSet != NULL) {
-      for (i = 0; i < numOfOids; i++) {
-        jOid = getJavaOID(env, &(cOidSet->elements[i]));
-        (*env)->SetObjectArrayElement(env, jOidSet, i, jOid);
-        (*env)->DeleteLocalRef(env, jOid);
+    if ((*env)->ExceptionCheck(env)) {
+      return NULL;
+    }
+    for (i = 0; i < numOfOids; i++) {
+      jOid = getJavaOID(env, &(cOidSet->elements[i]));
+      if ((*env)->ExceptionCheck(env)) {
+        return NULL;
       }
+      (*env)->SetObjectArrayElement(env, jOidSet, i, jOid);
+      if ((*env)->ExceptionCheck(env)) {
+        return NULL;
+      }
+      (*env)->DeleteLocalRef(env, jOid);
     }
     return jOidSet;
   }
   return NULL;
 }
 
-void debug(JNIEnv *env, char *msg) {
-  jstring jmsg = (*env)->NewStringUTF(env, msg);
-  (*env)->CallStaticVoidMethod(env, CLS_SunNativeProvider,
-                               MID_SunNativeProvider_debug, jmsg);
-  (*env)->DeleteLocalRef(env, jmsg);
-}
-
-int sameMech(JNIEnv *env, gss_OID mech, gss_OID mech2) {
+int sameMech(gss_OID mech, gss_OID mech2) {
   int result = JNI_FALSE; // default to not equal
 
   if (mech->length == mech2->length) {
diff --git a/src/share/native/sun/security/jgss/wrapper/NativeUtil.h b/src/share/native/sun/security/jgss/wrapper/NativeUtil.h
index c6194b6..78f7226 100644
--- a/src/share/native/sun/security/jgss/wrapper/NativeUtil.h
+++ b/src/share/native/sun/security/jgss/wrapper/NativeUtil.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,12 +37,13 @@
   extern OM_uint32 getGSSTime(jint);
   extern void checkStatus(JNIEnv *, jobject, OM_uint32, OM_uint32, char*);
   extern jint checkTime(OM_uint32);
+  extern void throwOutOfMemoryError(JNIEnv *, const char*);
   extern void initGSSBuffer(JNIEnv *, jbyteArray, gss_buffer_t);
-  extern void resetGSSBuffer(JNIEnv *, jbyteArray, gss_buffer_t);
+  extern void resetGSSBuffer(gss_buffer_t);
 
   extern gss_OID newGSSOID(JNIEnv *, jobject);
   extern void deleteGSSOID(gss_OID);
-  extern gss_OID_set newGSSOIDSet(JNIEnv *, gss_OID);
+  extern gss_OID_set newGSSOIDSet(gss_OID);
   extern void deleteGSSOIDSet(gss_OID_set);
 
   extern jbyteArray getJavaBuffer(JNIEnv *, gss_buffer_t);
@@ -51,13 +52,12 @@
   extern jobjectArray getJavaOIDArray(JNIEnv *, gss_OID_set);
 
   extern jstring getMinorMessage(JNIEnv *, jobject, OM_uint32);
-  extern void debug(JNIEnv *, char *);
-  extern int sameMech(JNIEnv *, gss_OID, gss_OID);
+  extern int sameMech(gss_OID, gss_OID);
 
   JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *, void *);
   JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *, void *);
 
-  extern char debugBuf[];
+  extern int JGSS_DEBUG;
 
   extern jclass CLS_Object;
   extern jclass CLS_GSSNameElement;
@@ -85,6 +85,12 @@
   extern jfieldID FID_NativeGSSContext_flags;
   extern jfieldID FID_NativeGSSContext_lifetime;
   extern jfieldID FID_NativeGSSContext_actualMech;
+  #define TRACE0(s) { if (JGSS_DEBUG) { puts(s); fflush(stdout); }}
+  #define TRACE1(s, p1) { if (JGSS_DEBUG) { printf(s"\n", p1); fflush(stdout); }}
+  #define TRACE2(s, p1, p2) { if (JGSS_DEBUG) { printf(s"\n", p1, p2); fflush(stdout); }}
+  #define TRACE3(s, p1, p2, p3) { if (JGSS_DEBUG) { printf(s"\n", p1, p2, p3); fflush(stdout); }}
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/share/native/sun/security/krb5/nativeccache.c b/src/share/native/sun/security/krb5/nativeccache.c
index 0b9fbfa..beb5bf0 100644
--- a/src/share/native/sun/security/krb5/nativeccache.c
+++ b/src/share/native/sun/security/krb5/nativeccache.c
@@ -141,7 +141,7 @@
 #endif /* DEBUG */
 
     ticketConstructor = (*env)->GetMethodID(env, ticketClass, "<init>", "(Lsun/security/util/DerValue;)V");
-    if (derValueConstructor == 0) {
+    if (ticketConstructor == 0) {
         printf("Couldn't find Ticket constructor\n");
         return JNI_ERR;
     }
@@ -272,6 +272,7 @@
     }
     return 0;
 }
+
 /*
  * Class:     sun_security_krb5_Credentials
  * Method:    acquireDefaultNativeCreds
@@ -309,7 +310,7 @@
     netypes = (*env)->GetArrayLength(env, jetypes);
     etypes = (jint *) (*env)->GetIntArrayElements(env, jetypes, NULL);
 
-    if (!err) {
+    if (etypes != NULL && !err) {
         while ((err = krb5_cc_next_cred (kcontext, ccache, &cursor, &creds)) == 0) {
             char *serverName = NULL;
 
@@ -319,8 +320,16 @@
             }
 
             if (!err) {
-                if (strncmp (serverName, "krbtgt", sizeof("krbtgt")-1) == 0 &&
-                        isIn(creds.keyblock.enctype, netypes, etypes)) {
+                char* slash = strchr(serverName, '/');
+                char* at = strchr(serverName, '@');
+                // Make sure the server's name is krbtgt/REALM@REALM, the etype
+                // is supported, and the ticket has not expired
+                if (slash && at &&
+                        strncmp (serverName, "krbtgt", slash-serverName) == 0 &&
+                            // the ablove line shows at must be after slash
+                        strncmp (slash+1, at+1, at-slash-1) == 0 &&
+                        isIn (creds.keyblock.enctype, netypes, etypes) &&
+                        creds.times.endtime > time(0)) {
                     jobject ticket, clientPrincipal, targetPrincipal, encryptionKey;
                     jobject ticketFlags, startTime, endTime;
                     jobject authTime, renewTillTime, hostAddresses;
@@ -399,8 +408,12 @@
                     if (endTime) (*env)->DeleteLocalRef(env, endTime);
                     if (renewTillTime) (*env)->DeleteLocalRef(env, renewTillTime);
                     if (hostAddresses) (*env)->DeleteLocalRef(env, hostAddresses);
-                }
 
+                    // Stop if there is an exception or we already found the initial TGT
+                    if ((*env)->ExceptionCheck(env) || krbCreds) {
+                        break;
+                    }
+                }
             }
 
             if (serverName != NULL) { krb5_free_unparsed_name (kcontext, serverName); }
@@ -410,7 +423,6 @@
 
         if (err == KRB5_CC_END) { err = 0; }
         printiferr (err, "while retrieving a ticket");
-
     }
 
     if (!err) {
@@ -445,25 +457,25 @@
     jbyteArray ary;
 
     ary = (*env)->NewByteArray(env, encodedTicket->length);
-    if ((*env)->ExceptionOccurred(env)) {
+    if ((*env)->ExceptionCheck(env)) {
         return (jobject) NULL;
     }
 
     (*env)->SetByteArrayRegion(env, ary, (jsize) 0, encodedTicket->length, (jbyte *)encodedTicket->data);
-    if ((*env)->ExceptionOccurred(env)) {
+    if ((*env)->ExceptionCheck(env)) {
         (*env)->DeleteLocalRef(env, ary);
         return (jobject) NULL;
     }
 
     derValue = (*env)->NewObject(env, derValueClass, derValueConstructor, ary);
-    if ((*env)->ExceptionOccurred(env)) {
+    if ((*env)->ExceptionCheck(env)) {
         (*env)->DeleteLocalRef(env, ary);
         return (jobject) NULL;
     }
 
     (*env)->DeleteLocalRef(env, ary);
     ticket = (*env)->NewObject(env, ticketClass, ticketConstructor, derValue);
-    if ((*env)->ExceptionOccurred(env)) {
+    if ((*env)->ExceptionCheck(env)) {
         (*env)->DeleteLocalRef(env, derValue);
         return (jobject) NULL;
     }
@@ -480,6 +492,10 @@
     if (!err) {
         // Make a PrincipalName from the full string and the type.  Let the PrincipalName class parse it out.
         jstring principalStringObj = (*env)->NewStringUTF(env, principalString);
+        if (principalStringObj == NULL) {
+            if (principalString != NULL) { krb5_free_unparsed_name (kcontext, principalString); }
+            return (jobject) NULL;
+        }
         principal = (*env)->NewObject(env, principalNameClass, principalNameConstructor, principalStringObj, principalName->type);
         if (principalString != NULL) { krb5_free_unparsed_name (kcontext, principalString); }
         (*env)->DeleteLocalRef(env, principalStringObj);
@@ -494,8 +510,13 @@
     jobject encryptionKey = NULL;
 
     ary = (*env)->NewByteArray(env,cryptoKey->length);
+
+    if (ary == NULL) {
+        return (jobject) NULL;
+    }
+
     (*env)->SetByteArrayRegion(env, ary, (jsize) 0, cryptoKey->length, (jbyte *)cryptoKey->contents);
-    if (!(*env)->ExceptionOccurred(env)) {
+    if (!(*env)->ExceptionCheck(env)) {
         encryptionKey = (*env)->NewObject(env, encryptionKeyClass, encryptionKeyConstructor, cryptoKey->enctype, ary);
     }
 
@@ -514,9 +535,14 @@
     unsigned long nlflags = htonl(flags);
 
     ary = (*env)->NewByteArray(env, sizeof(flags));
+
+    if (ary == NULL) {
+        return (jobject) NULL;
+    }
+
     (*env)->SetByteArrayRegion(env, ary, (jsize) 0, sizeof(flags), (jbyte *)&nlflags);
 
-    if (!(*env)->ExceptionOccurred(env)) {
+    if (!(*env)->ExceptionCheck(env)) {
         ticketFlags = (*env)->NewObject(env, ticketFlagsClass, ticketFlagsConstructor, sizeof(flags)*8, ary);
     }
 
@@ -550,6 +576,10 @@
 
     jobject address_list = (*env)->NewObjectArray(env, addressCount, hostAddressClass, NULL);
 
+    if (address_list == NULL) {
+        return (jobject) NULL;
+    }
+
     // Create a new HostAddress object for each address block.
     // First, reset the iterator.
     p = addresses;
@@ -567,9 +597,16 @@
 
         (*env)->DeleteLocalRef(env, ary);
 
+        if (address == NULL) {
+            return (jobject) NULL;
+        }
         // Add the HostAddress to the arrray.
         (*env)->SetObjectArrayElement(env, address_list, index, address);
 
+        if ((*env)->ExceptionCheck(env)) {
+            return (jobject) NULL;
+        }
+
         index++;
         p++;
     }
diff --git a/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c b/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c
index b56608a..2696483 100644
--- a/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c
+++ b/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c
@@ -141,8 +141,8 @@
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckEncryptedPartLen);
 
-    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
     (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     ckAssertReturnValueOK(env, rv);
     return ckEncryptedPartLen;
@@ -214,7 +214,7 @@
     }
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -266,7 +266,7 @@
     //printf("EF: ckLastEncryptedPartLen=%i", ckLastEncryptedPartLen);
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -361,8 +361,8 @@
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckPartLen);
 
-    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
     (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     ckAssertReturnValueOK(env, rv);
 
@@ -429,7 +429,7 @@
     }
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -478,7 +478,7 @@
                                          &ckLastPartLen);
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     }
 
diff --git a/src/solaris/classes/java/lang/UNIXProcess.java b/src/solaris/classes/java/lang/UNIXProcess.java
new file mode 100644
index 0000000..35d37e6
--- /dev/null
+++ b/src/solaris/classes/java/lang/UNIXProcess.java
@@ -0,0 +1,827 @@
+/*
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Locale;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.security.AccessController;
+import static java.security.AccessController.doPrivileged;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * java.lang.Process subclass in the UNIX environment.
+ *
+ * @author Mario Wolczko and Ross Knippel.
+ * @author Konstantin Kladko (ported to Linux and Bsd)
+ * @author Martin Buchholz
+ * @author Volker Simonis (ported to AIX)
+ */
+final class UNIXProcess extends Process {
+    private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
+        = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
+
+    private final int pid;
+    private int exitcode;
+    private boolean hasExited;
+
+    private /* final */ OutputStream stdin;
+    private /* final */ InputStream  stdout;
+    private /* final */ InputStream  stderr;
+
+    // only used on Solaris
+    private /* final */ DeferredCloseInputStream stdout_inner_stream;
+
+    private static enum LaunchMechanism {
+        // order IS important!
+        FORK,
+        POSIX_SPAWN,
+        VFORK
+    }
+
+    private static enum Platform {
+
+        LINUX(LaunchMechanism.VFORK, LaunchMechanism.FORK),
+
+        BSD(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK),
+
+        SOLARIS(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK),
+
+        AIX(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK);
+
+        final LaunchMechanism defaultLaunchMechanism;
+        final Set<LaunchMechanism> validLaunchMechanisms;
+
+        Platform(LaunchMechanism ... launchMechanisms) {
+            this.defaultLaunchMechanism = launchMechanisms[0];
+            this.validLaunchMechanisms =
+                EnumSet.copyOf(Arrays.asList(launchMechanisms));
+        }
+
+        private String helperPath(String javahome, String osArch) {
+            switch (this) {
+                case SOLARIS:
+                    if (osArch.equals("x86")) { osArch = "i386"; }
+                    else if (osArch.equals("x86_64")) { osArch = "amd64"; }
+                    // fall through...
+                case LINUX:
+                case AIX:
+                    return javahome + "/lib/" + osArch + "/jspawnhelper";
+
+                case BSD:
+                    return javahome + "/lib/jspawnhelper";
+
+                default:
+                    throw new AssertionError("Unsupported platform: " + this);
+            }
+        }
+
+        String helperPath() {
+            return AccessController.doPrivileged(
+                (PrivilegedAction<String>) () ->
+                    helperPath(System.getProperty("java.home"),
+                               System.getProperty("os.arch"))
+            );
+        }
+
+        LaunchMechanism launchMechanism() {
+            return AccessController.doPrivileged(
+                (PrivilegedAction<LaunchMechanism>) () -> {
+                    String s = System.getProperty(
+                        "jdk.lang.Process.launchMechanism");
+                    LaunchMechanism lm;
+                    if (s == null) {
+                        lm = defaultLaunchMechanism;
+                        s = lm.name().toLowerCase(Locale.ENGLISH);
+                    } else {
+                        try {
+                            lm = LaunchMechanism.valueOf(
+                                s.toUpperCase(Locale.ENGLISH));
+                        } catch (IllegalArgumentException e) {
+                            lm = null;
+                        }
+                    }
+                    if (lm == null || !validLaunchMechanisms.contains(lm)) {
+                        throw new Error(
+                            s + " is not a supported " +
+                            "process launch mechanism on this platform."
+                        );
+                    }
+                    return lm;
+                }
+            );
+        }
+
+        static Platform get() {
+            String osName = AccessController.doPrivileged(
+                (PrivilegedAction<String>) () -> System.getProperty("os.name")
+            );
+
+            if (osName.equals("Linux")) { return LINUX; }
+            if (osName.contains("OS X")) { return BSD; }
+            if (osName.equals("SunOS")) { return SOLARIS; }
+            if (osName.equals("AIX")) { return AIX; }
+
+            throw new Error(osName + " is not a supported OS platform.");
+        }
+    }
+
+    private static final Platform platform = Platform.get();
+    private static final LaunchMechanism launchMechanism = platform.launchMechanism();
+    private static final byte[] helperpath = toCString(platform.helperPath());
+
+    private static byte[] toCString(String s) {
+        if (s == null)
+            return null;
+        byte[] bytes = s.getBytes();
+        byte[] result = new byte[bytes.length + 1];
+        System.arraycopy(bytes, 0,
+                         result, 0,
+                         bytes.length);
+        result[result.length-1] = (byte)0;
+        return result;
+    }
+
+    /* this is for the reaping thread */
+    private native int waitForProcessExit(int pid);
+
+    /**
+     * Creates a process. Depending on the {@code mode} flag, this is done by
+     * one of the following mechanisms:
+     * <pre>
+     *   1 - fork(2) and exec(2)
+     *   2 - posix_spawn(3P)
+     *   3 - vfork(2) and exec(2)
+     *
+     *  (4 - clone(2) and exec(2) - obsolete and currently disabled in native code)
+     * </pre>
+     * @param fds an array of three file descriptors.
+     *        Indexes 0, 1, and 2 correspond to standard input,
+     *        standard output and standard error, respectively.  On
+     *        input, a value of -1 means to create a pipe to connect
+     *        child and parent processes.  On output, a value which
+     *        is not -1 is the parent pipe fd corresponding to the
+     *        pipe which has been created.  An element of this array
+     *        is -1 on input if and only if it is <em>not</em> -1 on
+     *        output.
+     * @return the pid of the subprocess
+     */
+    private native int forkAndExec(int mode, byte[] helperpath,
+                                   byte[] prog,
+                                   byte[] argBlock, int argc,
+                                   byte[] envBlock, int envc,
+                                   byte[] dir,
+                                   int[] fds,
+                                   boolean redirectErrorStream)
+        throws IOException;
+
+    /**
+     * The thread pool of "process reaper" daemon threads.
+     */
+    private static final Executor processReaperExecutor =
+        doPrivileged((PrivilegedAction<Executor>) () -> {
+
+            ThreadGroup tg = Thread.currentThread().getThreadGroup();
+            while (tg.getParent() != null) tg = tg.getParent();
+            ThreadGroup systemThreadGroup = tg;
+
+            ThreadFactory threadFactory = grimReaper -> {
+                // Our thread stack requirement is quite modest.
+                Thread t = new Thread(systemThreadGroup, grimReaper,
+                                      "process reaper", 32768);
+                t.setDaemon(true);
+                // A small attempt (probably futile) to avoid priority inversion
+                t.setPriority(Thread.MAX_PRIORITY);
+                return t;
+            };
+
+            return Executors.newCachedThreadPool(threadFactory);
+        });
+
+    UNIXProcess(final byte[] prog,
+                final byte[] argBlock, final int argc,
+                final byte[] envBlock, final int envc,
+                final byte[] dir,
+                final int[] fds,
+                final boolean redirectErrorStream)
+            throws IOException {
+
+        pid = forkAndExec(launchMechanism.ordinal() + 1,
+                          helperpath,
+                          prog,
+                          argBlock, argc,
+                          envBlock, envc,
+                          dir,
+                          fds,
+                          redirectErrorStream);
+
+        try {
+            doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+                initStreams(fds);
+                return null;
+            });
+        } catch (PrivilegedActionException ex) {
+            throw (IOException) ex.getException();
+        }
+    }
+
+    static FileDescriptor newFileDescriptor(int fd) {
+        FileDescriptor fileDescriptor = new FileDescriptor();
+        fdAccess.set(fileDescriptor, fd);
+        return fileDescriptor;
+    }
+
+    void initStreams(int[] fds) throws IOException {
+        switch (platform) {
+            case LINUX:
+            case BSD:
+                stdin = (fds[0] == -1) ?
+                        ProcessBuilder.NullOutputStream.INSTANCE :
+                        new ProcessPipeOutputStream(fds[0]);
+
+                stdout = (fds[1] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new ProcessPipeInputStream(fds[1]);
+
+                stderr = (fds[2] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new ProcessPipeInputStream(fds[2]);
+
+                processReaperExecutor.execute(() -> {
+                    int exitcode = waitForProcessExit(pid);
+
+                    synchronized (this) {
+                        this.exitcode = exitcode;
+                        this.hasExited = true;
+                        this.notifyAll();
+                    }
+
+                    if (stdout instanceof ProcessPipeInputStream)
+                        ((ProcessPipeInputStream) stdout).processExited();
+
+                    if (stderr instanceof ProcessPipeInputStream)
+                        ((ProcessPipeInputStream) stderr).processExited();
+
+                    if (stdin instanceof ProcessPipeOutputStream)
+                        ((ProcessPipeOutputStream) stdin).processExited();
+                });
+                break;
+
+            case SOLARIS:
+                stdin = (fds[0] == -1) ?
+                        ProcessBuilder.NullOutputStream.INSTANCE :
+                        new BufferedOutputStream(
+                            new FileOutputStream(newFileDescriptor(fds[0])));
+
+                stdout = (fds[1] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new BufferedInputStream(
+                             stdout_inner_stream =
+                                 new DeferredCloseInputStream(
+                                     newFileDescriptor(fds[1])));
+
+                stderr = (fds[2] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new DeferredCloseInputStream(newFileDescriptor(fds[2]));
+
+                /*
+                 * For each subprocess forked a corresponding reaper task
+                 * is submitted.  That task is the only thread which waits
+                 * for the subprocess to terminate and it doesn't hold any
+                 * locks while doing so.  This design allows waitFor() and
+                 * exitStatus() to be safely executed in parallel (and they
+                 * need no native code).
+                 */
+                processReaperExecutor.execute(() -> {
+                    int exitcode = waitForProcessExit(pid);
+
+                    synchronized (this) {
+                        this.exitcode = exitcode;
+                        this.hasExited = true;
+                        this.notifyAll();
+                    }
+                });
+                break;
+
+            case AIX:
+                stdin = (fds[0] == -1) ?
+                        ProcessBuilder.NullOutputStream.INSTANCE :
+                        new ProcessPipeOutputStream(fds[0]);
+
+                stdout = (fds[1] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new DeferredCloseProcessPipeInputStream(fds[1]);
+
+                stderr = (fds[2] == -1) ?
+                         ProcessBuilder.NullInputStream.INSTANCE :
+                         new DeferredCloseProcessPipeInputStream(fds[2]);
+
+                processReaperExecutor.execute(() -> {
+                    int exitcode = waitForProcessExit(pid);
+
+                    synchronized (this) {
+                        this.exitcode = exitcode;
+                        this.hasExited = true;
+                        this.notifyAll();
+                    }
+
+                    if (stdout instanceof DeferredCloseProcessPipeInputStream)
+                        ((DeferredCloseProcessPipeInputStream) stdout).processExited();
+
+                    if (stderr instanceof DeferredCloseProcessPipeInputStream)
+                        ((DeferredCloseProcessPipeInputStream) stderr).processExited();
+
+                    if (stdin instanceof ProcessPipeOutputStream)
+                        ((ProcessPipeOutputStream) stdin).processExited();
+                });
+                break;
+
+            default: throw new AssertionError("Unsupported platform: " + platform);
+        }
+    }
+
+    public OutputStream getOutputStream() {
+        return stdin;
+    }
+
+    public InputStream getInputStream() {
+        return stdout;
+    }
+
+    public InputStream getErrorStream() {
+        return stderr;
+    }
+
+    public synchronized int waitFor() throws InterruptedException {
+        while (!hasExited) {
+            wait();
+        }
+        return exitcode;
+    }
+
+    @Override
+    public synchronized boolean waitFor(long timeout, TimeUnit unit)
+        throws InterruptedException
+    {
+        if (hasExited) return true;
+        if (timeout <= 0) return false;
+
+        long timeoutAsNanos = unit.toNanos(timeout);
+        long startTime = System.nanoTime();
+        long rem = timeoutAsNanos;
+
+        while (!hasExited && (rem > 0)) {
+            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
+            rem = timeoutAsNanos - (System.nanoTime() - startTime);
+        }
+        return hasExited;
+    }
+
+    public synchronized int exitValue() {
+        if (!hasExited) {
+            throw new IllegalThreadStateException("process hasn't exited");
+        }
+        return exitcode;
+    }
+
+    private static native void destroyProcess(int pid, boolean force);
+
+    private void destroy(boolean force) {
+        switch (platform) {
+            case LINUX:
+            case BSD:
+            case AIX:
+                // There is a risk that pid will be recycled, causing us to
+                // kill the wrong process!  So we only terminate processes
+                // that appear to still be running.  Even with this check,
+                // there is an unavoidable race condition here, but the window
+                // is very small, and OSes try hard to not recycle pids too
+                // soon, so this is quite safe.
+                synchronized (this) {
+                    if (!hasExited)
+                        destroyProcess(pid, force);
+                }
+                try { stdin.close();  } catch (IOException ignored) {}
+                try { stdout.close(); } catch (IOException ignored) {}
+                try { stderr.close(); } catch (IOException ignored) {}
+                break;
+
+            case SOLARIS:
+                // There is a risk that pid will be recycled, causing us to
+                // kill the wrong process!  So we only terminate processes
+                // that appear to still be running.  Even with this check,
+                // there is an unavoidable race condition here, but the window
+                // is very small, and OSes try hard to not recycle pids too
+                // soon, so this is quite safe.
+                synchronized (this) {
+                    if (!hasExited)
+                        destroyProcess(pid, force);
+                    try {
+                        stdin.close();
+                        if (stdout_inner_stream != null)
+                            stdout_inner_stream.closeDeferred(stdout);
+                        if (stderr instanceof DeferredCloseInputStream)
+                            ((DeferredCloseInputStream) stderr)
+                                .closeDeferred(stderr);
+                    } catch (IOException e) {
+                        // ignore
+                    }
+                }
+                break;
+
+            default: throw new AssertionError("Unsupported platform: " + platform);
+        }
+    }
+
+    public void destroy() {
+        destroy(false);
+    }
+
+    @Override
+    public Process destroyForcibly() {
+        destroy(true);
+        return this;
+    }
+
+    @Override
+    public synchronized boolean isAlive() {
+        return !hasExited;
+    }
+
+    private static native void init();
+
+    static {
+        init();
+    }
+
+    /**
+     * A buffered input stream for a subprocess pipe file descriptor
+     * that allows the underlying file descriptor to be reclaimed when
+     * the process exits, via the processExited hook.
+     *
+     * This is tricky because we do not want the user-level InputStream to be
+     * closed until the user invokes close(), and we need to continue to be
+     * able to read any buffered data lingering in the OS pipe buffer.
+     */
+    private static class ProcessPipeInputStream extends BufferedInputStream {
+        private final Object closeLock = new Object();
+
+        ProcessPipeInputStream(int fd) {
+            super(new FileInputStream(newFileDescriptor(fd)));
+        }
+        private static byte[] drainInputStream(InputStream in)
+                throws IOException {
+            int n = 0;
+            int j;
+            byte[] a = null;
+            while ((j = in.available()) > 0) {
+                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
+                n += in.read(a, n, j);
+            }
+            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
+        }
+
+        /** Called by the process reaper thread when the process exits. */
+        synchronized void processExited() {
+            synchronized (closeLock) {
+                try {
+                    InputStream in = this.in;
+                    // this stream is closed if and only if: in == null
+                    if (in != null) {
+                        byte[] stragglers = drainInputStream(in);
+                        in.close();
+                        this.in = (stragglers == null) ?
+                            ProcessBuilder.NullInputStream.INSTANCE :
+                            new ByteArrayInputStream(stragglers);
+                    }
+                } catch (IOException ignored) {}
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+            // BufferedInputStream#close() is not synchronized unlike most other
+            // methods. Synchronizing helps avoid race with processExited().
+            synchronized (closeLock) {
+                super.close();
+            }
+        }
+    }
+
+    /**
+     * A buffered output stream for a subprocess pipe file descriptor
+     * that allows the underlying file descriptor to be reclaimed when
+     * the process exits, via the processExited hook.
+     */
+    private static class ProcessPipeOutputStream extends BufferedOutputStream {
+        ProcessPipeOutputStream(int fd) {
+            super(new FileOutputStream(newFileDescriptor(fd)));
+        }
+
+        /** Called by the process reaper thread when the process exits. */
+        synchronized void processExited() {
+            OutputStream out = this.out;
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException ignored) {
+                    // We know of no reason to get an IOException, but if
+                    // we do, there's nothing else to do but carry on.
+                }
+                this.out = ProcessBuilder.NullOutputStream.INSTANCE;
+            }
+        }
+    }
+
+    // A FileInputStream that supports the deferment of the actual close
+    // operation until the last pending I/O operation on the stream has
+    // finished.  This is required on Solaris because we must close the stdin
+    // and stdout streams in the destroy method in order to reclaim the
+    // underlying file descriptors.  Doing so, however, causes any thread
+    // currently blocked in a read on one of those streams to receive an
+    // IOException("Bad file number"), which is incompatible with historical
+    // behavior.  By deferring the close we allow any pending reads to see -1
+    // (EOF) as they did before.
+    //
+    private static class DeferredCloseInputStream extends FileInputStream
+    {
+        DeferredCloseInputStream(FileDescriptor fd) {
+            super(fd);
+        }
+
+        private Object lock = new Object();     // For the following fields
+        private boolean closePending = false;
+        private int useCount = 0;
+        private InputStream streamToClose;
+
+        private void raise() {
+            synchronized (lock) {
+                useCount++;
+            }
+        }
+
+        private void lower() throws IOException {
+            synchronized (lock) {
+                useCount--;
+                if (useCount == 0 && closePending) {
+                    streamToClose.close();
+                }
+            }
+        }
+
+        // stc is the actual stream to be closed; it might be this object, or
+        // it might be an upstream object for which this object is downstream.
+        //
+        private void closeDeferred(InputStream stc) throws IOException {
+            synchronized (lock) {
+                if (useCount == 0) {
+                    stc.close();
+                } else {
+                    closePending = true;
+                    streamToClose = stc;
+                }
+            }
+        }
+
+        public void close() throws IOException {
+            synchronized (lock) {
+                useCount = 0;
+                closePending = false;
+            }
+            super.close();
+        }
+
+        public int read() throws IOException {
+            raise();
+            try {
+                return super.read();
+            } finally {
+                lower();
+            }
+        }
+
+        public int read(byte[] b) throws IOException {
+            raise();
+            try {
+                return super.read(b);
+            } finally {
+                lower();
+            }
+        }
+
+        public int read(byte[] b, int off, int len) throws IOException {
+            raise();
+            try {
+                return super.read(b, off, len);
+            } finally {
+                lower();
+            }
+        }
+
+        public long skip(long n) throws IOException {
+            raise();
+            try {
+                return super.skip(n);
+            } finally {
+                lower();
+            }
+        }
+
+        public int available() throws IOException {
+            raise();
+            try {
+                return super.available();
+            } finally {
+                lower();
+            }
+        }
+    }
+
+    /**
+     * A buffered input stream for a subprocess pipe file descriptor
+     * that allows the underlying file descriptor to be reclaimed when
+     * the process exits, via the processExited hook.
+     *
+     * This is tricky because we do not want the user-level InputStream to be
+     * closed until the user invokes close(), and we need to continue to be
+     * able to read any buffered data lingering in the OS pipe buffer.
+     *
+     * On AIX this is especially tricky, because the 'close()' system call
+     * will block if another thread is at the same time blocked in a file
+     * operation (e.g. 'read()') on the same file descriptor. We therefore
+     * combine 'ProcessPipeInputStream' approach used on Linux and Bsd
+     * with the DeferredCloseInputStream approach used on Solaris. This means
+     * that every potentially blocking operation on the file descriptor
+     * increments a counter before it is executed and decrements it once it
+     * finishes. The 'close()' operation will only be executed if there are
+     * no pending operations. Otherwise it is deferred after the last pending
+     * operation has finished.
+     *
+     */
+    private static class DeferredCloseProcessPipeInputStream
+        extends BufferedInputStream {
+
+        private final Object closeLock = new Object();
+        private int useCount = 0;
+        private boolean closePending = false;
+
+        DeferredCloseProcessPipeInputStream(int fd) {
+            super(new FileInputStream(newFileDescriptor(fd)));
+        }
+
+        private InputStream drainInputStream(InputStream in)
+                throws IOException {
+            int n = 0;
+            int j;
+            byte[] a = null;
+            synchronized (closeLock) {
+                if (buf == null) // asynchronous close()?
+                    return null; // discard
+                j = in.available();
+            }
+            while (j > 0) {
+                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
+                synchronized (closeLock) {
+                    if (buf == null) // asynchronous close()?
+                        return null; // discard
+                    n += in.read(a, n, j);
+                    j = in.available();
+                }
+            }
+            return (a == null) ?
+                    ProcessBuilder.NullInputStream.INSTANCE :
+                    new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
+        }
+
+        /** Called by the process reaper thread when the process exits. */
+        synchronized void processExited() {
+            try {
+                InputStream in = this.in;
+                if (in != null) {
+                    InputStream stragglers = drainInputStream(in);
+                    in.close();
+                    this.in = stragglers;
+                }
+            } catch (IOException ignored) { }
+        }
+
+        private void raise() {
+            synchronized (closeLock) {
+                useCount++;
+            }
+        }
+
+        private void lower() throws IOException {
+            synchronized (closeLock) {
+                useCount--;
+                if (useCount == 0 && closePending) {
+                    closePending = false;
+                    super.close();
+                }
+            }
+        }
+
+        @Override
+        public int read() throws IOException {
+            raise();
+            try {
+                return super.read();
+            } finally {
+                lower();
+            }
+        }
+
+        @Override
+        public int read(byte[] b) throws IOException {
+            raise();
+            try {
+                return super.read(b);
+            } finally {
+                lower();
+            }
+        }
+
+        @Override
+        public int read(byte[] b, int off, int len) throws IOException {
+            raise();
+            try {
+                return super.read(b, off, len);
+            } finally {
+                lower();
+            }
+        }
+
+        @Override
+        public long skip(long n) throws IOException {
+            raise();
+            try {
+                return super.skip(n);
+            } finally {
+                lower();
+            }
+        }
+
+        @Override
+        public int available() throws IOException {
+            raise();
+            try {
+                return super.available();
+            } finally {
+                lower();
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+            // BufferedInputStream#close() is not synchronized unlike most other
+            // methods. Synchronizing helps avoid racing with drainInputStream().
+            synchronized (closeLock) {
+                if (useCount == 0) {
+                    super.close();
+                }
+                else {
+                    closePending = true;
+                }
+            }
+        }
+    }
+}
diff --git a/src/solaris/classes/java/lang/UNIXProcess.java.aix b/src/solaris/classes/java/lang/UNIXProcess.java.aix
deleted file mode 100644
index 2421646..0000000
--- a/src/solaris/classes/java/lang/UNIXProcess.java.aix
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.security.AccessController;
-import static java.security.AccessController.doPrivileged;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * java.lang.Process subclass in the UNIX environment.
- *
- * @author Mario Wolczko and Ross Knippel.
- * @author Konstantin Kladko (ported to Linux)
- * @author Martin Buchholz
- * @author Volker Simonis (ported to AIX)
- */
-final class UNIXProcess extends Process {
-    private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
-        = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
-
-    private final int pid;
-    private int exitcode;
-    private boolean hasExited;
-
-    private /* final */ OutputStream stdin;
-    private /* final */ InputStream  stdout;
-    private /* final */ InputStream  stderr;
-
-    private static enum LaunchMechanism {
-        FORK(1),
-        POSIX_SPAWN(2);
-
-        private int value;
-        LaunchMechanism(int x) {value = x;}
-    };
-
-    /* On AIX, the default is to spawn */
-    private static final LaunchMechanism launchMechanism;
-    private static byte[] helperpath;
-
-    private static byte[] toCString(String s) {
-        if (s == null)
-            return null;
-        byte[] bytes = s.getBytes();
-        byte[] result = new byte[bytes.length + 1];
-        System.arraycopy(bytes, 0,
-                         result, 0,
-                         bytes.length);
-        result[result.length-1] = (byte)0;
-        return result;
-    }
-
-    static {
-        launchMechanism = AccessController.doPrivileged(
-                new PrivilegedAction<LaunchMechanism>()
-        {
-            public LaunchMechanism run() {
-                String javahome = System.getProperty("java.home");
-                String osArch = System.getProperty("os.arch");
-
-                helperpath = toCString(javahome + "/lib/" + osArch + "/jspawnhelper");
-                String s = System.getProperty(
-                    "jdk.lang.Process.launchMechanism", "posix_spawn");
-
-                try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
-                } catch (IllegalArgumentException e) {
-                    throw new Error(s + " is not a supported " +
-                        "process launch mechanism on this platform.");
-                }
-            }
-        });
-    }
-
-    /* this is for the reaping thread */
-    private native int waitForProcessExit(int pid);
-
-    /**
-     * Create a process. Depending on the mode flag, this is done by
-     * one of the following mechanisms.
-     * - fork(2) and exec(2)
-     * - clone(2) and exec(2)
-     * - vfork(2) and exec(2)
-     *
-     * @param fds an array of three file descriptors.
-     *        Indexes 0, 1, and 2 correspond to standard input,
-     *        standard output and standard error, respectively.  On
-     *        input, a value of -1 means to create a pipe to connect
-     *        child and parent processes.  On output, a value which
-     *        is not -1 is the parent pipe fd corresponding to the
-     *        pipe which has been created.  An element of this array
-     *        is -1 on input if and only if it is <em>not</em> -1 on
-     *        output.
-     * @return the pid of the subprocess
-     */
-    private native int forkAndExec(int mode, byte[] helperpath,
-                                   byte[] prog,
-                                   byte[] argBlock, int argc,
-                                   byte[] envBlock, int envc,
-                                   byte[] dir,
-                                   int[] fds,
-                                   boolean redirectErrorStream)
-        throws IOException;
-
-    /**
-     * The thread factory used to create "process reaper" daemon threads.
-     */
-    private static class ProcessReaperThreadFactory implements ThreadFactory {
-        private final static ThreadGroup group = getRootThreadGroup();
-
-        private static ThreadGroup getRootThreadGroup() {
-            return doPrivileged(new PrivilegedAction<ThreadGroup> () {
-                public ThreadGroup run() {
-                    ThreadGroup root = Thread.currentThread().getThreadGroup();
-                    while (root.getParent() != null)
-                        root = root.getParent();
-                    return root;
-                }});
-        }
-
-        public Thread newThread(Runnable grimReaper) {
-            // Our thread stack requirement is quite modest.
-            Thread t = new Thread(group, grimReaper, "process reaper", 32768);
-            t.setDaemon(true);
-            // A small attempt (probably futile) to avoid priority inversion
-            t.setPriority(Thread.MAX_PRIORITY);
-            return t;
-        }
-    }
-
-    /**
-     * The thread pool of "process reaper" daemon threads.
-     */
-    private static final Executor processReaperExecutor =
-        doPrivileged(new PrivilegedAction<Executor>() {
-            public Executor run() {
-                return Executors.newCachedThreadPool
-                    (new ProcessReaperThreadFactory());
-            }});
-
-    UNIXProcess(final byte[] prog,
-                final byte[] argBlock, final int argc,
-                final byte[] envBlock, final int envc,
-                final byte[] dir,
-                final int[] fds,
-                final boolean redirectErrorStream)
-            throws IOException {
-
-        pid = forkAndExec(launchMechanism.value,
-                          helperpath,
-                          prog,
-                          argBlock, argc,
-                          envBlock, envc,
-                          dir,
-                          fds,
-                          redirectErrorStream);
-
-        try {
-            doPrivileged(new PrivilegedExceptionAction<Void>() {
-                public Void run() throws IOException {
-                    initStreams(fds);
-                    return null;
-                }});
-        } catch (PrivilegedActionException ex) {
-            throw (IOException) ex.getException();
-        }
-    }
-
-    static FileDescriptor newFileDescriptor(int fd) {
-        FileDescriptor fileDescriptor = new FileDescriptor();
-        fdAccess.set(fileDescriptor, fd);
-        return fileDescriptor;
-    }
-
-    void initStreams(int[] fds) throws IOException {
-        stdin = (fds[0] == -1) ?
-            ProcessBuilder.NullOutputStream.INSTANCE :
-            new ProcessPipeOutputStream(fds[0]);
-
-        stdout = (fds[1] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[1]);
-
-        stderr = (fds[2] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[2]);
-
-        processReaperExecutor.execute(new Runnable() {
-            public void run() {
-                int exitcode = waitForProcessExit(pid);
-                UNIXProcess.this.processExited(exitcode);
-            }});
-    }
-
-    void processExited(int exitcode) {
-        synchronized (this) {
-            this.exitcode = exitcode;
-            hasExited = true;
-            notifyAll();
-        }
-
-        if (stdout instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stdout).processExited();
-
-        if (stderr instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stderr).processExited();
-
-        if (stdin instanceof ProcessPipeOutputStream)
-            ((ProcessPipeOutputStream) stdin).processExited();
-    }
-
-    public OutputStream getOutputStream() {
-        return stdin;
-    }
-
-    public InputStream getInputStream() {
-        return stdout;
-    }
-
-    public InputStream getErrorStream() {
-        return stderr;
-    }
-
-    public synchronized int waitFor() throws InterruptedException {
-        while (!hasExited) {
-            wait();
-        }
-        return exitcode;
-    }
-
-    @Override
-    public synchronized boolean waitFor(long timeout, TimeUnit unit)
-        throws InterruptedException
-    {
-        if (hasExited) return true;
-        if (timeout <= 0) return false;
-
-        long timeoutAsNanos = unit.toNanos(timeout);
-        long startTime = System.nanoTime();
-        long rem = timeoutAsNanos;
-
-        while (!hasExited && (rem > 0)) {
-            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
-            rem = timeoutAsNanos - (System.nanoTime() - startTime);
-        }
-        return hasExited;
-    }
-
-    public synchronized int exitValue() {
-        if (!hasExited) {
-            throw new IllegalThreadStateException("process hasn't exited");
-        }
-        return exitcode;
-    }
-
-    private static native void destroyProcess(int pid, boolean force);
-    private void destroy(boolean force) {
-        // There is a risk that pid will be recycled, causing us to
-        // kill the wrong process!  So we only terminate processes
-        // that appear to still be running.  Even with this check,
-        // there is an unavoidable race condition here, but the window
-        // is very small, and OSes try hard to not recycle pids too
-        // soon, so this is quite safe.
-        synchronized (this) {
-            if (!hasExited)
-                destroyProcess(pid, force);
-        }
-        try { stdin.close();  } catch (IOException ignored) {}
-        try { stdout.close(); } catch (IOException ignored) {}
-        try { stderr.close(); } catch (IOException ignored) {}
-    }
-
-    public void destroy() {
-        destroy(false);
-    }
-
-    @Override
-    public Process destroyForcibly() {
-        destroy(true);
-        return this;
-    }
-
-    @Override
-    public synchronized boolean isAlive() {
-        return !hasExited;
-    }
-
-    private static native void init();
-
-    static {
-        init();
-    }
-
-    /**
-     * A buffered input stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     *
-     * This is tricky because we do not want the user-level InputStream to be
-     * closed until the user invokes close(), and we need to continue to be
-     * able to read any buffered data lingering in the OS pipe buffer.
-     *
-     * On AIX this is especially tricky, because the 'close()' system call
-     * will block if another thread is at the same time blocked in a file
-     * operation (e.g. 'read()') on the same file descriptor. We therefore
-     * combine this 'ProcessPipeInputStream' with the DeferredCloseInputStream
-     * approach used on Solaris (see "UNIXProcess.java.solaris"). This means
-     * that every potentially blocking operation on the file descriptor
-     * increments a counter before it is executed and decrements it once it
-     * finishes. The 'close()' operation will only be executed if there are
-     * no pending operations. Otherwise it is deferred after the last pending
-     * operation has finished.
-     *
-     */
-    static class ProcessPipeInputStream extends BufferedInputStream {
-        private final Object closeLock = new Object();
-        private int useCount = 0;
-        private boolean closePending = false;
-
-        ProcessPipeInputStream(int fd) {
-            super(new FileInputStream(newFileDescriptor(fd)));
-        }
-
-        private InputStream drainInputStream(InputStream in)
-                throws IOException {
-            int n = 0;
-            int j;
-            byte[] a = null;
-            synchronized (closeLock) {
-                if (buf == null) // asynchronous close()?
-                    return null; // discard
-                j = in.available();
-            }
-            while (j > 0) {
-                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
-                synchronized (closeLock) {
-                    if (buf == null) // asynchronous close()?
-                        return null; // discard
-                    n += in.read(a, n, j);
-                    j = in.available();
-                }
-            }
-            return (a == null) ?
-                    ProcessBuilder.NullInputStream.INSTANCE :
-                    new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            try {
-                InputStream in = this.in;
-                if (in != null) {
-                    InputStream stragglers = drainInputStream(in);
-                    in.close();
-                    this.in = stragglers;
-                }
-            } catch (IOException ignored) { }
-        }
-
-        private void raise() {
-            synchronized (closeLock) {
-                useCount++;
-            }
-        }
-
-        private void lower() throws IOException {
-            synchronized (closeLock) {
-                useCount--;
-                if (useCount == 0 && closePending) {
-                    closePending = false;
-                    super.close();
-                }
-            }
-        }
-
-        @Override
-        public int read() throws IOException {
-            raise();
-            try {
-                return super.read();
-            } finally {
-                lower();
-            }
-        }
-
-        @Override
-        public int read(byte[] b) throws IOException {
-            raise();
-            try {
-                return super.read(b);
-            } finally {
-                lower();
-            }
-        }
-
-        @Override
-        public int read(byte[] b, int off, int len) throws IOException {
-            raise();
-            try {
-                return super.read(b, off, len);
-            } finally {
-                lower();
-            }
-        }
-
-        @Override
-        public long skip(long n) throws IOException {
-            raise();
-            try {
-                return super.skip(n);
-            } finally {
-                lower();
-            }
-        }
-
-        @Override
-        public int available() throws IOException {
-            raise();
-            try {
-                return super.available();
-            } finally {
-                lower();
-            }
-        }
-
-        @Override
-        public void close() throws IOException {
-            // BufferedInputStream#close() is not synchronized unlike most other methods.
-            // Synchronizing helps avoid racing with drainInputStream().
-            synchronized (closeLock) {
-                if (useCount == 0) {
-                    super.close();
-                }
-                else {
-                    closePending = true;
-                }
-            }
-        }
-    }
-
-    /**
-     * A buffered output stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     */
-    static class ProcessPipeOutputStream extends BufferedOutputStream {
-        ProcessPipeOutputStream(int fd) {
-            super(new FileOutputStream(newFileDescriptor(fd)));
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            OutputStream out = this.out;
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException ignored) {
-                    // We know of no reason to get an IOException, but if
-                    // we do, there's nothing else to do but carry on.
-                }
-                this.out = ProcessBuilder.NullOutputStream.INSTANCE;
-            }
-        }
-    }
-}
diff --git a/src/solaris/classes/java/lang/UNIXProcess.java.bsd b/src/solaris/classes/java/lang/UNIXProcess.java.bsd
deleted file mode 100644
index 8f2069e..0000000
--- a/src/solaris/classes/java/lang/UNIXProcess.java.bsd
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.security.AccessController;
-import static java.security.AccessController.doPrivileged;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * java.lang.Process subclass in the UNIX environment.
- *
- * @author Mario Wolczko and Ross Knippel.
- * @author Konstantin Kladko (ported to Bsd)
- * @author Martin Buchholz
- */
-final class UNIXProcess extends Process {
-    private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
-        = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
-
-    private final int pid;
-    private int exitcode;
-    private boolean hasExited;
-
-    private /* final */ OutputStream stdin;
-    private /* final */ InputStream  stdout;
-    private /* final */ InputStream  stderr;
-
-    private static enum LaunchMechanism {
-        FORK(1),
-        POSIX_SPAWN(2);
-
-        private int value;
-        LaunchMechanism(int x) {value = x;}
-    };
-
-    /* On BSD, the default is to spawn */
-    private static final LaunchMechanism launchMechanism;
-    private static byte[] helperpath;
-
-    private static byte[] toCString(String s) {
-        if (s == null)
-            return null;
-        byte[] bytes = s.getBytes();
-        byte[] result = new byte[bytes.length + 1];
-        System.arraycopy(bytes, 0,
-                         result, 0,
-                         bytes.length);
-        result[result.length-1] = (byte)0;
-        return result;
-    }
-
-    static {
-        launchMechanism = AccessController.doPrivileged(
-                new PrivilegedAction<LaunchMechanism>()
-        {
-            public LaunchMechanism run() {
-                String javahome = System.getProperty("java.home");
-
-                helperpath = toCString(javahome + "/lib/jspawnhelper");
-                String s = System.getProperty(
-                    "jdk.lang.Process.launchMechanism", "posix_spawn");
-
-                try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
-                } catch (IllegalArgumentException e) {
-                    throw new Error(s + " is not a supported " +
-                        "process launch mechanism on this platform.");
-                }
-            }
-        });
-    }
-
-    /* this is for the reaping thread */
-    private native int waitForProcessExit(int pid);
-
-    /**
-     * Create a process. Depending on the mode flag, this is done by
-     * one of the following mechanisms.
-     * - fork(2) and exec(2)
-     * - posix_spawn(2)
-     *
-     * @param fds an array of three file descriptors.
-     *        Indexes 0, 1, and 2 correspond to standard input,
-     *        standard output and standard error, respectively.  On
-     *        input, a value of -1 means to create a pipe to connect
-     *        child and parent processes.  On output, a value which
-     *        is not -1 is the parent pipe fd corresponding to the
-     *        pipe which has been created.  An element of this array
-     *        is -1 on input if and only if it is <em>not</em> -1 on
-     *        output.
-     * @return the pid of the subprocess
-     */
-    private native int forkAndExec(int mode, byte[] helperpath,
-                                   byte[] prog,
-                                   byte[] argBlock, int argc,
-                                   byte[] envBlock, int envc,
-                                   byte[] dir,
-                                   int[] fds,
-                                   boolean redirectErrorStream)
-        throws IOException;
-
-    /**
-     * The thread factory used to create "process reaper" daemon threads.
-     */
-    private static class ProcessReaperThreadFactory implements ThreadFactory {
-        private final static ThreadGroup group = getRootThreadGroup();
-
-        private static ThreadGroup getRootThreadGroup() {
-            return doPrivileged(new PrivilegedAction<ThreadGroup> () {
-                public ThreadGroup run() {
-                    ThreadGroup root = Thread.currentThread().getThreadGroup();
-                    while (root.getParent() != null)
-                        root = root.getParent();
-                    return root;
-                }});
-        }
-
-        public Thread newThread(Runnable grimReaper) {
-            // Our thread stack requirement is quite modest.
-            Thread t = new Thread(group, grimReaper, "process reaper", 32768);
-            t.setDaemon(true);
-            // A small attempt (probably futile) to avoid priority inversion
-            t.setPriority(Thread.MAX_PRIORITY);
-            return t;
-        }
-    }
-
-    /**
-     * The thread pool of "process reaper" daemon threads.
-     */
-    private static final Executor processReaperExecutor =
-        doPrivileged(new PrivilegedAction<Executor>() {
-            public Executor run() {
-                return Executors.newCachedThreadPool
-                    (new ProcessReaperThreadFactory());
-            }});
-
-    UNIXProcess(final byte[] prog,
-                final byte[] argBlock, final int argc,
-                final byte[] envBlock, final int envc,
-                final byte[] dir,
-                final int[] fds,
-                final boolean redirectErrorStream)
-            throws IOException {
-
-        pid = forkAndExec(launchMechanism.value,
-                          helperpath,
-                          prog,
-                          argBlock, argc,
-                          envBlock, envc,
-                          dir,
-                          fds,
-                          redirectErrorStream);
-
-        try {
-            doPrivileged(new PrivilegedExceptionAction<Void>() {
-                public Void run() throws IOException {
-                    initStreams(fds);
-                    return null;
-                }});
-        } catch (PrivilegedActionException ex) {
-            throw (IOException) ex.getException();
-        }
-    }
-
-    static FileDescriptor newFileDescriptor(int fd) {
-        FileDescriptor fileDescriptor = new FileDescriptor();
-        fdAccess.set(fileDescriptor, fd);
-        return fileDescriptor;
-    }
-
-    void initStreams(int[] fds) throws IOException {
-        stdin = (fds[0] == -1) ?
-            ProcessBuilder.NullOutputStream.INSTANCE :
-            new ProcessPipeOutputStream(fds[0]);
-
-        stdout = (fds[1] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[1]);
-
-        stderr = (fds[2] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[2]);
-
-        processReaperExecutor.execute(new Runnable() {
-            public void run() {
-                int exitcode = waitForProcessExit(pid);
-                UNIXProcess.this.processExited(exitcode);
-            }});
-    }
-
-    void processExited(int exitcode) {
-        synchronized (this) {
-            this.exitcode = exitcode;
-            hasExited = true;
-            notifyAll();
-        }
-
-        if (stdout instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stdout).processExited();
-
-        if (stderr instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stderr).processExited();
-
-        if (stdin instanceof ProcessPipeOutputStream)
-            ((ProcessPipeOutputStream) stdin).processExited();
-    }
-
-    public OutputStream getOutputStream() {
-        return stdin;
-    }
-
-    public InputStream getInputStream() {
-        return stdout;
-    }
-
-    public InputStream getErrorStream() {
-        return stderr;
-    }
-
-    public synchronized int waitFor() throws InterruptedException {
-        while (!hasExited) {
-            wait();
-        }
-        return exitcode;
-    }
-
-    @Override
-    public synchronized boolean waitFor(long timeout, TimeUnit unit)
-        throws InterruptedException
-    {
-        if (hasExited) return true;
-        if (timeout <= 0) return false;
-
-        long timeoutAsNanos = unit.toNanos(timeout);
-        long startTime = System.nanoTime();
-        long rem = timeoutAsNanos;
-
-        while (!hasExited && (rem > 0)) {
-            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
-            rem = timeoutAsNanos - (System.nanoTime() - startTime);
-        }
-        return hasExited;
-    }
-
-    public synchronized int exitValue() {
-        if (!hasExited) {
-            throw new IllegalThreadStateException("process hasn't exited");
-        }
-        return exitcode;
-    }
-
-    private static native void destroyProcess(int pid, boolean force);
-    private void destroy(boolean force) {
-        // There is a risk that pid will be recycled, causing us to
-        // kill the wrong process!  So we only terminate processes
-        // that appear to still be running.  Even with this check,
-        // there is an unavoidable race condition here, but the window
-        // is very small, and OSes try hard to not recycle pids too
-        // soon, so this is quite safe.
-        synchronized (this) {
-            if (!hasExited)
-                destroyProcess(pid, force);
-        }
-        try { stdin.close();  } catch (IOException ignored) {}
-        try { stdout.close(); } catch (IOException ignored) {}
-        try { stderr.close(); } catch (IOException ignored) {}
-    }
-
-    public void destroy() {
-        destroy(false);
-    }
-
-    @Override
-    public Process destroyForcibly() {
-        destroy(true);
-        return this;
-    }
-
-    @Override
-    public synchronized boolean isAlive() {
-        return !hasExited;
-    }
-
-    private static native void init();
-
-    static {
-        init();
-    }
-
-    /**
-     * A buffered input stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     *
-     * This is tricky because we do not want the user-level InputStream to be
-     * closed until the user invokes close(), and we need to continue to be
-     * able to read any buffered data lingering in the OS pipe buffer.
-     */
-    static class ProcessPipeInputStream extends BufferedInputStream {
-        private final Object closeLock = new Object();
-
-        ProcessPipeInputStream(int fd) {
-            super(new FileInputStream(newFileDescriptor(fd)));
-        }
-        private static byte[] drainInputStream(InputStream in)
-                throws IOException {
-            int n = 0;
-            int j;
-            byte[] a = null;
-            while ((j = in.available()) > 0) {
-                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
-                n += in.read(a, n, j);
-            }
-            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            synchronized (closeLock) {
-                try {
-                    InputStream in = this.in;
-                    // this stream is closed if and only if: in == null
-                    if (in != null) {
-                        byte[] stragglers = drainInputStream(in);
-                        in.close();
-                        this.in = (stragglers == null) ?
-                            ProcessBuilder.NullInputStream.INSTANCE :
-                            new ByteArrayInputStream(stragglers);
-                    }
-                } catch (IOException ignored) {}
-            }
-        }
-
-        @Override
-        public void close() throws IOException {
-            // BufferedInputStream#close() is not synchronized unlike most other methods.
-            // Synchronizing helps avoid race with processExited().
-            synchronized (closeLock) {
-                super.close();
-            }
-        }
-    }
-
-    /**
-     * A buffered output stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     */
-    static class ProcessPipeOutputStream extends BufferedOutputStream {
-        ProcessPipeOutputStream(int fd) {
-            super(new FileOutputStream(newFileDescriptor(fd)));
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            OutputStream out = this.out;
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException ignored) {
-                    // We know of no reason to get an IOException, but if
-                    // we do, there's nothing else to do but carry on.
-                }
-                this.out = ProcessBuilder.NullOutputStream.INSTANCE;
-            }
-        }
-    }
-}
diff --git a/src/solaris/classes/java/lang/UNIXProcess.java.linux b/src/solaris/classes/java/lang/UNIXProcess.java.linux
deleted file mode 100644
index 3357495..0000000
--- a/src/solaris/classes/java/lang/UNIXProcess.java.linux
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.security.AccessController;
-import static java.security.AccessController.doPrivileged;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * java.lang.Process subclass in the UNIX environment.
- *
- * @author Mario Wolczko and Ross Knippel.
- * @author Konstantin Kladko (ported to Linux)
- * @author Martin Buchholz
- */
-final class UNIXProcess extends Process {
-    private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
-        = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
-
-    private final int pid;
-    private int exitcode;
-    private boolean hasExited;
-
-    private /* final */ OutputStream stdin;
-    private /* final */ InputStream  stdout;
-    private /* final */ InputStream  stderr;
-
-    private static enum LaunchMechanism {
-        FORK(1),
-        VFORK(3);
-
-        private int value;
-        LaunchMechanism(int x) {value = x;}
-    };
-
-    /* default is VFORK on Linux */
-    private static final LaunchMechanism launchMechanism;
-    private static byte[] helperpath;
-
-    private static byte[] toCString(String s) {
-        if (s == null)
-            return null;
-        byte[] bytes = s.getBytes();
-        byte[] result = new byte[bytes.length + 1];
-        System.arraycopy(bytes, 0,
-                         result, 0,
-                         bytes.length);
-        result[result.length-1] = (byte)0;
-        return result;
-    }
-
-    static {
-        launchMechanism = AccessController.doPrivileged(
-                new PrivilegedAction<LaunchMechanism>()
-        {
-            public LaunchMechanism run() {
-                String javahome = System.getProperty("java.home");
-                String osArch = System.getProperty("os.arch");
-
-                helperpath = toCString(javahome + "/lib/" + osArch + "/jspawnhelper");
-                String s = System.getProperty(
-                    "jdk.lang.Process.launchMechanism", "vfork");
-
-                try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
-                } catch (IllegalArgumentException e) {
-                    throw new Error(s + " is not a supported " +
-                        "process launch mechanism on this platform.");
-                }
-            }
-        });
-    }
-
-    /* this is for the reaping thread */
-    private native int waitForProcessExit(int pid);
-
-    /**
-     * Create a process. Depending on the mode flag, this is done by
-     * one of the following mechanisms.
-     * - fork(2) and exec(2)
-     * - clone(2) and exec(2)
-     * - vfork(2) and exec(2)
-     *
-     * @param fds an array of three file descriptors.
-     *        Indexes 0, 1, and 2 correspond to standard input,
-     *        standard output and standard error, respectively.  On
-     *        input, a value of -1 means to create a pipe to connect
-     *        child and parent processes.  On output, a value which
-     *        is not -1 is the parent pipe fd corresponding to the
-     *        pipe which has been created.  An element of this array
-     *        is -1 on input if and only if it is <em>not</em> -1 on
-     *        output.
-     * @return the pid of the subprocess
-     */
-    private native int forkAndExec(int mode, byte[] helperpath,
-                                   byte[] prog,
-                                   byte[] argBlock, int argc,
-                                   byte[] envBlock, int envc,
-                                   byte[] dir,
-                                   int[] fds,
-                                   boolean redirectErrorStream)
-        throws IOException;
-
-    /**
-     * The thread factory used to create "process reaper" daemon threads.
-     */
-    private static class ProcessReaperThreadFactory implements ThreadFactory {
-        private final static ThreadGroup group = getRootThreadGroup();
-
-        private static ThreadGroup getRootThreadGroup() {
-            return doPrivileged(new PrivilegedAction<ThreadGroup> () {
-                public ThreadGroup run() {
-                    ThreadGroup root = Thread.currentThread().getThreadGroup();
-                    while (root.getParent() != null)
-                        root = root.getParent();
-                    return root;
-                }});
-        }
-
-        public Thread newThread(Runnable grimReaper) {
-            // Our thread stack requirement is quite modest.
-            Thread t = new Thread(group, grimReaper, "process reaper", 32768);
-            t.setDaemon(true);
-            // A small attempt (probably futile) to avoid priority inversion
-            t.setPriority(Thread.MAX_PRIORITY);
-            return t;
-        }
-    }
-
-    /**
-     * The thread pool of "process reaper" daemon threads.
-     */
-    private static final Executor processReaperExecutor =
-        doPrivileged(new PrivilegedAction<Executor>() {
-            public Executor run() {
-                return Executors.newCachedThreadPool
-                    (new ProcessReaperThreadFactory());
-            }});
-
-    UNIXProcess(final byte[] prog,
-                final byte[] argBlock, final int argc,
-                final byte[] envBlock, final int envc,
-                final byte[] dir,
-                final int[] fds,
-                final boolean redirectErrorStream)
-            throws IOException {
-
-        pid = forkAndExec(launchMechanism.value,
-                          helperpath,
-                          prog,
-                          argBlock, argc,
-                          envBlock, envc,
-                          dir,
-                          fds,
-                          redirectErrorStream);
-
-        try {
-            doPrivileged(new PrivilegedExceptionAction<Void>() {
-                public Void run() throws IOException {
-                    initStreams(fds);
-                    return null;
-                }});
-        } catch (PrivilegedActionException ex) {
-            throw (IOException) ex.getException();
-        }
-    }
-
-    static FileDescriptor newFileDescriptor(int fd) {
-        FileDescriptor fileDescriptor = new FileDescriptor();
-        fdAccess.set(fileDescriptor, fd);
-        return fileDescriptor;
-    }
-
-    void initStreams(int[] fds) throws IOException {
-        stdin = (fds[0] == -1) ?
-            ProcessBuilder.NullOutputStream.INSTANCE :
-            new ProcessPipeOutputStream(fds[0]);
-
-        stdout = (fds[1] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[1]);
-
-        stderr = (fds[2] == -1) ?
-            ProcessBuilder.NullInputStream.INSTANCE :
-            new ProcessPipeInputStream(fds[2]);
-
-        processReaperExecutor.execute(new Runnable() {
-            public void run() {
-                int exitcode = waitForProcessExit(pid);
-                UNIXProcess.this.processExited(exitcode);
-            }});
-    }
-
-    void processExited(int exitcode) {
-        synchronized (this) {
-            this.exitcode = exitcode;
-            hasExited = true;
-            notifyAll();
-        }
-
-        if (stdout instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stdout).processExited();
-
-        if (stderr instanceof ProcessPipeInputStream)
-            ((ProcessPipeInputStream) stderr).processExited();
-
-        if (stdin instanceof ProcessPipeOutputStream)
-            ((ProcessPipeOutputStream) stdin).processExited();
-    }
-
-    public OutputStream getOutputStream() {
-        return stdin;
-    }
-
-    public InputStream getInputStream() {
-        return stdout;
-    }
-
-    public InputStream getErrorStream() {
-        return stderr;
-    }
-
-    public synchronized int waitFor() throws InterruptedException {
-        while (!hasExited) {
-            wait();
-        }
-        return exitcode;
-    }
-
-    @Override
-    public synchronized boolean waitFor(long timeout, TimeUnit unit)
-        throws InterruptedException
-    {
-        if (hasExited) return true;
-        if (timeout <= 0) return false;
-
-        long timeoutAsNanos = unit.toNanos(timeout);
-        long startTime = System.nanoTime();
-        long rem = timeoutAsNanos;
-
-        while (!hasExited && (rem > 0)) {
-            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
-            rem = timeoutAsNanos - (System.nanoTime() - startTime);
-        }
-        return hasExited;
-    }
-
-    public synchronized int exitValue() {
-        if (!hasExited) {
-            throw new IllegalThreadStateException("process hasn't exited");
-        }
-        return exitcode;
-    }
-
-    private static native void destroyProcess(int pid, boolean force);
-    private void destroy(boolean force) {
-        // There is a risk that pid will be recycled, causing us to
-        // kill the wrong process!  So we only terminate processes
-        // that appear to still be running.  Even with this check,
-        // there is an unavoidable race condition here, but the window
-        // is very small, and OSes try hard to not recycle pids too
-        // soon, so this is quite safe.
-        synchronized (this) {
-            if (!hasExited)
-                destroyProcess(pid, force);
-        }
-        try { stdin.close();  } catch (IOException ignored) {}
-        try { stdout.close(); } catch (IOException ignored) {}
-        try { stderr.close(); } catch (IOException ignored) {}
-    }
-
-    public void destroy() {
-        destroy(false);
-    }
-
-    @Override
-    public Process destroyForcibly() {
-        destroy(true);
-        return this;
-    }
-
-    @Override
-    public synchronized boolean isAlive() {
-        return !hasExited;
-    }
-
-    private static native void init();
-
-    static {
-        init();
-    }
-
-    /**
-     * A buffered input stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     *
-     * This is tricky because we do not want the user-level InputStream to be
-     * closed until the user invokes close(), and we need to continue to be
-     * able to read any buffered data lingering in the OS pipe buffer.
-     */
-    static class ProcessPipeInputStream extends BufferedInputStream {
-        private final Object closeLock = new Object();
-
-        ProcessPipeInputStream(int fd) {
-            super(new FileInputStream(newFileDescriptor(fd)));
-        }
-        private static byte[] drainInputStream(InputStream in)
-                throws IOException {
-            int n = 0;
-            int j;
-            byte[] a = null;
-            while ((j = in.available()) > 0) {
-                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
-                n += in.read(a, n, j);
-            }
-            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            synchronized (closeLock) {
-                try {
-                    InputStream in = this.in;
-                    // this stream is closed if and only if: in == null
-                    if (in != null) {
-                        byte[] stragglers = drainInputStream(in);
-                        in.close();
-                        this.in = (stragglers == null) ?
-                            ProcessBuilder.NullInputStream.INSTANCE :
-                            new ByteArrayInputStream(stragglers);
-                    }
-                } catch (IOException ignored) {}
-            }
-        }
-
-        @Override
-        public void close() throws IOException {
-            // BufferedInputStream#close() is not synchronized unlike most other methods.
-            // Synchronizing helps avoid race with processExited().
-            synchronized (closeLock) {
-                super.close();
-            }
-        }
-    }
-
-    /**
-     * A buffered output stream for a subprocess pipe file descriptor
-     * that allows the underlying file descriptor to be reclaimed when
-     * the process exits, via the processExited hook.
-     */
-    static class ProcessPipeOutputStream extends BufferedOutputStream {
-        ProcessPipeOutputStream(int fd) {
-            super(new FileOutputStream(newFileDescriptor(fd)));
-        }
-
-        /** Called by the process reaper thread when the process exits. */
-        synchronized void processExited() {
-            OutputStream out = this.out;
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException ignored) {
-                    // We know of no reason to get an IOException, but if
-                    // we do, there's nothing else to do but carry on.
-                }
-                this.out = ProcessBuilder.NullOutputStream.INSTANCE;
-            }
-        }
-    }
-}
diff --git a/src/solaris/classes/java/lang/UNIXProcess.java.solaris b/src/solaris/classes/java/lang/UNIXProcess.java.solaris
deleted file mode 100644
index 944c5e2..0000000
--- a/src/solaris/classes/java/lang/UNIXProcess.java.solaris
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.security.AccessController;
-import static java.security.AccessController.doPrivileged;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/* java.lang.Process subclass in the UNIX environment.
- *
- * @author Mario Wolczko and Ross Knippel.
- */
-
-final class UNIXProcess extends Process {
-    private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
-        = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
-
-    private final int pid;
-    private int exitcode;
-    private boolean hasExited;
-
-    private OutputStream stdin_stream;
-    private InputStream stdout_stream;
-    private DeferredCloseInputStream stdout_inner_stream;
-    private InputStream stderr_stream;
-
-    private static enum LaunchMechanism {
-        FORK(1),
-        POSIX_SPAWN(2);
-
-        private int value;
-        LaunchMechanism(int x) {value = x;}
-    };
-
-    /* On Solaris, the default is to spawn */
-    private static final LaunchMechanism launchMechanism;
-    private static byte[] helperpath;
-
-    private static byte[] toCString(String s) {
-        if (s == null)
-            return null;
-        byte[] bytes = s.getBytes();
-        byte[] result = new byte[bytes.length + 1];
-        System.arraycopy(bytes, 0,
-                         result, 0,
-                         bytes.length);
-        result[result.length-1] = (byte)0;
-        return result;
-    }
-
-    static {
-        launchMechanism = AccessController.doPrivileged(
-                new PrivilegedAction<LaunchMechanism>()
-        {
-            public LaunchMechanism run() {
-                String javahome = System.getProperty("java.home");
-                String osArch = System.getProperty("os.arch");
-                if (osArch.equals("x86")) {
-                    osArch = "i386";
-                } else if (osArch.equals("x86_64")) {
-                    osArch = "amd64";
-                }
-
-                helperpath = toCString(javahome + "/lib/" + osArch + "/jspawnhelper");
-                String s = System.getProperty(
-                    "jdk.lang.Process.launchMechanism", "posix_spawn");
-
-                try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
-                } catch (IllegalArgumentException e) {
-                    throw new Error(s + " is not a supported " +
-                        "process launch mechanism on this platform.");
-                }
-            }
-        });
-    }
-
-    /* this is for the reaping thread */
-    private native int waitForProcessExit(int pid);
-
-    /**
-     * Create a process. Depending on the mode flag, this is done by
-     * one of the following mechanisms.
-     * - fork(2) and exec(2)
-     * - posix_spawn(2)
-     *
-     * @param fds an array of three file descriptors.
-     *        Indexes 0, 1, and 2 correspond to standard input,
-     *        standard output and standard error, respectively.  On
-     *        input, a value of -1 means to create a pipe to connect
-     *        child and parent processes.  On output, a value which
-     *        is not -1 is the parent pipe fd corresponding to the
-     *        pipe which has been created.  An element of this array
-     *        is -1 on input if and only if it is <em>not</em> -1 on
-     *        output.
-     * @return the pid of the subprocess
-     */
-    private native int forkAndExec(int mode, byte[] helperpath,
-                                   byte[] prog,
-                                   byte[] argBlock, int argc,
-                                   byte[] envBlock, int envc,
-                                   byte[] dir,
-                                   int[] fds,
-                                   boolean redirectErrorStream)
-        throws IOException;
-
-    /**
-     * The thread factory used to create "process reaper" daemon threads.
-     */
-    private static class ProcessReaperThreadFactory implements ThreadFactory {
-        private final static ThreadGroup group = getRootThreadGroup();
-
-        private static ThreadGroup getRootThreadGroup() {
-            return doPrivileged(new PrivilegedAction<ThreadGroup> () {
-                public ThreadGroup run() {
-                    ThreadGroup root = Thread.currentThread().getThreadGroup();
-                    while (root.getParent() != null)
-                        root = root.getParent();
-                    return root;
-                }});
-        }
-
-        public Thread newThread(Runnable grimReaper) {
-            // Our thread stack requirement is quite modest.
-            Thread t = new Thread(group, grimReaper, "process reaper", 32768);
-            t.setDaemon(true);
-            // A small attempt (probably futile) to avoid priority inversion
-            t.setPriority(Thread.MAX_PRIORITY);
-            return t;
-        }
-    }
-
-    /**
-     * The thread pool of "process reaper" daemon threads.
-     */
-    private static final Executor processReaperExecutor =
-        doPrivileged(new PrivilegedAction<Executor>() {
-            public Executor run() {
-                return Executors.newCachedThreadPool
-                    (new ProcessReaperThreadFactory());
-            }});
-
-    UNIXProcess(final byte[] prog,
-                final byte[] argBlock, int argc,
-                final byte[] envBlock, int envc,
-                final byte[] dir,
-                final int[] fds,
-                final boolean redirectErrorStream)
-    throws IOException {
-        pid = forkAndExec(launchMechanism.value,
-                          helperpath,
-                          prog,
-                          argBlock, argc,
-                          envBlock, envc,
-                          dir,
-                          fds,
-                          redirectErrorStream);
-
-        try {
-            doPrivileged(
-                new PrivilegedExceptionAction<Void>() {
-                    public Void run() throws IOException {
-                        initStreams(fds);
-                        return null;
-                    }
-                });
-        } catch (PrivilegedActionException ex) {
-            throw (IOException) ex.getException();
-        }
-    }
-
-    void initStreams(int[] fds) throws IOException {
-        if (fds[0] == -1)
-            stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
-        else {
-            FileDescriptor stdin_fd = new FileDescriptor();
-            fdAccess.set(stdin_fd, fds[0]);
-            stdin_stream = new BufferedOutputStream(
-                new FileOutputStream(stdin_fd));
-        }
-
-        if (fds[1] == -1)
-            stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
-        else {
-            FileDescriptor stdout_fd = new FileDescriptor();
-            fdAccess.set(stdout_fd, fds[1]);
-            stdout_inner_stream = new DeferredCloseInputStream(stdout_fd);
-            stdout_stream = new BufferedInputStream(stdout_inner_stream);
-        }
-
-        if (fds[2] == -1)
-            stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
-        else {
-            FileDescriptor stderr_fd = new FileDescriptor();
-            fdAccess.set(stderr_fd, fds[2]);
-            stderr_stream = new DeferredCloseInputStream(stderr_fd);
-        }
-
-        processReaperExecutor.execute(new Runnable() {
-            public void run() {
-                int exitcode = waitForProcessExit(pid);
-                UNIXProcess.this.processExited(exitcode);
-            }});
-    }
-
-    void processExited(int exitcode) {
-        synchronized (this) {
-            this.exitcode = exitcode;
-            hasExited = true;
-            notifyAll();
-        }
-    }
-
-    public OutputStream getOutputStream() {
-        return stdin_stream;
-    }
-
-    public InputStream getInputStream() {
-        return stdout_stream;
-    }
-
-    public InputStream getErrorStream() {
-        return stderr_stream;
-    }
-
-    public synchronized int waitFor() throws InterruptedException {
-        while (!hasExited) {
-            wait();
-        }
-        return exitcode;
-    }
-
-    @Override
-    public synchronized boolean waitFor(long timeout, TimeUnit unit)
-        throws InterruptedException
-    {
-        if (hasExited) return true;
-        if (timeout <= 0) return false;
-
-        long timeoutAsNanos = unit.toNanos(timeout);
-        long startTime = System.nanoTime();
-        long rem = timeoutAsNanos;
-
-        while (!hasExited && (rem > 0)) {
-            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
-            rem = timeoutAsNanos - (System.nanoTime() - startTime);
-        }
-        return hasExited;
-    }
-
-    public synchronized int exitValue() {
-        if (!hasExited) {
-            throw new IllegalThreadStateException("process hasn't exited");
-        }
-        return exitcode;
-    }
-
-    private static native void destroyProcess(int pid, boolean force);
-    private synchronized void destroy(boolean force) {
-        // There is a risk that pid will be recycled, causing us to
-        // kill the wrong process!  So we only terminate processes
-        // that appear to still be running.  Even with this check,
-        // there is an unavoidable race condition here, but the window
-        // is very small, and OSes try hard to not recycle pids too
-        // soon, so this is quite safe.
-        if (!hasExited)
-            destroyProcess(pid, force);
-        try {
-            stdin_stream.close();
-            if (stdout_inner_stream != null)
-                stdout_inner_stream.closeDeferred(stdout_stream);
-            if (stderr_stream instanceof DeferredCloseInputStream)
-                ((DeferredCloseInputStream) stderr_stream)
-                    .closeDeferred(stderr_stream);
-        } catch (IOException e) {
-            // ignore
-        }
-    }
-
-    public void destroy() {
-        destroy(false);
-    }
-
-    @Override
-    public Process destroyForcibly() {
-        destroy(true);
-        return this;
-    }
-
-    @Override
-    public synchronized boolean isAlive() {
-        return !hasExited;
-    }
-
-    // A FileInputStream that supports the deferment of the actual close
-    // operation until the last pending I/O operation on the stream has
-    // finished.  This is required on Solaris because we must close the stdin
-    // and stdout streams in the destroy method in order to reclaim the
-    // underlying file descriptors.  Doing so, however, causes any thread
-    // currently blocked in a read on one of those streams to receive an
-    // IOException("Bad file number"), which is incompatible with historical
-    // behavior.  By deferring the close we allow any pending reads to see -1
-    // (EOF) as they did before.
-    //
-    private static class DeferredCloseInputStream
-        extends FileInputStream
-    {
-
-        private DeferredCloseInputStream(FileDescriptor fd) {
-            super(fd);
-        }
-
-        private Object lock = new Object();     // For the following fields
-        private boolean closePending = false;
-        private int useCount = 0;
-        private InputStream streamToClose;
-
-        private void raise() {
-            synchronized (lock) {
-                useCount++;
-            }
-        }
-
-        private void lower() throws IOException {
-            synchronized (lock) {
-                useCount--;
-                if (useCount == 0 && closePending) {
-                    streamToClose.close();
-                }
-            }
-        }
-
-        // stc is the actual stream to be closed; it might be this object, or
-        // it might be an upstream object for which this object is downstream.
-        //
-        private void closeDeferred(InputStream stc) throws IOException {
-            synchronized (lock) {
-                if (useCount == 0) {
-                    stc.close();
-                } else {
-                    closePending = true;
-                    streamToClose = stc;
-                }
-            }
-        }
-
-        public void close() throws IOException {
-            synchronized (lock) {
-                useCount = 0;
-                closePending = false;
-            }
-            super.close();
-        }
-
-        public int read() throws IOException {
-            raise();
-            try {
-                return super.read();
-            } finally {
-                lower();
-            }
-        }
-
-        public int read(byte[] b) throws IOException {
-            raise();
-            try {
-                return super.read(b);
-            } finally {
-                lower();
-            }
-        }
-
-        public int read(byte[] b, int off, int len) throws IOException {
-            raise();
-            try {
-                return super.read(b, off, len);
-            } finally {
-                lower();
-            }
-        }
-
-        public long skip(long n) throws IOException {
-            raise();
-            try {
-                return super.skip(n);
-            } finally {
-                lower();
-            }
-        }
-
-        public int available() throws IOException {
-            raise();
-            try {
-                return super.available();
-            } finally {
-                lower();
-            }
-        }
-
-    }
-
-    private static native void init();
-
-    static {
-        init();
-    }
-}
diff --git a/src/solaris/classes/sun/awt/X11/ListHelper.java b/src/solaris/classes/sun/awt/X11/ListHelper.java
index 0a83eaa..93adf5f 100644
--- a/src/solaris/classes/sun/awt/X11/ListHelper.java
+++ b/src/solaris/classes/sun/awt/X11/ListHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
  * For now, this class manages the list of items and painting thereof, but not
  * posting of Item or ActionEvents
  */
-public class ListHelper implements XScrollbarClient {
+final class ListHelper implements XScrollbarClient {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.ListHelper");
 
     private final int FOCUS_INSET = 1;
@@ -79,24 +79,16 @@
     // Holds the true if mouse is dragging outside of the area of the list
     // The flag is used at the moment of the dragging and releasing mouse
     // See 6243382 for more information
-    boolean mouseDraggedOutVertically = false;
+    private boolean mouseDraggedOutVertically = false;
     private volatile boolean vsbVisibilityChanged = false;
 
     /*
      * Comment
      */
-    public ListHelper(XWindow peer,
-                      Color[] colors,
-                      int initialSize,
-                      boolean multiSelect,
-                      boolean scrollVert,
-                      boolean scrollHoriz,
-                      Font font,
-                      int maxVisItems,
-                      int SPACE,
-                      int MARGIN,
-                      int BORDER,
-                      int SCROLLBAR) {
+    ListHelper(XWindow peer, Color[] colors, int initialSize,
+               boolean multiSelect, boolean scrollVert, boolean scrollHoriz,
+               Font font, int maxVisItems, int SPACE, int MARGIN, int BORDER,
+               int SCROLLBAR) {
         this.peer = peer;
         this.colors = colors;
         this.multiSelect = multiSelect;
@@ -121,6 +113,7 @@
         SCROLLBAR_WIDTH = SCROLLBAR;
     }
 
+    @Override
     public Component getEventSource() {
         return peer.getEventSource();
     }
@@ -129,36 +122,36 @@
     /* List management methods                                            */
     /**********************************************************************/
 
-    public void add(String item) {
+    void add(String item) {
         items.add(item);
         updateScrollbars();
     }
 
-    public void add(String item, int index) {
+    void add(String item, int index) {
         items.add(index, item);
         updateScrollbars();
     }
 
-    public void remove(String item) {
+    void remove(String item) {
         // FIXME: need to clean up select list, too?
         items.remove(item);
         updateScrollbars();
         // Is vsb visible now?
     }
 
-    public void remove(int index) {
+    void remove(int index) {
         // FIXME: need to clean up select list, too?
         items.remove(index);
         updateScrollbars();
         // Is vsb visible now?
     }
 
-    public void removeAll() {
+    void removeAll() {
         items.removeAll(items);
         updateScrollbars();
     }
 
-    public void setMultiSelect(boolean ms) {
+    void setMultiSelect(boolean ms) {
         multiSelect = ms;
     }
 
@@ -167,7 +160,7 @@
      * merely keeps internal track of which items are selected for painting
      * dealing with target Components happens elsewhere
      */
-    public void select(int index) {
+    void select(int index) {
         if (index > getItemCount() - 1) {
             index = (isEmpty() ? -1 : 0);
         }
@@ -182,13 +175,13 @@
     }
 
     /* docs */
-    public void deselect(int index) {
+    void deselect(int index) {
         assert(false);
     }
 
     /* docs */
     /* if called for multiselect, return -1 */
-    public int getSelectedIndex() {
+    int getSelectedIndex() {
         if (!multiSelect) {
             Integer val = (Integer)selected.get(0);
             return val.intValue();
@@ -202,21 +195,21 @@
      * A getter method for XChoicePeer.
      * Returns vsbVisiblityChanged value and sets it to false.
      */
-    public boolean checkVsbVisibilityChangedAndReset(){
+    boolean checkVsbVisibilityChangedAndReset(){
         boolean returnVal = vsbVisibilityChanged;
         vsbVisibilityChanged = false;
         return returnVal;
     }
 
-    public boolean isEmpty() {
+    boolean isEmpty() {
         return items.isEmpty();
     }
 
-    public int getItemCount() {
+    int getItemCount() {
         return items.size();
     }
 
-    public String getItem(int index) {
+    String getItem(int index) {
         return (String) items.get(index);
     }
 
@@ -224,15 +217,15 @@
     /* GUI-related methods                                                */
     /**********************************************************************/
 
-    public void setFocusedIndex(int index) {
+    void setFocusedIndex(int index) {
         focusedIndex = index;
     }
 
-    public boolean isFocusedIndex(int index) {
+    private boolean isFocusedIndex(int index) {
         return index == focusedIndex;
     }
 
-    public void setFont(Font newFont) {
+    void setFont(Font newFont) {
         if (newFont != font) {
             font = newFont;
             fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
@@ -243,7 +236,7 @@
     /*
      * Returns width of the text of the longest item
      */
-    public int getMaxItemWidth() {
+    int getMaxItemWidth() {
         int m = 0;
         int end = getItemCount();
         for(int i = 0 ; i < end ; i++) {
@@ -260,7 +253,7 @@
         return fm.getHeight() + (2*TEXT_SPACE);
     }
 
-    public int y2index(int y) {
+    int y2index(int y) {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("y=" + y +", firstIdx=" + firstDisplayedIndex() +", itemHeight=" + getItemHeight()
                      + ",item_margin=" + ITEM_MARGIN);
@@ -275,14 +268,14 @@
     public int numItemsDisplayed() {}
     */
 
-    public int firstDisplayedIndex() {
+    int firstDisplayedIndex() {
         if (vsbVis) {
             return vsb.getValue();
         }
         return 0;
     }
 
-    public int lastDisplayedIndex() {
+    int lastDisplayedIndex() {
         // FIXME: need to account for horiz scroll bar
         if (hsbVis) {
             assert false : "Implement for horiz scroll bar";
@@ -294,7 +287,7 @@
     /*
      * If the given index is not visible in the List, scroll so that it is.
      */
-    public void makeVisible(int index) {
+    private void makeVisible(int index) {
         if (vsbVis) {
             if (index < firstDisplayedIndex()) {
                 vsb.setValue(index);
@@ -306,7 +299,7 @@
     }
 
     // FIXME: multi-select needs separate focused index
-    public void up() {
+    void up() {
         int curIdx = getSelectedIndex();
         int numItems = getItemCount();
         int newIdx;
@@ -323,12 +316,12 @@
         select(newIdx);
     }
 
-    public void down() {
+    void down() {
         int newIdx = (getSelectedIndex() + 1) % getItemCount();
         select(newIdx);
     }
 
-    public void pageUp() {
+    void pageUp() {
         // FIXME: for multi-select, move the focused item, not the selected item
         if (vsbVis && firstDisplayedIndex() > 0) {
             if (multiSelect) {
@@ -343,7 +336,7 @@
             }
         }
     }
-    public void pageDown() {
+    void pageDown() {
         if (vsbVis && lastDisplayedIndex() < getItemCount() - 1) {
             if (multiSelect) {
                 assert false : "Implement pageDown() for multiSelect";
@@ -357,17 +350,17 @@
             }
         }
     }
-    public void home() {}
-    public void end() {}
+    void home() {}
+    void end() {}
 
 
-    public boolean isVSBVisible() { return vsbVis; }
-    public boolean isHSBVisible() { return hsbVis; }
+    boolean isVSBVisible() { return vsbVis; }
+    boolean isHSBVisible() { return hsbVis; }
 
-    public XVerticalScrollbar getVSB() { return vsb; }
-    public XHorizontalScrollbar getHSB() { return hsb; }
+    XVerticalScrollbar getVSB() { return vsb; }
+    XHorizontalScrollbar getHSB() { return hsb; }
 
-    public boolean isInVertSB(Rectangle bounds, int x, int y) {
+    boolean isInVertSB(Rectangle bounds, int x, int y) {
         if (vsbVis) {
             assert vsb != null : "Vert scrollbar is visible, yet is null?";
             int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
@@ -379,7 +372,7 @@
         return false;
     }
 
-    public boolean isInHorizSB(Rectangle bounds, int x, int y) {
+    boolean isInHorizSB(Rectangle bounds, int x, int y) {
         if (hsbVis) {
             assert hsb != null : "Horiz scrollbar is visible, yet is null?";
 
@@ -392,7 +385,7 @@
         return false;
     }
 
-    public void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
+    void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
         int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;
 
         vsb.handleMouseEvent(e.getID(),
@@ -405,7 +398,7 @@
      * Called when items are added/removed.
      * Update whether the scrollbar is visible or not, scrollbar values
      */
-    void updateScrollbars() {
+    private void updateScrollbars() {
         boolean oldVsbVis = vsbVis;
         vsbVis = vsb != null && items.size() > maxVisItems;
         if (vsbVis) {
@@ -420,10 +413,11 @@
         // FIXME: check if added item makes a hsb necessary (if supported, that of course)
     }
 
-    public int getNumItemsDisplayed() {
+    private int getNumItemsDisplayed() {
         return items.size() > maxVisItems ? maxVisItems : items.size();
     }
 
+    @Override
     public void repaintScrollbarRequest(XScrollbar sb) {
         Graphics g = peer.getGraphics();
         Rectangle bounds = peer.getBounds();
@@ -436,6 +430,7 @@
         g.dispose();
     }
 
+    @Override
     public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
         if (obj == vsb) {
             int oldScrollValue = vsb.getValue();
@@ -467,7 +462,7 @@
         }
     }
 
-    public void updateColors(Color[] newColors) {
+    void updateColors(Color[] newColors) {
         colors = newColors;
     }
 
@@ -481,7 +476,7 @@
                            XVerticalScrollbar vsb,
                            XHorizontalScrollbar hsb) {
     */
-    public void paintItems(Graphics g,
+    void paintItems(Graphics g,
                            Color[] colors,
                            Rectangle bounds) {
         // paint border
@@ -490,17 +485,14 @@
         // paint focus?
 
     }
-    public void paintAllItems(Graphics g,
+    void paintAllItems(Graphics g,
                            Color[] colors,
                            Rectangle bounds) {
         paintItems(g, colors, bounds,
                    firstDisplayedIndex(), lastDisplayedIndex());
     }
-    public void paintItems(Graphics g,
-                           Color[] colors,
-                           Rectangle bounds,
-                           int first,
-                           int last) {
+    private void paintItems(Graphics g, Color[] colors, Rectangle bounds,
+                            int first, int last) {
         peer.flush();
         int x = BORDER_WIDTH + ITEM_MARGIN;
         int width = bounds.width - 2*ITEM_MARGIN - 2*BORDER_WIDTH - (vsbVis ? SCROLLBAR_WIDTH : 0);
@@ -529,12 +521,9 @@
     /*
      * comment about what is painted (i.e. the focus rect
      */
-    public void paintItem(Graphics g,
-                          Color[] colors,
-                          String string,
-                          int x, int y, int width, int height,
-                          boolean selected,
-                          boolean focused) {
+    private void paintItem(Graphics g, Color[] colors, String string, int x,
+                           int y, int width, int height, boolean selected,
+                           boolean focused) {
         //System.out.println("LP.pI(): x="+x+" y="+y+" w="+width+" h="+height);
         //g.setColor(colors[BACKGROUND_COLOR]);
 
@@ -575,7 +564,7 @@
         //g.clipRect(clip.x, clip.y, clip.width, clip.height);
     }
 
-    boolean isItemSelected(int index) {
+    private boolean isItemSelected(int index) {
         Iterator itr = selected.iterator();
         while (itr.hasNext()) {
             Integer val = (Integer)itr.next();
@@ -586,7 +575,7 @@
         return false;
     }
 
-    public void paintVSB(Graphics g, Color colors[], Rectangle bounds) {
+    private void paintVSB(Graphics g, Color colors[], Rectangle bounds) {
         int height = bounds.height - 2*BORDER_WIDTH - (hsbVis ? (SCROLLBAR_WIDTH-2) : 0);
         Graphics ng = g.create();
 
@@ -602,7 +591,7 @@
         }
     }
 
-    public void paintHSB(Graphics g, Color colors[], Rectangle bounds) {
+    private void paintHSB(Graphics g, Color colors[], Rectangle bounds) {
 
     }
 
diff --git a/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java b/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java
index 49d48c8..05e7573 100644
--- a/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java
+++ b/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.Graphics;
+import java.awt.dnd.DropTarget;
 
 import sun.awt.LightweightFrame;
 import sun.swing.JLightweightFrame;
@@ -69,4 +70,14 @@
     public void updateCursorImmediately() {
         SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
     }
+
+    @Override
+    public void addDropTarget(DropTarget dt) {
+        getLwTarget().addDropTarget(dt);
+    }
+
+    @Override
+    public void removeDropTarget(DropTarget dt) {
+        getLwTarget().removeDropTarget(dt);
+    }
 }
diff --git a/src/solaris/classes/sun/awt/X11/XRootWindow.java b/src/solaris/classes/sun/awt/X11/XRootWindow.java
index 1a35581..6b8b162 100644
--- a/src/solaris/classes/sun/awt/X11/XRootWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XRootWindow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,8 @@
     }
 
     private XRootWindow() {
-        super(new XCreateWindowParams(new Object[] {DELAYED, Boolean.TRUE}));
+        super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
+                                                     EVENT_MASK, XConstants.StructureNotifyMask }));
     }
 
     public void postInit(XCreateWindowParams params){
diff --git a/src/solaris/classes/sun/awt/X11/XSelection.java b/src/solaris/classes/sun/awt/X11/XSelection.java
index 36ebc8e..529c21c 100644
--- a/src/solaris/classes/sun/awt/X11/XSelection.java
+++ b/src/solaris/classes/sun/awt/X11/XSelection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
 /**
  * A class which interfaces with the X11 selection service.
  */
-public final class XSelection {
+final class XSelection {
 
     /* Maps atoms to XSelection instances. */
     private static final Hashtable<XAtom, XSelection> table = new Hashtable<XAtom, XSelection>();
@@ -118,11 +118,10 @@
     /**
      * Creates a selection object.
      *
-     * @param atom   the selection atom.
-     * @param clpbrd the corresponding clipoboard
-     * @exception NullPointerException if atom is <code>null</code>.
+     * @param  atom the selection atom
+     * @throws NullPointerException if atom is {@code null}
      */
-    public XSelection(XAtom atom) {
+    XSelection(XAtom atom) {
         if (atom == null) {
             throw new NullPointerException("Null atom");
         }
@@ -134,8 +133,8 @@
         return selectionAtom;
     }
 
-    public synchronized boolean setOwner(Transferable contents, Map formatMap,
-                                         long[] formats, long time)
+    synchronized boolean setOwner(Transferable contents, Map formatMap,
+                                  long[] formats, long time)
     {
         long owner = XWindow.getXAWTRootWindow().getWindow();
         long selection = selectionAtom.getAtom();
@@ -433,7 +432,7 @@
         return data != null ? data : new byte[0];
     }
 
-    void validateDataGetter(WindowPropertyGetter propertyGetter)
+    private void validateDataGetter(WindowPropertyGetter propertyGetter)
             throws IOException
     {
         // The order of checks is important because a property getter
diff --git a/src/solaris/classes/sun/awt/X11/XToolkit.java b/src/solaris/classes/sun/awt/X11/XToolkit.java
index 9ad8fed..7d0da74 100644
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -164,7 +164,7 @@
     }
 
 
-    public native void nativeLoadSystemColors(int[] systemColors);
+    private native void nativeLoadSystemColors(int[] systemColors);
 
     static UIDefaults getUIDefaults() {
         if (uidefaults == null) {
@@ -903,6 +903,11 @@
     }
 
     public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
+        if (f != null) {
+            return f.createDragSourceContextPeer(dge);
+        }
+
         return XDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
@@ -913,6 +918,11 @@
                     int srcActions,
                     DragGestureListener dgl)
     {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(c);
+        if (f != null) {
+            return f.createDragGestureRecognizer(recognizerClass, ds, c, srcActions, dgl);
+        }
+
         if (MouseDragGestureRecognizer.class.equals(recognizerClass))
             return (T)new XMouseDragGestureRecognizer(ds, c, srcActions, dgl);
         else
@@ -2344,9 +2354,7 @@
 
     private static XEventDispatcher oops_waiter;
     private static boolean oops_updated;
-    private static boolean oops_failed;
-    private XAtom oops;
-    private static final long WORKAROUND_SLEEP = 100;
+    private static boolean oops_move;
 
     /**
      * @inheritDoc
@@ -2357,52 +2365,33 @@
         if (oops_waiter == null) {
             oops_waiter = new XEventDispatcher() {
                     public void dispatchEvent(XEvent e) {
-                        if (e.get_type() == XConstants.SelectionNotify) {
-                            XSelectionEvent pe = e.get_xselection();
-                            if (pe.get_property() == oops.getAtom()) {
-                                oops_updated = true;
-                                awtLockNotifyAll();
-                            } else if (pe.get_selection() == XAtom.get("WM_S0").getAtom() &&
-                                       pe.get_target() == XAtom.get("VERSION").getAtom() &&
-                                       pe.get_property() == 0 &&
-                                       XlibWrapper.XGetSelectionOwner(getDisplay(), XAtom.get("WM_S0").getAtom()) == 0)
-                            {
-                                // WM forgot to acquire selection  or there is no WM
-                                oops_failed = true;
-                                awtLockNotifyAll();
-                            }
-
+                        if (e.get_type() == XConstants.ConfigureNotify) {
+                            // OOPS ConfigureNotify event catched
+                            oops_updated = true;
+                            awtLockNotifyAll();
                         }
                     }
                 };
         }
 
-        if (oops == null) {
-            oops = XAtom.get("OOPS");
-        }
-
         awtLock();
         try {
             addEventDispatcher(win.getWindow(), oops_waiter);
 
             oops_updated = false;
-            oops_failed = false;
-            // Wait for selection notify for oops on win
             long event_number = getEventNumber();
-            XAtom atom = XAtom.get("WM_S0");
-            if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
-                eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
-            }
-            XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
-                                          XAtom.get("VERSION").getAtom(), oops.getAtom(),
-                                          win.getWindow(), XConstants.CurrentTime);
+            // Generate OOPS ConfigureNotify event
+            XlibWrapper.XMoveWindow(getDisplay(), win.getWindow(), oops_move ? 0 : 1, 0);
+            // Change win position each time to avoid system optimization
+            oops_move = !oops_move;
             XSync();
 
-            eventLog.finer("Requested OOPS");
+            eventLog.finer("Generated OOPS ConfigureNotify event");
 
             long start = System.currentTimeMillis();
-            while (!oops_updated && !oops_failed) {
+            while (!oops_updated) {
                 try {
+                    // Wait for OOPS ConfigureNotify event
                     awtLockWait(timeout);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
@@ -2413,20 +2402,8 @@
                     throw new OperationTimedOut(Long.toString(System.currentTimeMillis() - start));
                 }
             }
-            if (oops_failed && getEventNumber() - event_number == 1) {
-                // If selection update failed we can simply wait some time
-                // hoping some events will arrive
-                awtUnlock();
-                eventLog.finest("Emergency sleep");
-                try {
-                    Thread.sleep(WORKAROUND_SLEEP);
-                } catch (InterruptedException ie) {
-                    throw new RuntimeException(ie);
-                } finally {
-                    awtLock();
-                }
-            }
-            return getEventNumber() - event_number > 2;
+            // Don't take into account OOPS ConfigureNotify event
+            return getEventNumber() - event_number > 1;
         } finally {
             removeEventDispatcher(win.getWindow(), oops_waiter);
             eventLog.finer("Exiting syncNativeQueue");
diff --git a/src/solaris/classes/sun/awt/X11/XWindow.java b/src/solaris/classes/sun/awt/X11/XWindow.java
index e55b8b8..65fb345 100644
--- a/src/solaris/classes/sun/awt/X11/XWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java
@@ -43,7 +43,7 @@
 import sun.java2d.SunGraphics2D;
 import sun.java2d.SurfaceData;
 
-public class XWindow extends XBaseWindow implements X11ComponentPeer {
+class XWindow extends XBaseWindow implements X11ComponentPeer {
     private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindow");
     private static PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWindow");
     private static PlatformLogger eventLog = PlatformLogger.getLogger("sun.awt.X11.event.XWindow");
@@ -55,7 +55,6 @@
    */
     private final static int AWT_MULTICLICK_SMUDGE = 4;
     // ButtonXXX events stuff
-    static int rbutton = 0;
     static int lastX = 0, lastY = 0;
     static long lastTime = 0;
     static long lastButton = 0;
@@ -632,23 +631,6 @@
         return res;
     }
 
-    /**
-     * Returns true if this event is disabled and shouldn't be passed to Java.
-     * Default implementation returns false for all events.
-     */
-    static int getRightButtonNumber() {
-        if (rbutton == 0) { // not initialized yet
-            XToolkit.awtLock();
-            try {
-                rbutton = XlibWrapper.XGetPointerMapping(XToolkit.getDisplay(), XlibWrapper.ibuffer, 3);
-            }
-            finally {
-                XToolkit.awtUnlock();
-            }
-        }
-        return rbutton;
-    }
-
     static int getMouseMovementSmudge() {
         //TODO: It's possible to read corresponding settings
         return AWT_MULTICLICK_SMUDGE;
@@ -716,11 +698,7 @@
             /*
                Check for popup trigger !!
             */
-            if (lbutton == getRightButtonNumber() || lbutton > 2) {
-                popupTrigger = true;
-            } else {
-                popupTrigger = false;
-            }
+            popupTrigger = (lbutton == 3);
         }
 
         button = XConstants.buttons[lbutton - 1];
@@ -858,8 +836,10 @@
 
 
     // REMIND: need to implement looking for disabled events
-    public native boolean x11inputMethodLookupString(long event, long [] keysymArray);
-    native boolean haveCurrentX11InputMethodInstance();
+    private native boolean x11inputMethodLookupString(long event,
+                                                      long[] keysymArray);
+
+    private native boolean haveCurrentX11InputMethodInstance();
 
     private boolean mouseAboveMe;
 
diff --git a/src/solaris/classes/sun/awt/X11/XlibWrapper.java b/src/solaris/classes/sun/awt/X11/XlibWrapper.java
index fb30079..01d0640 100644
--- a/src/solaris/classes/sun/awt/X11/XlibWrapper.java
+++ b/src/solaris/classes/sun/awt/X11/XlibWrapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,12 @@
 package sun.awt.X11;
 
 import java.security.AccessController;
-import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
-import sun.misc.*;
 
-final public class XlibWrapper
-{
+import sun.misc.Unsafe;
+import sun.security.action.GetPropertyAction;
+
+final class XlibWrapper {
+
     static Unsafe unsafe = Unsafe.getUnsafe();
     // strange constants
     static final int MAXSIZE = 32767;
@@ -48,7 +48,7 @@
    char *display_name;
 
 */
-    public final static String eventToString[]=
+    static final String[] eventToString =
     {"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
      "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
      "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
@@ -66,7 +66,7 @@
 
     /**
      * Gets byte string from str_ptr and copies it into byte array
-     * String should be NULL terminated
+     * String should be NULL terminated.
      */
     static native byte[] getStringBytes(long str_ptr);
 
@@ -529,7 +529,7 @@
           display   Specifies the connection to the X server.
           onoff     Specifies a Boolean value that indicates whether to enable or disable synchronization.
      */
-    public static native int XSynchronize(long display, boolean onoff);
+    static native int XSynchronize(long display, boolean onoff);
 
     /**
      * Extracts an X event that can be processed in a secondary loop.
diff --git a/src/solaris/classes/sun/awt/X11FontManager.java b/src/solaris/classes/sun/awt/X11FontManager.java
index 573d250..b3a91df 100644
--- a/src/solaris/classes/sun/awt/X11FontManager.java
+++ b/src/solaris/classes/sun/awt/X11FontManager.java
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.awt;
 
 import java.awt.GraphicsEnvironment;
@@ -29,7 +54,7 @@
 /**
  * The X11 implementation of {@link FontManager}.
  */
-public class X11FontManager extends SunFontManager {
+public final class X11FontManager extends SunFontManager {
 
     // constants identifying XLFD and font ID fields
     private static final int FOUNDRY_FIELD = 1;
@@ -129,8 +154,6 @@
       */
      private static String[] fontdirs = null;
 
-    private static String[] defaultPlatformFont = null;
-
     private FontConfigManager fcManager = null;
 
     public static X11FontManager getInstance() {
@@ -768,11 +791,9 @@
         return getFontPathNative(noType1Fonts);
     }
 
-    public String[] getDefaultPlatformFont() {
-        if (defaultPlatformFont != null) {
-            return defaultPlatformFont;
-        }
-        String[] info = new String[2];
+    @Override
+    protected String[] getDefaultPlatformFont() {
+        final String[] info = new String[2];
         getFontConfigManager().initFontConfigFonts(false);
         FontConfigManager.FcCompFont[] fontConfigFonts =
             getFontConfigManager().getFontConfigFonts();
@@ -798,8 +819,7 @@
                 info[1] = "/dialog.ttf";
             }
         }
-        defaultPlatformFont = info;
-        return defaultPlatformFont;
+        return info;
     }
 
     public synchronized FontConfigManager getFontConfigManager() {
diff --git a/src/solaris/classes/sun/awt/windows/ThemeReader.java b/src/solaris/classes/sun/awt/windows/ThemeReader.java
index 7445cc2..5bd2f7e 100644
--- a/src/solaris/classes/sun/awt/windows/ThemeReader.java
+++ b/src/solaris/classes/sun/awt/windows/ThemeReader.java
@@ -45,6 +45,10 @@
         return false;
     }
 
+    public static boolean isXPStyleEnabled() {
+        return false;
+    }
+
     public static void paintBackground(int[] buffer, String widget,
            int part, int state, int x, int y, int w, int h, int stride) {
     }
diff --git a/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java b/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java
index 9d95769..f999748 100644
--- a/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java
+++ b/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
 
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -31,12 +31,14 @@
 
     XRSurfaceData srcPict;
     XRColor xrCol;
-    int curPixVal = -1;
+    int curPixVal;
 
     public XRSolidSrcPict(XRBackend con, int parentXid) {
         this.con = con;
 
         xrCol = new XRColor();
+        curPixVal = 0xFF000000;
+
         int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
         int solidSrcPictXID = con.createPicture(solidPixmap, XRUtils.PictStandardARGB32);
         con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
diff --git a/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java b/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
index 3554d31..6211811 100644
--- a/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
+++ b/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
@@ -77,8 +77,7 @@
 
     static {
         defaultDomain = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("http.auth.ntlm.domain",
-                                                      "domain"));
+            new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", ""));
     };
 
     public static boolean supportsTransparentAuth () {
@@ -100,17 +99,13 @@
             public String run() {
                 String localhost;
                 try {
-                    localhost = InetAddress.getLocalHost().getHostName().toUpperCase();
+                    localhost = InetAddress.getLocalHost().getHostName();
                 } catch (UnknownHostException e) {
                      localhost = "localhost";
                 }
                 return localhost;
             }
         });
-        int x = hostname.indexOf ('.');
-        if (x != -1) {
-            hostname = hostname.substring (0, x);
-        }
     };
 
     PasswordAuthentication pw;
diff --git a/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java b/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
index 871f194..8c7cfd2 100644
--- a/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
+++ b/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
@@ -141,7 +141,7 @@
         Throwable exc = null;
         try {
             begin();
-            int n = accept0(this.fd, newfd, isaa);
+            int n = accept(this.fd, newfd, isaa);
 
             // spurious wakeup, is this possible?
             if (n == IOStatus.UNAVAILABLE) {
@@ -277,7 +277,7 @@
         try {
             begin();
 
-            int n = accept0(this.fd, newfd, isaa);
+            int n = accept(this.fd, newfd, isaa);
             if (n == IOStatus.UNAVAILABLE) {
 
                 // need calling context when there is security manager as
@@ -332,6 +332,18 @@
         }
     }
 
+    /**
+     * Accept a connection on a socket.
+     *
+     * @implNote Wrap native call to allow instrumentation.
+     */
+    private int accept(FileDescriptor ssfd, FileDescriptor newfd,
+                       InetSocketAddress[] isaa)
+        throws IOException
+    {
+        return accept0(ssfd, newfd, isaa);
+    }
+
     // -- Native methods --
 
     private static native void initIDs();
diff --git a/src/solaris/classes/sun/print/CUPSPrinter.java b/src/solaris/classes/sun/print/CUPSPrinter.java
index 2899af8..1a941d0 100644
--- a/src/solaris/classes/sun/print/CUPSPrinter.java
+++ b/src/solaris/classes/sun/print/CUPSPrinter.java
@@ -140,6 +140,9 @@
         return cupsCustomMediaSNames;
     }
 
+    public int getDefaultMediaIndex() {
+        return ((pageSizes.length >1) ? (int)(pageSizes[pageSizes.length -1]) : 0);
+    }
 
     /**
      * Returns array of MediaPrintableArea derived from PPD.
@@ -201,8 +204,15 @@
 
                 // add this new custom msn to MediaSize array
                 if ((width > 0.0) && (length > 0.0)) {
+                    try {
                     new MediaSize(width, length,
                                   Size2DSyntax.INCH, msn);
+                    } catch (IllegalArgumentException e) {
+                        /* PDF printer in Linux for Ledger paper causes
+                        "IllegalArgumentException: X dimension > Y dimension".
+                        We rotate based on IPP spec. */
+                        new MediaSize(length, width, Size2DSyntax.INCH, msn);
+                    }
                 }
             }
 
diff --git a/src/solaris/classes/sun/print/IPPPrintService.java b/src/solaris/classes/sun/print/IPPPrintService.java
index b7acf6b..a355b17 100644
--- a/src/solaris/classes/sun/print/IPPPrintService.java
+++ b/src/solaris/classes/sun/print/IPPPrintService.java
@@ -414,6 +414,7 @@
                     mediaSizeNames = cps.getMediaSizeNames();
                     mediaTrays = cps.getMediaTrays();
                     customMediaSizeNames = cps.getCustomMediaSizeNames();
+                    defaultMediaIndex = cps.getDefaultMediaIndex();
                     urlConnection.disconnect();
                     init = true;
                     return;
@@ -1436,7 +1437,9 @@
                 return JobSheets.STANDARD;
             }
         } else if (category == Media.class) {
-            defaultMediaIndex = 0;
+            if (defaultMediaIndex == -1) {
+                defaultMediaIndex = 0;
+            }
             if (mediaSizeNames.length == 0) {
                 String defaultCountry = Locale.getDefault().getCountry();
                 if (defaultCountry != null &&
@@ -1452,17 +1455,7 @@
             if (attribClass != null) {
                 String name = attribClass.getStringValue();
                 if (isCupsPrinter) {
-                    for (int i=0; i< customMediaSizeNames.length; i++) {
-                        //REMIND:  get default from PPD. In native _getMedia,
-                        // move default (ppd_option_t->defchoice) to index 0.
-                        // In the meantime, use indexOf because PPD name
-                        // may be different from the IPP attribute name.
-                        if (customMediaSizeNames[i].toString().indexOf(name)
-                            != -1) {
-                            defaultMediaIndex = i;
-                            return mediaSizeNames[defaultMediaIndex];
-                        }
-                    }
+                    return mediaSizeNames[defaultMediaIndex];
                 } else {
                     for (int i=0; i< mediaSizeNames.length; i++) {
                         if (mediaSizeNames[i].toString().indexOf(name) != -1) {
diff --git a/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java b/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
index d58a4c1..ad344f1 100644
--- a/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,14 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
-import java.util.Properties;
 
 /*
  * Bsd implementation of HotSpotVirtualMachine
@@ -191,6 +191,8 @@
         }
 
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
 
             // In the event of a protocol mismatch then the target VM
@@ -205,7 +207,11 @@
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
@@ -237,8 +243,9 @@
             if ((off < 0) || (off > bs.length) || (len < 0) ||
                 ((off + len) > bs.length) || ((off + len) < 0)) {
                 throw new IndexOutOfBoundsException();
-            } else if (len == 0)
+            } else if (len == 0) {
                 return 0;
+            }
 
             return BsdVirtualMachine.read(s, bs, off, len);
         }
diff --git a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
index 1e08d70..9dec425 100644
--- a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,14 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
-import java.util.Properties;
 
 /*
  * Linux implementation of HotSpotVirtualMachine
@@ -207,6 +207,8 @@
         }
 
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
 
             // In the event of a protocol mismatch then the target VM
@@ -221,7 +223,11 @@
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
diff --git a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
index c7dcf21..3c57e4b 100644
--- a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,15 +24,15 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.util.Properties;
 
 /*
  * Solaris implementation of HotSpotVirtualMachine.
@@ -147,11 +147,17 @@
         // If non-0 it means an error but we need to special-case the
         // "load" command to ensure that the right exception is thrown.
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
diff --git a/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java b/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
index 89981bf..d549b87 100644
--- a/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
+++ b/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,100 +25,10 @@
 
 package sun.util.locale.provider;
 
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.text.spi.DateFormatProvider;
-import java.util.Locale;
-
 /**
  * LocaleProviderAdapter implementation for the Unix locale data
  *
  * @author Naoto Sato
  */
 public class HostLocaleProviderAdapterImpl {
-    static Locale[] supported = {Locale.getDefault(Locale.Category.FORMAT)};
-
-    public static DateFormatProvider getDateFormatProvider() {
-        return new DateFormatProvider() {
-            String posixPattern;
-
-            @Override
-            public Locale[] getAvailableLocales() {
-                // not implemented yet
-                return new Locale[0];
             }
-            @Override
-            public DateFormat getDateInstance(int style, Locale locale) {
-                posixPattern = getPattern(style, -1, locale.toLanguageTag());
-                return new SimpleDateFormat(convertPosixToJava(posixPattern), locale);
-            }
-            @Override
-            public DateFormat getTimeInstance(int style, Locale locale) {
-                posixPattern = getPattern(-1, style, locale.toLanguageTag());
-                return new SimpleDateFormat(convertPosixToJava(posixPattern), locale);
-            }
-            @Override
-            public DateFormat getDateTimeInstance(int dateStyle,
-                    int timeStyle, Locale locale) {
-                posixPattern = getPattern(dateStyle, timeStyle, locale.toLanguageTag());
-                return new SimpleDateFormat(convertPosixToJava(posixPattern), locale);
-            }
-        };
-    }
-
-    private static String convertPosixToJava(String posixPattern) {
-        StringBuilder sb = new StringBuilder();
-        boolean conversion = false;
-
-        for (int index = 0; index < posixPattern.length(); index++) {
-            char c = posixPattern.charAt(index);
-            if (conversion) {
-                switch (c) {
-                case 'a':
-                    sb.append("EEE");
-                    break;
-                case 'b':
-                    sb.append("MMM");
-                    break;
-                case 'e':
-                    sb.append("dd");
-                    break;
-                case 'H':
-                    sb.append("kk");
-                    break;
-                case 'M':
-                    sb.append("mm");
-                    break;
-                case 'S':
-                    sb.append("ss");
-                    break;
-                case 'Y':
-                    sb.append("yyyy");
-                    break;
-                case 'm':
-                    sb.append("MM");
-                    break;
-                case 'd':
-                    sb.append("dd");
-                    break;
-                case 'r':
-                    sb.append("hh:mm:ss aa");
-                    break;
-                case 'Z':
-                    sb.append("zzz");
-                    break;
-                }
-                conversion = false;
-            } else {
-                if (c == '%') {
-                    conversion = true;
-                } else {
-                    sb.append(c);
-                }
-            }
-        }
-        return sb.toString();
-    }
-
-    private static native String getPattern(int dateStyle, int timeStyle, String langtag);
-}
diff --git a/src/solaris/doc/sun/man/man1/java.1 b/src/solaris/doc/sun/man/man1/java.1
index bc8f1f1..552dd48 100644
--- a/src/solaris/doc/sun/man/man1/java.1
+++ b/src/solaris/doc/sun/man/man1/java.1
@@ -1,3461 +1,2198 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: java
-.\" Language: English
-.\" Date: 08 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: java.1
 .\"
 .if n .pl 99999
-.TH "java" "1" "08 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH java 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 java \- Launches a Java application\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fIclassname\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.fi     
+.nf     
+
 \fBjava\fR [\fIoptions\fR] \fB\-jar\fR \fIfilename\fR [\fIargs\fR]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options separated by spaces\&. See Options\&.
-.RE
-.PP
+Command-line options separated by spaces\&. See Options\&.
+.TP     
 \fIclassname\fR
-.RS 4
 The name of the class to be launched\&.
-.RE
-.PP
+.TP     
 \fIfilename\fR
-.RS 4
-The name of the Java Archive (JAR) file to be called\&. Used only with the
-\fB\-jar\fR
-option\&.
-.RE
-.PP
+The name of the Java Archive (JAR) file to be called\&. Used only with the \f3-jar\fR option\&.
+.TP     
 \fIargs\fR
-.RS 4
-The arguments passed to the
-\fBmain()\fR
-method separated by spaces\&.
-.RE
-.SH "DESCRIPTION"
+The arguments passed to the \f3main()\fR method separated by spaces\&.
+.SH DESCRIPTION    
+The \f3java\fR command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\&'s \f3main()\fR method\&. The method must be declared \fIpublic\fR and \fIstatic\fR, it must not return any value, and it must accept a \f3String\fR array as a parameter\&. The method declaration has the following form:
+.sp     
+.nf     
+\f3public static void main(String[] args)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3java\fR command can be used to launch a JavaFX application by loading a class that either has a \f3main()\fR method or that extends \f3javafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the \f3Application\fR class, calls its \f3init()\fR method, and then calls the \f3start(javafx\&.stage\&.Stage)\fR method\&.
 .PP
-The
-\fBjava\fR
-command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\*(Aqs
-\fBmain()\fR
-method\&. The method must be declared
-\fIpublic\fR
-and
-\fIstatic\fR, it must not return any value, and it must accept a
-\fBString\fR
-array as a parameter\&. The method declaration has the following form:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static void main(String[] args)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-The
-\fBjava\fR
-command can be used to launch a JavaFX application by loading a class that either has a
-\fBmain()\fR
-method or that extends
-\fBjavafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the
-\fBApplication\fR
-class, calls its
-\fBinit()\fR
-method, and then calls the
-\fBstart(javafx\&.stage\&.Stage)\fR
-method\&.
-.PP
-By default, the first argument that is not an option of the
-\fBjava\fR
-command is the fully qualified name of the class to be called\&. If the
-\fB\-jar\fR
-option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the
-\fBMain\-Class\fR
-manifest header in its source code\&.
+By default, the first argument that is not an option of the \f3java\fR command is the fully qualified name of the class to be called\&. If the \f3-jar\fR option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the \f3Main-Class\fR manifest header in its source code\&.
 .PP
 The JRE searches for the startup class (and other classes used by the application) in three sets of locations: the bootstrap class path, the installed extensions, and the user\(cqs class path\&.
 .PP
-Arguments after the class file name or the JAR file name are passed to the
-\fBmain()\fR
-method\&.
-.SH "OPTIONS"
-.PP
-The
-\fBjava\fR
-command supports a wide range of options that can be divided into the following categories:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+Arguments after the class file name or the JAR file name are passed to the \f3main()\fR method\&.
+.SH OPTIONS    
+The \f3java\fR command supports a wide range of options that can be divided into the following categories:
+.TP 0.2i    
+\(bu
 Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Non\-Standard Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
+Non-Standard Options
+.TP 0.2i    
+\(bu
 Advanced Runtime Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced JIT Compiler Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Serviceability Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 Advanced Garbage Collection Options
-.RE
 .PP
 Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM)\&. They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on\&.
 .PP
-Non\-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with
-\fB\-X\fR\&.
+Non-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with \f3-X\fR\&.
 .PP
-Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with
-\fB\-XX\fR\&.
+Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with \f3-XX\fR\&.
 .PP
 To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document\&.
 .PP
-Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean
-\fB\-XX\fR
-options are enabled using the plus sign (\fB\-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\fB\-XX:\-\fR\fIOptionName\fR)\&.
+Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean \f3-XX\fR options are enabled using the plus sign (\f3-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\f3-XX:-\fR\fIOptionName\fR)\&.
 .PP
-For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix
-\fBk\fR
-or
-\fBK\fR
-for kilobytes (KB),
-\fBm\fR
-or
-\fBM\fR
-for megabytes (MB),
-\fBg\fR
-or
-\fBG\fR
-for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either
-\fB8g\fR,
-\fB8192m\fR,
-\fB8388608k\fR, or
-\fB8589934592\fR
-as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify
-\fB0\&.25\fR
-for 25%)\&.
-.SS "Standard Options"
-.PP
+For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix \f3k\fR or \f3K\fR for kilobytes (KB), \f3m\fR or \f3M\fR for megabytes (MB), \f3g\fR or \f3G\fR for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either \f38g\fR, \f38192m\fR, \f38388608k\fR, or \f38589934592\fR as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify \f30\&.25\fR for 25%)\&.
+.SS STANDARD\ OPTIONS    
 These are the most commonly used options that are supported by all implementations of the JVM\&.
-.PP
-\-agentlib:\fIlibname\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified native agent library\&. After the library name, a comma\-separated list of options specific to the library can be used\&.
-.sp
-If the option
-\fB\-agentlib:foo\fR
-is specified, then the JVM attempts to load the library named
-\fBlibfoo\&.so\fR
-in the location specified by the
-\fBLD_LIBRARY_PATH\fR
-system variable (on OS X this variable is
-\fBDYLD_LIBRARY_PATH\fR)\&.
-.sp
+.TP
+-agentlib:\fIlibname\fR[=\fIoptions\fR]
+.br
+Loads the specified native agent library\&. After the library name, a comma-separated list of options specific to the library can be used\&.
+
+If the option \f3-agentlib:foo\fR is specified, then the JVM attempts to load the library named \f3libfoo\&.so\fR in the location specified by the \f3LD_LIBRARY_PATH\fR system variable (on OS X this variable is \f3DYLD_LIBRARY_PATH\fR)\&.
+
 The following example shows how to load the heap profiling tool (HPROF) library and get sample CPU information every 20 ms, with a stack depth of 3:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:hprof=cpu=samples,interval=20,depth=3\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:hprof=cpu=samples,interval=20,depth=3\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 For more information about the native agent libraries, refer to the following:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The
-\fBjava\&.lang\&.instrument\fR
-package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
+The \f3java\&.lang\&.instrument\fR package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP 0.2i    
+\(bu
 Agent Command Line Options in the JVM Tools Interface guide at http://docs\&.oracle\&.com/javase/8/docs/platform/jvmti/jvmti\&.html#starting
-.RE
-.RE
-.PP
-\-agentpath:\fIpathname\fR[=\fIoptions\fR]
-.RS 4
-Loads the native agent library specified by the absolute path name\&. This option is equivalent to
-\fB\-agentlib\fR
-but uses the full path and file name of the library\&.
-.RE
-.PP
-\-client
-.RS 4
-Selects the Java HotSpot Client VM\&. The 64\-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.RE     
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-D\fIproperty\fR=\fIvalue\fR
-.RS 4
-Sets a system property value\&. The
-\fIproperty\fR
-variable is a string with no spaces that represents the name of the property\&. The
-\fIvalue\fR
-variable is a string that represents the value of the property\&. If
-\fIvalue\fR
-is a string with spaces, then enclose it in quotation marks (for example
-\fB\-Dfoo="foo bar"\fR)\&.
-.RE
-.PP
-\-d32
-.RS 4
-Runs the application in a 32\-bit environment\&. If a 32\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.RE
-.PP
-\-d64
-.RS 4
-Runs the application in a 64\-bit environment\&. If a 64\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
-.sp
-Currently only the Java HotSpot Server VM supports 64\-bit operation, and the
-\fB\-server\fR
-option is implicit with the use of
-\fB\-d64\fR\&. The
-\fB\-client\fR
-option is ignored with the use of
-\fB\-d64\fR\&. This is subject to change in a future release\&.
-.RE
-.PP
-\-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+-agentpath:\fIpathname\fR[=\fIoptions\fR]
 .br
-\-da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+Loads the native agent library specified by the absolute path name\&. This option is equivalent to \f3-agentlib\fR but uses the full path and file name of the library\&.
+.TP
+-client
+.br
+Selects the Java HotSpot Client VM\&. The 64-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
+
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-D\fIproperty\fR=\fIvalue\fR
+.br
+Sets a system property value\&. The \fIproperty\fR variable is a string with no spaces that represents the name of the property\&. The \fIvalue\fR variable is a string that represents the value of the property\&. If \fIvalue\fR is a string with spaces, then enclose it in quotation marks (for example \f3-Dfoo="foo bar"\fR)\&.
+.TP
+-d32
+.br
+Runs the application in a 32-bit environment\&. If a 32-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+.TP
+-d64
+.br
+Runs the application in a 64-bit environment\&. If a 64-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32-bit environment unless a 64-bit system is used\&.
+
+Currently only the Java HotSpot Server VM supports 64-bit operation, and the \f3-server\fR option is implicit with the use of \f3-d64\fR\&. The \f3-client\fR option is ignored with the use of \f3-d64\fR\&. This is subject to change in a future release\&.
+.TP
+.nf
+-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.br
+.fi
 Disables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-disableassertions\fR
-(\fB\-da\fR) disables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch disables assertions in the specified class\&.
-.sp
-The
-\fB\-disableassertions\fR
-(\fB\-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The
-\fB\-disablesystemassertions\fR
-option enables you to disable assertions in all system classes\&.
-.sp
-To explicitly enable assertions in specific packages or classes, use the
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-disablesystemassertions
+
+With no arguments, \f3-disableassertions\fR (\f3-da\fR) disables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch disables assertions in the specified class\&.
+
+The \f3-disableassertions\fR (\f3-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The \f3-disablesystemassertions\fR option enables you to disable assertions in all system classes\&.
+
+To explicitly enable assertions in specific packages or classes, use the \f3-enableassertions\fR (\f3-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the \f3MyClass\fR application with assertions enabled in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-disablesystemassertions, -dsa
 .br
-\-dsa
-.RS 4
 Disables assertions in all system classes\&.
-.RE
-.PP
-\-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
+.TP
+.nf
+-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR], -ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 .br
-\-ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
-.RS 4
+.fi
 Enables assertions\&. By default, assertions are disabled in all packages and classes\&.
-.sp
-With no arguments,
-\fB\-enableassertions\fR
-(\fB\-ea\fR) enables assertions in all packages and classes\&. With the
-\fIpackagename\fR
-argument ending in
-\fB\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply
-\fB\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the
-\fIclassname\fR
-argument, the switch enables assertions in the specified class\&.
-.sp
-The
-\fB\-enableassertions\fR
-(\fB\-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The
-\fB\-enablesystemassertions\fR
-option provides a separate switch to enable assertions in all system classes\&.
-.sp
-To explicitly disable assertions in specific packages or classes, use the
-\fB\-disableassertions\fR
-(\fB\-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the
-\fBMyClass\fR
-application with assertions enabled only in package
-\fBcom\&.wombat\&.fruitbat\fR
-(and any subpackages) but disabled in class
-\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-enablesystemassertions
+
+With no arguments, \f3-enableassertions\fR (\f3-ea\fR) enables assertions in all packages and classes\&. With the \fIpackagename\fR argument ending in \f3\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply \f3\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the \fIclassname\fR argument\f3\fR, the switch enables assertions in the specified class\&.
+
+The \f3-enableassertions\fR (\f3-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The \f3-enablesystemassertions\fR option provides a separate switch to enable assertions in all system classes\&.
+
+To explicitly disable assertions in specific packages or classes, use the \f3-disableassertions\fR (\f3-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the \f3MyClass\fR application with assertions enabled only in package \f3com\&.wombat\&.fruitbat\fR (and any subpackages) but disabled in class \f3com\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
+.sp     
+.nf     
+\f3java \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-enablesystemassertions, -esa
 .br
-\-esa
-.RS 4
 Enables assertions in all system classes\&.
-.RE
-.PP
-\-help
+.TP
+-help, -?
 .br
-\-?
-.RS 4
-Displays usage information for the
-\fBjava\fR
-command without actually running the JVM\&.
-.RE
-.PP
-\-jar \fIfilename\fR
-.RS 4
-Executes a program encapsulated in a JAR file\&. The
-\fIfilename\fR
-argument is the name of a JAR file with a manifest that contains a line in the form
-\fBMain\-Class:\fR\fIclassname\fR
-that defines the class with the
-\fBpublic static void main(String[] args)\fR
-method that serves as your application\*(Aqs starting point\&.
-.sp
-When you use the
-\fB\-jar\fR
-option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
-.sp
+Displays usage information for the \f3java\fR command without actually running the JVM\&.
+.TP
+-jar \fIfilename\fR
+.br
+Executes a program encapsulated in a JAR file\&. The \fIfilename\fR argument is the name of a JAR file with a manifest that contains a line in the form \f3Main-Class:\fR\fIclassname\fR that defines the class with the \f3public static void main(String[] args)\fR method that serves as your application\&'s starting point\&.
+
+When you use the \f3-jar\fR option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
+
 For more information about JAR files, see the following resources:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RS     
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 The Java Archive (JAR) Files guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/jar/index\&.html
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Lesson: Packaging Programs in JAR Files at
+.TP 0.2i    
+\(bu
+Lesson: Packaging Programs in JAR Files at http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
+.RE     
 
-http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
-.RE
-.RE
-.PP
-\-javaagent:\fIjarpath\fR[=\fIoptions\fR]
-.RS 4
-Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the
-\fBjava\&.lang\&.instrument\fR
-package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
-.RE
-.PP
-\-jre\-restrict\-search
-.RS 4
-Includes user\-private JREs in the version search\&.
-.RE
-.PP
-\-no\-jre\-restrict\-search
-.RS 4
-Excludes user\-private JREs from the version search\&.
-.RE
-.PP
-\-server
-.RS 4
-Selects the Java HotSpot Server VM\&. The 64\-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
-.sp
-For default JVM selection, see Server\-Class Machine Detection at
+.TP
+-javaagent:\fIjarpath\fR[=\fIoptions\fR]
+.br
+Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the \f3java\&.lang\&.instrument\fR package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package-summary\&.html
+.TP
+-jre-restrict-search
+.br
+Includes user-private JREs in the version search\&.
+.TP
+-no-jre-restrict-search
+.br
+Excludes user-private JREs from the version search\&.
+.TP
+-server
+.br
+Selects the Java HotSpot Server VM\&. The 64-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
 
-http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
-.RE
-.PP
-\-showversion
-.RS 4
-Displays version information and continues execution of the application\&. This option is equivalent to the
-\fB\-version\fR
-option except that the latter instructs the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-splash:\fIimgname\fR
-.RS 4
-Shows the splash screen with the image specified by
-\fIimgname\fR\&. For example, to show the
-\fBsplash\&.gif\fR
-file from the
-\fBimages\fR
-directory when starting your application, use the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-splash:images/splash\&.gif\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-verbose:class
-.RS 4
+For default JVM selection, see Server-Class Machine Detection at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server-class\&.html
+.TP
+-showversion
+.br
+Displays version information and continues execution of the application\&. This option is equivalent to the \f3-version\fR option except that the latter instructs the JVM to exit after displaying version information\&.
+.TP
+-splash:\fIimgname\fR
+.br
+Shows the splash screen with the image specified by \fIimgname\fR\&. For example, to show the \f3splash\&.gif\fR file from the \f3images\fR directory when starting your application, use the following option:
+.sp     
+.nf     
+\f3\-splash:images/splash\&.gif\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-verbose:class
+.br
 Displays information about each loaded class\&.
-.RE
-.PP
-\-verbose:gc
-.RS 4
+.TP
+-verbose:gc
+.br
 Displays information about each garbage collection (GC) event\&.
-.RE
-.PP
-\-verbose:jni
-.RS 4
+.TP
+-verbose:jni
+.br
 Displays information about the use of native methods and other Java Native Interface (JNI) activity\&.
-.RE
-.PP
-\-version
-.RS 4
-Displays version information and then exits\&. This option is equivalent to the
-\fB\-showversion\fR
-option except that the latter does not instruct the JVM to exit after displaying version information\&.
-.RE
-.PP
-\-version:\fIrelease\fR
-.RS 4
-Specifies the release version to be used for running the application\&. If the version of the
-\fBjava\fR
-command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
-.sp
-The
-\fIrelease\fR
-argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A
-\fIversion string\fR
-is the developer designation of the version number in the following form:
-\fB1\&.\fR\fIx\fR\fB\&.0_\fR\fIu\fR
-(where
-\fIx\fR
-is the major version number, and
-\fIu\fR
-is the update version number)\&. A
-\fIversion range\fR
-is made up of a version string followed by a plus sign (\fB+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\fB*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical
-\fIOR\fR
-combination, or an ampersand (\fB&\fR) for a logical
-\fIAND\fR
-combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Quotation marks are necessary only if there are spaces in the
-\fIrelease\fR
-parameter\&.
-.sp
+.TP
+-version
+.br
+Displays version information and then exits\&. This option is equivalent to the \f3-showversion\fR option except that the latter does not instruct the JVM to exit after displaying version information\&.
+.TP
+-version:\fIrelease\fR
+.br
+Specifies the release version to be used for running the application\&. If the version of the \f3java\fR command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
+
+The \fIrelease\fR argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A \fIversion string\fR is the developer designation of the version number in the following form: \f31\&.\fR\fIx\fR\f3\&.0_\fR\fIu\fR (where \fIx\fR is the major version number, and \fIu\fR is the update version number)\&. A \fIversion range\fR is made up of a version string followed by a plus sign (\f3+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\f3*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical \fIOR\fR combination, or an ampersand (\f3&\fR) for a logical \fIAND\fR combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
+.sp     
+.nf     
+\f3\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Quotation marks are necessary only if there are spaces in the \fIrelease\fR parameter\&.
+
 For JAR files, the preference is to specify version requirements in the JAR file manifest rather than on the command line\&.
-.RE
-.SS "Non\-Standard Options"
-.PP
+.SS NON-STANDARD\ OPTIONS    
 These options are general purpose options that are specific to the Java HotSpot Virtual Machine\&.
-.PP
-\-X
-.RS 4
-Displays help for all available
-\fB\-X\fR
-options\&.
-.RE
-.PP
-\-Xbatch
-.RS 4
-Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The
-\fB\-Xbatch\fR
-flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
-.sp
-This option is equivalent to
-\fB\-XX:\-BackgroundCompilation\fR\&.
-.RE
-.PP
-\-Xbootclasspath:\fIpath\fR
-.RS 4
+.TP
+-X
+.br
+Displays help for all available \f3-X\fR options\&.
+.TP
+-Xbatch
+.br
+Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The \f3-Xbatch\fR flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
+
+This option is equivalent to \f3-XX:-BackgroundCompilation\fR\&.
+.TP
+-Xbootclasspath:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to search for boot class files\&. These are used in place of the boot class files included in the JDK\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+
+\fI\fRDo not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to append to the end of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to prepend to the front of the default bootstrap class path\&.
-.sp
-Do not deploy applications that use this option to override a class in
-\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
-.RE
-.PP
-\-Xcheck:jni
-.RS 4
+
+Do not deploy applications that use this option to override a class in \f3rt\&.jar\fR, because this violates the JRE binary code license\&.
+.TP
+-Xcheck:jni
+.br
 Performs additional checks for Java Native Interface (JNI) functions\&. Specifically, it validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request\&. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with an irrecoverable error in such cases\&. Expect a performance degradation when this option is used\&.
-.RE
-.PP
-\-Xcomp
-.RS 4
-Forces compilation of methods on first invocation\&. By default, the Client VM (\fB\-client\fR) performs 1,000 interpreted method invocations and the Server VM (\fB\-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the
-\fB\-Xcomp\fR
-option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
-.sp
-You can also change the number of interpreted method invocations before compilation using the
-\fB\-XX:CompileThreshold\fR
-option\&.
-.RE
-.PP
-\-Xdebug
-.RS 4
+.TP
+-Xcomp
+.br
+Forces compilation of methods on first invocation\&. By default, the Client VM (\f3-client\fR) performs 1,000 interpreted method invocations and the Server VM (\f3-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the \f3-Xcomp\fR option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
+
+You can also change the number of interpreted method invocations before compilation using the \f3-XX:CompileThreshold\fR option\&.
+.TP
+-Xdebug
+.br
 Does nothing\&. Provided for backward compatibility\&.
-.RE
-.PP
-\-Xdiag
-.RS 4
+.TP
+-Xdiag
+.br
 Shows additional diagnostic messages\&.
-.RE
-.PP
-\-Xfuture
-.RS 4
-Enables strict class\-file format checks that enforce close conformance to the class\-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
-.RE
-.PP
-\-Xint
-.RS 4
-Runs the application in interpreted\-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
-.RE
-.PP
-\-Xinternalversion
-.RS 4
-Displays more detailed JVM version information than the
-\fB\-version\fR
-option, and then exits\&.
-.RE
-.PP
-\-Xloggc:\fIfilename\fR
-.RS 4
-Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of
-\fB\-verbose:gc\fR
-with the time elapsed since the first GC event preceding each logged event\&. The
-\fB\-Xloggc\fR
-option overrides
-\fB\-verbose:gc\fR
-if both are given with the same
-\fBjava\fR
-command\&.
-.sp
+.TP
+-Xfuture
+.br
+Enables strict class-file format checks that enforce close conformance to the class-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
+.TP
+-Xint
+.br
+Runs the application in interpreted-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
+.TP
+-Xinternalversion
+.br
+Displays more detailed JVM version information than the \f3-version\fR option, and then exits\&.
+.TP
+-Xloggc:\fIfilename\fR
+.br
+Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of \f3-verbose:gc\fR with the time elapsed since the first GC event preceding each logged event\&. The \f3-Xloggc\fR option overrides \f3-verbose:gc\fR if both are given with the same \f3java\fR command\&.
+
 Example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xloggc:garbage\-collection\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xmaxjitcodesize=\fIsize\fR
-.RS 4
-Specifies the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the value is set to 48 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmaxjitcodesize=48m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ReservedCodeCacheSize\fR\&.
-.RE
-.PP
-\-Xmixed
-.RS 4
+.sp     
+.nf     
+\f3\-Xloggc:garbage\-collection\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xmaxjitcodesize=\fIsize\fR
+.br
+Specifies the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the value is set to 48 MB:
+.sp     
+.nf     
+\f3\-Xmaxjitcodesize=48m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ReservedCodeCacheSize\fR\&.
+.TP
+-Xmixed
+.br
 Executes all bytecode by the interpreter except for hot methods, which are compiled to native code\&.
-.RE
-.PP
-\-Xmn\fIsize\fR
-.RS 4
-Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.TP
+-Xmn\fIsize\fR
+.br
+Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too small, then a lot of minor garbage collections will be performed\&. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial and maximum size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmn256m\fR
-\fB\-Xmn262144k\fR
-\fB\-Xmn268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Instead of the
-\fB\-Xmn\fR
-option to set both the initial and maximum size of the heap for the young generation, you can use
-\fB\-XX:NewSize\fR
-to set the initial size and
-\fB\-XX:MaxNewSize\fR
-to set the maximum size\&.
-.RE
-.PP
-\-Xms\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-Xmn256m\fP
+.fi     
+.nf     
+\f3\-Xmn262144k\fP
+.fi     
+.nf     
+\f3\-Xmn268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Instead of the \f3-Xmn\fR option to set both the initial and maximum size of the heap for the young generation, you can use \f3-XX:NewSize\fR to set the initial size and \f3-XX:MaxNewSize\fR to set the maximum size\&.
+.TP
+-Xms\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xms6291456\fR
-\fB\-Xms6144k\fR
-\fB\-Xms6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the
-\fB\-Xmn\fR
-option or the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-Xmx\fIsize\fR
-.RS 4
-Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-Xms\fR
-and
-\fB\-Xmx\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-Xms6291456\fP
+.fi     
+.nf     
+\f3\-Xms6144k\fP
+.fi     
+.nf     
+\f3\-Xms6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the \f3-Xmn\fR option or the \f3-XX:NewSize\fR option\&.
+.TP
+-Xmx\fIsize\fR
+.br
+Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-Xms\fR and \f3-Xmx\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xmx83886080\fR
-\fB\-Xmx81920k\fR
-\fB\-Xmx80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-Xmx\fR
-option is equivalent to
-\fB\-XX:MaxHeapSize\fR\&.
-.RE
-.PP
-\-Xnoclassgc
-.RS 4
+.sp     
+.nf     
+\f3\-Xmx83886080\fP
+.fi     
+.nf     
+\f3\-Xmx81920k\fP
+.fi     
+.nf     
+\f3\-Xmx80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-Xmx\fR option is equivalent to \f3-XX:MaxHeapSize\fR\&.
+.TP
+-Xnoclassgc
+.br
 Disables garbage collection (GC) of classes\&. This can save some GC time, which shortens interruptions during the application run\&.
-.sp
-When you specify
-\fB\-Xnoclassgc\fR
-at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
-.RE
-.PP
-\-Xprof
-.RS 4
+
+When you specify \f3-Xnoclassgc\fR at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
+.TP
+-Xprof
+.br
 Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
-.RE
-.PP
-\-Xrs
-.RS 4
+.TP
+-Xrs
+.br
 Reduces the use of operating system signals by the JVM\&.
-.sp
+
 Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly\&.
-.sp
-The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses
-\fBSIGHUP\fR,
-\fBSIGINT\fR, and
-\fBSIGTERM\fR
-to initiate the running of shutdown hooks\&.
-.sp
-The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses
-\fBSIGQUIT\fR
-to perform thread dumps\&.
-.sp
-Applications embedding the JVM frequently need to trap signals such as
-\fBSIGINT\fR
-or
-\fBSIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The
-\fB\-Xrs\fR
-option is available to address this issue\&. When
-\fB\-Xrs\fR
-is used, the signal masks for
-\fBSIGINT\fR,
-\fBSIGTERM\fR,
-\fBSIGHUP\fR, and
-\fBSIGQUIT\fR
-are not changed by the JVM, and signal handlers for these signals are not installed\&.
-.sp
-There are two consequences of specifying
-\fB\-Xrs\fR:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fBSIGQUIT\fR
-thread dumps are not available\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-User code is responsible for causing shutdown hooks to run, for example, by calling
-\fBSystem\&.exit()\fR
-when the JVM is to be terminated\&.
-.RE
-.RE
-.PP
-\-Xshare:\fImode\fR
-.RS 4
-Sets the class data sharing mode\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+
+The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses \f3SIGHUP\fR, \f3SIGINT\fR, and \f3SIGTERM\fR to initiate the running of shutdown hooks\&.
+
+The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses \f3SIGQUIT\fR to perform thread dumps\&.
+
+Applications embedding the JVM frequently need to trap signals such as \f3SIGINT\fR or \f3SIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The \f3-Xrs\fR option is available to address this issue\&. When \f3-Xrs\fR is used, the signal masks for \f3SIGINT\fR, \f3SIGTERM\fR, \f3SIGHUP\fR, and \f3SIGQUIT\fR are not changed by the JVM, and signal handlers for these signals are not installed\&.
+
+There are two consequences of specifying \f3-Xrs\fR:
+.RS     
+.TP 0.2i    
+\(bu
+\f3SIGQUIT\fR thread dumps are not available\&.
+.TP 0.2i    
+\(bu
+User code is responsible for causing shutdown hooks to run, for example, by calling \f3System\&.exit()\fR when the JVM is to be terminated\&.
+.RE     
+
+.TP
+-Xshare:\fImode\fR
+.br
+Sets the class data sharing mode\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 auto
-.RS 4
-Use shared class data if possible\&. This is the default value for Java HotSpot 32\-Bit Client VM\&.
-.RE
-.PP
+Use shared class data if possible\&. This is the default value for Java HotSpot 32-Bit Client VM\&.
+.TP     
 on
-.RS 4
 Require the use of class data sharing\&. Print an error message and exit if class data sharing cannot be used\&.
-.RE
-.PP
+.TP     
 off
-.RS 4
-Do not use shared class data\&. This is the default value for Java HotSpot 32\-Bit Server VM, Java HotSpot 64\-Bit Client VM, and Java HotSpot 64\-Bit Server VM\&.
-.RE
-.PP
+Do not use shared class data\&. This is the default value for Java HotSpot 32-Bit Server VM, Java HotSpot 64-Bit Client VM, and Java HotSpot 64-Bit Server VM\&.
+.TP     
 dump
-.RS 4
 Manually generate the class data sharing archive\&.
-.RE
-.RE
-.PP
-\-XshowSettings:\fIcategory\fR
-.RS 4
-Shows settings and continues\&. Possible
-\fIcategory\fR
-arguments for this option include the following:
-.PP
+.RE     
+
+.TP
+-XshowSettings:\fIcategory\fR
+.br
+Shows settings and continues\&. Possible \fIcategory\fR arguments for this option include the following:
+.RS     
+.TP     
 all
-.RS 4
 Shows all categories of settings\&. This is the default value\&.
-.RE
-.PP
+.TP     
 locale
-.RS 4
 Shows settings related to locale\&.
-.RE
-.PP
+.TP     
 properties
-.RS 4
 Shows settings related to system properties\&.
-.RE
-.PP
+.TP     
 vm
-.RS 4
 Shows the settings of the JVM\&.
-.RE
-.RE
-.PP
-\-Xss\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate KB,
-\fBm\fR
-or
-\fBM\fR
-to indicate MB,
-\fBg\fR
-or
-\fBG\fR
-to indicate GB\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.RE     
+
+.TP
+-Xss\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate KB, \f3m\fR or \f3M\fR to indicate MB, \f3g\fR or \f3G\fR to indicate GB\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xss1m\fR
-\fB\-Xss1024k\fR
-\fB\-Xss1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-XX:ThreadStackSize\fR\&.
-.RE
-.PP
-\-Xusealtsigs
-.RS 4
-Use alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. This option is equivalent to
-\fB\-XX:+UseAltSigs\fR\&.
-.RE
-.PP
-\-Xverify:\fImode\fR
-.RS 4
-Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-Xss1m\fP
+.fi     
+.nf     
+\f3\-Xss1024k\fP
+.fi     
+.nf     
+\f3\-Xss1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-XX:ThreadStackSize\fR\&.
+.TP
+-Xusealtsigs
+.br
+Use alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. This option is equivalent to \f3-XX:+UseAltSigs\fR\&.
+.TP
+-Xverify:\fImode\fR
+.br
+Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 none
-.RS 4
 Do not verify the bytecode\&. This reduces startup time and also reduces the protection provided by Java\&.
-.RE
-.PP
+.TP     
 remote
-.RS 4
-Verify only those classes that are loaded remotely over the network\&. This is the default behavior if you do not specify the
-\fB\-Xverify\fR
-option\&.
-.RE
-.PP
+Verify those classes that are not loaded by the bootstrap class loader\&. This is the default behavior if you do not specify the \f3-Xverify\fR option\&.
+.TP     
 all
-.RS 4
 Verify all classes\&.
-.RE
-.RE
-.SS "Advanced Runtime Options"
-.PP
+.RE     
+
+.SS ADVANCED\ RUNTIME\ OPTIONS    
 These options control the runtime behavior of the Java HotSpot VM\&.
-.PP
-\-XX:+DisableAttachMechanism
-.RS 4
-Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as
-\fBjcmd\fR,
-\fBjstack\fR,
-\fBjmap\fR, and
-\fBjinfo\fR\&.
-.RE
-.PP
-\-XX:ErrorFile=\fIfilename\fR
-.RS 4
-Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named
-\fBhs_err_pid\fR\fIpid\fR\fB\&.log\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as
-\fB%p\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the error log to
-\fB/var/log/java/java_error\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ErrorFile=/var/log/java/java_error\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is
-\fB/tmp\fR\&.
-.RE
-.PP
-\-XX:+FailOverToOldVerifier
-.RS 4
+.TP
+-XX:+DisableAttachMechanism
+.br
+Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as \f3jcmd\fR, \f3jstack\fR, \f3jmap\fR, and \f3jinfo\fR\&.
+.TP
+-XX:ErrorFile=\fIfilename\fR
+.br
+Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named \f3hs_err_pid\fR\fIpid\fR\f3\&.log\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as \f3%p\fR):
+.sp     
+.nf     
+\f3\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example shows how to set the error log to \f3/var/log/java/java_error\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:ErrorFile=/var/log/java/java_error\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is \f3/tmp\fR\&.
+.TP
+-XX:+FailOverToOldVerifier
+.br
 Enables automatic failover to the old verifier when the new type checker fails\&. By default, this option is disabled and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:LargePageSizeInBytes=\fIsize\fR
-.RS 4
-Sets the maximum size (in bytes) for large pages used for Java heap\&. The
-\fIsize\fR
-argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
-.sp
+.TP
+-XX:LargePageSizeInBytes=\fIsize\fR
+.br
+On Solaris, sets the maximum size (in bytes) for large pages used for Java heap\&. The \fIsize\fR argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
+
 The following example illustrates how to set the large page size to 4 megabytes (MB):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LargePageSizeInBytes=4m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxDirectMemorySize=\fIsize\fR
-.RS 4
-Sets the maximum total size (in bytes) of the New I/O (the
-\fBjava\&.nio\fR
-package) direct\-buffer allocations\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct\-buffer allocations automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:LargePageSizeInBytes=4m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxDirectMemorySize=\fIsize\fR
+.br
+Sets the maximum total size (in bytes) of the New I/O (the \f3java\&.nio\fR package) direct-buffer allocations\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct-buffer allocations automatically\&.
+
 The following examples illustrate how to set the NIO size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxDirectMemorySize=1m\fR
-\fB\-XX:MaxDirectMemorySize=1024k\fR
-\fB\-XX:MaxDirectMemorySize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NativeMemoryTracking=\fImode\fR
-.RS 4
-Specifies the mode for tracking JVM native memory usage\&. Possible
-\fImode\fR
-arguments for this option include the following:
-.PP
+.sp     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1m\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:MaxDirectMemorySize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NativeMemoryTracking=\fImode\fR
+.br
+Specifies the mode for tracking JVM native memory usage\&. Possible \fImode\fR arguments for this option include the following:
+.RS     
+.TP     
 off
-.RS 4
-Do not track JVM native memory usage\&. This is the default behavior if you do not specify the
-\fB\-XX:NativeMemoryTracking\fR
-option\&.
-.RE
-.PP
+Do not track JVM native memory usage\&. This is the default behavior if you do not specify the \f3-XX:NativeMemoryTracking\fR option\&.
+.TP     
 summary
-.RS 4
 Only track memory usage by JVM subsystems, such as Java heap, class, code, and thread\&.
-.RE
-.PP
+.TP     
 detail
-.RS 4
-In addition to tracking memory usage by JVM subsystems, track memory usage by individual
-\fBCallSite\fR, individual virtual memory region and its committed regions\&.
-.RE
-.RE
-.PP
-\-XX:OnError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
-.sp
-The following example shows how the
-\fB\-XX:OnError\fR
-option can be used to run the
-\fBgcore\fR
-command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the
-\fB%p\fR
-designates the current process):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:OnError="gcore %p;dbx \- %p"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:OnOutOfMemoryError=\fIstring\fR
-.RS 4
-Sets a custom command or a series of semicolon\-separated commands to run when an
-\fBOutOfMemoryError\fR
-exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the
-\fB\-XX:OnError\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintCommandLineFlags
-.RS 4
+In addition to tracking memory usage by JVM subsystems, track memory usage by individual \f3CallSite\fR, individual virtual memory region and its committed regions\&.
+.RE     
+
+.TP
+-XX:ObjectAlignmentInBytes=\fIalignment\fR
+.br
+Sets the memory alignment of Java objects (in bytes)\&. By default, the value is set to 8 bytes\&. The specified value should be a power of two, and must be within the range of 8 and 256 (inclusive)\&. This option makes it possible to use compressed pointers with large Java heap sizes\&.
+
+The heap size limit in bytes is calculated as:
+
+\f34GB * ObjectAlignmentInBytes\fR
+
+Note: As the alignment value increases, the unused space between objects will also increase\&. As a result, you may not realize any benefits from using compressed pointers with large Java heap sizes\&.
+.TP
+-XX:OnError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
+
+\fI\fRThe following example shows how the \f3-XX:OnError\fR option can be used to run the \f3gcore\fR command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the \f3%p\fR designates the current process):
+.sp     
+.nf     
+\f3\-XX:OnError="gcore %p;dbx \- %p"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:OnOutOfMemoryError=\fIstring\fR
+.br
+Sets a custom command or a series of semicolon-separated commands to run when an \f3OutOfMemoryError\fR exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the \f3-XX:OnError\fR option\&.
+.TP
+-XX:+PerfDataSaveToFile
+.br
+If enabled, saves jstat(1) binary data when the Java application exits\&. This binary data is saved in a file named \f3hsperfdata_\fR\fI<pid>\fR, where \fI<pid>\fR is the process identifier of the Java application you ran\&. Use \f3jstat\fR to display the performance data contained in this file as follows:
+.sp     
+.nf     
+\f3jstat \-class file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.nf     
+\f3jstat \-gc file:///\fI<path>\fR/hsperfdata_\fI<pid>\fR\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintCommandLineFlags
+.br
 Enables printing of ergonomically selected JVM flags that appeared on the command line\&. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector\&. By default, this option is disabled and flags are not printed\&.
-.RE
-.PP
-\-XX:+PrintNMTStatistics
-.RS 4
-Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see
-\fB\-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
-.RE
-.PP
-\-XX:+RelaxAccessControlCheck
-.RS 4
+.TP
+-XX:+PrintNMTStatistics
+.br
+Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see \f3-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
+.TP
+-XX:+RelaxAccessControlCheck
+.br
 Decreases the amount of access control checks in the verifier\&. By default, this option is disabled, and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
-.RE
-.PP
-\-XX:+ShowMessageBoxOnError
-.RS 4
+.TP
+-XX:+ShowMessageBoxOnError
+.br
 Enables displaying of a dialog box when the JVM experiences an irrecoverable error\&. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:ThreadStackSize=\fIsize\fR
-.RS 4
-Sets the thread stack size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value depends on the platform:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/ARM (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Linux/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-OS X (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/i386 (32\-bit): 320 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Oracle Solaris/x64 (64\-bit): 1024 KB
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP
+-XX:ThreadStackSize=\fIsize\fR
+.br
+Sets the thread stack size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value depends on the platform:
+.RS     
+.TP 0.2i    
+\(bu
+Linux/ARM (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Linux/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+OS X (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/i386 (32-bit): 320 KB
+.TP 0.2i    
+\(bu
+Oracle Solaris/x64 (64-bit): 1024 KB
+.TP 0.2i    
+\(bu
 Windows: depends on virtual memory
-.RE
-.sp
+.RE     
+
+
 The following examples show how to set the thread stack size to 1024 KB in different units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ThreadStackSize=1m\fR
-\fB\-XX:ThreadStackSize=1024k\fR
-\fB\-XX:ThreadStackSize=1048576\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-This option is equivalent to
-\fB\-Xss\fR\&.
-.RE
-.PP
-\-XX:+TraceClassLoading
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ThreadStackSize=1m\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1024k\fP
+.fi     
+.nf     
+\f3\-XX:ThreadStackSize=1048576\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+This option is equivalent to \f3-Xss\fR\&.
+.TP
+-XX:+TraceClassLoading
+.br
 Enables tracing of classes as they are loaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassLoadingPreorder
-.RS 4
+.TP
+-XX:+TraceClassLoadingPreorder
+.br
 Enables tracing of all loaded classes in the order in which they are referenced\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassResolution
-.RS 4
+.TP
+-XX:+TraceClassResolution
+.br
 Enables tracing of constant pool resolutions\&. By default, this option is disabled and constant pool resolutions are not traced\&.
-.RE
-.PP
-\-XX:+TraceClassUnloading
-.RS 4
+.TP
+-XX:+TraceClassUnloading
+.br
 Enables tracing of classes as they are unloaded\&. By default, this option is disabled and classes are not traced\&.
-.RE
-.PP
-\-XX:+TraceLoaderConstraints
-.RS 4
+.TP
+-XX:+TraceLoaderConstraints
+.br
 Enables tracing of the loader constraints recording\&. By default, this option is disabled and loader constraints recording is not traced\&.
-.RE
-.PP
-\-XX:+UseAltSigs
-.RS 4
-Enables the use of alternative signals instead of
-\fBSIGUSR1\fR
-and
-\fBSIGUSR2\fR
-for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to
-\fB\-Xusealtsigs\fR\&.
-.RE
-.PP
-\-XX:\-UseBiasedLocking
-.RS 4
-Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning\-139912\&.html#section4\&.2\&.5
-.sp
+.TP
+-XX:+UseAltSigs
+.br
+Enables the use of alternative signals instead of \f3SIGUSR1\fR and \f3SIGUSR2\fR for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to \f3-Xusealtsigs\fR\&.
+.TP
+-XX:-UseBiasedLocking
+.br
+Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning-139912\&.html#section4\&.2\&.5
+
 By default, this option is enabled\&.
-.RE
-.PP
-\-XX:\-UseCompressedOops
-.RS 4
-Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32\-bit offsets instead of 64\-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64\-bit JVMs\&.
-.RE
-.PP
-\-XX:\-UseLargePages
-.RS 4
-Disables the use of large page memory\&. This option is enabled by default\&.
-.sp
-For more information, see Java Support for Large Memory Pages at http://www\&.oracle\&.com/technetwork/java/javase/tech/largememory\-jsp\-137182\&.html
-.RE
-.PP
-\-XX:+UseMembar
-.RS 4
+.TP
+-XX:-UseCompressedOops
+.br
+Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32-bit offsets instead of 64-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64-bit JVMs\&.
+
+It is also possible to use compressed pointers when Java heap sizes are greater than 32GB\&. See the \f3-XX:ObjectAlignmentInBytes\fR option\&.
+.TP
+-XX:+UseHugeTLBFS
+.br
+This option for Linux is the equivalent of specifying \f3-XX:+UseLargePages\fR\&. This option is disabled by default\&. This option pre-allocates all large pages up-front, when memory is reserved; consequently the JVM cannot dynamically grow or shrink large pages memory areas; see \f3-XX:UseTransparentHugePages\fR if you want this behavior\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseLargePages
+.br
+Enables the use of large page memory\&. By default, this option is disabled and large page memory is not used\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseMembar
+.br
 Enables issuing of membars on thread state transitions\&. This option is disabled by default on all platforms except ARM servers, where it is enabled\&. (It is recommended that you do not disable this option on ARM servers\&.)
-.RE
-.PP
-\-XX:+UsePerfData
-.RS 4
-Enables the
-\fBperfdata\fR
-feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the
-\fBhsperfdata_userid\fR
-directories\&. To disable the
-\fBperfdata\fR
-feature, specify
-\fB\-XX:\-UsePerfData\fR\&.
-.RE
-.PP
-\-XX:+AllowUserSignalHandlers
-.RS 4
+.TP
+-XX:+UsePerfData
+.br
+Enables the \f3perfdata\fR feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the \f3hsperfdata_userid\fR directories\&. To disable the \f3perfdata\fR feature, specify \f3-XX:-UsePerfData\fR\&.
+.TP
+-XX:+UseTransparentHugePages
+.br
+On Linux, enables the use of large pages that can dynamically grow or shrink\&. This option is disabled by default\&. You may encounter performance problems with transparent huge pages as the OS moves other pages around to create huge pages; this option is made available for experimentation\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+AllowUserSignalHandlers
+.br
 Enables installation of signal handlers by the application\&. By default, this option is disabled and the application is not allowed to install signal handlers\&.
-.RE
-.SS "Advanced JIT Compiler Options"
-.PP
-These options control the dynamic just\-in\-time (JIT) compilation performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveOpts
-.RS 4
+.SS ADVANCED\ JIT\ COMPILER\ OPTIONS    
+These options control the dynamic just-in-time (JIT) compilation performed by the Java HotSpot VM\&.
+.TP
+-XX:+AggressiveOpts
+.br
 Enables the use of aggressive performance optimization features, which are expected to become default in upcoming releases\&. By default, this option is disabled and experimental performance features are not used\&.
-.RE
-.PP
-\-XX:AllocateInstancePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocateInstancePrefetchLines=\fIlines\fR
+.br
 Sets the number of lines to prefetch ahead of the instance allocation pointer\&. By default, the number of lines to prefetch is set to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocateInstancePrefetchLines=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocateInstancePrefetchLines=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchDistance=\fIsize\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchDistance=\fIsize\fR
+.br
 Sets the size (in bytes) of the prefetch distance for object allocation\&. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object\&. Each Java thread has its own allocation point\&.
-.sp
-Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to \-1\&.
-.sp
+
+Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to -1\&.
+
 The following example shows how to set the prefetch distance to 1024 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchDistance=1024\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchDistance=1024\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchInstr=\fIinstruction\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchInstr=\fIinstruction\fR
+.br
 Sets the prefetch instruction to prefetch ahead of the allocation pointer\&. Only the Java HotSpot Server VM supports this option\&. Possible values are from 0 to 3\&. The actual instructions behind the values depend on the platform\&. By default, the prefetch instruction is set to 0:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchInstr=0\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchInstr=0\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchLines=\fIlines\fR
-.RS 4
+.TP
+-XX:AllocatePrefetchLines=\fIlines\fR
+.br
 Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code\&. The default value is 1 if the last allocated object was an instance, and 3 if it was an array\&.
-.sp
+
 The following example shows how to set the number of loaded cache lines to 5:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchLines=5\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchLines=5\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStepSize=\fIsize\fR
-.RS 4
-Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the step size is set to 16 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:AllocatePrefetchStepSize=16\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-XX:AllocatePrefetchStepSize=\fIsize\fR
+.br
+Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the step size is set to 16 bytes:
+.sp     
+.nf     
+\f3\-XX:AllocatePrefetchStepSize=16\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:AllocatePrefetchStyle=\fIstyle\fR
-.RS 4
-Sets the generated code style for prefetch instructions\&. The
-\fIstyle\fR
-argument is an integer from 0 to 3:
-.PP
+.TP
+-XX:AllocatePrefetchStyle=\fIstyle\fR
+.br
+Sets the generated code style for prefetch instructions\&. The \fIstyle\fR argument is an integer from 0 to 3:
+.RS     
+.TP     
 0
-.RS 4
 Do not generate prefetch instructions\&.
-.RE
-.PP
+.TP     
 1
-.RS 4
 Execute prefetch instructions after each allocation\&. This is the default parameter\&.
-.RE
-.PP
+.TP     
 2
-.RS 4
-Use the thread\-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
-.RE
-.PP
+Use the thread-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
+.TP     
 3
-.RS 4
 Use BIS instruction on SPARC for allocation prefetch\&.
-.RE
-.sp
+.RE     
+
+
 Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+BackgroundCompilation
-.RS 4
-Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify
-\fB\-XX:\-BackgroundCompilation\fR
-(this is equivalent to specifying
-\fB\-Xbatch\fR)\&.
-.RE
-.PP
-\-XX:CICompilerCount=\fIthreads\fR
-.RS 4
+.TP
+-XX:+BackgroundCompilation
+.br
+Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify \f3-XX:-BackgroundCompilation\fR (this is equivalent to specifying \f3-Xbatch\fR)\&.
+.TP
+-XX:CICompilerCount=\fIthreads\fR
+.br
 Sets the number of compiler threads to use for compilation\&. By default, the number of threads is set to 2 for the server JVM, to 1 for the client JVM, and it scales to the number of cores if tiered compilation is used\&. The following example shows how to set the number of threads to 2:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CICompilerCount=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
-.RS 4
-Sets the minimum free space (in bytes) required for compilation\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CodeCacheMinimumFreeSpace=1024m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
-.RS 4
-Specifies a command to perform on a method\&. For example, to exclude the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the
-\fBindexOf(String)\fR
-method of the
-\fBString\fR
-class from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all
-\fBindexOf()\fR
-methods in all classes from being compiled, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=exclude,*\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to
-\fB\-XX:CompileCommand\fR
-using spaces as separators by enclosing the argument in quotation marks:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand="exclude java/lang/String indexOf"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that after parsing the commands passed on the command line using the
-\fB\-XX:CompileCommand\fR
-options, the JIT compiler then reads commands from the
-\fB\&.hotspot_compiler\fR
-file\&. You can add commands to this file or specify a different file using the
-\fB\-XX:CompileCommandFile\fR
-option\&.
-.sp
-To add several commands, either specify the
-\fB\-XX:CompileCommand\fR
-option multiple times, or separate each argument with the newline separator (\fB\en\fR)\&. The following commands are available:
-.PP
+.sp     
+.nf     
+\f3\-XX:CICompilerCount=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
+.br
+Sets the minimum free space (in bytes) required for compilation\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
+.sp     
+.nf     
+\f3\-XX:CodeCacheMinimumFreeSpace=1024m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
+.br
+Specifies a command to perform on a method\&. For example, to exclude the \f3indexOf()\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the \f3indexOf(String)\fR method of the \f3String\fR class from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all \f3indexOf()\fR methods in all classes from being compiled, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=exclude,*\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to \f3-XX:CompileCommand\fR using spaces as separators by enclosing the argument in quotation marks:
+.sp     
+.nf     
+\f3\-XX:CompileCommand="exclude java/lang/String indexOf"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that after parsing the commands passed on the command line using the \f3-XX:CompileCommand\fR options, the JIT compiler then reads commands from the \f3\&.hotspot_compiler\fR file\&. You can add commands to this file or specify a different file using the \f3-XX:CompileCommandFile\fR option\&.
+
+To add several commands, either specify the \f3-XX:CompileCommand\fR option multiple times, or separate each argument with the newline separator (\f3\en\fR)\&. The following commands are available:
+.RS     
+.TP     
 break
-.RS 4
 Set a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method\&.
-.RE
-.PP
+.TP     
 compileonly
-.RS 4
-Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the
-\fB\-XX:CompileOnly\fR
-option, which allows to specify several methods\&.
-.RE
-.PP
+Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the \f3-XX:CompileOnly\fR option, which allows to specify several methods\&.
+.TP     
 dontinline
-.RS 4
 Prevent inlining of the specified method\&.
-.RE
-.PP
+.TP     
 exclude
-.RS 4
 Exclude the specified method from compilation\&.
-.RE
-.PP
+.TP     
 help
-.RS 4
-Print a help message for the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
+Print a help message for the \f3-XX:CompileCommand\fR option\&.
+.TP     
 inline
-.RS 4
 Attempt to inline the specified method\&.
-.RE
-.PP
+.TP     
 log
-.RS 4
-Exclude compilation logging (with the
-\fB\-XX:+LogCompilation\fR
-option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
-.RE
-.PP
+Exclude compilation logging (with the \f3-XX:+LogCompilation\fR option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
+.TP     
 option
-.RS 4
-This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the
-\fBBlockLayoutByFrequency\fR
-option for the
-\fBappend()\fR
-method of the
-\fBStringBuffer\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the \f3BlockLayoutByFrequency\fR option for the \f3append()\fR method of the \f3StringBuffer\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 You can specify multiple compilation options, separated by commas or spaces\&.
-.RE
-.PP
+.TP     
 print
-.RS 4
 Print generated assembler code after compilation of the specified method\&.
-.RE
-.PP
+.TP     
 quiet
-.RS 4
-Do not print the compile commands\&. By default, the commands that you specify with the \-\fBXX:CompileCommand\fR
-option are printed; for example, if you exclude from compilation the
-\fBindexOf()\fR
-method of the
-\fBString\fR
-class, then the following will be printed to standard output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBCompilerOracle: exclude java/lang/String\&.indexOf\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can suppress this by specifying the
-\fB\-XX:CompileCommand=quiet\fR
-option before other
-\fB\-XX:CompileCommand\fR
-options\&.
-.RE
-.RE
-.PP
-\-XX:CompileCommandFile=\fIfilename\fR
-.RS 4
-Sets the file from which JIT compiler commands are read\&. By default, the
-\fB\&.hotspot_compiler\fR
-file is used to store commands performed by the JIT compiler\&.
-.sp
-Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the
-\fBtoString()\fR
-method of the
-\fBString\fR
-class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBprint java/lang/String toString\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-For more information about specifying the commands for the JIT compiler to perform on methods, see the
-\fB\-XX:CompileCommand\fR
-option\&.
-.RE
-.PP
-\-XX:CompileOnly=\fImethods\fR
-.RS 4
-Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the
-\fBlength()\fR
-method of the
-\fBString\fR
-class and the
-\fBsize()\fR
-method of the
-\fBList\fR
-class, use the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
-\fB\-XX:+PrintCompilation\fR
-and
-\fB\-XX:+LogCompilation\fR
-options:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Do not print the compile commands\&. By default, the commands that you specify with the -\f3XX:CompileCommand\fR option are printed; for example, if you exclude from compilation the \f3indexOf()\fR method of the \f3String\fR class, then the following will be printed to standard output:
+.sp     
+.nf     
+\f3CompilerOracle: exclude java/lang/String\&.indexOf\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can suppress this by specifying the \f3-XX:CompileCommand=quiet\fR option before other \f3-XX:CompileCommand\fR options\&.
+.RE     
+
+.TP
+-XX:CompileCommandFile=\fIfilename\fR
+.br
+Sets the file from which JIT compiler commands are read\&. By default, the \f3\&.hotspot_compiler\fR file is used to store commands performed by the JIT compiler\&.
+
+Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the \f3toString()\fR method of the \f3String\fR class:
+.sp     
+.nf     
+\f3print java/lang/String toString\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+For more information about specifying the commands for the JIT compiler to perform on methods, see the \f3-XX:CompileCommand\fR option\&.
+.TP
+-XX:CompileOnly=\fImethods\fR
+.br
+Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the \f3length()\fR method of the \f3String\fR class and the \f3size()\fR method of the \f3List\fR class, use the following:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Note that the full class name is specified, including all packages and subpackages separated by a slash (\f3/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the \f3-XX:+PrintCompilation\fR and \f3-XX:+LogCompilation\fR options:
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Although wildcards are not supported, you can specify only the class or package name to compile all methods in that class or package, as well as specify just the method to compile methods with this name in any class:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileOnly=java/lang/String\fR
-\fB\-XX:CompileOnly=java/lang\fR
-\fB\-XX:CompileOnly=\&.length\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CompileThreshold=\fIinvocations\fR
-.RS 4
-Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. The following example shows how to set the number of interpreted method invocations to 5,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CompileThreshold=5000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-You can completely disable interpretation of Java methods before compilation by specifying the
-\fB\-Xcomp\fR
-option\&.
-.RE
-.PP
-\-XX:+DoEscapeAnalysis
-.RS 4
-Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify
-\fB\-XX:\-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:InitialCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the initial code cache size (in bytes)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is set to 500 KB\&. The following example shows how to set the initial code cache size to 32 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialCodeCacheSize=32k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+Inline
-.RS 4
-Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify
-\fB\-XX:\-Inline\fR\&.
-.RE
-.PP
-\-XX:InlineSmallCode=\fIsize\fR
-.RS 4
-Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InlineSmallCode=1000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+LogCompilation
-.RS 4
-Enables logging of compilation activity to a file named
-\fBhotspot\&.log\fR
-in the current working directory\&. You can specify a different log file path and name using the
-\fB\-XX:LogFile\fR
-option\&.
-.sp
-By default, this option is disabled and compilation activity is not logged\&. The
-\fB\-XX:+LogCompilation\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.sp
-You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the
-\fB\-XX:+PrintCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:MaxInlineSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxInlineSize=35\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNodeLimit=\fInodes\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CompileOnly=java/lang/String\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=java/lang\fP
+.fi     
+.nf     
+\f3\-XX:CompileOnly=\&.length\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CompileThreshold=\fIinvocations\fR
+.br
+Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. This option is ignored when tiered compilation is enabled; see the option \f3-XX:+TieredCompilation\fR\&. The following example shows how to set the number of interpreted method invocations to 5,000:
+.sp     
+.nf     
+\f3\-XX:CompileThreshold=5000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+You can completely disable interpretation of Java methods before compilation by specifying the \f3-Xcomp\fR option\&.
+.TP
+-XX:+DoEscapeAnalysis
+.br
+Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify \f3-XX:-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:InitialCodeCacheSize=\fIsize\fR
+.br
+Sets the initial code cache size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is set to 500 KB\&. The initial code cache size should be not less than the system\&'s minimal memory page size\&. The following example shows how to set the initial code cache size to 32 KB:
+.sp     
+.nf     
+\f3\-XX:InitialCodeCacheSize=32k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+Inline
+.br
+Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify \f3-XX:-Inline\fR\&.
+.TP
+-XX:InlineSmallCode=\fIsize\fR
+.br
+Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
+.sp     
+.nf     
+\f3\-XX:InlineSmallCode=1000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+LogCompilation
+.br
+Enables logging of compilation activity to a file named \f3hotspot\&.log\fR in the current working directory\&. You can specify a different log file path and name using the \f3-XX:LogFile\fR option\&.
+
+By default, this option is disabled and compilation activity is not logged\&. The \f3-XX:+LogCompilation\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+
+You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the \f3-XX:+PrintCompilation\fR option\&.
+.TP
+-XX:MaxInlineSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxInlineSize=35\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNodeLimit=\fInodes\fR
+.br
 Sets the maximum number of nodes to be used during single method compilation\&. By default, the maximum number of nodes is set to 65,000:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxNodeLimit=65000\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxTrivialSize=\fIsize\fR
-.RS 4
-Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTrivialSize=6\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+OptimizeStringConcat
-.RS 4
-Enables the optimization of
-\fBString\fR
-concatenation operations\&. This option is enabled by default\&. To disable the optimization of
-\fBString\fR
-concatenation operations, specify
-\fB\-XX:\-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+PrintAssembly
-.RS 4
-Enables printing of assembly code for bytecoded and native methods by using the external
-\fBdisassembler\&.so\fR
-library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
-.sp
-By default, this option is disabled and assembly code is not printed\&. The
-\fB\-XX:+PrintAssembly\fR
-option has to be used together with the
-\fB\-XX:UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:+PrintCompilation
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxNodeLimit=65000\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxTrivialSize=\fIsize\fR
+.br
+Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
+.sp     
+.nf     
+\f3\-XX:MaxTrivialSize=6\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+OptimizeStringConcat
+.br
+Enables the optimization of \f3String\fR concatenation operations\&. This option is enabled by default\&. To disable the optimization of \f3String\fR concatenation operations, specify \f3-XX:-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.TP
+-XX:+PrintAssembly
+.br
+Enables printing of assembly code for bytecoded and native methods by using the external \f3disassembler\&.so\fR library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
+
+By default, this option is disabled and assembly code is not printed\&. The \f3-XX:+PrintAssembly\fR option has to be used together with the \f3-XX:UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:+PrintCompilation
+.br
 Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled\&. This enables you to see which methods actually get compiled\&. By default, this option is disabled and diagnostic output is not printed\&.
-.sp
-You can also log compilation activity to a file by using the
-\fB\-XX:+LogCompilation\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintInlining
-.RS 4
+
+You can also log compilation activity to a file by using the \f3-XX:+LogCompilation\fR option\&.
+.TP
+-XX:+PrintInlining
+.br
 Enables printing of inlining decisions\&. This enables you to see which methods are getting inlined\&.
-.sp
-By default, this option is disabled and inlining information is not printed\&. The
-\fB\-XX:+PrintInlining\fR
-option has to be used together with the
-\fB\-XX:+UnlockDiagnosticVMOptions\fR
-option that unlocks diagnostic JVM options\&.
-.RE
-.PP
-\-XX:ReservedCodeCacheSize=\fIsize\fR
-.RS 4
-Sets the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. This option is equivalent to
-\fB\-Xmaxjitcodesize\fR\&.
-.RE
-.PP
-\-XX:+TieredCompilation
-.RS 4
+
+By default, this option is disabled and inlining information is not printed\&. The \f3-XX:+PrintInlining\fR option has to be used together with the \f3-XX:+UnlockDiagnosticVMOptions\fR option that unlocks diagnostic JVM options\&.
+.TP
+-XX:ReservedCodeCacheSize=\fIsize\fR
+.br
+Sets the maximum code cache size (in bytes) for JIT-compiled code\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. This option has a limit of 2 GB; otherwise, an error is generated\&. The maximum code cache size should not be less than the initial code cache size; see the option \f3-XX:InitialCodeCacheSize\fR\&. This option is equivalent to \f3-Xmaxjitcodesize\fR\&.
+.TP
+-XX:RTMAbortRatio=\fIabort_ratio\fR
+.br
+The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the \f3-XX:+UseRTMDeopt\fR option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
+.TP
+-XX:RTMRetryCount=\fInumber_of_retries\fR
+.br
+RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The \f3-XX:UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+TieredCompilation
+.br
 Enables the use of tiered compilation\&. By default, this option is enabled\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseAES
-.RS 4
-Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
-.RE
-.PP
-\-XX:+UseAESIntrinsics
-.RS 4
-UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32\-bit and 64\-bit\&. To disable hardware\-based AES intrinsics, specify
-\fB\-XX:\-UseAES \-XX:\-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:+UseAES \-XX:+UseAESIntrinsics\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To support UseAES and UseAESIntrinsics flags for 32\-bit and 64\-bit use
-\fB\-server\fR
-option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
-.RE
-.PP
-\-XX:+UseCodeCacheFlushing
-.RS 4
-Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify
-\fB\-XX:\-UseCodeCacheFlushing\fR\&.
-.RE
-.PP
-\-XX:+UseCondCardMark
-.RS 4
+.TP
+-XX:+UseAES
+.br
+Enables hardware-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
+.TP
+-XX:+UseAESIntrinsics
+.br
+UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32-bit and 64-bit\&. To disable hardware-based AES intrinsics, specify \f3-XX:-UseAES -XX:-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
+.sp     
+.nf     
+\f3\-XX:+UseAES \-XX:+UseAESIntrinsics\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To support UseAES and UseAESIntrinsics flags for 32-bit and 64-bit use \f3-server\fR option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
+.TP
+-XX:+UseCodeCacheFlushing
+.br
+Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify \f3-XX:-UseCodeCacheFlushing\fR\&.
+.TP
+-XX:+UseCondCardMark
+.br
 Enables checking of whether the card is already marked before updating the card table\&. This option is disabled by default and should only be used on machines with multiple sockets, where it will increase performance of Java applications that rely heavily on concurrent operations\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.PP
-\-XX:+UseSuperWord
-.RS 4
-Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify
-\fB\-XX:\-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
-.RE
-.SS "Experimental JIT Compiler Options"
-.PP
-The options related to the Restricted Transactional Memory (RTM) locking feature in this section are experimental and are not officially supported in Java SE 8u20; you must enable the
-\fB\-XX:+UnlockExperimentalVMOptions\fR
-option to use them\&. These options are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
-.PP
-\-XX:RTMAbortRatio=\fIabort_ratio\fR
-.RS 4
-The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the
-\fB\-XX:+UseRTMDeopt\fR
-option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
-.RE
-.PP
-\-XX:RTMRetryCount=\fInumber_of_retries\fR
-.RS 4
-RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMDeopt
-.RS 4
-Auto\-tunes RTM locking depending on the abort ratio\&. This ratio is specified by
-\fB\-XX:RTMAbortRatio\fR
-option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The
-\fB\-XX:UseRTMLocking\fR
-option must be enabled\&.
-.RE
-.PP
-\-XX:+UseRTMLocking
-.RS 4
-Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&.
-.sp
-RTM is part of Intel\*(Aqs Transactional Synchronization Extensions (TSX), which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions
-\fBXBEGIN\fR,
-\fBXABORT\fR,
-\fBXEND\fR, and
-\fBXTEST\fR\&. The
-\fBXBEGIN\fR
-and
-\fBXEND\fR
-instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the
-\fBXEND\fR
-instruction\&. The
-\fBXABORT\fR
-instruction can be used to explicitly abort a transaction and the
-\fBXEND\fR
-instruction to check if a set of instructions are being run in a transaction\&.
-.sp
-A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\*(Aqs system\&.
-.sp
-RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse\-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse\-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine\-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping\-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
-.RE
-.SS "Advanced Serviceability Options"
-.PP
+.TP
+-XX:+UseRTMDeopt
+.br
+Auto-tunes RTM locking depending on the abort ratio\&. This ratio is specified by \f3-XX:RTMAbortRatio\fR option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The \f3-XX:+UseRTMLocking\fR option must be enabled\&.
+.TP
+-XX:+UseRTMLocking
+.br
+Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&. Options related to RTM are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
+
+RTM is part of Intel\&'s TSX, which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions \f3XBEGIN\fR, \f3XABORT\fR, \f3XEND\fR, and \f3XTEST\fR\&. The \f3XBEGIN\fR and \f3XEND\fR instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the \f3XEND\fR instruction\&. The \f3XABORT\fR instruction can be used to explicitly abort a transaction and the \f3XEND\fR instruction to check if a set of instructions are being run in a transaction\&.
+
+A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\&'s system\&.
+
+RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
+.TP
+-XX:+UseSHA
+.br
+Enables hardware-based intrinsics for SHA crypto hash functions for SPARC hardware\&. \f3UseSHA\fR is used in conjunction with the \f3UseSHA1Intrinsics\fR, \f3UseSHA256Intrinsics\fR, and \f3UseSHA512Intrinsics\fR options\&.
+
+The \f3UseSHA\fR and \f3UseSHA*Intrinsics\fR flags are enabled by default, and are supported only for Java HotSpot Server VM 64-bit on SPARC T4 and newer\&.
+
+This feature is only applicable when using the \f3sun\&.security\&.provider\&.Sun\fR provider for SHA operations\&.
+
+To disable all hardware-based SHA intrinsics, specify \f3-XX:-UseSHA\fR\&. To disable only a particular SHA intrinsic, use the appropriate corresponding option\&. For example: \f3-XX:-UseSHA256Intrinsics\fR\&.
+.TP
+-XX:+UseSHA1Intrinsics
+.br
+Enables intrinsics for SHA-1 crypto hash function\&.
+.TP
+-XX:+UseSHA256Intrinsics
+.br
+Enables intrinsics for SHA-224 and SHA-256 crypto hash functions\&.
+.TP
+-XX:+UseSHA512Intrinsics
+.br
+Enables intrinsics for SHA-384 and SHA-512 crypto hash functions\&.
+.TP
+-XX:+UseSuperWord
+.br
+Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify \f3-XX:-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
+.SS ADVANCED\ SERVICEABILITY\ OPTIONS    
 These options provide the ability to gather system information and perform extensive debugging\&.
-.PP
-\-XX:+ExtendedDTraceProbes
-.RS 4
-Enables additional
-\fBdtrace\fR
-tool probes that impact the performance\&. By default, this option is disabled and
-\fBdtrace\fR
-performs only standard probes\&.
-.RE
-.PP
-\-XX:+HeapDumpOnOutOfMemory
-.RS 4
-Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a
-\fBjava\&.lang\&.OutOfMemoryError\fR
-exception is thrown\&. You can explicitly set the heap dump file path and name using the
-\fB\-XX:HeapDumpPath\fR
-option\&. By default, this option is disabled and the heap is not dumped when an
-\fBOutOfMemoryError\fR
-exception is thrown\&.
-.RE
-.PP
-\-XX:HeapDumpPath=\fIpath\fR
-.RS 4
-Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the
-\fB\-XX:+HeapDumpOnOutOfMemoryError\fR
-option is set\&. By default, the file is created in the current working directory, and it is named
-\fBjava_pid\fR\fIpid\fR\fB\&.hprof\fR
-where
-\fIpid\fR
-is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\fB%p\fR
-represents the current process identificator):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example shows how to set the heap dump file to
-\fB/var/log/java/java_heapdump\&.hprof\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:LogFile=\fIpath\fR
-.RS 4
-Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named
-\fBhotspot\&.log\fR\&.
-.sp
-The following example shows how to set the log file to
-\fB/var/log/java/hotspot\&.log\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:LogFile=/var/log/java/hotspot\&.log\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+PrintClassHistogram
-.RS 4
-Enables printing of a class instance histogram after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjmap \-histo\fR
-command, or the
-\fBjcmd \fR\fIpid\fR\fB GC\&.class_histogram\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+PrintConcurrentLocks
-.RS 4
-Enables printing of j locks after a event\&. By default, this option is disabled\&.
-.sp
-Enables printing of j\fBava\&.util\&.concurrent\fR
-locks after a
-\fBControl+C\fR
-event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
-.sp
-Setting this option is equivalent to running the
-\fBjstack \-l\fR
-command or the
-\fBjcmd \fR\fIpid\fR\fB Thread\&.print \-l\fR
-command, where
-\fIpid\fR
-is the current Java process identifier\&.
-.RE
-.PP
-\-XX:+UnlockDiagnosticVMOptions
-.RS 4
+.TP
+-XX:+ExtendedDTraceProbes
+.br
+Enables additional \f3dtrace\fR tool probes that impact the performance\&. By default, this option is disabled and \f3dtrace\fR performs only standard probes\&.
+.TP
+-XX:+HeapDumpOnOutOfMemory
+.br
+Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a \f3java\&.lang\&.OutOfMemoryError\fR exception is thrown\&. You can explicitly set the heap dump file path and name using the \f3-XX:HeapDumpPath\fR option\&. By default, this option is disabled and the heap is not dumped when an \f3OutOfMemoryError\fR exception is thrown\&.
+.TP
+-XX:HeapDumpPath=\fIpath\fR
+.br
+Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the \f3-XX:+HeapDumpOnOutOfMemoryError\fR option is set\&. By default, the file is created in the current working directory, and it is named \f3java_pid\fR\fIpid\fR\f3\&.hprof\fR where \fIpid\fR is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\f3%p\fR represents the current process identificator):
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fI\fRThe following example shows how to set the heap dump file to \f3/var/log/java/java_heapdump\&.hprof\fR:
+.sp     
+.nf     
+\f3\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:LogFile=\fIpath\fR
+.br
+Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named \f3hotspot\&.log\fR\&.
+
+\fI\fRThe following example shows how to set the log file to \f3/var/log/java/hotspot\&.log\fR:
+.sp     
+.nf     
+\f3\-XX:LogFile=/var/log/java/hotspot\&.log\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+PrintClassHistogram
+.br
+\fI\fREnables printing of a class instance histogram after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jmap -histo\fR command, or the \f3jcmd\fR\fIpid\fR\f3GC\&.class_histogram\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP     
+-XX:+PrintConcurrentLocks
+
+
+Enables printing of \f3java\&.util\&.concurrent\fR locks after a \f3Control+C\fR event (\f3SIGTERM\fR)\&. By default, this option is disabled\&.
+
+Setting this option is equivalent to running the \f3jstack -l\fR command or the \f3jcmd\fR\fIpid\fR\f3Thread\&.print -l\fR command, where \fIpid\fR is the current Java process identifier\&.
+.TP
+-XX:+UnlockDiagnosticVMOptions
+.br
 Unlocks the options intended for diagnosing the JVM\&. By default, this option is disabled and diagnostic options are not available\&.
-.RE
-.SS "Advanced Garbage Collection Options"
-.PP
+.SS ADVANCED\ GARBAGE\ COLLECTION\ OPTIONS    
 These options control how garbage collection (GC) is performed by the Java HotSpot VM\&.
-.PP
-\-XX:+AggressiveHeap
-.RS 4
-Enables Java heap optimization\&. This sets various parameters to be optimal for long\-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
-.RE
-.PP
-\-XX:+AlwaysPreTouch
-.RS 4
-Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the
-\fBmain()\fR
-method\&. The option can be used in testing to simulate a long\-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
-.RE
-.PP
-\-XX:+CMSClassUnloadingEnabled
-.RS 4
-Enables class unloading when using the concurrent mark\-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify
-\fB\-XX:\-CMSClassUnloadingEnabled\fR\&.
-.RE
-.PP
-\-XX:CMSExpAvgFactor=\fIpercent\fR
-.RS 4
+.TP
+-XX:+AggressiveHeap
+.br
+Enables Java heap optimization\&. This sets various parameters to be optimal for long-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
+.TP
+-XX:+AlwaysPreTouch
+.br
+Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the \f3main()\fR method\&. The option can be used in testing to simulate a long-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
+.TP
+-XX:+CMSClassUnloadingEnabled
+.br
+Enables class unloading when using the concurrent mark-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify \f3-XX:-CMSClassUnloadingEnabled\fR\&.
+.TP
+-XX:CMSExpAvgFactor=\fIpercent\fR
+.br
 Sets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics\&. By default, the exponential averages factor is set to 25%\&. The following example shows how to set the factor to 15%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSExpAvgFactor=15\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
-.RS 4
-Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to \-1\&. Any negative value (including the default) implies that
-\fB\-XX:CMSTriggerRatio\fR
-is used to define the value of the initiating occupancy fraction\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:CMSExpAvgFactor=15\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
+.br
+Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to -1\&. Any negative value (including the default) implies that \f3-XX:CMSTriggerRatio\fR is used to define the value of the initiating occupancy fraction\&.
+
 The following example shows how to set the occupancy fraction to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSInitiatingOccupancyFraction=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+CMSScavengeBeforeRemark
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSInitiatingOccupancyFraction=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+CMSScavengeBeforeRemark
+.br
 Enables scavenging attempts before the CMS remark step\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:CMSTriggerRatio=\fIpercent\fR
-.RS 4
-Sets the percentage (0 to 100) of the value specified by
-\fB\-XX:MinHeapFreeRatio\fR
-that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
-.sp
+.TP
+-XX:CMSTriggerRatio=\fIpercent\fR
+.br
+Sets the percentage (0 to 100) of the value specified by \f3-XX:MinHeapFreeRatio\fR that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
+
 The following example shows how to set the occupancy fraction to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:CMSTriggerRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:ConcGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:CMSTriggerRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:ConcGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for concurrent GC\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for concurrent GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ConcGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+DisableExplicitGC
-.RS 4
-Enables the option that disables processing of calls to
-\fBSystem\&.gc()\fR\&. This option is disabled by default, meaning that calls to
-\fBSystem\&.gc()\fR
-are processed\&. If processing of calls to
-\fBSystem\&.gc()\fR
-is disabled, the JVM still performs GC when necessary\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrent
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-.RS 4
-Enables invoking of concurrent GC by using the
-\fBSystem\&.gc()\fR
-request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&.
-.RE
-.PP
-\-XX:G1HeapRegionSize=\fIsize\fR
-.RS 4
-Sets the size of the regions into which the Java heap is subdivided when using the garbage\-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:ConcGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+DisableExplicitGC
+.br
+Enables the option that disables processing of calls to \f3System\&.gc()\fR\&. This option is disabled by default, meaning that calls to \f3System\&.gc()\fR are processed\&. If processing of calls to \f3System\&.gc()\fR is disabled, the JVM still performs GC when necessary\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrent
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
+.br
+Enables invoking of concurrent GC by using the \f3System\&.gc()\fR request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the \f3-XX:+UseConcMarkSweepGC\fR option\&.
+.TP
+-XX:G1HeapRegionSize=\fIsize\fR
+.br
+Sets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
+
 The following example shows how to set the size of the subdivisions to 16 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1HeapRegionSize=16m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+G1PrintHeapRegions
-.RS 4
+.sp     
+.nf     
+\f3\-XX:G1HeapRegionSize=16m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+G1PrintHeapRegions
+.br
 Enables the printing of information about which regions are allocated and which are reclaimed by the G1 collector\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:G1ReservePercent=\fIpercent\fR
-.RS 4
+.TP
+-XX:G1ReservePercent=\fIpercent\fR
+.br
 Sets the percentage of the heap (0 to 50) that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector\&. By default, this option is set to 10%\&.
-.sp
+
 The following example shows how to set the reserved heap to 20%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:G1ReservePercent=20\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitialHeapSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:G1ReservePercent=20\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitialHeapSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the size of allocated memory to 6 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialHeapSize=6291456\fR
-\fB\-XX:InitialHeapSize=6144k\fR
-\fB\-XX:InitialHeapSize=6m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the
-\fB\-XX:NewSize\fR
-option\&.
-.RE
-.PP
-\-XX:InitialSurvivorRatio=\fIratio\fR
-.RS 4
-Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the
-\fB\-XX:+UseParallelGC\fR
-and/or \-\fBXX:+UseParallelOldGC\fR
-options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the
-\fB\-XX:+UseParallelGC\fR
-and
-\fB\-XX:+UseParallelOldGC\fR
-options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-option), then the
-\fB\-XX:SurvivorRatio\fR
-option should be used to set the size of the survivor space for the entire execution of the application\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:InitialHeapSize=6291456\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6144k\fP
+.fi     
+.nf     
+\f3\-XX:InitialHeapSize=6m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the \f3-XX:NewSize\fR option\&.
+.TP
+-XX:InitialSurvivorRatio=\fIratio\fR
+.br
+Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the \f3-XX:+UseParallelGC\fR and/or -\f3XX:+UseParallelOldGC\fR options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the \f3-XX:+UseParallelGC\fR and \f3-XX:+UseParallelOldGC\fR options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the \f3-XX:-UseAdaptiveSizePolicy\fR option), then the \f3-XX:SurvivorRatio\fR option should be used to set the size of the survivor space for the entire execution of the application\&.
+
 The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBS=Y/(R+2)\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3S=Y/(R+2)\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The 2 in the equation denotes two survivor spaces\&. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size\&.
-.sp
+
 By default, the initial survivor space ratio is set to 8\&. If the default value for the young generation space size is used (2 MB), the initial size of the survivor space will be 0\&.2 MB\&.
-.sp
+
 The following example shows how to set the initial survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitialSurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitialSurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
+.br
 Sets the percentage of the heap occupancy (0 to 100) at which to start a concurrent GC cycle\&. It is used by garbage collectors that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (for example, the G1 garbage collector)\&.
-.sp
+
 By default, the initiating value is set to 45%\&. A value of 0 implies nonstop GC cycles\&. The following example shows how to set the initiating heap occupancy to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:InitiatingHeapOccupancyPercent=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxGCPauseMillis=\fItime\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:InitiatingHeapOccupancyPercent=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxGCPauseMillis=\fItime\fR
+.br
 Sets a target for the maximum GC pause time (in milliseconds)\&. This is a soft goal, and the JVM will make its best effort to achieve it\&. By default, there is no maximum pause time value\&.
-.sp
+
 The following example shows how to set the maximum target pause time to 500 ms:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxGCPauseMillis=500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxHeapSize=\fIsize\fR
-.RS 4
-Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
-\fB\-XX:InitialHeapSize\fR
-and
-\fB\-XX:MaxHeapSize\fR
-are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
-.sp
+.sp     
+.nf     
+\f3\-XX:MaxGCPauseMillis=500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxHeapSize=\fIsize\fR
+.br
+Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments, \f3-XX:InitialHeapSize\fR and \f3-XX:MaxHeapSize\fR are often set to the same value\&. See the section "Ergonomics" in \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
+
 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapSize=83886080\fR
-\fB\-XX:MaxHeapSize=81920k\fR
-\fB\-XX:MaxHeapSize=80m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-XX:MaxHeapSize=83886080\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=81920k\fP
+.fi     
+.nf     
+\f3\-XX:MaxHeapSize=80m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus overhead amounts\&. On Oracle Solaris 2\&.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&.
-.sp
-The
-\fB\-XX:MaxHeapSize\fR
-option is equivalent to
-\fB\-Xmx\fR\&.
-.RE
-.PP
-\-XX:MaxHeapFreeRatio=\fIpercent\fR
-.RS 4
+
+The \f3-XX:MaxHeapSize\fR option is equivalent to \f3-Xmx\fR\&.
+.TP
+-XX:MaxHeapFreeRatio=\fIpercent\fR
+.br
 Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space expands above this value, then the heap will be shrunk\&. By default, this value is set to 70%\&.
-.sp
+
 The following example shows how to set the maximum free heap ratio to 75%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxHeapFreeRatio=75\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxMetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxHeapFreeRatio=75\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxMetaspaceSize=\fIsize\fR
+.br
 Sets the maximum amount of native memory that can be allocated for class metadata\&. By default, the size is not limited\&. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system\&.
-.sp
+
 The following example shows how to set the maximum class metadata size to 256 MB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxMetaspaceSize=256m\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MaxNewSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxMetaspaceSize=256m\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MaxNewSize=\fIsize\fR
+.br
 Sets the maximum size (in bytes) of the heap for the young generation (nursery)\&. The default value is set ergonomically\&.
-.RE
-.PP
-\-XX:MaxTenuringThreshold=\fIthreshold\fR
-.RS 4
+.TP
+-XX:MaxTenuringThreshold=\fIthreshold\fR
+.br
 Sets the maximum tenuring threshold for use in adaptive GC sizing\&. The largest value is 15\&. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector\&.
-.sp
+
 The following example shows how to set the maximum tenuring threshold to 10:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MaxTenuringThreshold=10\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:MetaspaceSize=\fIsize\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MaxTenuringThreshold=10\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:MetaspaceSize=\fIsize\fR
+.br
 Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded\&. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used\&. The default size depends on the platform\&.
-.RE
-.PP
-\-XX:MinHeapFreeRatio=\fIpercent\fR
-.RS 4
+.TP
+-XX:MinHeapFreeRatio=\fIpercent\fR
+.br
 Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space falls below this value, then the heap will be expanded\&. By default, this value is set to 40%\&.
-.sp
+
 The following example shows how to set the minimum free heap ratio to 25%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:MinHeapFreeRatio=25\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:MinHeapFreeRatio=25\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewRatio=\fIratio\fR
+.br
 Sets the ratio between young and old generation sizes\&. By default, this option is set to 2\&. The following example shows how to set the young/old ratio to 1:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewRatio=1\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:NewSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:NewRatio=1\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:NewSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&.
+
 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too low, then a large number of minor GCs will be performed\&. If the size is too high, then only full GCs will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
-.sp
+
 The following examples show how to set the initial size of young generation to 256 MB using various units:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:NewSize=256m\fR
-\fB\-XX:NewSize=262144k\fR
-\fB\-XX:NewSize=268435456\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-XX:NewSize\fR
-option is equivalent to
-\fB\-Xmn\fR\&.
-.RE
-.PP
-\-XX:ParallelGCThreads=\fIthreads\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:NewSize=256m\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=262144k\fP
+.fi     
+.nf     
+\f3\-XX:NewSize=268435456\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The \f3-XX:NewSize\fR option is equivalent to \f3-Xmn\fR\&.
+.TP
+-XX:ParallelGCThreads=\fIthreads\fR
+.br
 Sets the number of threads used for parallel garbage collection in the young and old generations\&. The default value depends on the number of CPUs available to the JVM\&.
-.sp
+
 For example, to set the number of threads for parallel GC to 2, specify the following option:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:ParallelGCThreads=2\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+ParallelRefProcEnabled
-.RS 4
+.sp     
+.nf     
+\f3\-XX:ParallelGCThreads=2\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+ParallelRefProcEnabled
+.br
 Enables parallel reference processing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintAdaptiveSizePolicy
-.RS 4
+.TP
+-XX:+PrintAdaptiveSizePolicy
+.br
 Enables printing of information about adaptive generation sizing\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGC
-.RS 4
+.TP
+-XX:+PrintGC
+.br
 Enables printing of messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationConcurrentTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationConcurrentTime
+.br
 Enables printing of how much time elapsed since the last pause (for example, a GC pause)\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCApplicationStoppedTime
-.RS 4
+.TP
+-XX:+PrintGCApplicationStoppedTime
+.br
 Enables printing of how much time the pause (for example, a GC pause) lasted\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDateStamps
-.RS 4
+.TP
+-XX:+PrintGCDateStamps
+.br
 Enables printing of a date stamp at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCDetails
-.RS 4
+.TP
+-XX:+PrintGCDetails
+.br
 Enables printing of detailed messages at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTaskTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTaskTimeStamps
+.br
 Enables printing of time stamps for every individual GC worker thread task\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintGCTimeStamps
-.RS 4
+.TP
+-XX:+PrintGCTimeStamps
+.br
 Enables printing of time stamps at every GC\&. By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+PrintStringDeduplicationStatistics
-.RS 4
-Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:+PrintTenuringDistribution
-.RS 4
+.TP
+-XX:+PrintStringDeduplicationStatistics
+.br
+Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:+PrintTenuringDistribution
+.br
 Enables printing of tenuring age information\&. The following is an example of the output:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBDesired survivor size 48286924 bytes, new threshold 10 (max 10)\fR
-\fB\- age 1: 28992024 bytes, 28992024 total\fR
-\fB\- age 2: 1366864 bytes, 30358888 total\fR
-\fB\- age 3: 1425912 bytes, 31784800 total\fR
-\fB\&.\&.\&.\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3Desired survivor size 48286924 bytes, new threshold 10 (max 10)\fP
+.fi     
+.nf     
+\f3\- age 1: 28992024 bytes, 28992024 total\fP
+.fi     
+.nf     
+\f3\- age 2: 1366864 bytes, 30358888 total\fP
+.fi     
+.nf     
+\f3\- age 3: 1425912 bytes, 31784800 total\fP
+.fi     
+.nf     
+\f3\&.\&.\&.\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 Age 1 objects are the youngest survivors (they were created after the previous scavenge, survived the latest scavenge, and moved from eden to survivor space)\&. Age 2 objects have survived two scavenges (during the second scavenge they were copied from one survivor space to the next)\&. And so on\&.
-.sp
+
 In the preceding example, 28 992 024 bytes survived one scavenge and were copied from eden to survivor space, 1 366 864 bytes are occupied by age 2 objects, etc\&. The third value in each row is the cumulative size of objects of age n or less\&.
-.sp
+
 By default, this option is disabled\&.
-.RE
-.PP
-\-XX:+ScavengeBeforeFullGC
-.RS 4
-Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you
-\fIdo not\fR
-disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify
-\fB\-XX:\-ScavengeBeforeFullGC\fR\&.
-.RE
-.PP
-\-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
-.RS 4
-Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The
-\fB\-XX:SoftRefLRUPolicyMSPerMB\fR
-option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the
-\fB\-Xmx\fR
-option has a significant effect on how quickly soft references are garbage collected\&.
-.sp
+.TP
+-XX:+ScavengeBeforeFullGC
+.br
+Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you \fIdo not\fR disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify \f3-XX:-ScavengeBeforeFullGC\fR\&.
+.TP
+-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
+.br
+Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The \f3-XX:SoftRefLRUPolicyMSPerMB\fR option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the \f3-Xmx\fR option has a significant effect on how quickly soft references are garbage collected\&.
+
 The following example shows how to set the value to 2\&.5 seconds:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SoftRefLRUPolicyMSPerMB=2500\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
-.RS 4
-\fBString\fR
-objects reaching the specified age are considered candidates for deduplication\&. An object\*(Aqs age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the
-\fB\-XX:+PrintTenuringDistribution\fR
-option\&. Note that
-\fBString\fR
-objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is
-\fB3\fR\&. See the
-\fB\-XX:+UseStringDeduplication\fR
-option\&.
-.RE
-.PP
-\-XX:SurvivorRatio=\fIratio\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SoftRefLRUPolicyMSPerMB=2500\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
+.br
+\f3String\fR objects reaching the specified age are considered candidates for deduplication\&. An object\&'s age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the \f3-XX:+PrintTenuringDistribution\fR option\&. Note that \f3String\fR objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is \f33\fR\&. See the \f3-XX:+UseStringDeduplication\fR option\&.
+.TP
+-XX:SurvivorRatio=\fIratio\fR
+.br
 Sets the ratio between eden space size and survivor space size\&. By default, this option is set to 8\&. The following example shows how to set the eden/survivor space ratio to 4:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:SurvivorRatio=4\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TargetSurvivorRatio=\fIpercent\fR
-.RS 4
+.sp     
+.nf     
+\f3\-XX:SurvivorRatio=4\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TargetSurvivorRatio=\fIpercent\fR
+.br
 Sets the desired percentage of survivor space (0 to 100) used after young garbage collection\&. By default, this option is set to 50%\&.
-.sp
+
 The following example shows how to set the target survivor space ratio to 30%:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TargetSurvivorRatio=30\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:TLABSize=\fIsize\fR
-.RS 4
-Sets the initial size (in bytes) of a thread\-local allocation buffer (TLAB)\&. Append the letter
-\fBk\fR
-or
-\fBK\fR
-to indicate kilobytes,
-\fBm\fR
-or
-\fBM\fR
-to indicate megabytes,
-\fBg\fR
-or
-\fBG\fR
-to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
-.sp
+.sp     
+.nf     
+\f3\-XX:TargetSurvivorRatio=30\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:TLABSize=\fIsize\fR
+.br
+Sets the initial size (in bytes) of a thread-local allocation buffer (TLAB)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes, \f3m\fR or \f3M\fR to indicate megabytes, \f3g\fR or \f3G\fR to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
+
 The following example shows how to set the initial TLAB size to 512 KB:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-XX:TLABSize=512k\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-XX:+UseAdaptiveSizePolicy
-.RS 4
-Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify
-\fB\-XX:\-UseAdaptiveSizePolicy\fR
-and set the size of the memory allocation pool explicitly (see the
-\fB\-XX:SurvivorRatio\fR
-option)\&.
-.RE
-.PP
-\-XX:+UseCMSInitiatingOccupancyOnly
-.RS 4
+.sp     
+.nf     
+\f3\-XX:TLABSize=512k\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-XX:+UseAdaptiveSizePolicy
+.br
+Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify \f3-XX:-UseAdaptiveSizePolicy\fR and set the size of the memory allocation pool explicitly (see the \f3-XX:SurvivorRatio\fR option)\&.
+.TP
+-XX:+UseCMSInitiatingOccupancyOnly
+.br
 Enables the use of the occupancy value as the only criterion for initiating the CMS collector\&. By default, this option is disabled and other criteria may be used\&.
-.RE
-.PP
-\-XX:+UseConcMarkSweepGC
-.RS 4
-Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\fB\-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\fB\-XX:+UseG1GC\fR) is another alternative\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the
-\fB\-XX:+UseParNewGC\fR
-option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8:
-\fB\-XX:+UseConcMarkSweepGC \-XX:\-UseParNewGC\fR\&.
-.RE
-.PP
-\-XX:+UseG1GC
-.RS 4
-Enables the use of the garbage\-first (G1) garbage collector\&. It is a server\-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
-.sp
+.TP
+-XX:+UseConcMarkSweepGC
+.br
+Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\f3-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\f3-XX:+UseG1GC\fR) is another alternative\&.
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the \f3-XX:+UseParNewGC\fR option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8: \f3-XX:+UseConcMarkSweepGC -XX:-UseParNewGC\fR\&.
+.TP
+-XX:+UseG1GC
+.br
+Enables the use of the garbage-first (G1) garbage collector\&. It is a server-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
+
 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseGCOverheadLimit
-.RS 4
-Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an
-\fBOutOfMemoryError\fR
-exception is thrown\&. This option is enabled, by default and the parallel GC will throw an
-\fBOutOfMemoryError\fR
-if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify
-\fB\-XX:\-UseGCOverheadLimit\fR\&.
-.RE
-.PP
-\-XX:+UseNUMA
-.RS 4
-Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\*(Aqs use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\fB\-XX:+UseParallelGC\fR)\&.
-.RE
-.PP
-\-XX:+UseParallelGC
-.RS 4
+.TP
+-XX:+UseGCOverheadLimit
+.br
+Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an \f3OutOfMemoryError\fR exception is thrown\&. This option is enabled, by default and the parallel GC will throw an \f3OutOfMemoryError\fR if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify \f3-XX:-UseGCOverheadLimit\fR\&.
+.TP
+-XX:+UseNUMA
+.br
+Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\&'s use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\f3-XX:+UseParallelGC\fR)\&.
+.TP
+-XX:+UseParallelGC
+.br
 Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors\&.
-.sp
-By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the
-\fB\-XX:+UseParallelOldGC\fR
-option is automatically enabled, unless you explicitly disable it\&.
-.RE
-.PP
-\-XX:+UseParallelOldGC
-.RS 4
-Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the
-\fB\-XX:+UseParallelGC\fR
-option\&.
-.RE
-.PP
-\-XX:+UseParNewGC
-.RS 4
-Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option\&. Using the
-\fB\-XX:+UseParNewGC\fR
-option without the
-\fB\-XX:+UseConcMarkSweepGC\fR
-option was deprecated in JDK 8\&.
-.RE
-.PP
-\-XX:+UseSerialGC
-.RS 4
+
+By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the \f3-XX:+UseParallelOldGC\fR option is automatically enabled, unless you explicitly disable it\&.
+.TP
+-XX:+UseParallelOldGC
+.br
+Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the \f3-XX:+UseParallelGC\fR option\&.
+.TP
+-XX:+UseParNewGC
+.br
+Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the \f3-XX:+UseConcMarkSweepGC\fR option\&. Using the \f3-XX:+UseParNewGC\fR option without the \f3-XX:+UseConcMarkSweepGC\fR option was deprecated in JDK 8\&.
+.TP
+-XX:+UseSerialGC
+.br
 Enables the use of the serial garbage collector\&. This is generally the best choice for small and simple applications that do not require any special functionality from garbage collection\&. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
-.RE
-.PP
-\-XX:+UseStringDeduplication
-.RS 4
-Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage\-first (G1) garbage collector\&. See the
-\fB\-XX:+UseG1GC\fR
-option\&.
-.sp
-\fIString deduplication\fR
-reduces the memory footprint of
-\fBString\fR
-objects on the Java heap by taking advantage of the fact that many
-\fBString\fR
-objects are identical\&. Instead of each
-\fBString\fR
-object pointing to its own character array, identical
-\fBString\fR
-objects can point to and share the same character array\&.
-.RE
-.PP
-\-XX:+UseTLAB
-.RS 4
-Enables the use of thread\-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify
-\fB\-XX:\-UseTLAB\fR\&.
-.RE
-.SS "Deprecated and Removed Options"
-.PP
+.TP
+-XX:+UseSHM
+.br
+On Linux, enables the JVM to use shared memory to setup large pages\&.
+
+For more information, see Large Pages\&.
+.TP
+-XX:+UseStringDeduplication
+.br
+Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage-first (G1) garbage collector\&. See the \f3-XX:+UseG1GC\fR option\&.
+
+\fIString deduplication\fR reduces the memory footprint of \f3String\fR objects on the Java heap by taking advantage of the fact that many \f3String\fR objects are identical\&. Instead of each \f3String\fR object pointing to its own character array, identical \f3String\fR objects can point to and share the same character array\&.
+.TP
+-XX:+UseTLAB
+.br
+Enables the use of thread-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify \f3-XX:-UseTLAB\fR\&.
+.SS DEPRECATED\ AND\ REMOVED\ OPTIONS    
 These options were included in the previous release, but have since been considered unnecessary\&.
-.PP
-\-Xincgc
-.RS 4
+.TP
+-Xincgc
+.br
 Enables incremental garbage collection\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-Xrun\fIlibname\fR
-.RS 4
-Loads the specified debugging/profiling library\&. This option was superseded by the
-\fB\-agentlib\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycle=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when
-\fB\-XX:+CMSIncrementalPacing\fR
-is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalMode
-.RS 4
-Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with
-\fBCMSIncremental\fR\&.
-.RE
-.PP
-\-XX:CMSIncrementalOffset=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:+CMSIncrementalPacing
-.RS 4
-Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
-.RS 4
-Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
-\fB\-XX:+CMSIncrementalMode\fR
-option\&.
-.RE
-.PP
-\-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
-.RS 4
+.TP
+-Xrun\fIlibname\fR
+.br
+Loads the specified debugging/profiling library\&. This option was superseded by the \f3-agentlib\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycle=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when \f3-XX:+CMSIncrementalPacing\fR is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalMode
+.br
+Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with \f3CMSIncremental\fR\&.
+.TP
+-XX:CMSIncrementalOffset=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:+CMSIncrementalPacing
+.br
+Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
+.br
+Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the \f3-XX:+CMSIncrementalMode\fR option\&.
+.TP
+-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
+.br
 Sets the percentage of the permanent generation occupancy (0 to 100) at which to start a GC\&. This option was deprecated in JDK 8 with no replacement\&.
-.RE
-.PP
-\-XX:MaxPermSize=\fIsize\fR
-.RS 4
-Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the
-\fB\-XX:MaxMetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:PermSize=\fIsize\fR
-.RS 4
-Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the
-\fB\-XX:MetaspaceSize\fR
-option\&.
-.RE
-.PP
-\-XX:+UseSplitVerifier
-.RS 4
+.TP
+-XX:MaxPermSize=\fIsize\fR
+.br
+Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the \f3-XX:MaxMetaspaceSize\fR option\&.
+.TP
+-XX:PermSize=\fIsize\fR
+.br
+Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the \f3-XX:MetaspaceSize\fR option\&.
+.TP
+-XX:+UseSplitVerifier
+.br
 Enables splitting of the verification process\&. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime)\&. This option was deprecated in JDK 8, and verification is now split by default without a way to disable it\&.
-.RE
-.PP
-\-XX:+UseStringCache
-.RS 4
+.TP
+-XX:+UseStringCache
+.br
 Enables caching of commonly allocated strings\&. This option was removed from JDK 8 with no replacement\&.
-.RE
-.SH "PERFORMANCE TUNING EXAMPLES"
-.PP
+.SH PERFORMANCE\ TUNING\ EXAMPLES    
 The following examples show how to use experimental tuning flags to either optimize throughput or to provide lower response time\&.
 .PP
-\fBExample 1\fR
-.br
-Tuning for Higher Throughput
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+\f3Example 1 Tuning for Higher Throughput\fR
+.sp     
+.nf     
+\f3java \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Tuning for Lower Response Time\fR
+.sp     
+.nf     
+\f3java \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH LARGE\ PAGES    
+Also known as huge pages, large pages are memory pages that are significantly larger than the standard memory page size (which varies depending on the processor and operating system)\&. Large pages optimize processor Translation-Lookaside Buffers\&.
 .PP
-\fBExample 2\fR
-.br
-Tuning for Lower Response Time
-.RS 4
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "EXIT STATUS"
+A Translation-Lookaside Buffer (TLB) is a page translation cache that holds the most-recently used virtual-to-physical address translations\&. TLB is a scarce system resource\&. A TLB miss can be costly as the processor must then read from the hierarchical page table, which may require multiple memory accesses\&. By using a larger memory page size, a single TLB entry can represent a larger memory range\&. There will be less pressure on TLB, and memory-intensive applications may have better performance\&.
 .PP
-The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call
-\fBSystem\&.exit(exitValue)\fR\&. The values are:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB0\fR: Successful completion
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB>0\fR: An error occurred
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+However, large pages page memory can negatively affect system performance\&. For example, when a large mount of memory is pinned by an application, it may create a shortage of regular memory and cause excessive paging in other applications and slow down the entire system\&. Also, a system that has been up for a long time could produce excessive fragmentation, which could make it impossible to reserve enough large page memory\&. When this happens, either the OS or JVM reverts to using regular pages\&.
+.SS LARGE\ PAGES\ SUPPORT    
+Solaris and Linux support large pages\&.
+.PP
+Solaris 9 and later include Multiple Page Size Support (MPSS); no additional configuration is necessary\&. See http://www\&.oracle\&.com/technetwork/server-storage/solaris10/overview/solaris9-features-scalability-135663\&.html\&.
+.PP
+The 2\&.6 kernel supports large pages\&. Some vendors have backported the code to their 2\&.4-based releases\&. To check if your system can support large page memory, try the following:
+.sp     
+.nf     
+\f3# cat /proc/meminfo | grep Huge\fP
+.fi     
+.nf     
+\f3HugePages_Total: 0\fP
+.fi     
+.nf     
+\f3HugePages_Free: 0\fP
+.fi     
+.nf     
+\f3Hugepagesize: 2048 kB\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If the output shows the three "Huge" variables, then your system can support large page memory but it needs to be configured\&. If the command prints nothing, then your system does not support large pages\&. To configure the system to use large page memory, login as \f3root\fR, and then follow these steps:
+.TP 0.4i    
+1\&.
+If you are using the option \f3-XX:+UseSHM\fR (instead of \f3-XX:+UseHugeTLBFS\fR), then increase the \f3SHMMAX\fR value\&. It must be larger than the Java heap size\&. On a system with 4 GB of physical RAM (or less), the following will make all the memory sharable:
+.sp     
+.nf     
+\f3# echo 4294967295 > /proc/sys/kernel/shmmax\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP 0.4i    
+2\&.
+If you are using the option \f3-XX:+UseSHM\fR or \f3-XX:+UseHugeTLBFS\fR, then specify the number of large pages\&. In the following example, 3 GB of a 4 GB system are reserved for large pages (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048 kB = 1536):
+.sp     
+.nf     
+\f3# echo 1536 > /proc/sys/vm/nr_hugepages\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.PP
+Note
+.PP
+Note that the values contained in \f3/proc\fR will reset after you reboot your system, so may want to set them in an initialization script (for example, \f3rc\&.local\fR or \f3sysctl\&.conf\fR)\&.
+.PP
+If you configure (or resize) the OS kernel parameters \f3/proc/sys/kernel/shmmax\fR or \f3/proc/sys/vm/nr_hugepages\fR, Java processes may allocate large pages for areas in addition to the Java heap\&. These steps can allocate large pages for the following areas:
+.PP
+Java heap
+.PP
+Permanent generation
+.PP
+Code cache
+.PP
+The marking bitmap data structure for the parallel GC
+.PP
+Consequently, if you configure the \f3nr_hugepages\fR parameter to the size of the Java heap, then the JVM can fail in allocating the permanent generation and code cache areas on large pages because these areas are quite large in size\&.
+.SH EXIT\ STATUS    
+The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call \f3System\&.exit(exitValue)\fR\&. The values are:
+.TP 0.2i    
+\(bu
+\f30\fR: Successful completion
+.TP 0.2i    
+\(bu
+\f3>0\fR: An error occurred
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 javac(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.TP 0.2i    
+\(bu
+jstat(1)
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/solaris/doc/sun/man/man1/javac.1 b/src/solaris/doc/sun/man/man1/javac.1
index a3d55e2..5cc8c18 100644
--- a/src/solaris/doc/sun/man/man1/javac.1
+++ b/src/solaris/doc/sun/man/man1/javac.1
@@ -1,2116 +1,1370 @@
 '\" t
-.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: javac
-.\" Language: English
-.\" Date: 8 August 2014
-.\" SectDesc: Basic Tools
-.\" Software: JDK 8
-.\" Arch: generic
-.\" Part Number: E38207-03
+.\"  Copyright (c) 1994, 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.

+.\"

+.\"     Arch: generic
+.\"     Software: JDK 8
+.\"     Date: 03 March 2015
+.\"     SectDesc: Basic Tools
+.\"     Title: javac.1
 .\"
 .if n .pl 99999
-.TH "javac" "1" "8 August 2014" "JDK 8" "Basic Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
+.TH javac 1 "03 March 2015" "JDK 8" "Basic Tools"
+.\" -----------------------------------------------------------------

+.\" * Define some portability stuff

+.\" -----------------------------------------------------------------

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.\" http://bugs.debian.org/507673

+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html

+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+.ie \n(.g .ds Aq \(aq

+.el       .ds Aq '

+.\" -----------------------------------------------------------------

+.\" * set default formatting

+.\" -----------------------------------------------------------------

+.\" disable hyphenation

+.nh

+.\" disable justification (adjust text to left margin only)

+.ad l

+.\" -----------------------------------------------------------------

+.\" * MAIN CONTENT STARTS HERE *

+.\" -----------------------------------------------------------------

+
+.SH NAME    
 javac \- Reads Java class and interface definitions and compiles them into bytecode and class files\&.
-.SH "SYNOPSIS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
+.SH SYNOPSIS    
+.sp     
+.nf     
+
 \fBjavac\fR [ \fIoptions\fR ] [ \fIsourcefiles\fR ] [ \fIclasses\fR] [ \fI@argfiles\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
+.fi     
+.sp     
 Arguments can be in any order:
-.PP
+.TP     
 \fIoptions\fR
-.RS 4
-Command\-line options\&. See Options\&.
-.RE
-.PP
+Command-line options\&. See Options\&.
+.TP     
 \fIsourcefiles\fR
-.RS 4
-One or more source files to be compiled (such as
-\fBMyClass\&.java\fR)\&.
-.RE
-.PP
+One or more source files to be compiled (such as \f3MyClass\&.java\fR)\&.
+.TP     
 \fIclasses\fR
-.RS 4
-One or more classes to be processed for annotations (such as
-\fBMyPackage\&.MyClass\fR)\&.
-.RE
-.PP
+One or more classes to be processed for annotations (such as \f3MyPackage\&.MyClass\fR)\&.
+.TP     
 \fI@argfiles\fR
-.RS 4
-One or more files that list options and source files\&. The
-\fB\-J\fR
-options are not allowed in these files\&. See Command\-Line Argument Files\&.
-.RE
-.SH "DESCRIPTION"
+One or more files that list options and source files\&. The \f3-J\fR options are not allowed in these files\&. See Command-Line Argument Files\&.
+.SH DESCRIPTION    
+The \f3javac\fR command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The \f3javac\fR command can also process annotations in Java source files and classes\&.
 .PP
-The
-\fBjavac\fR
-command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The
-\fBjavac\fR
-command can also process annotations in Java source files and classes\&.
-.PP
-There are two ways to pass source code file names to
-\fBjavac\fR\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+There are two ways to pass source code file names to \f3javac\fR\&.
+.TP 0.2i    
+\(bu
 For a small number of source files, list the file names on the command line\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the
-\fBjavac\fR
-command\&.
-.RE
+.TP 0.2i    
+\(bu
+For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the \f3javac\fR command\&.
 .PP
-Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called
-\fBMyClass\fR
-would be written in a source file called
-\fBMyClass\&.java\fR
-and compiled into a bytecode class file called
-\fBMyClass\&.class\fR\&.
+Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called \f3MyClass\fR would be written in a source file called \f3MyClass\&.java\fR and compiled into a bytecode class file called \f3MyClass\&.class\fR\&.
 .PP
-Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as
-\fBMyClass$MyInnerClass\&.class\fR\&.
+Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as \f3MyClass$MyInnerClass\&.class\fR\&.
 .PP
-Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in
-\fB/workspace\fR, then put the source code for
-\fBcom\&.mysoft\&.mypack\&.MyClass\fR
-in
-\fB/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
+Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in \f3/workspace\fR, then put the source code for \f3com\&.mysoft\&.mypack\&.MyClass\fR in \f3/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
 .PP
-By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.SH "OPTIONS"
-.PP
-The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the
-\fB\-X\fR
-option\&.
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-See also Cross\-Compilation Options
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the \f3-d\fR option\&.
+.SH OPTIONS    
+The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the \f3-X\fR option\&.
+.TP 0.2i    
+\(bu
+See also Cross-Compilation Options
+.TP 0.2i    
+\(bu
 See also Nonstandard Options
-.RE
-.SS "Standard Options"
-.PP
-\-A\fIkey\fR[\fI=value\fR]
-.RS 4
-Specifies options to pass to annotation processors\&. These options are not interpreted by
-\fBjavac\fR
-directly, but are made available for use by individual processors\&. The
-\fBkey\fR
-value should be one or more identifiers separated by a dot (\&.)\&.
-.RE
-.PP
-\-cp \fIpath\fR or \-classpath \fIpath\fR
-.RS 4
-Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the
-\fBCLASSPATH\fR
-environment variable\&. If neither
-\fBCLASSPATH\fR,
-\fB\-cp\fR
-nor
-\fB\-classpath\fR
-is specified, then the user
-\fIclass path\fR
-is the current directory\&. See Setting the Class Path \&.
-.sp
-If the
-\fB\-sourcepath\fR
-option is not specified, then the user class path is also searched for source files\&.
-.sp
-If the
-\fB\-processorpath\fR
-option is not specified, then the class path is also searched for annotation processors\&.
-.RE
-.PP
-\-Djava\&.ext\&.dirs=\fIdirectories\fR
-.RS 4
+.SS STANDARD\ OPTIONS    
+.TP
+-A\fIkey\fR[\fI=value\fR]
+.br
+Specifies options to pass to annotation processors\&. These options are not interpreted by \f3javac\fR directly, but are made available for use by individual processors\&. The \f3key\fR value should be one or more identifiers separated by a dot (\&.)\&.
+.TP
+-cp \fIpath\fR or -classpath \fIpath\fR
+.br
+Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the \f3CLASSPATH\fR environment variable\&. If neither \f3CLASSPATH\fR, \f3-cp\fR nor \f3-classpath\fR is specified, then the user \fIclass path\fR is the current directory\&. See Setting the Class Path\&.
+
+If the \f3-sourcepath\fR option is not specified, then the user class path is also searched for source files\&.
+
+If the \f3-processorpath\fR option is not specified, then the class path is also searched for annotation processors\&.
+.TP
+-Djava\&.ext\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of installed extensions\&.
-.RE
-.PP
-\-Djava\&.endorsed\&.dirs=\fIdirectories\fR
-.RS 4
+.TP
+-Djava\&.endorsed\&.dirs=\fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-d \fIdirectory\fR
-.RS 4
-Sets the destination directory for class files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then
-\fBjavac\fR
-puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-d\fR
-\fB/home/myclasses\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the class file is
-\fB/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
-.sp
-If the
-\fI\-d\fR
-option is not specified, then
-\fBjavac\fR
-puts each class file in the same directory as the source file from which it was generated\&.
-.sp
-\fBNote:\fR
-The directory specified by the
-\fI\-d\fR
-option is not automatically added to your user class path\&.
-.RE
-.PP
-\-deprecation
-.RS 4
-Shows a description of each use or override of a deprecated member or class\&. Without the
-\fB\-deprecation\fR
-option,
-\fBjavac\fR
-shows a summary of the source files that use or override deprecated members or classes\&. The
-\fB\-deprecation\fR
-option is shorthand for
-\fB\-Xlint:deprecation\fR\&.
-.RE
-.PP
-\-encoding \fIencoding\fR
-.RS 4
-Sets the source file encoding name, such as EUC\-JP and UTF\-8\&. If the
-\fB\-encoding\fR
-option is not specified, then the platform default converter is used\&.
-.RE
-.PP
-\-endorseddirs \fIdirectories\fR
-.RS 4
+.TP
+-d \fIdirectory\fR
+.br
+Sets the destination directory for class files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then \f3javac\fR puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-d\fR\f3/home/myclasses\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the class file is \f3/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
+
+If the \fI-d\fR option is not specified, then \f3javac\fR puts each class file in the same directory as the source file from which it was generated\&.
+
+\fINote:\fR The directory specified by the \fI-d\fR option is not automatically added to your user class path\&.
+.TP
+-deprecation
+.br
+Shows a description of each use or override of a deprecated member or class\&. Without the \f3-deprecation\fR option, \f3javac\fR shows a summary of the source files that use or override deprecated members or classes\&. The \f3-deprecation\fR option is shorthand for \f3-Xlint:deprecation\fR\&.
+.TP
+-encoding \fIencoding\fR
+.br
+Sets the source file encoding name, such as EUC-JP and UTF-8\&. If the \f3-encoding\fR option is not specified, then the platform default converter is used\&.
+.TP
+-endorseddirs \fIdirectories\fR
+.br
 Overrides the location of the endorsed standards path\&.
-.RE
-.PP
-\-extdirs \fIdirectories\fR
-.RS 4
-Overrides the location of the
-\fBext\fR
-directory\&. The directories variable is a colon\-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
-.sp
-If you are cross\-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross\-Compilation Options for more information\&.
-.RE
-.PP
-\-g
-.RS 4
+.TP
+-extdirs \fIdirectories\fR
+.br
+Overrides the location of the \f3ext\fR directory\&. The directories variable is a colon-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
+
+If you are cross-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross-Compilation Options for more information\&.
+.TP
+-g
+.br
 Generates all debugging information, including local variables\&. By default, only line number and source file information is generated\&.
-.RE
-.PP
-\-g:none
-.RS 4
+.TP
+-g:none
+.br
 Does not generate any debugging information\&.
-.RE
-.PP
-\-g:[\fIkeyword list\fR]
-.RS 4
+.TP
+-g:[\fIkeyword list\fR]
+.br
 Generates only some kinds of debugging information, specified by a comma separated list of keywords\&. Valid keywords are:
-.PP
+.RS     
+.TP     
 source
-.RS 4
 Source file debugging information\&.
-.RE
-.PP
+.TP     
 lines
-.RS 4
 Line number debugging information\&.
-.RE
-.PP
+.TP     
 vars
-.RS 4
 Local variable debugging information\&.
-.RE
-.RE
-.PP
-\-help
-.RS 4
+.RE     
+
+.TP
+-help
+.br
 Prints a synopsis of standard options\&.
-.RE
-.PP
-\-implicit:[\fIclass, none\fR]
-.RS 4
-Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use
-\fB\-implicit:class\fR\&. To suppress class file generation, use
-\fB\-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the
-\fB\-implicit\fR
-option is set explicitly\&. See Searching for Types\&.
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Passes
-\fBoption\fR
-to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example,
-\fB\-J\-Xms48m\fR
-sets the startup memory to 48 MB\&. See
-java(1)\&.
-.sp
-\fBNote:\fR
-The
-\fICLASSPATH\fR,
-\fB\-classpath\fR,
-\fB\-bootclasspath\fR, and
-\fB\-extdirs\fR
-options do not specify the classes used to run
-\fBjavac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the
-\fB\-J\fR
-option to pass options through to the underlying Java launcher\&.
-.RE
-.PP
-\-nowarn
-.RS 4
-Disables warning messages\&. This option operates the same as the
-\fB\-Xlint:none\fR
-option\&.
-.RE
-.PP
-\-parameters
-.RS 4
-Stores formal parameter names of constructors and methods in the generated class file so that the method
-\fBjava\&.lang\&.reflect\&.Executable\&.getParameters\fR
-from the Reflection API can retrieve them\&.
-.RE
-.PP
-\-proc: [\fInone\fR, \fIonly\fR]
-.RS 4
-Controls whether annotation processing and compilation are done\&.
-\fB\-proc:none\fR
-means that compilation takes place without annotation processing\&.
-\fB\-proc:only\fR
-means that only annotation processing is done, without any subsequent compilation\&.
-.RE
-.PP
-\-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
-.RS 4
+.TP
+-implicit:[\fIclass, none\fR]
+.br
+Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use \f3-implicit:class\fR\&. To suppress class file generation, use \f3-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the \f3-implicit\fR option is set explicitly\&. See Searching for Types\&.
+.TP
+-J\fIoption\fR
+.br
+Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
+
+\fINote:\fR The \fICLASSPATH\fR, \f3-classpath\fR, \f3-bootclasspath\fR, and \f3-extdirs\fR options do not specify the classes used to run \f3javac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the \f3-J\fR option to pass options through to the underlying \f3\fRJava launcher\&.
+.TP
+-nowarn
+.br
+Disables warning messages\&. This option operates the same as the \f3-Xlint:none\fR option\&.
+.TP
+-parameters
+.br
+Stores formal parameter names of constructors and methods in the generated class file so that the method \f3java\&.lang\&.reflect\&.Executable\&.getParameters\fR from the Reflection API can retrieve them\&.
+.TP
+-proc: [\fInone\fR, \fIonly\fR]
+.br
+Controls whether annotation processing and compilation are done\&. \f3-proc:none\fR means that compilation takes place without annotation processing\&. \f3-proc:only\fR means that only annotation processing is done, without any subsequent compilation\&.
+.TP
+-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
+.br
 Names of the annotation processors to run\&. This bypasses the default discovery process\&.
-.RE
-.PP
-\-processorpath \fIpath\fR
-.RS 4
+.TP
+-processorpath \fIpath\fR
+.br
 Specifies where to find annotation processors\&. If this option is not used, then the class path is searched for processors\&.
-.RE
-.PP
-\-s \fIdir\fR
-.RS 4
-Specifies the directory where to place the generated source files\&. The directory must already exist because
-\fBjavac\fR
-does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
-.sp
-If you specify
-\fB\-s /home/mysrc\fR
-and the class is called
-\fBcom\&.mypackage\&.MyClass\fR, then the source file is put in
-\fB/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
-.RE
-.PP
-\-source \fIrelease\fR
-.RS 4
-Specifies the version of source code accepted\&. The following values for
-\fBrelease\fR
-are allowed:
-.PP
+.TP
+-s \fIdir\fR
+.br
+Specifies the directory where to place the generated source files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
+
+If you specify \f3-s /home/mysrc\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the source file is put in \f3/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
+.TP
+-source \fIrelease\fR
+.br
+Specifies the version of source code accepted\&. The following values for \f3release\fR are allowed:
+.RS     
+.TP     
 1\&.3
-.RS 4
 The compiler does not support assertions, generics, or other language features introduced after Java SE 1\&.3\&.
-.RE
-.PP
+.TP     
 1\&.4
-.RS 4
 The compiler accepts code containing assertions, which were introduced in Java SE 1\&.4\&.
-.RE
-.PP
+.TP     
 1\&.5
-.RS 4
 The compiler accepts code containing generics and other language features introduced in Java SE 5\&.
-.RE
-.PP
+.TP     
 5
-.RS 4
 Synonym for 1\&.5\&.
-.RE
-.PP
+.TP     
 1\&.6
-.RS 4
 No language changes were introduced in Java SE 6\&. However, encoding errors in source files are now reported as errors instead of warnings as in earlier releases of Java Platform, Standard Edition\&.
-.RE
-.PP
+.TP     
 6
-.RS 4
 Synonym for 1\&.6\&.
-.RE
-.PP
+.TP     
 1\&.7
-.RS 4
 The compiler accepts code with features introduced in Java SE 7\&.
-.RE
-.PP
+.TP     
 7
-.RS 4
 Synonym for 1\&.7\&.
-.RE
-.PP
+.TP     
 1\&.8
-.RS 4
 This is the default value\&. The compiler accepts code with features introduced in Java SE 8\&.
-.RE
-.PP
+.TP     
 8
-.RS 4
 Synonym for 1\&.8\&.
-.RE
-.RE
-.PP
-\-sourcepath \fIsourcepath\fR
-.RS 4
+.RE     
+
+.TP
+-sourcepath \fIsourcepath\fR
+.br
 Specifies the source code path to search for class or interface definitions\&. As with the user class path, source path entries are separated by colons (:) on Oracle Solaris and semicolons on Windows and can be directories, JAR archives, or ZIP archives\&. If packages are used, then the local path name within the directory or archive must reflect the package name\&.
-.sp
-\fBNote:\fR
-Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
-.RE
-.PP
-\-verbose
-.RS 4
+
+\fINote:\fR Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
+.TP
+-verbose
+.br
 Uses verbose output, which includes information about each class loaded and each source file compiled\&.
-.RE
-.PP
-\-version
-.RS 4
+.TP
+-version
+.br
 Prints release information\&.
-.RE
-.PP
-\-werror
-.RS 4
+.TP
+-werror
+.br
 Terminates compilation when warnings occur\&.
-.RE
-.PP
-\-X
-.RS 4
+.TP
+-X
+.br
 Displays information about nonstandard options and exits\&.
-.RE
-.SS "Cross\-Compilation Options"
-.PP
-By default, classes are compiled against the bootstrap and extension classes of the platform that
-\fBjavac\fR
-shipped with\&. But
-\fBjavac\fR
-also supports cross\-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the
-\fB\-bootclasspath\fR
-and
-\fB\-extdirs\fR
-options when cross\-compiling\&.
-.PP
-\-target \fIversion\fR
-.RS 4
+.SS CROSS-COMPILATION\ OPTIONS    
+By default, classes are compiled against the bootstrap and extension classes of the platform that \f3javac\fR shipped with\&. But \f3javac\fR also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the \f3-bootclasspath\fR and \f3-extdirs\fR options when cross-compiling\&.
+.TP
+-target \fIversion\fR
+.br
 Generates class files that target a specified release of the virtual machine\&. Class files will run on the specified target and on later releases, but not on earlier releases of the JVM\&. Valid targets are 1\&.1, 1\&.2, 1\&.3, 1\&.4, 1\&.5 (also 5), 1\&.6 (also 6), 1\&.7 (also 7), and 1\&.8 (also 8)\&.
-.sp
-The default for the
-\fB\-target\fR
-option depends on the value of the
-\fB\-source\fR
-option:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is not specified, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.2, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.3, then the value of the
-\fB\-target\fR
-option is 1\&.4
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.5, then the value of the
-\fB\-target\fR
-option is 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.6, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-If the
-\fB\-source\fR
-option is 1\&.7, then the value of the
-\fB\-target\fR
-is option 1\&.8
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-For all other values of the
-\fB\-source\fR
-option, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option\&.
-.RE
-.RE
+
+The default for the \f3-target\fR option depends on the value of the \f3-source\fR option:
+.RS     
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is not specified, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.2, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.3, then the value of the \f3-target\fR option is 1\&.4
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.5, then the value of the \f3-target\fR option is 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.6, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+If the \f3-source\fR option is 1\&.7, then the value of the \f3-target\fR is option 1\&.8
+.TP 0.2i    
+\(bu
+For all other values of the \f3-source\fR option, the value of the \f3-target\fR option is the value of the \f3-source\fR option\&.
+.RE     
+
+.TP
+-bootclasspath \fIbootclasspath\fR
+.br
+Cross-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
+.SS COMPACT\ PROFILE\ OPTION    
+Beginning with JDK 8, the \f3javac\fR compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
 .PP
-\-bootclasspath \fIbootclasspath\fR
-.RS 4
-Cross\-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
-.RE
-.SS "Compact Profile Option"
-.PP
-Beginning with JDK 8, the
-\fBjavac\fR
-compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
-.PP
-The supported profile values are
-\fBcompact1\fR,
-\fBcompact2\fR, and
-\fBcompact3\fR\&. These are additive layers\&. Each higher\-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
-.PP
-\-profile
-.RS 4
+The supported profile values are \f3compact1\fR, \f3compact2\fR, and \f3compact3\fR\&. These are additive layers\&. Each higher-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
+.TP
+-profile
+.br
 When using compact profiles, this option specifies the profile name when compiling\&. For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-profile compact1 Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3javac \-profile compact1 Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 javac does not compile source code that uses any Java SE APIs that is not in the specified profile\&. Here is an example of the error message that results from attempting to compile such source code:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBcd jdk1\&.8\&.0/bin\fR
-\fB\&./javac \-profile compact1 Paint\&.java\fR
-\fBPaint\&.java:5: error: Applet is not available in profile \*(Aqcompact1\*(Aq\fR
-\fBimport java\&.applet\&.Applet;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-In this example, you can correct the error by modifying the source to not use the
-\fBApplet\fR
-class\&. You could also correct the error by compiling without the \-profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the
-\fBApplet\fR
-class\&.)
-.sp
-An alternative way to compile with compact profiles is to use the
-\fB\-bootclasspath\fR
-option to specify a path to an
-\fBrt\&.jar\fR
-file that specifies a profile\*(Aqs image\&. Using the
-\fB\-profile\fR
-option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross\-compiling\&.
-.RE
-.SS "Nonstandard Options"
-.PP
-\-Xbootclasspath/p:\fIpath\fR
-.RS 4
+.sp     
+.nf     
+\f3cd jdk1\&.8\&.0/bin\fP
+.fi     
+.nf     
+\f3\&./javac \-profile compact1 Paint\&.java\fP
+.fi     
+.nf     
+\f3Paint\&.java:5: error: Applet is not available in profile \&'compact1\&'\fP
+.fi     
+.nf     
+\f3import java\&.applet\&.Applet;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+In this example, you can correct the error by modifying the source to not use the \f3Applet\fR class\&. You could also correct the error by compiling without the -profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the \f3Applet\fR class\&.)
+
+An alternative way to compile with compact profiles is to use the \f3-bootclasspath\fR option to specify a path to an \f3rt\&.jar\fR file that specifies a profile\&'s image\&. Using the \f3-profile\fR option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross-compiling\&.
+.SS NONSTANDARD\ OPTIONS    
+.TP
+-Xbootclasspath/p:\fIpath\fR
+.br
 Adds a suffix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/a:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/a:\fIpath\fR
+.br
 Adds a prefix to the bootstrap class path\&.
-.RE
-.PP
-\-Xbootclasspath/:\fIpath\fR
-.RS 4
+.TP
+-Xbootclasspath/:\fIpath\fR
+.br
 Overrides the location of the bootstrap class files\&.
-.RE
-.PP
-\-Xdoclint:[\-]\fIgroup\fR [\fI/access\fR]
-.RS 4
-Enables or disables specific groups of checks, where
-\fIgroup\fR
-is one of the following values:
-\fBaccessibility\fR,
-\fBsyntax\fR,
-\fBreference\fR,
-\fBhtml\fR
-or
-\fBmissing\fR\&. For more information about these groups of checks see the
-\fB\-Xdoclint\fR
-option of the
-\fBjavadoc\fR
-command\&. The
-\fB\-Xdoclint\fR
-option is disabled by default in the
-\fBjavac\fR
-command\&.
-.sp
-The variable
-\fIaccess\fR
-specifies the minimum visibility level of classes and members that the
-\fB\-Xdoclint\fR
-option checks\&. It can have one of the following values (in order of most to least visible) :
-\fBpublic\fR,
-\fBprotected\fR,
-\fBpackage\fR
-and
-\fBprivate\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all/protected\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.TP
+-Xdoclint:[-]\fIgroup\fR [\fI/access\fR]
+.br
+Enables or disables specific groups of checks, where \fIgroup\fR is one of the following values: \f3accessibility\fR, \f3syntax\fR, \f3reference\fR, \f3html\fR or \f3missing\fR\&. For more information about these groups of checks see the \f3-Xdoclint\fR option of the \f3javadoc\fR command\&. The \f3-Xdoclint\fR option is disabled by default in the \f3javac\fR command\&.
+
+The variable \fIaccess\fR specifies the minimum visibility level of classes and members that the \f3-Xdoclint\fR option checks\&. It can have one of the following values (in order of most to least visible) : \f3public\fR, \f3protected\fR, \f3package\fR and \f3private\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
+.sp     
+.nf     
+\f3\-Xdoclint:all/protected\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The following option enables all groups of checks for all access levels, except it will not check for HTML errors for classes and members that have access level package and higher (which includes package and public):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-Xdoclint:all,\-html/package\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-\-Xdoclint:none
-.RS 4
+.sp     
+.nf     
+\f3\-Xdoclint:all,\-html/package\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-Xdoclint:none
+.br
 Disables all groups of checks\&.
-.RE
-.PP
-\-Xdoclint:all[\fI/access\fR]
-.RS 4
+.TP
+-Xdoclint:all[\fI/access\fR]
+.br
 Enables all groups of checks\&.
-.RE
-.PP
-\-Xlint
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:all
-.RS 4
-Enables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
-.RE
-.PP
-\-Xlint:none
-.RS 4
+.TP
+-Xlint
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:all
+.br
+\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
+.TP
+-Xlint:none
+.br
 Disables all warnings\&.
-.RE
-.PP
-\-Xlint:\fIname\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option for a list of warnings you can disable with this option\&.
-.RE
-.PP
-\-Xlint:\fI\-name\fR
-.RS 4
-Disables warning name\&. See Enable or Disable Warnings with the \-Xlint Option with the
-\fB\-Xlint\fR
-option to get a list of warnings that you can disable with this option\&.
-.RE
-.PP
-\-Xmaxerrs \fInumber\fR
-.RS 4
+.TP
+-Xlint:\fIname\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option for a list of warnings you can disable with this option\&.
+.TP
+-Xlint:\fI-name\fR
+.br
+Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option with the \f3-Xlint\fR option to get a list of warnings that you can disable with this option\&.
+.TP
+-Xmaxerrs \fInumber\fR
+.br
 Sets the maximum number of errors to print\&.
-.RE
-.PP
-\-Xmaxwarns \fInumber\fR
-.RS 4
+.TP
+-Xmaxwarns \fInumber\fR
+.br
 Sets the maximum number of warnings to print\&.
-.RE
-.PP
-\-Xstdout \fIfilename\fR
-.RS 4
-Sends compiler messages to the named file\&. By default, compiler messages go to
-\fBSystem\&.err\fR\&.
-.RE
-.PP
-\-Xprefer:[\fInewer,source\fR]
-.RS 4
-Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the
-\fB\-Xprefer:newer\fR
-option is used, then it reads the newer of the source or class file for a type (default)\&. If the
-\fB\-Xprefer:source\fR
-option is used, then it reads the source file\&. Use \-\fBXprefer:source\fR
-when you want to be sure that any annotation processors can access annotations declared with a retention policy of
-\fBSOURCE\fR\&.
-.RE
-.PP
-\-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
-.RS 4
-Control whether javac generates
-\fBpackage\-info\&.class\fR
-files from package\-info\&.java files\&. Possible mode arguments for this option include the following\&.
-.PP
+.TP
+-Xstdout \fIfilename\fR
+.br
+Sends compiler messages to the named file\&. By default, compiler messages go to \f3System\&.err\fR\&.
+.TP
+-Xprefer:[\fInewer,source\fR]
+.br
+Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the \f3-Xprefer:newer\fR option is used, then it reads the newer of the source or class file for a type (default)\&. If the \f3-Xprefer:source\fR option is used, then it reads the source file\&. Use -\f3Xprefer:source\fR when you want to be sure that any annotation processors can access annotations declared with a retention policy of \f3SOURCE\fR\&.
+.TP
+-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
+.br
+Control whether javac generates \f3package-info\&.class\fR files from package-info\&.java files\&. Possible mode arguments for this option include the following\&.
+.RS     
+.TP     
 always
-.RS 4
-Always generate a
-\fBpackage\-info\&.class\fR
-file for every
-\fBpackage\-info\&.java\fR
-file\&. This option may be useful if you use a build system such as Ant, which checks that each
-\fB\&.java\fR
-file has a corresponding
-\fB\&.class\fR
-file\&.
-.RE
-.PP
+Always generate a \f3package-info\&.class\fR file for every \f3package-info\&.java\fR file\&. This option may be useful if you use a build system such as Ant, which checks that each \f3\&.java\fR file has a corresponding \f3\&.class\fR file\&.
+.TP     
 legacy
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations\&. Don\*(Aqt generate a
-\fBpackage\-info\&.class\fR
-file if package\-info\&.java only contains comments\&.
-.sp
-\fBNote:\fR
-A
-\fBpackage\-info\&.class\fR
-file might be generated but be empty if all the annotations in the package\-info\&.java file have
-\fBRetentionPolicy\&.SOURCE\fR\&.
-.RE
-.PP
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations\&. Don\&'t generate a \f3package-info\&.class\fR file if package-info\&.java only contains comments\&.
+
+\fINote:\fR A \f3package-info\&.class\fR file might be generated but be empty if all the annotations in the package-info\&.java file have \f3RetentionPolicy\&.SOURCE\fR\&.
+.TP     
 nonempty
-.RS 4
-Generate a
-\fBpackage\-info\&.class\fR
-file only if package\-info\&.java contains annotations with
-\fBRetentionPolicy\&.CLASS\fR
-or
-\fBRetentionPolicy\&.RUNTIME\fR\&.
-.RE
-.RE
-.PP
-\-Xprint
-.RS 4
+Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations with \f3RetentionPolicy\&.CLASS\fR or \f3RetentionPolicy\&.RUNTIME\fR\&.
+.RE     
+
+.TP
+-Xprint
+.br
 Prints a textual representation of specified types for debugging purposes\&. Perform neither annotation processing nor compilation\&. The format of the output could change\&.
-.RE
-.PP
-\-XprintProcessorInfo
-.RS 4
+.TP
+-XprintProcessorInfo
+.br
 Prints information about which annotations a processor is asked to process\&.
-.RE
-.PP
-\-XprintRounds
-.RS 4
+.TP
+-XprintRounds
+.br
 Prints information about initial and subsequent annotation processing rounds\&.
-.RE
-.SH "ENABLE OR DISABLE WARNINGS WITH THE -XLINT OPTION"
-.PP
-Enable warning
-\fIname\fR
-with the
-\fB\-Xlint:name\fR
-option, where
-\fBname\fR
-is one of the following warning names\&. Note that you can disable a warning with the
-\fB\-Xlint:\-name:\fR
-option\&.
-.PP
+.SH ENABLE\ OR\ DISABLE\ WARNINGS\ WITH\ THE\ -XLINT\ OPTION    
+Enable warning \fIname\fR with the \f3-Xlint:name\fR option, where \f3name\fR is one of the following warning names\&. Note that you can disable a warning with the \f3-Xlint:-name:\fR option\&.
+.TP     
 cast
-.RS 4
 Warns about unnecessary and redundant casts, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBString s = (String) "Hello!"\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3String s = (String) "Hello!"\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 classfile
-.RS 4
 Warns about issues related to class file contents\&.
-.RE
-.PP
+.TP     
 deprecation
-.RS 4
 Warns about the use of deprecated items, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava\&.util\&.Date myDate = new java\&.util\&.Date();\fR
-\fBint currentDay = myDate\&.getDay();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The method
-\fBjava\&.util\&.Date\&.getDay\fR
-has been deprecated since JDK 1\&.1
-.RE
-.PP
-dep\-ann
-.RS 4
-Warns about items that are documented with an
-\fB@deprecated\fR
-Javadoc comment, but do not have a
-\fB@Deprecated\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB/**\fR
-\fB  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fR
-\fB  */\fR
-\fBpublic static void deprecatedMethood() { }\fR
-\fBpublic static void newMethod() { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3java\&.util\&.Date myDate = new java\&.util\&.Date();\fP
+.fi     
+.nf     
+\f3int currentDay = myDate\&.getDay();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The method \f3java\&.util\&.Date\&.getDay\fR has been deprecated since JDK 1\&.1
+.TP     
+dep-ann
+Warns about items that are documented with an \f3@deprecated\fR Javadoc comment, but do not have a \f3@Deprecated\fR annotation, for example:
+.sp     
+.nf     
+\f3/**\fP
+.fi     
+.nf     
+\f3  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fP
+.fi     
+.nf     
+\f3  */\fP
+.fi     
+.nf     
+\f3public static void deprecatedMethood() { }\fP
+.fi     
+.nf     
+\f3public static void newMethod() { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 divzero
-.RS 4
 Warns about division by the constant integer 0, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBint divideByZero = 42 / 0;\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+.sp     
+.nf     
+\f3int divideByZero = 42 / 0;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 empty
-.RS 4
-Warns about empty statements after
-\fBif \fRstatements, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass E {\fR
-\fB    void m() {\fR
-\fB         if (true) ;\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about empty statements after \f3if\fRstatements, for example:
+.sp     
+.nf     
+\f3class E {\fP
+.fi     
+.nf     
+\f3    void m() {\fP
+.fi     
+.nf     
+\f3         if (true) ;\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 fallthrough
-.RS 4
-Checks the switch blocks for fall\-through cases and provides a warning message for any that are found\&. Fall\-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBswitch (x) {\fR
-\fBcase 1:\fR
-\fB  System\&.out\&.println("1");\fR
-\fB  // No break statement here\&.\fR
-\fBcase 2:\fR
-\fB  System\&.out\&.println("2");\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If the
-\fB\-Xlint:fallthrough\fR
-option was used when compiling this code, then the compiler emits a warning about possible fall\-through into case, with the line number of the case in question\&.
-.RE
-.PP
+Checks the switch blocks for fall-through cases and provides a warning message for any that are found\&. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
+.sp     
+.nf     
+\f3switch (x) {\fP
+.fi     
+.nf     
+\f3case 1:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("1");\fP
+.fi     
+.nf     
+\f3  // No break statement here\&.\fP
+.fi     
+.nf     
+\f3case 2:\fP
+.fi     
+.nf     
+\f3  System\&.out\&.println("2");\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If the \f3-Xlint:fallthrough\fR option was used when compiling this code, then the compiler emits a warning about possible fall-through into case, with the line number of the case in question\&.
+.TP     
 finally
-.RS 4
-Warns about
-\fBfinally\fR
-clauses that cannot complete normally, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int m() {\fR
-\fB  try {\fR
-\fB     throw new NullPointerException();\fR
-\fB  }  catch (NullPointerException(); {\fR
-\fB     System\&.err\&.println("Caught NullPointerException\&.");\fR
-\fB     return 1;\fR
-\fB   } finally {\fR
-\fB     return 0;\fR
-\fB   }\fR
-\fB  }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The compiler generates a warning for the
-\fBfinally\fR
-block in this example\&. When the
-\fBint\fR
-method is called, it returns a value of 0\&. A
-\fBfinally\fR
-block executes when the
-\fBtry\fR
-block exits\&. In this example, when control is transferred to the
-\fBcatch\fR
-block, the
-\fBint\fR
-method exits\&. However, the
-\fBfinally\fR
-block must execute, so it is executed, even though control was transferred outside the method\&.
-.RE
-.PP
+Warns about \f3finally\fR clauses that cannot complete normally, for example:
+.sp     
+.nf     
+\f3public static int m() {\fP
+.fi     
+.nf     
+\f3  try {\fP
+.fi     
+.nf     
+\f3     throw new NullPointerException();\fP
+.fi     
+.nf     
+\f3  }  catch (NullPointerException(); {\fP
+.fi     
+.nf     
+\f3     System\&.err\&.println("Caught NullPointerException\&.");\fP
+.fi     
+.nf     
+\f3     return 1;\fP
+.fi     
+.nf     
+\f3   } finally {\fP
+.fi     
+.nf     
+\f3     return 0;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The compiler generates a warning for the \f3finally\fR block in this example\&. When the \f3int\fR method is called, it returns a value of 0\&. A \f3finally\fR block executes when the \f3try\fR block exits\&. In this example, when control is transferred to the \f3catch\fR block, the \f3int\fR method exits\&. However, the \f3finally\fR block must execute, so it is executed, even though control was transferred outside the method\&.
+.TP     
 options
-.RS 4
-Warns about issues that related to the use of command\-line options\&. See Cross\-Compilation Options\&.
-.RE
-.PP
+Warns about issues that related to the use of command-line options\&. See Cross-Compilation Options\&.
+.TP     
 overrides
-.RS 4
 Warns about issues regarding method overrides\&. For example, consider the following two classes:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ClassWithVarargsMethod {\fR
-\fB  void varargsMethod(String\&.\&.\&. s) { }\fR
-\fB}\fR
- 
-\fBpublic class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fR
-\fB   @Override\fR
-\fB   void varargsMethod(String[] s) { }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3public class ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3  void varargsMethod(String\&.\&.\&. s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fP
+.fi     
+.nf     
+\f3   @Override\fP
+.fi     
+.nf     
+\f3   void varargsMethod(String[] s) { }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates a warning similar to the following:\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fR
-\fBoverrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fR
-\fBmethod is missing \*(Aq\&.\&.\&.\*(Aq\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a
-\fBvarargs\fR
-method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. In the method
-\fBClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBString\&.\&.\&. s\fR
-to the formal parameter
-\fBString[] s\fR, an array, which matches the formal parameter of the method
-\fBClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fP
+.fi     
+.nf     
+\f3overrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fP
+.fi     
+.nf     
+\f3method is missing \&'\&.\&.\&.\&'\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a \f3varargs\fR method, it translates the \f3varargs\fR formal parameter into an array\&. In the method \f3ClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the \f3varargs\fR formal parameter \f3String\&.\&.\&. s\fR to the formal parameter \f3String[] s\fR, an array, which matches the formal parameter of the method \f3ClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
+.TP     
 path
-.RS 4
-Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the
-\fB@SuppressWarnings\fR
-annotation, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the \f3@SuppressWarnings\fR annotation, for example:
+.sp     
+.nf     
+\f3javac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 processing
-.RS 4
 Warn about issues regarding annotation processing\&. The compiler generates this warning when you have a class that has an annotation, and you use an annotation processor that cannot handle that type of exception\&. For example, the following is a simple annotation processor:
-.sp
-\fBSource file AnnocProc\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBimport java\&.util\&.*;\fR
-\fBimport javax\&.annotation\&.processing\&.*;\fR
-\fBimport javax\&.lang\&.model\&.*;\fR
-\fBimport\&.javaz\&.lang\&.model\&.element\&.*;\fR
- 
-\fB@SupportedAnnotationTypes("NotAnno")\fR
-\fBpublic class AnnoProc extends AbstractProcessor {\fR
-\fB  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fR
-\fB     return true;\fR
-\fB  }\fR
- 
-\fB  public SourceVersion getSupportedSourceVersion() {\fR
-\fB     return SourceVersion\&.latest();\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBSource file AnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB@interface Anno { }\fR
-\fB \fR
-\fB@Anno\fR
-\fBclass AnnosWithoutProcessors { }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following commands compile the annotation processor
-\fBAnnoProc\fR, then run this annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac AnnoProc\&.java\fR
-\fBjavac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler runs the annotation processor against the source file
-\fBAnnosWithoutProcessors\&.java\fR, it generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [processing] No processor claimed any of these annotations: Anno\fR
-\fB \fR
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can rename the annotation defined and used in the class
-\fBAnnosWithoutProcessors\fR
-from
-\fBAnno\fR
-to
-\fBNotAnno\fR\&.
-.RE
-.PP
+
+\fISource file AnnocProc\&.java\fR:
+.sp     
+.nf     
+\f3import java\&.util\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.annotation\&.processing\&.*;\fP
+.fi     
+.nf     
+\f3import javax\&.lang\&.model\&.*;\fP
+.fi     
+.nf     
+\f3import\&.javaz\&.lang\&.model\&.element\&.*;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@SupportedAnnotationTypes("NotAnno")\fP
+.fi     
+.nf     
+\f3public class AnnoProc extends AbstractProcessor {\fP
+.fi     
+.nf     
+\f3  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fP
+.fi     
+.nf     
+\f3     return true;\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3  public SourceVersion getSupportedSourceVersion() {\fP
+.fi     
+.nf     
+\f3     return SourceVersion\&.latest();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fISource file AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3@interface Anno { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3@Anno\fP
+.fi     
+.nf     
+\f3class AnnosWithoutProcessors { }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following commands compile the annotation processor \f3AnnoProc\fR, then run this annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR:
+.sp     
+.nf     
+\f3javac AnnoProc\&.java\fP
+.fi     
+.nf     
+\f3javac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler runs the annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR, it generates the following warning:
+.sp     
+.nf     
+\f3warning: [processing] No processor claimed any of these annotations: Anno\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can rename the annotation defined and used in the class \f3AnnosWithoutProcessors\fR from \f3Anno\fR to \f3NotAnno\fR\&.
+.TP     
 rawtypes
-.RS 4
-Warns about unchecked operations on raw types\&. The following statement generates a
-\fBrawtypes\fR
-warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The following example does not generate a
-\fBrawtypes\fR
-warning
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBvoid countElements(List<?> l) { \&.\&.\&. }\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBList\fR
-is a raw type\&. However,
-\fBList<?>\fR
-is an unbounded wildcard parameterized type\&. Because
-\fBList\fR
-is a parameterized interface, always specify its type argument\&. In this example, the
-\fBList\fR
-formal argument is specified with an unbounded wildcard (\fB?\fR) as its formal type parameter, which means that the
-\fBcountElements\fR
-method can accept any instantiation of the
-\fBList\fR
-interface\&.
-.RE
-.PP
+Warns about unchecked operations on raw types\&. The following statement generates a \f3rawtypes\fR warning:
+.sp     
+.nf     
+\f3void countElements(List l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+The following example does not generate a \f3rawtypes\fR warning
+.sp     
+.nf     
+\f3void countElements(List<?> l) { \&.\&.\&. }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\f3List\fR is a raw type\&. However, \f3List<?>\fR is an unbounded wildcard parameterized type\&. Because \f3List\fR is a parameterized interface, always specify its type argument\&. In this example, the \f3List\fR formal argument is specified with an unbounded wildcard (\f3?\fR) as its formal type parameter, which means that the \f3countElements\fR method can accept any instantiation of the \f3List\fR interface\&.
+.TP     
 Serial
-.RS 4
-Warns about missing
-\fBserialVersionUID\fR
-definitions on serializable classes, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class PersistentTime implements Serializable\fR
-\fB{\fR
-\fB  private Date time;\fR
-\fB \fR
-\fB   public PersistentTime() {\fR
-\fB     time = Calendar\&.getInstance()\&.getTime();\fR
-\fB   }\fR
-\fB \fR
-\fB   public Date getTime() {\fR
-\fB     return time;\fR
-\fB   }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+Warns about missing \f3serialVersionUID\fR definitions on serializable classes, for example:
+.sp     
+.nf     
+\f3public class PersistentTime implements Serializable\fP
+.fi     
+.nf     
+\f3{\fP
+.fi     
+.nf     
+\f3  private Date time;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public PersistentTime() {\fP
+.fi     
+.nf     
+\f3     time = Calendar\&.getInstance()\&.getTime();\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3   public Date getTime() {\fP
+.fi     
+.nf     
+\f3     return time;\fP
+.fi     
+.nf     
+\f3   }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [serial] serializable class PersistentTime has no definition of\fR
-\fBserialVersionUID\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If a serializable class does not explicitly declare a field named
-\fBserialVersionUID\fR, then the serialization runtime environment calculates a default
-\fBserialVersionUID\fR
-value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare
-\fBserialVersionUID\fR
-values because the default process of computing
-\fBserialVersionUID\fR
-vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected
-\fBInvalidClassExceptions\fR
-during deserialization\&. To guarantee a consistent
-\fBserialVersionUID\fR
-value across different Java compiler implementations, a serializable class must declare an explicit
-\fBserialVersionUID\fR
-value\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [serial] serializable class PersistentTime has no definition of\fP
+.fi     
+.nf     
+\f3serialVersionUID\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+If a serializable class does not explicitly declare a field named \f3serialVersionUID\fR, then the serialization runtime environment calculates a default \f3serialVersionUID\fR value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare \f3serialVersionUID\fR values because the default process of computing \f3serialVersionUID\fR vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected \f3InvalidClassExceptions\fR during deserialization\&. To guarantee a consistent \f3serialVersionUID\fR value across different Java compiler implementations, a serializable class must declare an explicit \f3serialVersionUID\fR value\&.
+.TP     
 static
-.RS 4
 Warns about issues relating to the use of statics, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBclass XLintStatic {\fR
-\fB    static void m1() { }\fR
-\fB    void m2() { this\&.m1(); }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3class XLintStatic {\fP
+.fi     
+.nf     
+\f3    static void m1() { }\fP
+.fi     
+.nf     
+\f3    void m2() { this\&.m1(); }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
 The compiler generates the following warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [static] static method should be qualified by type name, \fR
-\fBXLintStatic, instead of by an expression\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To resolve this issue, you can call the
-\fBstatic\fR
-method
-\fBm1\fR
-as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBXLintStatic\&.m1();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Alternately, you can remove the
-\fBstatic\fR
-keyword from the declaration of the method
-\fBm1\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3warning: [static] static method should be qualified by type name, \fP
+.fi     
+.nf     
+\f3XLintStatic, instead of by an expression\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+To resolve this issue, you can call the \f3static\fR method \f3m1\fR as follows:
+.sp     
+.nf     
+\f3XLintStatic\&.m1();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+Alternately, you can remove the \f3static\fR keyword from the declaration of the method \f3m1\fR\&.
+.TP     
 try
-.RS 4
-Warns about issues relating to use of
-\fBtry\fR
-blocks, including try\-with\-resources statements\&. For example, a warning is generated for the following statement because the resource
-\fBac\fR
-declared in the
-\fBtry\fR
-block is not used:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBtry ( AutoCloseable ac = getResource() ) {    // do nothing}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
+Warns about issues relating to use of \f3try\fR blocks, including try-with-resources statements\&. For example, a warning is generated for the following statement because the resource \f3ac\fR declared in the \f3try\fR block is not used:
+.sp     
+.nf     
+\f3try ( AutoCloseable ac = getResource() ) {    // do nothing}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+.TP     
 unchecked
-.RS 4
 Gives more detail for unchecked conversion warnings that are mandated by the Java Language Specification, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBList l = new ArrayList<Number>();\fR
-\fBList<String> ls = l;       // unchecked warning\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-During type erasure, the types
-\fBArrayList<Number>\fR
-and
-\fBList<String>\fR
-become
-\fBArrayList\fR
-and
-\fBList\fR, respectively\&.
-.sp
-The
-\fBls\fR
-command has the parameterized type
-\fBList<String>\fR\&. When the
-\fBList\fR
-referenced by
-\fBl\fR
-is assigned to
-\fBls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether
-\fBl\fR
-refers to a
-\fBList<String>\fR
-type\&. In this case,
-\fBl\fR
-does not refer to a
-\fBList<String>\fR
-type\&. As a result, heap pollution occurs\&.
-.sp
-A heap pollution situation occurs when the
-\fBList\fR
-object
-\fBl\fR, whose static type is
-\fBList<Number>\fR, is assigned to another
-\fBList\fR
-object,
-\fBls\fR, that has a different static type,
-\fBList<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure,
-\fBList<Number>\fR
-and
-\fBList<String>\fR
-both become
-\fBList\fR\&. Consequently, the compiler allows the assignment of the object
-\fBl\fR\fB,\fR
-which has a raw type of
-\fBList\fR, to the object
-\fBls\fR\&.
-.RE
-.PP
+.sp     
+.nf     
+\f3List l = new ArrayList<Number>();\fP
+.fi     
+.nf     
+\f3List<String> ls = l;       // unchecked warning\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+During type erasure, the types \f3ArrayList<Number>\fR and \f3List<String>\fR become \f3ArrayList\fR and \f3List\fR, respectively\&.
+
+The \f3ls\fR command has the parameterized type \f3List<String>\fR\&. When the \f3List\fR referenced by \f3l\fR is assigned to \f3ls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether \f3l\fR refers to a \f3List<String>\fR type\&. In this case, \f3l\fR does not refer to a \f3List<String>\fR type\&. As a result, heap pollution occurs\&.
+
+A heap pollution situation occurs when the \f3List\fR object \f3l\fR, whose static type is \f3List<Number>\fR, is assigned to another \f3List\fR object, \f3ls\fR, that has a different static type, \f3List<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure, \f3List<Number>\fR and \f3List<String>\fR both become \f3List\fR\&. Consequently, the compiler allows the assignment of the object \f3l\fR\f3,\fR which has a raw type of \f3List\fR, to the object \f3ls\fR\&.
+.TP     
 varargs
-.RS 4
-Warns about unsafe usages of variable arguments (\fBvarargs\fR) methods, in particular, those that contain non\-reifiable arguments, for example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic class ArrayBuilder {\fR
-\fB  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fR
-\fB    for (T x : elements) {\fR
-\fB      listArg\&.add(x);\fR
-\fB    }\fR
-\fB  }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-\fBNote:\fR
-A non\-reifiable type is a type whose type information is not fully available at runtime\&.
-.sp
-The compiler generates the following warning for the definition of the method
-\fBArrayBuilder\&.addToList\fR
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBwarning: [varargs] Possible heap pollution from parameterized vararg type T\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-When the compiler encounters a varargs method, it translates the
-\fBvarargs\fR
-formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method
-\fBArrayBuilder\&.addToList\fR, the compiler translates the
-\fBvarargs\fR
-formal parameter
-\fBT\&.\&.\&.\fR
-elements to the formal parameter
-\fBT[]\fR
-elements, an array\&. However, because of type erasure, the compiler converts the
-\fBvarargs\fR
-formal parameter to
-\fBObject[]\fR
-elements\&. Consequently, there is a possibility of heap pollution\&.
-.RE
-.SH "COMMAND-LINE ARGUMENT FILES"
+Warns about unsafe usages of variable arguments (\f3varargs\fR) methods, in particular, those that contain non-reifiable arguments, for example:
+.sp     
+.nf     
+\f3public class ArrayBuilder {\fP
+.fi     
+.nf     
+\f3  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fP
+.fi     
+.nf     
+\f3    for (T x : elements) {\fP
+.fi     
+.nf     
+\f3      listArg\&.add(x);\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3  }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+\fINote:\fR A non-reifiable type is a type whose type information is not fully available at runtime\&.
+
+The compiler generates the following warning for the definition of the method \f3ArrayBuilder\&.addToList\fR
+.sp     
+.nf     
+\f3warning: [varargs] Possible heap pollution from parameterized vararg type T\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+
+
+When the compiler encounters a varargs method, it translates the \f3varargs\fR formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method \f3ArrayBuilder\&.addToList\fR, the compiler translates the \f3varargs\fR formal parameter \f3T\&.\&.\&.\fR elements to the formal parameter \f3T[]\fR elements, an array\&. However, because of type erasure, the compiler converts the \f3varargs\fR formal parameter to \f3Object[]\fR elements\&. Consequently, there is a possibility of heap pollution\&.
+.SH COMMAND-LINE\ ARGUMENT\ FILES    
+To shorten or simplify the \f3javac\fR command, you can specify one or more files that contain arguments to the \f3javac\fR command (except \f3-J\fR options)\&. This enables you to create \f3javac\fR commands of any length on any operating system\&.
 .PP
-To shorten or simplify the
-\fBjavac\fR
-command, you can specify one or more files that contain arguments to the
-\fBjavac\fR
-command (except
-\fB\-J\fR
-options)\&. This enables you to create
-\fBjavac\fR
-commands of any length on any operating system\&.
+An argument file can include \f3javac\fR options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
 .PP
-An argument file can include
-\fBjavac\fR
-options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
+File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying \f3*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The \f3-J\fR options are not supported because they are passed to the launcher, which does not support argument files\&.
 .PP
-File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying
-\fB*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The
-\fB\-J\fR
-options are not supported because they are passed to the launcher, which does not support argument files\&.
+When executing the \f3javac\fR command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the \f3javac\fR command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
 .PP
-When executing the
-\fBjavac\fR
-command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the
-\fBjavac\fR
-command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
+\f3Example 1 Single Argument File\fR
 .PP
-\fBExample 1\fR
-.br
-Single Argument File
-.RS 4
-You could use a single argument file named
-\fBargfile\fR
-to hold all
-\fBjavac\fR
-arguments:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @argfile\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+You could use a single argument file named \f3argfile\fR to hold all \f3javac\fR arguments:
+.sp     
+.nf     
+\f3javac @argfile\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 This argument file could contain the contents of both files shown in Example 2
-.RE
 .PP
-\fBExample 2\fR
-.br
-Two Argument Files
-.RS 4
-You can create two argument files: one for the
-\fBjavac\fR
-options and the other for the source file names\&. Note that the following lists have no line\-continuation characters\&.
-.sp
+\f3Example 2 Two Argument Files\fR
+.PP
+You can create two argument files: one for the \f3javac\fR options and the other for the source file names\&. Note that the following lists have no line-continuation characters\&.
+.PP
 Create a file named options that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-d classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-g\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fR
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
- 
-.fi
-.if n \{\
-.RE
-.\}
+.sp     
+.nf     
+\f3\-d classes\fP
+.fi     
+.nf     
+\f3\-g\fP
+.fi     
+.nf     
+\f3\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Create a file named classes that contains the following:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBMyClass1\&.java\fR
-\fBMyClass2\&.java\fR
-\fBMyClass3\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Then, run the
-\fBjavac\fR
-command as follows:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @options @classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3MyClass1\&.java\fP
+.fi     
+.nf     
+\f3MyClass2\&.java\fP
+.fi     
+.nf     
+\f3MyClass3\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Then, run the \f3javac\fR command as follows:
+.sp     
+.nf     
+\f3javac @options @classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Argument Files with Paths\fR
 .PP
-\fBExample 3\fR
-.br
-Argument Files with Paths
-.RS 4
-The argument files can have paths, but any file names inside the files are relative to the current working directory (not
-\fBpath1\fR
-or
-\fBpath2\fR):
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac @path1/options @path2/classes\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.SH "ANNOTATION PROCESSING"
+The argument files can have paths, but any file names inside the files are relative to the current working directory (not \f3path1\fR or \f3path2\fR):
+.sp     
+.nf     
+\f3javac @path1/options @path2/classes\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+.SH ANNOTATION\ PROCESSING    
+The \f3javac\fR command provides direct support for annotation processing, superseding the need for the separate annotation processing command, \f3apt\fR\&.
 .PP
-The
-\fBjavac\fR
-command provides direct support for annotation processing, superseding the need for the separate annotation processing command,
-\fBapt\fR\&.
-.PP
-The API for annotation processors is defined in the
-\fBjavax\&.annotation\&.processing\fR
-and j\fBavax\&.lang\&.model\fR
-packages and subpackages\&.
-.SS "How Annotation Processing Works"
-.PP
-Unless annotation processing is disabled with the
-\fB\-proc:none\fR
-option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the
-\fB\-processorpath\fR
-option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider\-configuration files named
-\fBMETA\-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the
-\fB\-processor\fR
-option\&.
+The API for annotation processors is defined in the \f3javax\&.annotation\&.processing\fR and j\f3avax\&.lang\&.model\fR packages and subpackages\&.
+.SS HOW\ ANNOTATION\ PROCESSING\ WORKS    
+Unless annotation processing is disabled with the \f3-proc:none\fR option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the \f3-processorpath\fR option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider-configuration files named \f3META-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the \f3-processor\fR option\&.
 .PP
 After scanning the source files and classes on the command line to determine what annotations are present, the compiler queries the processors to determine what annotations they process\&. When a match is found, the processor is called\&. A processor can claim the annotations it processes, in which case no further attempt is made to find any processors for those annotations\&. After all of the annotations are claimed, the compiler does not search for additional processors\&.
 .PP
 If any processors generate new source files, then another round of annotation processing occurs: Any newly generated source files are scanned, and the annotations processed as before\&. Any processors called on previous rounds are also called on all subsequent rounds\&. This continues until no new source files are generated\&.
 .PP
-After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the
-\fB\-proc:only\fR
-option is used, the compiler compiles the original and all generated source files\&.
-.SS "Implicitly Loaded Source Files"
-.PP
-To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The
-\fB\-implicit\fR
-option provides a way to suppress the warning\&.
-.SH "SEARCHING FOR TYPES"
-.PP
+After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the \f3-proc:only\fR option is used, the compiler compiles the original and all generated source files\&.
+.SS IMPLICITLY\ LOADED\ SOURCE\ FILES    
+To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The \f3-implicit\fR option provides a way to suppress the warning\&.
+.SH SEARCHING\ FOR\ TYPES    
 To compile a source file, the compiler often needs information about a type, but the type definition is not in the source files specified on the command line\&. The compiler needs type information for every class or interface used, extended, or implemented in the source file\&. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance\&.
 .PP
-For example, when you create a subclass
-\fBjava\&.applet\&.Applet\fR, you are also using the ancestor classes of
-\fBApplet\fR:
-\fBjava\&.awt\&.Panel\fR,
-\fBjava\&.awt\&.Container\fR,
-\fBjava\&.awt\&.Component\fR, and
-\fBjava\&.lang\&.Object\fR\&.
+For example, when you create a subclass \f3java\&.applet\&.Applet\fR, you are also using the ancestor classes of \f3Applet\fR: \f3java\&.awt\&.Panel\fR, \f3java\&.awt\&.Container\fR, \f3java\&.awt\&.Component\fR, and \f3java\&.lang\&.Object\fR\&.
 .PP
-When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the
-\fBCLASSPATH\fR
-environment variable or by using the
-\fB\-classpath\fR
-option\&.
+When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the \f3CLASSPATH\fR environment variable or by using the \f3-classpath\fR option\&.
 .PP
-If you set the
-\fB\-sourcepath\fR
-option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
+If you set the \f3-sourcepath\fR option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
 .PP
-You can specify different bootstrap or extension classes with the
-\fB\-bootclasspath\fR
-and the
-\fB\-extdirs\fR
-options\&. See Cross\-Compilation Options\&.
+You can specify different bootstrap or extension classes with the \f3-bootclasspath\fR and the \f3-extdirs\fR options\&. See Cross-Compilation Options\&.
 .PP
-A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the
-\fB\-Xprefer\fR
-option to instruct the compiler which to use\&. If
-\fBnewer\fR
-is specified, then the compiler uses the newer of the two files\&. If
-\fBsource\fR
-is specified, the compiler uses the source file\&. The default is
-\fBnewer\fR\&.
+A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the \f3-Xprefer\fR option to instruct the compiler which to use\&. If \f3newer\fR is specified, then the compiler uses the newer of the two files\&. If \f3source\fR is specified, the compiler uses the source file\&. The default is \f3newer\fR\&.
 .PP
-If a type search finds a source file for a required type, either by itself, or as a result of the setting for the
-\fB\-Xprefer\fR
-option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the
-\fB\-implicit\fR
-option to specify the behavior\&. If
-\fBnone\fR
-is specified, then no class files are generated for the source file\&. If
-\fBclass\fR
-is specified, then class files are generated for the source file\&.
+If a type search finds a source file for a required type, either by itself, or as a result of the setting for the \f3-Xprefer\fR option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the \f3-implicit\fR option to specify the behavior\&. If \f3none\fR is specified, then no class files are generated for the source file\&. If \f3class\fR is specified, then class files are generated for the source file\&.
 .PP
-The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no
-\fB\-implicit\fR
-option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the
-\fB\-implicit\fR
-option to specify whether or not class files should be generated for such source files\&.
-.SH "PROGRAMMATIC INTERFACE"
+The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no \f3-implicit\fR option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the \f3-implicit\fR option to specify whether or not class files should be generated for such source files\&.
+.SH PROGRAMMATIC\ INTERFACE    
+The \f3javac\fR command supports the new Java Compiler API defined by the classes and interfaces in the \f3javax\&.tools\fR package\&.
+.SS EXAMPLE    
+To compile as though providing command-line arguments, use the following syntax:
+.sp     
+.nf     
+\f3JavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The example writes diagnostics to the standard output stream and returns the exit code that \f3javac\fR would give when called from the command line\&.
 .PP
-The
-\fBjavac\fR
-command supports the new Java Compiler API defined by the classes and interfaces in the
-\fBjavax\&.tools\fR
-package\&.
-.SS "Example"
+You can use other methods in the \f3javax\&.tools\&.JavaCompiler\fR interface to handle diagnostics, control where files are read from and written to, and more\&.
+.SS OLD\ INTERFACE    
+\fINote:\fR This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
 .PP
-To compile as though providing command\-line arguments, use the following syntax:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBJavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The \f3com\&.sun\&.tools\&.javac\&.Main\fR class provides two static methods to call the compiler from a program:
+.sp     
+.nf     
+\f3public static int compile(String[] args);\fP
+.fi     
+.nf     
+\f3public static int compile(String[] args, PrintWriter out);\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3args\fR parameter represents any of the command-line arguments that would typically be passed to the compiler\&.
 .PP
-The example writes diagnostics to the standard output stream and returns the exit code that
-\fBjavac\fR
-would give when called from the command line\&.
+The \f3out\fR parameter indicates where the compiler diagnostic output is directed\&.
 .PP
-You can use other methods in the
-\fBjavax\&.tools\&.JavaCompiler\fR
-interface to handle diagnostics, control where files are read from and written to, and more\&.
-.SS "Old Interface"
+The \f3return\fR value is equivalent to the \f3exit\fR value from \f3javac\fR\&.
 .PP
-\fBNote:\fR
-This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
+\fINote:\fR All other classes and methods found in a package with names that start with \f3com\&.sun\&.tools\&.javac\fR (subpackages of \f3com\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
+.SH EXAMPLES    
+\f3Example 1 Compile a Simple Program\fR
 .PP
-The
-\fBcom\&.sun\&.tools\&.javac\&.Main\fR
-class provides two static methods to call the compiler from a program:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpublic static int compile(String[] args);\fR
-\fBpublic static int compile(String[] args, PrintWriter out);\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+This example shows how to compile the \f3Hello\&.java\fR source file in the greetings directory\&. The class defined in \f3Hello\&.java\fR is called \f3greetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the \f3-d\fR option\&.
 .PP
-The
-\fBargs\fR
-parameter represents any of the command\-line arguments that would typically be passed to the compiler\&.
-.PP
-The
-\fBout\fR
-parameter indicates where the compiler diagnostic output is directed\&.
-.PP
-The
-\fBreturn\fR
-value is equivalent to the
-\fBexit\fR
-value from
-\fBjavac\fR\&.
-.PP
-\fBNote:\fR
-All other classes and methods found in a package with names that start with
-\fBcom\&.sun\&.tools\&.javac\fR
-(subpackages of
-\fBcom\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
-.SH "EXAMPLES"
-.PP
-\fBExample 1\fR
-.br
-Compile a Simple Program
-.RS 4
-This example shows how to compile the
-\fBHello\&.java\fR
-source file in the greetings directory\&. The class defined in
-\fBHello\&.java\fR
-is called
-\fBgreetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the
-\fB\-d\fR
-option\&.
-.sp
-The source code in
-\fBHello\&.java\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpackage greetings;\fR
-\fB \fR
-\fBpublic class Hello {\fR
-\fB    public static void main(String[] args) {\fR
-\fB        for (int i=0; i < args\&.length; i++) {\fR
-\fB            System\&.out\&.println("Hello " + args[i]);\fR
-\fB        }\fR
-\fB    }\fR
-\fB}\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The source code in \f3Hello\&.java\fR:
+.sp     
+.nf     
+\f3package greetings;\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.nf     
+\f3public class Hello {\fP
+.fi     
+.nf     
+\f3    public static void main(String[] args) {\fP
+.fi     
+.nf     
+\f3        for (int i=0; i < args\&.length; i++) {\fP
+.fi     
+.nf     
+\f3            System\&.out\&.println("Hello " + args[i]);\fP
+.fi     
+.nf     
+\f3        }\fP
+.fi     
+.nf     
+\f3    }\fP
+.fi     
+.nf     
+\f3}\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 Compile greetings\&.Hello:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac greetings/Hello\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Run
-\fBgreetings\&.Hello\fR:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava greetings\&.Hello World Universe Everyone\fR
-\fBHello World\fR
-\fBHello Universe\fR
-\fBHello Everyone\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3javac greetings/Hello\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Run \f3greetings\&.Hello\fR:
+.sp     
+.nf     
+\f3java greetings\&.Hello World Universe Everyone\fP
+.fi     
+.nf     
+\f3Hello World\fP
+.fi     
+.nf     
+\f3Hello Universe\fP
+.fi     
+.nf     
+\f3Hello Everyone\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 2 Compile Multiple Source Files\fR
 .PP
-\fBExample 2\fR
-.br
-Compile Multiple Source Files
-.RS 4
-This example compiles the
-\fBAloha\&.java\fR,
-\fBGutenTag\&.java\fR,
-\fBHello\&.java\fR, and
-\fBHi\&.java\fR
-source files in the
-\fBgreetings\fR
-package\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB% javac greetings/*\&.java\fR
-\fB% ls greetings\fR
-\fBAloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fR
-\fBAloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+This example compiles the \f3Aloha\&.java\fR, \f3GutenTag\&.java\fR, \f3Hello\&.java\fR, and \f3Hi\&.java\fR source files in the \f3greetings\fR package\&.
+.sp     
+.nf     
+\f3% javac greetings/*\&.java\fP
+.fi     
+.nf     
+\f3% ls greetings\fP
+.fi     
+.nf     
+\f3Aloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fP
+.fi     
+.nf     
+\f3Aloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 3 Specify a User Class Path\fR
 .PP
-\fBExample 3\fR
-.br
-Specify a User Class Path
-.RS 4
 After changing one of the source files in the previous example, recompile it:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpwd\fR
-\fB/examples\fR
-\fBjavac greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-Because
-\fBgreetings\&.Hi\fR
-refers to other classes in the
-\fBgreetings\fR
-package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting
-\fBCLASSPATH\fR\&. This example uses the
-\fB\-classpath\fR
-option\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-If you change
-\fBgreetings\&.Hi\fR
-to use a banner utility, then that utility also needs to be accessible through the user class path\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-classpath /examples:/lib/Banners\&.jar \e\fR
-\fB            /examples/greetings/Hi\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-To execute a class in the
-\fBgreetings\fR
-package, the program needs access to the
-\fBgreetings\fR
-package, and to the classes that the
-\fBgreetings\fR
-classes use\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjava \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-.RE
+.sp     
+.nf     
+\f3pwd\fP
+.fi     
+.nf     
+\f3/examples\fP
+.fi     
+.nf     
+\f3javac greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+Because \f3greetings\&.Hi\fR refers to other classes in the \f3greetings\fR package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting \f3CLASSPATH\fR\&. This example uses the \f3-classpath\fR option\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+If you change \f3greetings\&.Hi\fR to use a banner utility, then that utility also needs to be accessible through the user class path\&.
+.sp     
+.nf     
+\f3javac \-classpath /examples:/lib/Banners\&.jar \e\fP
+.fi     
+.nf     
+\f3            /examples/greetings/Hi\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+To execute a class in the \f3greetings\fR package, the program needs access to the \f3greetings\fR package, and to the classes that the \f3greetings\fR classes use\&.
+.sp     
+.nf     
+\f3java \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+\f3Example 4 Separate Source Files and Class Files\fR
 .PP
-\fBExample 4\fR
-.br
-Separate Source Files and Class Files
-.RS 4
-The following example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fR
-\fB\-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The
-\fB\-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile
-\fBOldCode\&.java\fR\&. The option
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the
-\fB\-target\fR
-option is the value of the
-\fB\-source\fR
-option; in this example, you can omit the
-\fB\-target\fR
-option\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \fR
-\fB\-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+The following example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e \fP
+.fi     
+.nf     
+\f3\-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The \f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language be used to compile \f3OldCode\&.java\fR\&. The option \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&. Note that in most cases, the value of the \f3-target\fR option is the value of the \f3-source\fR option; in this example, you can omit the \f3-target\fR option\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \fP
+.fi     
+.nf     
+\f3\-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules (in this example, it uses version 1\&.7 of the Java programming language) combined with the new bootstrap classes, which can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&.
-.RE
 .PP
-\fBExample 5\fR
-.br
-Cross Compile
-.RS 4
-This example uses
-\fBjavac\fR
-to compile code that runs on JVM 1\&.7\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fR
-\fB            \-extdirs "" OldCode\&.java\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
-The\fB \-source 1\&.7\fR
-option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The
-\fB\-target 1\&.7\fR
-option ensures that the generated class files are compatible with JVM 1\&.7\&. In most cases, the value of the
-\fB\-target\fR
-is the value of
-\fB\-source\fR\&. In this example, the
-\fB\-target\fR
-option is omitted\&.
-.sp
-You must specify the
-\fB\-bootclasspath\fR
-option to specify the correct version of the bootstrap classes (the
-\fBrt\&.jar\fR
-library)\&. If not, then the compiler generates a warning:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjavac \-source 1\&.7 OldCode\&.java\fR
-\fBwarning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fR
- 
-.fi
-.if n \{\
-.RE
-.\}
+\f3Example 5 Cross Compile\fR
+.PP
+This example uses \f3javac\fR to compile code that runs on JVM 1\&.7\&.
+.sp     
+.nf     
+\f3javac \-source 1\&.7 \-target 1\&.7 \-bootclasspath jdk1\&.7\&.0/lib/rt\&.jar \e\fP
+.fi     
+.nf     
+\f3            \-extdirs "" OldCode\&.java\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
+The\f3-source 1\&.7\fR option specifies that release 1\&.7 (or 7) of the Java programming language to be used to compile OldCode\&.java\&. The \f3-target 1\&.7\fR option ensures that the generated class files are compatible with JVM 1\&.7\&.
+.PP
+You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
+.sp     
+.nf     
+\f3javac \-source 1\&.7 OldCode\&.java\fP
+.fi     
+.nf     
+\f3warning: [options] bootstrap class path not set in conjunction with \-source 1\&.7\fP
+.fi     
+.nf     
+\f3\fP
+.fi     
+.sp     
 If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules combined with the new bootstrap classes\&. This combination can result in class files that do not work on the older platform (in this case, Java SE 7) because reference to nonexistent methods can get included\&. In this example, the compiler uses release 1\&.7 of the Java programming language\&.
-.RE
-.SH "SEE ALSO"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.SH SEE\ ALSO    
+.TP 0.2i    
+\(bu
 java(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javah(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 javadoc(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jar(1)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
+.TP 0.2i    
+\(bu
 jdb(1)
-.RE
-.br
-'pl 8.5i
-'bp
+.RE

+.br

+'pl 8.5i

+'bp

diff --git a/src/solaris/doc/sun/man/man1/javadoc.1 b/src/solaris/doc/sun/man/man1/javadoc.1
index b48535a..f4b342b 100644
--- a/src/solaris/doc/sun/man/man1/javadoc.1
+++ b/src/solaris/doc/sun/man/man1/javadoc.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: javadoc.1
 .\"
 .if n .pl 99999
-.TH javadoc 1 "10 May 2011" "JDK 8" "Basic Tools"
+.TH javadoc 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -209,7 +209,7 @@
 \f3package java\&.lang\&.applet;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -251,7 +251,7 @@
 \f3initialize, start, and stop the applet\&. \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3@since 1\&.0 \fP
@@ -266,7 +266,7 @@
 \f3</HTML>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3package\&.html\fR file is a typical HTML file and does not include a package declaration\&. The content of the package comment file is written in HTML with one exception\&. The documentation comment should not include the comment separators \f3/**\fR and \f3*/\fR or leading asterisks\&. When writing the comment, make the first sentence a summary about the package, and do not put a title or any other text between the \f3<body>\fR tag and the first sentence\&. You can include package tags\&. All block tags must appear after the main description\&. If you add an \f3@see\fR tag in a package comment file, then it must have a fully qualified name\&.
@@ -334,7 +334,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS TEST\ AND\ TEMPLATE\ FILES    
@@ -350,7 +350,7 @@
 \f3com/package1/test\-files/\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 If your test files contain documentation comments, then you can set up a separate run of the \f3javadoc\fR command to produce test file documentation by passing in their test source file names with wild cards, such as \f3com/package1/test-files/*\&.java\fR\&.
@@ -560,7 +560,7 @@
 \f3implements Serializable\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The declaration for the \f3Boolean\&.valueOf\fR method is:
@@ -569,7 +569,7 @@
 \f3public static Boolean valueOf(String s)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command can include the modifiers \f3public\fR, \f3protected\fR, \f3private\fR, \f3abstract\fR, \f3final\fR, \f3static\fR, \f3transient\fR, and \f3volatile\fR, but not \f3synchronized\fR or \f3native\fR\&. The \f3synchronized\fR and \f3native\fR modifiers are considered implementation detail and not part of the API specification\&.
@@ -593,7 +593,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To save space you can put a comment on one line:
@@ -602,7 +602,7 @@
 \f3/** This comment takes up only one line\&. */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -623,19 +623,19 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3import com\&.example;   // MISTAKE \- Important not to put import statement here\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class Whatever{ }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -657,7 +657,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -676,7 +676,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -700,7 +700,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -730,7 +730,7 @@
 \f3public int x, y;      // Avoid this \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The \f3javadoc\fR command generates the following documentation from the previous code:
@@ -739,7 +739,7 @@
 \f3public int x\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -748,7 +748,7 @@
 \f3public int y\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The horizontal and vertical distances of point (x, y)\&.
@@ -872,7 +872,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -899,11 +899,10 @@
 .TP 0.2i    
 \(bu
 In the text arguments of the \f3@return\fR, \f3@param,\fR and \f3@throws\fR tags of a method\&. In this case, the tag text is copied from the corresponding tag up the hierarchy\&.
-.RE
-.RS
-See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
+.RE     
 
-.RE
+
+See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy\&. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section\&.
 .TP     
 {@link \fIpackage\&.class#member label\fR}
 Introduced in JDK 1\&.2
@@ -920,7 +919,7 @@
 \f3Use the {@link #getComponentAt(int, int) getComponentAt} method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -931,7 +930,7 @@
 \f3Use the <a href="Component\&.html#getComponentAt(int, int)">getComponentAt</a> method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -942,7 +941,7 @@
 \f3Use the getComponentAt method\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -982,7 +981,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1014,7 +1013,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1071,7 +1070,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1091,7 +1090,7 @@
 \f3</dl>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1128,7 +1127,7 @@
 \f3@see #constructor(Type argname, Type argname,\&.\&.\&.) \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing another class in the current or imported packages\fR\fP
@@ -1155,7 +1154,7 @@
 \f3@see Class \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3\fIReferencing an element in another package (fully qualified)\fR\fP
@@ -1185,7 +1184,7 @@
 \f3@see package\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3\fRNotes about the previous listing:
@@ -1215,7 +1214,7 @@
 Any enclosing classes and interfaces searching the closest first\&.
 .TP 0.4i    
 3\&.
-Any superclasses and superonterfaces, searching the closest first\&.
+Any superclasses and superinterfaces, searching the closest first\&.
 .TP 0.4i    
 4\&.
 The current package\&.
@@ -1307,7 +1306,7 @@
 \f3@see "The Java Programming Language"    //  "The Java Programming Language" \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \fINote:\fR You can extend the \f3@se\fR\f3e\fR tag to link to classes not being documented with the \f3-link\fR option\&.
@@ -1317,7 +1316,7 @@
 
 Used in the documentation comment for a default serializable field\&. See Documenting Serializable Fields and Data for a Class at http://docs\&.oracle\&.com/javase/8/docs/platform/serialization/spec/serial-arch\&.html#5251
 
-See also Oracle\(cqs Criteria for Including Classes in the Serialilzed Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
+See also Oracle\(cqs Criteria for Including Classes in the Serialized Form Specification at http://www\&.oracle\&.com/technetwork/java/javase/documentation/serialized-criteria-137781\&.html
 
 An optional \f3field-description\fR should explain the meaning of the field and list the acceptable values\&. When needed, the description can span multiple lines\&. The standard doclet adds this information to the serialized form page\&. See Cross-Reference Pages\&.
 
@@ -1331,13 +1330,12 @@
 .TP 0.2i    
 \(bu
 A private or package-private class that implements \f3Serializable\fR is excluded unless that class (or its package) is marked with the \f3@serial include\fR tag\&.
-.RE
-.RS
+.RE     
+
+
 For example, the \f3javax\&.swing\fR package is marked with the \f3@serial\fR\f3exclude\fR tag in package\&.html or package-info\&.java\&. The public class \f3java\&.security\&.BasicPermission\fR is marked with the \f3@serial exclude\fR tag\&. The package-private class \f3java\&.util\&.PropertyPermissionCollection\fR is marked with the \f3@serial include\fR tag\&.
 
 The \f3@serial\fR tag at the class level overrides the \f3@serial\fR tag at the package level\&.
-
-.RE
 .TP     
 @serialData \fIdata-description\fR
 Introduced in JDK 1\&.2
@@ -1387,7 +1385,7 @@
 \f3public static final String SCRIPT_START = "<script>"\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1407,7 +1405,7 @@
 \f3public String evalScript(String script) {}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1494,7 +1492,7 @@
 \f3}\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS FIELD\ TAGS    
@@ -1523,7 +1521,7 @@
 \f3    int x = 1263732;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS CONSTRUCTOR\ AND\ METHOD\ TAGS    
@@ -1578,7 +1576,7 @@
 \f3    }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH OPTIONS    
@@ -1592,7 +1590,7 @@
 .PP
 The options are:
 .PP
--1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
+-1\&.1 || -author || -bootclasspath classpathlist || -bottom text || -breakiterator || -charset name || -classpath classpathlist || -d directory || -docencoding name || -docfilesubdirs || -doclet class || -docletpath classpathlist || -doctitle title || -encoding || -exclude packagename1:packagename2:\&.\&.\&. || -excludedocfilessubdir name1:name2 || -extdirs dirist || -footer footer || -group groupheading packagepattern:packagepattern || -header header || -help || -helpfile path\efilename || -Jflag || -javafx ||-keywords || -link extdocURL || -linkoffline extdocURL packagelistLoc || -linksource || -locale language_country_variant || -nocomment || -nodeprecated || -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier all | packagename1:packagename2\&.\&.\&. || -nosince || -notimestamp || -notree || -overview path/filename || -package || -private || -protected || -public || -quiet || -serialwarn || -source release || -sourcepath sourcepathlist || -sourcetab tablength || -splitindex || -stylesheet path/filename || -subpackages package1:package2:\&.\&.\&. || -tag tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath tagletpathlist || -title title || -top || -use || -verbose || -version || -windowtitle title
 .PP
 The following options are the core Javadoc options that are available to all doclets\&. The standard doclet provides the rest of the doclets: \f3-bootclasspath\fR, \f3-breakiterator\fR, \f3-classpath\fR, \f3-doclet\fR, \f3-docletpath\fR, \f3-encoding\fR, -\f3exclude\fR, \f3-extdirs\fR, \f3-help\fR, \f3-locale\fR, \f3-\fR\f3overview\fR, \f3-package\fR, \f3-private\fR, \f3-protected\fR, \f3-public\fR, \f3-quiet\fR, \f3-source\fR, \f3-sourcepath\fR, \f3-subpackages\fR, and \f3-verbose\fR\&.
 .SS JAVADOC\ OPTIONS    
@@ -1635,12 +1633,11 @@
 .TP 0.2i    
 \(bu
 \f3-Xdoclint all,\fR\fI-group\fR : enable all except \fIgroup\fR checks
-.RE
-.RS
+.RE     
+
+
 The variable \fIgroup\fR has one of the following values:
 .RS     
-
-.RE
 .TP 0.2i    
 \(bu
 \f3accessibility\fR : Checks for the issues to be detected by an accessibility checker (for example, no caption or summary attributes specified in a \f3<table>\fR tag)\&.
@@ -1656,8 +1653,9 @@
 .TP 0.2i    
 \(bu
 \f3syntax\fR : Checks for low level issues like unescaped angle brackets (\f3<\fR and \f3>\fR) and ampersands (\f3&\fR) and invalid Javadoc tags\&.
-.RE
-.RS
+.RE     
+
+
 You can specify the \f3-Xdoclint\fR option multiple times to enable the option to check errors and warnings in multiple categories\&. Alternatively, you can specify multiple error and warning categories by using the preceding options\&. For example, use either of the following commands to check for the HTML, syntax, and accessibility issues in the file \fIfilename\fR\&.
 .sp     
 .nf     
@@ -1667,7 +1665,7 @@
 \f3javadoc \-Xdoclint:html,syntax,accessibility \fIfilename\fR\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1675,8 +1673,6 @@
 \fINote:\fR The \f3javadoc\fR command does not guarantee the completeness of these checks\&. In particular, it is not a full HTML compliance checker\&. The goal of the -\f3Xdoclint\fR option is to enable the \f3javadoc\fR command to report majority of common errors\&.
 
 The \f3javadoc\fR command does not attempt to fix invalid input, it just reports it\&.
-
-.RE
 .TP
 -public
 .br
@@ -1740,7 +1736,7 @@
 \f3javadoc \-sourcepath /home/user/src/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1755,7 +1751,7 @@
 \f3javadoc \-sourcepath /home/user1/src:/home/user2/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1766,13 +1762,13 @@
 
 If you omit \f3-sourcepath\fR, then the \f3javadoc\fR command uses \f3-classpath\fR to find the source files and class files (for backward compatibility)\&. If you want to search for source and class files in separate paths, then use both \f3-sourcepath\fR and \f3-classpath\fR\&.
 
-For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/libthen you would use the following command:
+For example, if you want to document \f3com\&.mypackage\fR, whose source files reside in the directory /home/user/src/com/mypackage, and if this package relies on a library in /home/user/lib, then you would use the following command:
 .sp     
 .nf     
 \f3javadoc \-sourcepath /home/user/lib \-classpath /home/user/src com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1795,7 +1791,7 @@
 \f3javadoc \-d docs \-sourcepath /home/user/src  \-subpackages java:javax\&.swing \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1813,7 +1809,7 @@
 \f3    java\&.net:java\&.lang\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1846,11 +1842,10 @@
 .TP 0.2i    
 \(bu
 Breakiterator sentence-break algorithm\&. Stops at a period, question mark, or exclamation point followed by a space when the next word starts with a capital letter\&. This is meant to handle most abbreviations (such as "The serial no\&. is valid", but will not handle "Mr\&. Smith")\&. The \f3-breakiterator\fR option does not stop at HTML tags or sentences that begin with numbers or symbols\&. The algorithm stops at the last period in \&.\&./filename, even when embedded in an HTML tag\&.
-.RE
-.RS
-In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
+.RE     
 
-.RE
+
+In Java SE 1\&.5 the \f3-breakiterator\fR option warning messages are removed, and the default sentence-break algorithm is unchanged\&. If you have not modified your source code to eliminate the \f3-breakiterator\fR option warnings in Java SE 1\&.4\&.x, then you do not have to do anything\&. The warnings go away starting with Java SE 1\&.5\&.0\&.
 .TP
 -locale \fIlanguage_country_variant\fR
 .br
@@ -1885,7 +1880,21 @@
 \f3Java HotSpot(TM) 64\-Bit Server VM (build 23\&.5\-b02, mixed mode)\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
+.fi     
+.sp     
+
+.TP
+-javafx
+.br
+Generates HTML documentation using the JavaFX extensions to the standard doclet\&. The generated documentation includes a Property Summary section in addition to the other summary sections generated by the standard Java doclet\&. The listed properties are linked to the sections for the getter and setter methods of each property\&.
+
+If there are no documentation comments written explicitly for getter and setter methods, the documentation comments from the property method are automatically copied to the generated documentation for these methods\&. This option also adds a new \f3@defaultValue\fR tag that allows documenting the default value for a property\&.
+
+Example:
+.sp     
+.nf     
+\f3javadoc \-javafx MyClass\&.java \-d testdir\fP
 .fi     
 .sp     
 
@@ -1957,7 +1966,7 @@
 \f3\-link <directory>/<directory>/\&.\&.\&./<name>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -1982,7 +1991,7 @@
 \f3javadoc \-link http://docs\&.oracle\&.com/javase/8/docs/api/ com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The command generates documentation for the package \f3com\&.mypackage\fR with links to the Java SE packages\&. The generated documentation contains links to the \f3Object\fR class, for example, in the class \f3trees\fR\&. Other options, such as the \f3-sourcepath\fR and \f3-d\fR options, are not shown\&.
@@ -2044,7 +2053,7 @@
 \f3and so on \&.\&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When \f3javadoc\fR is run without the \f3-link\fR option and encounters a name that belongs to an externally referenced class, it prints the name with no link\&. However, when the \f3-link\fR option is used, the \f3javadoc\fR command searches the package-list file at the specified \fIextdocURL\fR location for that package name\&. When it finds the package name, it prefixes the name with \fIextdocURL\fR\&.
@@ -2094,7 +2103,7 @@
 \f3javadoc \-linkoffline http://docs\&.oracle\&.com/javase/8/docs/api/ \&.  com\&.mypackage \fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2118,7 +2127,7 @@
 \f3packagelistLoc2 \&.\&.\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2133,7 +2142,7 @@
 \f3javadoc \-d update \-linkoffline \&. html com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 When the \f3javadoc\fR command completes, copy these generated class pages in update/com/package (not the overview or index) to the original files in html/com/package\&.
@@ -2150,7 +2159,7 @@
 \f3public class Button extends Component implements Accessible\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2161,7 +2170,7 @@
 \f3public String getLabel()\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2176,8 +2185,9 @@
 .TP 0.2i    
 \(bu
 The \f3packagepattern\fR value can be any package name at the start of any package name followed by an asterisk (*)\&. The asterisk is the only wildcard allowed and means match any characters\&. Multiple patterns can be included in a group by separating them with colons (:)\&. If you use an asterisk in a pattern or pattern list, then the pattern list must be inside quotation marks, such as \f3"java\&.lang*:java\&.util"\fR\&.
-.RE
-.RS
+.RE     
+
+
 When you do not supply a \f3-group\fR option, all packages are placed in one group with the heading \fIPackages\fR and appropriate subheadings\&. If the subheadings do not include all documented packages (all groups), then the remaining packages appear in a separate group with the subheading Other Packages\&.
 
 For example, the following \f3javadoc\fR command separates the three documented packages into \fICore\fR, \fIExtension\fR, and \fIOther Packages\fR\&. The trailing dot (\&.) does not appear in \f3java\&.lang*\fR\&. Including the dot, such as \f3java\&.lang\&.*\fR omits the\f3java\&.lang\fR package\&.
@@ -2192,7 +2202,7 @@
 \f3        java\&.lang java\&.lang\&.reflect java\&.util javax\&.servlet java\&.new\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2212,8 +2222,6 @@
 \fIOther Packages\fR
 
 \f3java\&.new\fR
-
-.RE
 .TP
 -nodeprecated
 .br
@@ -2251,7 +2259,7 @@
 \f3javadoc \-helpfile /home/user/myhelp\&.html java\&.awt\&.\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2264,7 +2272,7 @@
 \f3javadoc \-stylesheet file /home/user/mystylesheet\&.css com\&.mypackage\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2283,7 +2291,7 @@
 \f3<META http\-equiv="Content\-Type" content="text/html; charset=ISO\-8859\-1">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2296,7 +2304,7 @@
 .br
 Specifies the encoding of the generated HTML files\&. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets at http://www\&.iana\&.org/assignments/character-sets
 
-If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding"iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
+If you omit the \f3-docencoding\fR option but use the \f3-encoding\fR option, then the encoding of the generated HTML files is determined by the \f3-encoding\fR option, for example: \f3javadoc -docencoding "iso-8859-1" mypackage\fR\&. See also the \f3-encoding\fR and \f3-docencoding name\fR options\&.
 .TP
 -keywords
 .br
@@ -2315,7 +2323,7 @@
 \f3<META NAME="keywords" CONTENT="charAt()">\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2360,7 +2368,7 @@
 \f3 */\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2390,7 +2398,7 @@
 \f3\-tag example:X\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2433,7 +2441,7 @@
 \f3\-tag see\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2523,7 +2531,7 @@
 \f3\-sourcepath /java/pubs/ws/1\&.7\&.0/src/share/classes\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Create a file named packages that contains:
@@ -2538,7 +2546,7 @@
 \f3com\&.mypackage3\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:
@@ -2547,7 +2555,7 @@
 \f3javadoc @options @packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Argument Files with Paths\fR
@@ -2558,7 +2566,7 @@
 \f3javadoc @path1/options @path2/packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Option Arguments\fR
@@ -2581,7 +2589,7 @@
 \f3    Other names may be trademarks of their respective owners\&.</font>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 Run the \f3javadoc\fR command as follows:\f3javadoc -bottom @bottom @packages\fR\&.
@@ -2616,7 +2624,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src \-subpackages java \-exclude\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to Root and Run Explicit Packages\fR
@@ -2630,7 +2638,7 @@
 \f3javadoc \-d /home/html java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 To also traverse down other package trees, append their names to the \f3-subpackages\fR argument, such as j\f3ava:javax:org\&.xml\&.sax\fR\&.
@@ -2643,7 +2651,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 4 Run from Any Directory on Explicit Packages in Multiple Trees\fR
@@ -2654,7 +2662,7 @@
 \f3javadoc \-d /home/html \-sourcepath /home/src1:/home/src2 java\&.awt java\&.awt\&.event\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The result is that all cases generate HTML-formatted documentation for the \f3public\fR and \f3protected\fR classes and interfaces in packages j\f3ava\&.awt\fR and \f3java\&.awt\&.even\fRt and save the HTML files in the specified destination directory\&. Because two or more packages are being generated, the document has three HTML frames: one for the list of packages, another for the list of classes, and the third for the main class pages\&.
@@ -2676,7 +2684,7 @@
 \f3javadoc \-d /home/html Button\&.java Canvas\&.java Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Change to the Root Directory of the Package\fR
@@ -2690,7 +2698,7 @@
 \f3javadoc \-d /home/html java/awt/Button\&.java java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Document Files from Any Directory\fR
@@ -2704,7 +2712,7 @@
 \f3/home/src/java/awt/Graphics*\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2720,7 +2728,7 @@
 \f3/home/src/java/applet/Applet\&.java\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS REAL-WORLD\ EXAMPLES    
@@ -2784,7 +2792,7 @@
 \f3@packages\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -2802,7 +2810,7 @@
 \f3import javax\&.tools\&.ToolProvider;\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3public class JavaAccessSample{\fP
@@ -2838,7 +2846,7 @@
 \f3 }\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 The first three arguments of the \f3run\fR method specify input, standard output, and standard error streams\&. \f3Null\fR is the default value for \f3System\&.in\fR, \f3System\&.out\fR, and \f3System\&.err\fR, respectively\&.
@@ -2891,7 +2899,7 @@
 \f3        java\&.applet\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .nf     
 \f3WINDOWTITLE = \&'Java\(tm SE 7 API Specification\&'\fP
@@ -2927,7 +2935,7 @@
 \f3SRCDIR = \&'/java/jdk/1\&.7\&.0/src/share/classes\&'\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SS NOTES    
diff --git a/src/solaris/doc/sun/man/man1/jjs.1 b/src/solaris/doc/sun/man/man1/jjs.1
index 47b5602..f223cf8 100644
--- a/src/solaris/doc/sun/man/man1/jjs.1
+++ b/src/solaris/doc/sun/man/man1/jjs.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Basic Tools
 .\"     Title: jjs.1
 .\"
 .if n .pl 99999
-.TH jjs 1 "21 November 2013" "JDK 8" "Basic Tools"
+.TH jjs 1 "03 March 2015" "JDK 8" "Basic Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -82,7 +82,7 @@
 \f3\-css=1k\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -91,7 +91,7 @@
 .br
 Compiles the script without running it\&.
 .TP
--cp \fIpath\fR , --classpath \fIpath\fR
+-cp \fIpath\fR , -classpath \fIpath\fR
 .br
 Specifies the path to the supporting class files To set multiple paths, the option can be repeated, or you can separate each path with a colon (:)\&.
 .TP
@@ -112,7 +112,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
@@ -133,7 +133,7 @@
 .TP
 -doe, --dump-on-error
 .br
-Provides a full stack trace when an arror occurs\&. By default, only a brief error message is printed\&.
+Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&.
 .TP
 --early-lvalue-error
 .br
@@ -180,13 +180,17 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 
 
 This option can be repeated to pass multiple \f3java\fR command options\&.
 .TP
+--language=[es5]
+.br
+Specifies the ECMAScript language version\&. The default version is ES5\&.
+.TP
 --lazy-compilation
 .br
 Enables lazy code generation strategies (that is, the entire script is not compiled at once)\&. This option is experimental\&.
@@ -202,12 +206,13 @@
 .nf     
 \f3\-\-log=fields:finest,codegen:info\fP
 .fi     
-.nf     
-\f3\fR
-.fi     
 .sp     
 
 .TP
+--optimistic-types=[true|false]
+.br
+Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&.
+.TP
 --package=\fIname\fR
 .br
 Specifies the package to which generated class files are added\&.
@@ -302,7 +307,7 @@
 \f3jjs script\&.js\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 2 Running Nashorn in Interactive Mode\fR
@@ -323,7 +328,7 @@
 \f3>>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 \f3Example 3 Passing Arguments to Nashorn\fR
@@ -341,7 +346,7 @@
 \f3jjs>\fP
 .fi     
 .nf     
-\f3\fR
+\f3\fP
 .fi     
 .sp     
 .SH SEE\ ALSO    
diff --git a/src/solaris/doc/sun/man/man1/jstat.1 b/src/solaris/doc/sun/man/man1/jstat.1
index 405df26..b8ec74b 100644
--- a/src/solaris/doc/sun/man/man1/jstat.1
+++ b/src/solaris/doc/sun/man/man1/jstat.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 10 May 2011
+.\"     Date: 03 March 2015
 .\"     SectDesc: Monitoring Tools
 .\"     Title: jstat.1
 .\"
 .if n .pl 99999
-.TH jstat 1 "10 May 2011" "JDK 8" "Monitoring Tools"
+.TH jstat 1 "03 March 2015" "JDK 8" "Monitoring Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -101,7 +101,7 @@
 The communications protocol\&. If the \fIprotocol\fR value is omitted and a host name is not specified, then the default protocol is a platform-specific optimized local protocol\&. If the \fIprotocol\fR value is omitted and a host name is specified, then the default protocol is \f3rmi\fR\&.
 .TP     
 \fIlvmid\fR
-The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on UNIX platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
+The local virtual machine identifier for the target JVM\&. The \f3lvmid\fR is a platform-specific value that uniquely identifies a JVM on a system\&. The \f3lvmid\fR is the only required component of a virtual machine identifier\&. The \f3lvmid\fR is typically, but not necessarily, the operating system\&'s process identifier for the target JVM process\&. You can use the \f3jps\fR command to determine the \f3lvmid\fR\&. Also, you can determine the \f3lvmid\fR on Solaris, Linux, and OS X platforms with the \f3ps\fR command, and on Windows with the Windows Task Manager\&.
 .TP     
 \fIhostname\fR
 A hostname or IP address that indicates the target host\&. If the \fIhostname\fR value is omitted, then the target host is the local host\&.
@@ -154,7 +154,7 @@
 
 \f3gcnewcapacity\fR: Displays statistics about the sizes of the new generations and its corresponding spaces\&.
 
-\f3gcold\fR: Displays statistics about the behavior of the old generation and Metaspace Statistics\&.
+\f3gcold\fR: Displays statistics about the behavior of the old generation and metaspace statistics\&.
 
 \f3gcoldcapacity\fR: Displays statistics about the sizes of the old generation\&.
 
@@ -170,7 +170,7 @@
 .TP
 -t
 .br
-Display sa timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
+Displays a timestamp column as the first column of output\&. The time stamp is the time since the start time of the target JVM\&.
 .TP
 -J\fIjavaOption\fR
 .br
@@ -184,7 +184,7 @@
 
 \f3Loaded\fR: Number of classes loaded\&.
 
-\f3Bytes\fR: Number of KBs loaded\&.
+\f3Bytes\fR: Number of kBs loaded\&.
 
 \f3Unloaded\fR: Number of classes unloaded\&.
 
@@ -212,25 +212,29 @@
 .br
 Garbage-collected heap statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3OU\fR: Old space utilization (KB)\&.
+\f3OU\fR: Old space utilization (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metacspace utilization (KB)\&.
+\f3MU\fR: Metacspace utilization (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3CCSU\fR: Compressed class space used (kB)\&.
 
 \f3YGC\fR: Number of young generation garbage collection events\&.
 
@@ -246,67 +250,71 @@
 .br
 Memory pool generation and space capacities\&.
 
-\f3NGCMN\fR: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3YGC\fR: Number of Young generation GC Events\&.
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
+
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
+
+\f3YGC\fR: Number of young generation GC events\&.
+
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gccause \fIoption\fR
 .br
 This option displays the same summary of garbage collection statistics as the \f3-gcutil\fR option, but includes the causes of the last garbage collection event and (when applicable) the current garbage collection event\&. In addition to the columns listed for \f3-gcutil\fR, this option adds the following columns\&.
 
-Garbage collection statistics, including garbage collection Events\&.
+\f3LGCC\fR: Cause of last garbage collection
 
-\f3LGCC\fR: Cause of last garbage collection\&.
-
-\f3GCC\fR: Cause of current garbage collection\&.
+\f3GCC\fR: Cause of current garbage collection
 .TP
 -gcnew \fIoption\fR
 .br
 New generation statistics\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3S0U\fR: Survivor space 0 utilization (KB)\&.
+\f3S0U\fR: Survivor space 0 utilization (kB)\&.
 
-\f3S1U\fR: Survivor space 1 utilization (KB)\&.
+\f3S1U\fR: Survivor space 1 utilization (kB)\&.
 
 \f3TT\fR: Tenuring threshold\&.
 
 \f3MTT\fR: Maximum tenuring threshold\&.
 
-\f3DSS\fR: Desired survivor size (KB)\&.
+\f3DSS\fR: Desired survivor size (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
-\f3EU\fR: Eden space utilization (KB)\&.
+\f3EU\fR: Eden space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -316,39 +324,43 @@
 .br
 New generation space size statistics\&.
 
-NGCMN: Minimum new generation capacity (KB)\&.
+\f3NGCMN\fR: Minimum new generation capacity (kB)\&.
 
-\f3NGCMX\fR: Maximum new generation capacity (KB)\&.
+\f3NGCMX\fR: Maximum new generation capacity (kB)\&.
 
-\f3NGC\fR: Current new generation capacity (KB)\&.
+\f3NGC\fR: Current new generation capacity (kB)\&.
 
-\f3S0CMX\fR: Maximum survivor space 0 capacity (KB)\&.
+\f3S0CMX\fR: Maximum survivor space 0 capacity (kB)\&.
 
-\f3S0C\fR: Current survivor space 0 capacity (KB)\&.
+\f3S0C\fR: Current survivor space 0 capacity (kB)\&.
 
-\f3S1CMX\fR: Maximum survivor space 1 capacity (KB)\&.
+\f3S1CMX\fR: Maximum survivor space 1 capacity (kB)\&.
 
-\f3S1C\fR: Current survivor space 1 capacity (KB)\&.
+\f3S1C\fR: Current survivor space 1 capacity (kB)\&.
 
-\f3ECMX\fR: Maximum eden space capacity (KB)\&.
+\f3ECMX\fR: Maximum eden space capacity (kB)\&.
 
-\f3EC\fR: Current eden space capacity (KB)\&.
+\f3EC\fR: Current eden space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
-\f3FGC\fR: Number of Full GC Events\&.
+\f3FGC\fR: Number of full GC events\&.
 .TP
 -gcold \fIoption\fR
 .br
-old and permanent generation statistics\&.
+Old and permanent generation statistics\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
 
-\f3MU\fR: Metaspace utilization (KB)\&.
+\f3MU\fR: Metaspace utilization (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3CCSC\fR: Compressed class space capacity (kB)\&.
 
-\f3OU\fR: old space utilization (KB)\&.
+\f3CCSU\fR: Compressed class space used (kB)\&.
+
+\f3OC\fR: Current old space capacity (kB)\&.
+
+\f3OU\fR: Old space utilization (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -362,13 +374,13 @@
 .br
 Old generation statistics\&.
 
-\f3OGCMN\fR: Minimum old generation capacity (KB)\&.
+\f3OGCMN\fR: Minimum old generation capacity (kB)\&.
 
-\f3OGCMX\fR: Maximum old generation capacity (KB)\&.
+\f3OGCMX\fR: Maximum old generation capacity (kB)\&.
 
-\f3OGC\fR: Current old generation capacity (KB)\&.
+\f3OGC\fR: Current old generation capacity (kB)\&.
 
-\f3OC\fR: Current old space capacity (KB)\&.
+\f3OC\fR: Current old space capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -382,11 +394,15 @@
 .br
 Permanent generation statistics\&.
 
-\f3MCMN\fR: Minimum metaspace capacity (KB)\&.
+\f3MCMN\fR: Minimum metaspace capacity (kB)\&.
 
-\f3MCMX\fR: Maximum metaspace capacity (KB)\&.
+\f3MCMX\fR: Maximum metaspace capacity (kB)\&.
 
-\f3MC\fR: Metaspace capacity (KB)\&.
+\f3MC\fR: Metaspace capacity (kB)\&.
+
+\f3CCSMN\fR: Compressed class space minimum capacity (kB)\&.
+
+\f3CCSMX\fR: Compressed class space maximum capacity (kB)\&.
 
 \f3YGC\fR: Number of young generation GC events\&.
 
@@ -410,6 +426,8 @@
 
 \f3M\fR: Metaspace utilization as a percentage of the space\&'s current capacity\&.
 
+\f3CCS\fR: Compressed class space utilization as a percentage\&.
+
 \f3YGC\fR: Number of young generation GC events\&.
 
 \f3YGCT\fR: Young generation garbage collection time\&.
@@ -430,47 +448,44 @@
 
 \f3Type\fR: Compilation type of the most recently compiled method\&.
 
-\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintComplation\fR option\&.
+\f3Method\fR: Class name and method name identifying the most recently compiled method\&. Class name uses slash (/) instead of dot (\&.) as a name space separator\&. Method name is the method within the specified class\&. The format for these two fields is consistent with the HotSpot \f3-XX:+PrintCompilation\fR option\&.
 .SH EXAMPLES    
 This section presents some examples of monitoring a local JVM with an \fIlvmid\fR of 21891\&.
 .SS THE\ GCUTIL\ OPTION    
 This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified by the -\f3gcutil\fR option\&.
 .PP
-The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.001 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 9\&.49% to 9\&.51%\&. Before the collection, the survivor space was 12\&.44% utilized, but after this collection it is only 7\&.74% utilized\&.
+The output of this example shows that a young generation collection occurred between the third and fourth sample\&. The collection took 0\&.078 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old space utilization from 66\&.80% to 68\&.19%\&. Before the collection, the survivor space was 97\&.02% utilized, but after this collection it is 91\&.03% utilized\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 21891 250 7\fP
 .fi     
 .nf     
-\f3  S0     S1     E      O      M       YGC    YGCT    FGC    FGCT     GCT\fP
+\f3  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   \fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  70\&.31  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  86\&.23  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3  0\&.00  97\&.02  96\&.53  66\&.80  95\&.52  89\&.14      7    0\&.300     0    0\&.000    0\&.300\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.49   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00   1\&.98  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  15\&.82  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .nf     
-\f30\&.00  99\&.74  13\&.80   7\&.86  95\&.82      3    0\&.124     0    0\&.000    0\&.124\fP
-.fi     
-.nf     
-\f3\fP
+\f3 91\&.03   0\&.00  17\&.80  68\&.19  95\&.89  91\&.24      8    0\&.378     0    0\&.000    0\&.378\fP
 .fi     
 .sp     
 .SS REPEAT\ THE\ COLUMN\ HEADER\ STRING    
-This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcutil\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
+This example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by \f3-gcnew\fR option\&. In addition, it uses the \f3-h3\fR option to output the column header after every 3 lines of data\&.
 .PP
 In addition to showing the repeating header string, this example shows that between the second and third samples, a young GC occurred\&. Its duration was 0\&.001 seconds\&. The collection found enough active data that the survivor space 0 utilization (S0U) would have exceeded the desired survivor Size (DSS)\&. As a result, objects were promoted to the old generation (not visible in this output), and the tenuring threshold (TT) was lowered from 31 to 2\&.
 .PP
@@ -516,7 +531,7 @@
 .SS INCLUDE\ A\ TIME\ STAMP\ FOR\ EACH\ SAMPLE    
 This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals\&. The \f3-t\fR option is used to generate a time stamp for each sample in the first column\&.
 .PP
-The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown to from 11,696 KB to 13820 KB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 KB (OGCMX), so it still has room to expand\&.
+The Timestamp column reports the elapsed time in seconds since the start of the target JVM\&. In addition, the \f3-gcoldcapacity\fR output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands\&. The old generation capacity (OGC) has grown from 11,696 kB to 13,820 kB after the eighty-first full garbage collection (FGC)\&. The maximum capacity of the generation (and space) is 60,544 kB (OGCMX), so it still has room to expand\&.
 .sp     
 .nf     
 \f3Timestamp      OGCMN    OGCMX     OGC       OC       YGC   FGC    FGCT    GCT\fP
@@ -537,7 +552,7 @@
 .SS MONITOR\ INSTRUMENTATION\ FOR\ A\ REMOTE\ JVM    
 This example attaches to lvmid 40496 on the system named remote\&.domain using the \f3-gcutil\fR option, with samples taken every second indefinitely\&.
 .PP
-The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the rmiregistry on \f3remote\&.domain\fR that is bound to the default rmiregistry port (port 1099)\&.
+The lvmid is combined with the name of the remote host to construct a \fIvmid\fR of \f340496@remote\&.domain\fR\&. This vmid results in the use of the \f3rmi\fR protocol to communicate to the default \f3jstatd\fR server on the remote host\&. The \f3jstatd\fR server is located using the \f3rmiregistry\fR command on \f3remote\&.domain\fR that is bound to the default port of the \f3rmiregistry\fR command (port 1099)\&.
 .sp     
 .nf     
 \f3jstat \-gcutil 40496@remote\&.domain 1000\fP
diff --git a/src/solaris/doc/sun/man/man1/keytool.1 b/src/solaris/doc/sun/man/man1/keytool.1
index 7275889..5a89779 100644
--- a/src/solaris/doc/sun/man/man1/keytool.1
+++ b/src/solaris/doc/sun/man/man1/keytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 6 August 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: keytool.1
 .\"
 .if n .pl 99999
-.TH keytool 1 "6 August 2013" "JDK 8" "Security Tools"
+.TH keytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -185,10 +185,16 @@
 .TP 0.2i    
 \(bu
 Items in italics (option values) represent the actual values that must be supplied\&. For example, here is the format of the \f3-printcert\fR command:
+.sp     
+.nf     
+\f3keytool \-printcert {\-file \fIcert_file\fR} {\-v}\fP
+.fi     
+.sp     
 
-\f3keytool -printcert {-file cert_file} {-v}\fR
 
-When you specify a \f3-printcert\fR command, replace \f3cert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
+
+
+When you specify a \f3-printcert\fR command, replace \fIcert_file\fR with the actual file name, as follows: \f3keytool -printcert -file VScert\&.cer\fR
 .TP 0.2i    
 \(bu
 Option values must be put in quotation marks when they contain a blank (space)\&.
@@ -385,10 +391,39 @@
 .PP
 \fINote:\fR Users should be aware that some combinations of extensions (and other certificate fields) may not conform to the Internet standard\&. See Certificate Conformance Warning\&.
 .SH COMMANDS    
-.TP
+.TP     
 -gencert
-.br
-\f3{-rfc} {-infile infile} {-outfile outfile} {-alias alias} {-sigalg sigalg} {-dname dname} {-startdate startdate {-ext ext}* {-validity valDays} [-keypass keypass] {-keystore keystore} [-storepass storepass] {-storetype storetype} {-providername provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-rfc} {\-infile \fIinfile\fR} {\-outfile \fIoutfile\fR} {\-alias \fIalias\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-dname \fIdname\fR} {\-startdate \fIstartdate\fR {\-ext \fIext\fR}* {\-validity \fIvalDays\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-providername \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a certificate as a response to a certificate request file (which can be created by the \f3keytool\fR\f3-certreq\fR command)\&. The command reads the request from \fIinfile\fR (if omitted, from the standard input), signs it using alias\&'s private key, and outputs the X\&.509 certificate into \fIoutfile\fR (if omitted, to the standard output)\&. When\f3-rfc\fR is specified, the output format is Base64-encoded PEM; otherwise, a binary DER is created\&.
 
@@ -459,10 +494,39 @@
 .fi     
 .sp     
 
-.TP
+.TP     
 -genkeypair
-.br
-\f3{-alias alias} {-keyalg keyalg} {-keysize keysize} {-sigalg sigalg} [-dname dname] [-keypass keypass] {-startdate value} {-ext ext}* {-validity valDays} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} {\-sigalg \fIsigalg\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-dname \fIdname\fR] [\-keypass \fIkeypass\fR] {\-startdate \fIvalue\fR} {\-ext \fIext\fR}*\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-validity \fIvalDays\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a key pair (a public key and associated private key)\&. Wraps the public key into an X\&.509 v3 self-signed certificate, which is stored as a single-element certificate chain\&. This certificate chain and the private key are stored in a new keystore entry identified by alias\&.
 
@@ -510,18 +574,61 @@
 The value of \f3valDays\fR specifies the number of days (starting at the date specified by \f3-startdate\fR, or the current date when \f3-startdate\fR is not specified) for which the certificate should be considered valid\&.
 
 This command was named \f3-genkey\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-genkeypair\fR, is preferred going forward\&.
-.TP
+.TP     
 -genseckey
-.br
-\f3-genseckey {-alias alias} {-keyalg keyalg} {-keysize keysize} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-keyalg \fIkeyalg\fR} {\-keysize \fIkeysize\fR} [\-keypass \fIkeypass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a secret key and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&.
 
 The value of \f3keyalg\fR specifies the algorithm to be used to generate the secret key, and the value of \f3keysize\fR specifies the size of the key to be generated\&. The \f3keypass\fR value is a password that protects the secret key\&. If no password is provided, then the user is prompted for it\&. If you press the Return key at the prompt, then the key password is set to the same password that is used for the \f3keystore\fR\&. The \f3keypass\fR value must be at least 6 characters\&.
-.TP
+.TP     
 -importcert
-.br
-\f3-importcert {-alias alias} {-file cert_file} [-keypass keypass] {-noprompt} {-trustcacerts} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} [\-keypass \fIkeypass\fR] {\-noprompt} {\-trustcacerts}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate or certificate chain (where the latter is supplied in a PKCS#7 formatted reply or a sequence of X\&.509 certificates) from the file \f3cert_file\fR, and stores it in the \f3keystore\fR entry identified by \f3alias\fR\&. If no file is specified, then the certificate or certificate chain is read from \f3stdin\fR\&.
 
@@ -530,16 +637,74 @@
 You import a certificate for two reasons: To add it to the list of trusted certificates, and to import a certificate reply received from a certificate authority (CA) as the result of submitting a Certificate Signing Request to that CA (see the \f3-certreq\fR option in Commands)\&.
 
 Which type of import is intended is indicated by the value of the \f3-alias\fR option\&. If the alias does not point to a key entry, then the \f3keytool\fR command assumes you are adding a trusted certificate entry\&. In this case, the alias should not already exist in the keystore\&. If the alias does already exist, then the \f3keytool\fR command outputs an error because there is already a trusted certificate for that alias, and does not import the certificate\&. If the alias points to a key entry, then the \f3keytool\fR command assumes you are importing a certificate reply\&.
-.TP
+.TP     
 -importpassword
-.br
-\f3{-alias alias} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a passphrase and stores it in a new \f3KeyStore\&.SecretKeyEntry\fR identified by \f3alias\fR\&. The passphrase may be supplied via the standard input stream; otherwise the user is prompted for it\&. \f3keypass\fR is a password used to protect the imported passphrase\&. If no password is provided, the user is prompted for it\&. If you press the Return key at the prompt, the key password is set to the same password as that used for the \f3keystore\fR\&. \f3keypass\fR must be at least 6 characters long\&.
-.TP
+.TP     
 -importkeystore
-.br
-\f3{-srcstoretype srcstoretype} {-deststoretype deststoretype} [-srcstorepass srcstorepass] [-deststorepass deststorepass] {-srcprotected} {-destprotected} {-srcalias srcalias {-destalias destalias} [-srckeypass srckeypass] } [-destkeypass destkeypass] {-noprompt} {-srcProviderName src_provider_name} {-destProviderName dest_provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-srcstoretype \fIsrcstoretype\fR} {\-deststoretype \fIdeststoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-srcstorepass \fIsrcstorepass\fR] [\-deststorepass \fIdeststorepass\fR] {\-srcprotected}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-destprotected} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcalias \fIsrcalias\fR {\-destalias \fIdestalias\fR} [\-srckeypass \fIsrckeypass\fR]} \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-destkeypass \fIdestkeypass\fR] {\-noprompt}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-srcProviderName \fIsrc_provider_name\fR} {\-destProviderName \fIdest_provider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Imports a single entry or all entries from a source keystore to a destination keystore\&.
 
@@ -550,16 +715,44 @@
 If the destination alias already exists in the destination keystore, then the user is prompted to either overwrite the entry or to create a new entry under a different alias name\&.
 
 If the \f3-noprompt\fR option is provided, then the user is not prompted for a new destination alias\&. Existing entries are overwritten with the destination alias name\&. Entries that cannot be imported are skipped and a warning is displayed\&.
-.TP
+.TP     
 -printcertreq
-.br
-\f3{-file file}\fR
+.sp     
+.nf     
+\f3{\-file \fIfile\fR}\fP
+.fi     
+.sp     
+
 
 Prints the content of a PKCS #10 format certificate request, which can be generated by the \f3keytool\fR\f3-certreq\fR command\&. The command reads the request from file\&. If there is no file, then the request is read from the standard input\&.
-.TP
+.TP     
 -certreq
-.br
-\f3{-alias alias} {-dname dname} {-sigalg sigalg} {-file certreq_file} [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-dname \fIdname\fR} {\-sigalg \fIsigalg\fR} {\-file \fIcertreq_file\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Generates a Certificate Signing Request (CSR) using the PKCS #10 format\&.
 
@@ -572,10 +765,29 @@
 The CSR is stored in the file certreq_file\&. If no file is specified, then the CSR is output to \f3stdout\fR\&.
 
 Use the \f3importcert\fR command to import the response from the CA\&.
-.TP
+.TP     
 -exportcert
-.br
-\f3{-alias alias} {-file cert_file} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-rfc} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-file \fIcert_file\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-rfc} {\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads from the keystore the certificate associated with \fIalias\fR and stores it in the cert_file file\&. When no file is specified, the certificate is output to \f3stdout\fR\&.
 
@@ -584,20 +796,48 @@
 If \f3alias\fR refers to a trusted certificate, then that certificate is output\&. Otherwise, \f3alias\fR refers to a key entry with an associated certificate chain\&. In that case, the first certificate in the chain is returned\&. This certificate authenticates the public key of the entity addressed by \f3alias\fR\&.
 
 This command was named \f3-export\fR in earlier releases\&. The old name is still supported in this release\&. The new name, \f3-exportcert\fR, is preferred going forward\&.
-.TP
+.TP     
 -list
-.br
-\f3{-alias alias} {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v | -rfc} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v | \-rfc} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Prints to \f3stdout\fR the contents of the keystore entry identified by \f3alias\fR\&. If no \f3alias\fR is specified, then the contents of the entire keystore are printed\&.
 
 This command by default prints the SHA1 fingerprint of a certificate\&. If the \f3-v\fR option is specified, then the certificate is printed in human-readable format, with additional information such as the owner, issuer, serial number, and any extensions\&. If the \f3-rfc\fR option is specified, then the certificate contents are printed using the printable encoding format, as defined by the Internet RFC 1421 Certificate Encoding Standard\&.
 
 You cannot specify both \f3-v\fR and \f3-rfc\fR\&.
-.TP
+.TP     
 -printcert
-.br
-\f3{-file cert_file | -sslserver host[:port]} {-jarfile JAR_file {-rfc} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-file \fIcert_file\fR | \-sslserver \fIhost\fR[:\fIport\fR]} {\-jarfile \fIJAR_file\fR {\-rfc} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Reads the certificate from the file cert_file, the SSL server located at host:port, or the signed JAR file \f3JAR_file\fR (with the \f3-jarfile\fR option and prints its contents in a human-readable format\&. When no port is specified, the standard HTTPS port 443 is assumed\&. Note that \f3-sslserver\fR and -file options cannot be provided at the same time\&. Otherwise, an error is reported\&. If neither option is specified, then the certificate is read from \f3stdin\fR\&.
 
@@ -608,40 +848,120 @@
 If the SSL server is behind a firewall, then the \f3-J-Dhttps\&.proxyHost=proxyhost\fR and \f3-J-Dhttps\&.proxyPort=proxyport\fR options can be specified on the command line for proxy tunneling\&. See Java Secure Socket Extension (JSSE) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide\&.html
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -printcrl
-.br
-\f3-file crl_ {-v}\fR
+.sp     
+.nf     
+\f3\-file \fIcrl_\fR {\-v}\fP
+.fi     
+.sp     
+
 
 Reads the Certificate Revocation List (CRL) from the file \f3crl_\fR\&. A CRL is a list of digital certificates that were revoked by the CA that issued them\&. The CA generates the \f3crl_\fR file\&.
 
 \fINote:\fR This option can be used independently of a keystore\&.
-.TP
+.TP     
 -storepasswd
-.br
-\f3[-new new_storepass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-new \fInew_storepass\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3[\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password used to protect the integrity of the keystore contents\&. The new password is \f3new_storepass\fR, which must be at least 6 characters\&.
-.TP
+.TP     
 -keypasswd
-.br
-\f3{-alias alias} [-keypass old_keypass] [-new new_keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-keypass \fIold_keypass\fR] [\-new \fInew_keypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Changes the password under which the private/secret key identified by \f3alias\fR is protected, from \f3old_keypass\fR to \f3new_keypass\fR, which must be at least 6 characters\&.
 
 If the \f3-keypass\fR option is not provided at the command line, and the key password is different from the keystore password, then the user is prompted for it\&.
 
 If the \f3-new\fR option is not provided at the command line, then the user is prompted for it
-.TP
+.TP     
 -delete
-.br
-\f3[-alias alias] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3[\-alias \fIalias\fR] {\-storetype \fIstoretype\fR} {\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR]\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerName \fIprovider_name\fR}  \fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-v} {\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Deletes from the keystore the entry identified by \f3alias\fR\&. The user is prompted for the alias, when no alias is provided at the command line\&.
-.TP
+.TP     
 -changealias
-.br
-\f3{-alias alias} [-destalias destalias] [-keypass keypass] {-storetype storetype} {-keystore keystore} [-storepass storepass] {-providerName provider_name} {-providerClass provider_class_name {-providerArg provider_arg}} {-v} {-protected} {-Jjavaoption}\fR
+.sp     
+.nf     
+\f3{\-alias \fIalias\fR} [\-destalias \fIdestalias\fR] [\-keypass \fIkeypass\fR] {\-storetype \fIstoretype\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-keystore \fIkeystore\fR} [\-storepass \fIstorepass\fR] {\-providerName \fIprovider_name\fR}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-providerClass \fIprovider_class_name\fR {\-providerArg \fIprovider_arg\fR}} {\-v}\fP
+.fi     
+.sp     
+.sp     
+.nf     
+\f3{\-protected} {\-Jjavaoption}\fP
+.fi     
+.sp     
+
 
 Move an existing keystore entry from the specified \f3alias\fR to a new alias, \f3destalias\fR\&. If no destination alias is provided, then the command prompts for one\&. If the original entry is protected with an entry password, then the password can be supplied with the \f3-keypass\fR option\&. If no key password is provided, then the \f3storepass\fR (if provided) is attempted first\&. If the attempt fails, then the user is prompted for a password\&.
 .TP
diff --git a/src/solaris/doc/sun/man/man1/policytool.1 b/src/solaris/doc/sun/man/man1/policytool.1
index a82f7be..c7fb46b 100644
--- a/src/solaris/doc/sun/man/man1/policytool.1
+++ b/src/solaris/doc/sun/man/man1/policytool.1
@@ -1,5 +1,5 @@
 '\" t
-.\"  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+.\"  Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
 .\"

 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 .\"

@@ -23,12 +23,12 @@
 .\"

 .\"     Arch: generic
 .\"     Software: JDK 8
-.\"     Date: 21 November 2013
+.\"     Date: 03 March 2015
 .\"     SectDesc: Security Tools
 .\"     Title: policytool.1
 .\"
 .if n .pl 99999
-.TH policytool 1 "21 November 2013" "JDK 8" "Security Tools"
+.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
 .\" -----------------------------------------------------------------

 .\" * Define some portability stuff

 .\" -----------------------------------------------------------------

@@ -80,7 +80,7 @@
 Run the \f3policytool\fR command and load the specified file:
 .sp     
 .nf     
-\f3policytool\-file mypolicyfile\fP
+\f3policytool \-file \fImypolicyfile\fR\fP
 .fi     
 .nf     
 \f3\fP
diff --git a/src/solaris/native/java/io/FileOutputStream_md.c b/src/solaris/native/java/io/FileOutputStream_md.c
index efd5864..22d80a2 100644
--- a/src/solaris/native/java/io/FileOutputStream_md.c
+++ b/src/solaris/native/java/io/FileOutputStream_md.c
@@ -53,8 +53,8 @@
  */
 
 JNIEXPORT void JNICALL
-Java_java_io_FileOutputStream_open(JNIEnv *env, jobject this,
-                                   jstring path, jboolean append) {
+Java_java_io_FileOutputStream_open0(JNIEnv *env, jobject this,
+                                    jstring path, jboolean append) {
     fileOpen(env, this, path, fos_fd,
              O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
 }
diff --git a/src/solaris/native/java/lang/UNIXProcess_md.c b/src/solaris/native/java/lang/UNIXProcess_md.c
index ec85b68..bccd41d 100644
--- a/src/solaris/native/java/lang/UNIXProcess_md.c
+++ b/src/solaris/native/java/lang/UNIXProcess_md.c
@@ -598,9 +598,9 @@
      */
     assert(prog != NULL && argBlock != NULL);
     if ((phelperpath = getBytes(env, helperpath))   == NULL) goto Catch;
-    if ((pprog     = getBytes(env, prog))       == NULL) goto Catch;
-    if ((pargBlock = getBytes(env, argBlock))   == NULL) goto Catch;
-    if ((c->argv = NEW(const char *, argc + 3)) == NULL) goto Catch;
+    if ((pprog       = getBytes(env, prog))         == NULL) goto Catch;
+    if ((pargBlock   = getBytes(env, argBlock))     == NULL) goto Catch;
+    if ((c->argv     = NEW(const char *, argc + 3)) == NULL) goto Catch;
     c->argv[0] = pprog;
     c->argc = argc + 2;
     initVectorFromBlock(c->argv+1, pargBlock, argc);
@@ -689,10 +689,11 @@
     closeSafely(childenv[0]);
     closeSafely(childenv[1]);
 
-    releaseBytes(env, prog,     pprog);
-    releaseBytes(env, argBlock, pargBlock);
-    releaseBytes(env, envBlock, penvBlock);
-    releaseBytes(env, dir,      c->pdir);
+    releaseBytes(env, helperpath, phelperpath);
+    releaseBytes(env, prog,       pprog);
+    releaseBytes(env, argBlock,   pargBlock);
+    releaseBytes(env, envBlock,   penvBlock);
+    releaseBytes(env, dir,        c->pdir);
 
     free(c->argv);
     free(c->envv);
diff --git a/src/solaris/native/java/lang/locale_str.h b/src/solaris/native/java/lang/locale_str.h
index d63e26c..72a796c 100644
--- a/src/solaris/native/java/lang/locale_str.h
+++ b/src/solaris/native/java/lang/locale_str.h
@@ -135,7 +135,7 @@
     "sr_SP", "sr_YU",
     "tchinese", "zh_TW",
 #endif
-    ""
+    "", "",
  };
 
 /*
@@ -188,7 +188,7 @@
     "japanese", "ja",
     "korean", "ko",
 #endif
-    "",
+    "", "",
 };
 
 /*
@@ -201,7 +201,7 @@
     "iqtelif", "Latn",
     "latin", "Latn",
 #endif
-    "",
+    "", "",
 };
 
 /*
@@ -212,7 +212,7 @@
     "RN", "US", // used on Linux, not clear what it stands for
 #endif
     "YU", "CS", // YU has been removed from ISO 3166
-    "",
+    "", "",
 };
 
 /*
@@ -220,5 +220,5 @@
  */
 static char *variant_names[] = {
     "nynorsk", "NY",
-    "",
+    "", "",
 };
diff --git a/src/solaris/native/java/net/net_util_md.c b/src/solaris/native/java/net/net_util_md.c
index 8ba8732..769e540 100644
--- a/src/solaris/native/java/net/net_util_md.c
+++ b/src/solaris/native/java/net/net_util_md.c
@@ -1310,7 +1310,7 @@
      *    or sending UDP packet.
      * 2. IPv6 on Linux: By default Linux ignores flowinfo
      *    field so enable IPV6_FLOWINFO_SEND so that flowinfo
-     *    will be examined.
+     *    will be examined. We also set the IPv4 TOS option in this case.
      * 3. IPv4: set socket option based on ToS and Precedence
      *    fields (otherwise get invalid argument)
      */
@@ -1326,8 +1326,10 @@
 #if defined(AF_INET6) && defined(__linux__)
         if (ipv6_available()) {
             int optval = 1;
-            return setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
-                              (void *)&optval, sizeof(optval));
+            if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
+                           (void *)&optval, sizeof(optval)) < 0) {
+                return -1;
+            }
         }
 #endif
 
diff --git a/src/solaris/native/java/util/TimeZone_md.c b/src/solaris/native/java/util/TimeZone_md.c
index c90fcee..76c3f39 100644
--- a/src/solaris/native/java/util/TimeZone_md.c
+++ b/src/solaris/native/java/util/TimeZone_md.c
@@ -652,11 +652,11 @@
  * using <java_home>/lib/tzmappings. If the TZ value is not found, it
  * trys some libc implementation dependent mappings. If it still
  * can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
- * form. `country', which can be null, is not used for UNIX platforms.
+ * form.
  */
 /*ARGSUSED1*/
 char *
-findJavaTZ_md(const char *java_home_dir, const char *country)
+findJavaTZ_md(const char *java_home_dir)
 {
     char *tz;
     char *javatz = NULL;
diff --git a/src/solaris/native/java/util/TimeZone_md.h b/src/solaris/native/java/util/TimeZone_md.h
index 9d20bca..99e0192 100644
--- a/src/solaris/native/java/util/TimeZone_md.h
+++ b/src/solaris/native/java/util/TimeZone_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #ifndef _TIMEZONE_MD_H
 #define _TIMEZONE_MD_H
 
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
 char *getGMTOffsetID();
 
 #endif
diff --git a/src/solaris/native/sun/awt/CUPSfuncs.c b/src/solaris/native/sun/awt/CUPSfuncs.c
index 653428b..d7d9896 100644
--- a/src/solaris/native/sun/awt/CUPSfuncs.c
+++ b/src/solaris/native/sun/awt/CUPSfuncs.c
@@ -349,7 +349,8 @@
         // create array of dimensions - (num_choices * 6)
         //to cover length & height
         DPRINTF( "CUPSfuncs::option->num_choices %d\n", option->num_choices)
-        sizeArray = (*env)->NewFloatArray(env, option->num_choices*6);
+        // +1 is for storing the default media index
+        sizeArray = (*env)->NewFloatArray(env, option->num_choices*6+1);
         if (sizeArray == NULL) {
             unlink(filename);
             j2d_ppdClose(ppd);
@@ -369,6 +370,10 @@
         }
         for (i = 0; i<option->num_choices; i++) {
             choice = (option->choices)+i;
+            // get the index of the default page
+            if (!strcmp(choice->choice, option->defchoice)) {
+                dims[option->num_choices*6] = (float)i;
+            }
             size = j2d_ppdPageSize(ppd, choice->choice);
             if (size != NULL) {
                 // paper width and height
diff --git a/src/solaris/native/sun/awt/X11Color.c b/src/solaris/native/sun/awt/X11Color.c
index a1fdc58..e7bf05b 100644
--- a/src/solaris/native/sun/awt/X11Color.c
+++ b/src/solaris/native/sun/awt/X11Color.c
@@ -1377,7 +1377,7 @@
 
         /* Unlock now to initialize the SystemColor class */
         if (lock) {
-            AWT_UNLOCK ();
+            AWT_UNLOCK_CHECK_EXCEPTION(env);
         }
         sysColors = (*env)->FindClass (env, "java/awt/SystemColor");
         CHECK_NULL(sysColors);
diff --git a/src/solaris/native/sun/awt/awt.h b/src/solaris/native/sun/awt/awt.h
index 352a90e..df5f603 100644
--- a/src/solaris/native/sun/awt/awt.h
+++ b/src/solaris/native/sun/awt/awt.h
@@ -34,9 +34,9 @@
 #include "jni_util.h"
 #include "debug_util.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 #include <X11/Intrinsic.h>
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 
 /* The JVM instance: defined in awt_MToolkit.c */
@@ -75,6 +75,12 @@
     AWT_NOFLUSH_UNLOCK();                       \
 } while (0)
 
+#define AWT_UNLOCK_CHECK_EXCEPTION(env) \
+    do { \
+      AWT_UNLOCK(); \
+      JNU_CHECK_EXCEPTION(env); \
+    } while (0)
+
 #define AWT_LOCK_IMPL() \
     (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID)
 
@@ -110,9 +116,9 @@
 #define AWT_NOTIFY()         AWT_NOTIFY_IMPL()
 #define AWT_NOTIFY_ALL()     AWT_NOTIFY_ALL_IMPL()
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 extern Display         *awt_display; /* awt_GraphicsEnv.c */
 extern Boolean          awt_ModLockIsShiftLock; /* XToolkit.c */
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #endif /* ! _AWT_ */
diff --git a/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index 324d0cf..f142c86 100644
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -1348,7 +1348,9 @@
     }
 
     /* Make Color Model object for this GraphicsConfiguration */
-    colorModel = awtJNI_GetColorModel (env, adata);
+    colorModel = (*env)->ExceptionCheck(env)
+                 ? NULL : awtJNI_GetColorModel (env, adata);
+
     AWT_UNLOCK ();
 
     return colorModel;
@@ -2052,7 +2054,7 @@
 
     AWT_FLUSH_UNLOCK();
 
-    if (!success) {
+    if (!success && !(*env)->ExceptionCheck(env)) {
         JNU_ThrowInternalError(env, "Could not set display mode");
     }
 #endif /* !HEADLESS */
diff --git a/src/solaris/native/sun/awt/awt_LoadLibrary.c b/src/solaris/native/sun/awt/awt_LoadLibrary.c
index ff6f462..5948302 100644
--- a/src/solaris/native/sun/awt/awt_LoadLibrary.c
+++ b/src/solaris/native/sun/awt/awt_LoadLibrary.c
@@ -35,8 +35,6 @@
 #include <sys/param.h>
 #include <sys/utsname.h>
 
-#include "awt_Plugin.h"
-
 #ifdef AIX
 #include "porting_aix.h" /* For the 'dladdr' function. */
 #endif
@@ -236,55 +234,3 @@
 
     (*XsessionWMcommand)(env, jargv);
 }
-
-
-#define REFLECT_VOID_FUNCTION(name, arglist, paramlist)                 \
-typedef name##_type arglist;                                            \
-void name arglist                                                       \
-{                                                                       \
-    static name##_type *name##_ptr = NULL;                              \
-    if (name##_ptr == NULL && awtHandle == NULL) {                      \
-        return;                                                         \
-    }                                                                   \
-    name##_ptr = (name##_type *)                                        \
-        dlsym(awtHandle, #name);                                        \
-    if (name##_ptr == NULL) {                                           \
-        return;                                                         \
-    }                                                                   \
-    (*name##_ptr)paramlist;                                             \
-}
-
-#define REFLECT_FUNCTION(return_type, name, arglist, paramlist)         \
-typedef return_type name##_type arglist;                                \
-return_type name arglist                                                \
-{                                                                       \
-    static name##_type *name##_ptr = NULL;                              \
-    if (name##_ptr == NULL && awtHandle == NULL) {                      \
-        return NULL;                                                    \
-    }                                                                   \
-    name##_ptr = (name##_type *)                                        \
-        dlsym(awtHandle, #name);                                        \
-    if (name##_ptr == NULL) {                                           \
-        return NULL;                                                    \
-    }                                                                   \
-    return (*name##_ptr)paramlist;                                      \
-}
-
-
-/*
- * These entry point must remain in libawt.so ***for Java Plugin ONLY***
- * Reflect this call over to the correct libawt_<toolkit>.so.
- */
-
-REFLECT_VOID_FUNCTION(getAwtLockFunctions,
-                      (void (**AwtLock)(JNIEnv *), void (**AwtUnlock)(JNIEnv *),
-                       void (**AwtNoFlushUnlock)(JNIEnv *), void *reserved),
-                      (AwtLock, AwtUnlock, AwtNoFlushUnlock, reserved))
-
-REFLECT_VOID_FUNCTION(getAwtData,
-                      (int32_t *awt_depth, Colormap *awt_cmap, Visual **awt_visual,
-                       int32_t *awt_num_colors, void *pReserved),
-                      (awt_depth, awt_cmap, awt_visual,
-                       awt_num_colors, pReserved))
-
-REFLECT_FUNCTION(Display *, getAwtDisplay, (void), ())
diff --git a/src/solaris/native/sun/awt/awt_Plugin.c b/src/solaris/native/sun/awt/awt_Plugin.c
deleted file mode 100644
index 0b33ac2..0000000
--- a/src/solaris/native/sun/awt/awt_Plugin.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifdef HEADLESS
-    #error This file should not be included in headless library
-#endif
-
-#include <jni.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <awt.h>
-#include <awt_p.h>
-
-/*
- * Fix 4221246: Provide utility function for Netscape to use to
- * get AWT display, depth, colormap, and number of colors.
- *
- */
-
-Display *getAwtDisplay(void)
-{
-  return awt_display;
-}
-
-void getExtAwtData(Display      *display,
-                   int32_t      screen,
-                   int32_t      *awt_depth,
-                   Colormap     *awt_cmap,
-                   Visual       **awt_visual,
-                   int32_t      *awt_num_colors,
-                   void         *pReserved)
-{
-  AwtGraphicsConfigDataPtr defaultConfig = NULL;
-
-#ifdef DEBUG
-  if (pReserved != NULL) {
-    jio_fprintf(stderr,
-                "getExtAwtData: warning: reserved pointer is not null\n");
-  }
-#endif
-
-  if (screen >= 0) {
-    defaultConfig = getDefaultConfig(screen);
-  }
-
-  if (defaultConfig) {
-    if (awt_depth != NULL) {
-      *awt_depth = defaultConfig->awt_depth;
-    }
-
-    if (awt_cmap != NULL) {
-      *awt_cmap = defaultConfig->awt_cmap;
-    }
-
-    if (awt_visual != NULL) {
-      *awt_visual = defaultConfig->awt_visInfo.visual;
-    }
-
-    if (awt_num_colors != NULL) {
-      *awt_num_colors = defaultConfig->awt_num_colors;
-    }
-  }
-}
-
-/*
- * getAwtData provided for compatibility with Solaris 1.2 Java Plug-in
- *
- */
-void getAwtData(int32_t          *awt_depth,
-                Colormap     *awt_cmap,
-                Visual       **awt_visual,
-                int32_t          *awt_num_colors,
-                void         *pReserved)
-{
-  Display *display = getAwtDisplay();
-
-  getExtAwtData(display,
-                DefaultScreen(display),
-                awt_depth,
-                awt_cmap,
-                awt_visual,
-                awt_num_colors,
-                pReserved);
-}
-
-/*
- * Fix 4221246: Provide utility funtion for Netscape to get
- * function pointers to AWT lock functions.
- *
- */
-
-static void awt_lock_wrapper(JNIEnv *env) {
-  AWT_LOCK();
-}
-
-static void awt_unlock_wrapper(JNIEnv *env) {
-  AWT_UNLOCK();
-}
-
-static void awt_noflush_unlock_wrapper(JNIEnv *env) {
-  AWT_NOFLUSH_UNLOCK();
-}
-
-void getAwtLockFunctions(void (**AwtLock)(JNIEnv *),
-                         void (**AwtUnlock)(JNIEnv *),
-                         void (**AwtNoFlushUnlock)(JNIEnv *),
-                         void *pReserved)
-{
-#ifdef DEBUG
-  if (pReserved != NULL) {
-    jio_fprintf(stderr,
-                "getAwtLockFunctions: warning: reserved pointer is not null\n");
-  }
-#endif
-
-  if (AwtLock != NULL) {
-    *AwtLock = awt_lock_wrapper;
-  }
-
-  if (AwtUnlock != NULL) {
-    *AwtUnlock = awt_unlock_wrapper;
-  }
-
-  if (AwtNoFlushUnlock != NULL) {
-    *AwtNoFlushUnlock = awt_noflush_unlock_wrapper;
-  }
-}
diff --git a/src/solaris/native/sun/awt/awt_Plugin.h b/src/solaris/native/sun/awt/awt_Plugin.h
deleted file mode 100644
index 434fabb..0000000
--- a/src/solaris/native/sun/awt/awt_Plugin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Fix 4221246: Export functions for Netscape to use to get AWT info
- */
-
-#ifndef _AWT_PLUGIN_H_
-#define _AWT_PLUGIN_H_
-
-#include <jni.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-void getAwtLockFunctions(void (**AwtLock)(JNIEnv *),
-                         void (**AwtUnlock)(JNIEnv *),
-                         void (**AwtNoFlushUnlock)(JNIEnv *),
-                         void *);
-
-void getExtAwtData(Display *,
-                   int32_t,
-                   int32_t *,      /* awt_depth */
-                   Colormap *,     /* awt_cmap  */
-                   Visual **,      /* awt_visInfo.visual */
-                   int32_t *,      /* awt_num_colors */
-                   void *);
-
-void getAwtData(int32_t *, Colormap *, Visual **, int32_t *, void *);
-
-Display *getAwtDisplay(void);
-
-#endif /* _AWT_PLUGIN_H_ */
diff --git a/src/solaris/native/sun/awt/awt_util.h b/src/solaris/native/sun/awt/awt_util.h
index dd0be22..8708905 100644
--- a/src/solaris/native/sun/awt/awt_util.h
+++ b/src/solaris/native/sun/awt/awt_util.h
@@ -52,6 +52,8 @@
  */
 extern XErrorHandler current_native_xerror_handler;
 
+Window get_xawt_root_shell(JNIEnv *env);
+
 #endif /* !HEADLESS */
 
 #ifndef INTERSECTS
diff --git a/src/solaris/native/sun/awt/color.h b/src/solaris/native/sun/awt/color.h
index 16a0c55..92df41c 100644
--- a/src/solaris/native/sun/awt/color.h
+++ b/src/solaris/native/sun/awt/color.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,13 @@
 #include "awt.h"
 #include "colordata.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 typedef struct {
     unsigned int Depth;
     XPixmapFormatValues wsImageFormat;
     ImgColorData clrdata;
     ImgConvertFcn *convert[NUM_IMGCV];
 } awtImageData;
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #endif           /* _COLOR_H_ */
diff --git a/src/solaris/native/sun/awt/gtk2_interface.c b/src/solaris/native/sun/awt/gtk2_interface.c
index 0b6cbd6..f61fee0 100644
--- a/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/src/solaris/native/sun/awt/gtk2_interface.c
@@ -783,6 +783,8 @@
         fp_gtk_widget_show = dl_symbol("gtk_widget_show");
         fp_gtk_main = dl_symbol("gtk_main");
 
+        fp_g_path_get_dirname = dl_symbol("g_path_get_dirname");
+
         /**
          * GLib thread system
          */
diff --git a/src/solaris/native/sun/awt/gtk2_interface.h b/src/solaris/native/sun/awt/gtk2_interface.h
index 1523f74..3498e38 100644
--- a/src/solaris/native/sun/awt/gtk2_interface.h
+++ b/src/solaris/native/sun/awt/gtk2_interface.h
@@ -817,7 +817,7 @@
 void (*fp_gtk_widget_show)(GtkWidget *widget);
 void (*fp_gtk_main)(void);
 guint (*fp_gtk_main_level)(void);
-
+gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
diff --git a/src/solaris/native/sun/awt/img_util_md.h b/src/solaris/native/sun/awt/img_util_md.h
index c8d13f3..68a1884 100644
--- a/src/solaris/native/sun/awt/img_util_md.h
+++ b/src/solaris/native/sun/awt/img_util_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 #include "color.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 typedef struct {
     ImgConvertData cvdata;      /* The data needed by ImgConvertFcn's */
     struct Hsun_awt_image_ImageRepresentation *hJavaObject;     /* backptr */
@@ -68,7 +68,7 @@
 #define MaskScan(cvdata)                                        \
         ((((IRData *)cvdata)->maskim->bytes_per_line) >> 2)
 
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #define MaskOffset(x)           ((x) >> 5)
 
diff --git a/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c b/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c
index 1122258..85a9304 100644
--- a/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c
+++ b/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c
@@ -794,3 +794,11 @@
 SplashReconfigure(Splash * splash) {
     sendctl(splash, SPLASHCTL_RECONFIGURE);
 }
+
+SPLASHEXPORT char*
+SplashGetScaledImageName(const char* jarName, const char* fileName,
+                           float *scaleFactor)
+{
+    *scaleFactor = 1;
+    return NULL;
+}
diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
index 9d96781..1c040e0 100644
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
@@ -59,7 +59,6 @@
 static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
 {
     JNIEnv *env;
-    jclass cx;
     jstring filename;
 
     env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -158,62 +157,55 @@
     fp_gdk_threads_leave();
 }
 
-/**
- * Convert a GSList to an array of filenames (without the parent folder)
+/*
+ * baseDir should be freed by user.
  */
-static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list)
-{
-    jstring str;
-    jclass stringCls;
-    GSList *iterator;
-    jobjectArray array;
-    int i;
-    char* entry;
+static gboolean isFromSameDirectory(GSList* list, gchar** baseDir) {
 
-    if (NULL == list) {
-        return NULL;
-    }
+    GSList *it = list;
+    gchar* prevDir = NULL;
+    gboolean isAllDirsSame = TRUE;
 
-    stringCls = (*env)->FindClass(env, "java/lang/String");
-    if (stringCls == NULL) {
-        (*env)->ExceptionClear(env);
-        JNU_ThrowInternalError(env, "Could not get java.lang.String class");
-        return NULL;
-    }
+    while (it) {
+        gchar* dir = fp_g_path_get_dirname((gchar*) it->data);
 
-    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls, NULL);
-    if (array == NULL) {
-        (*env)->ExceptionClear(env);
-        JNU_ThrowInternalError(env, "Could not instantiate array files array");
-        return NULL;
-    }
-
-    i = 0;
-    for (iterator = list; iterator; iterator = iterator->next) {
-        entry = (char*) iterator->data;
-        entry = strrchr(entry, '/') + 1;
-        str = (*env)->NewStringUTF(env, entry);
-        if (str && !(*env)->ExceptionCheck(env)) {
-            (*env)->SetObjectArrayElement(env, array, i, str);
+        if (prevDir && strcmp(prevDir, dir) != 0) {
+            isAllDirsSame = FALSE;
+            fp_g_free(dir);
+            break;
         }
-        i++;
+
+        if (!prevDir) {
+            prevDir = strdup(dir);
+        }
+        fp_g_free(dir);
+
+        it = it->next;
     }
 
-    return array;
+    if (isAllDirsSame) {
+        *baseDir = prevDir;
+    } else {
+        free(prevDir);
+        *baseDir = strdup("/");
+    }
+
+    return isAllDirsSame;
 }
 
 /**
- * Convert a GSList to an array of filenames (with the parent folder)
+ * Convert a GSList to an array of filenames
  */
-static jobjectArray toPathAndFilenamesArray(JNIEnv *env, GSList* list)
+static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list, jstring* jcurrent_folder)
 {
     jstring str;
     jclass stringCls;
     GSList *iterator;
     jobjectArray array;
     int i;
-    char* entry;
-
+    gchar* entry;
+    gchar * baseDir;
+    gboolean isFromSameDir;
 
     if (list == NULL) {
         return NULL;
@@ -233,61 +225,63 @@
         return NULL;
     }
 
-    i = 0;
-    for (iterator = list; iterator; iterator = iterator->next) {
-        entry = (char*) iterator->data;
+    isFromSameDir = isFromSameDirectory(list, &baseDir);
 
-        //check for leading slash.
-        if (entry[0] == '/') {
+    *jcurrent_folder = (*env)->NewStringUTF(env, baseDir);
+    if (*jcurrent_folder == NULL) {
+        free(baseDir);
+        return NULL;
+    }
+
+    for (iterator = list, i=0;
+            iterator;
+            iterator = iterator->next, i++) {
+
+        entry = (gchar*) iterator->data;
+
+        if (isFromSameDir) {
+            entry = strrchr(entry, '/') + 1;
+        } else if (entry[0] == '/') {
             entry++;
         }
 
         str = (*env)->NewStringUTF(env, entry);
-        if (str && !(*env)->ExceptionCheck(env)) {
-            (*env)->SetObjectArrayElement(env, array, i, str);
+        if((*env)->ExceptionCheck(env)){
+            break;
         }
-        i++;
+        if (str) {
+            (*env)->SetObjectArrayElement(env, array, i, str);
+            if((*env)->ExceptionCheck(env)){
+                break;
+            }
+        }
     }
 
+    free(baseDir);
     return array;
 }
 
 static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
 {
     JNIEnv *env;
-    char *current_folder;
     GSList *filenames;
-    jclass cx;
-    jstring jcurrent_folder;
+    jstring jcurrent_folder = NULL;
     jobjectArray jfilenames;
 
     env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
-    current_folder = NULL;
     filenames = NULL;
-    gboolean full_path_names = FALSE;
 
     if (responseId == GTK_RESPONSE_ACCEPT) {
-        current_folder = fp_gtk_file_chooser_get_current_folder(
-                GTK_FILE_CHOOSER(aDialog));
-        if (current_folder == NULL) {
-            full_path_names = TRUE;
-        }
         filenames = fp_gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(aDialog));
     }
-    if (full_path_names) {
-        //This is a hack for use with "Recent Folders" in gtk where each
-        //file could have its own directory.
-        jfilenames = toPathAndFilenamesArray(env, filenames);
-        jcurrent_folder = (*env)->NewStringUTF(env, "/");
-    } else {
-        jfilenames = toFilenamesArray(env, filenames);
-        jcurrent_folder = (*env)->NewStringUTF(env, current_folder);
-    }
+
+    jfilenames = toFilenamesArray(env, filenames, &jcurrent_folder);
+
     if (!(*env)->ExceptionCheck(env)) {
         (*env)->CallVoidMethod(env, obj, setFileInternalMethodID,
                                jcurrent_folder, jfilenames);
     }
-    fp_g_free(current_folder);
+
     quit(env, (jobject)obj, TRUE);
 }
 
diff --git a/src/solaris/native/sun/awt/utility/rect.h b/src/solaris/native/sun/awt/utility/rect.h
index 948b4ce..063caa3 100644
--- a/src/solaris/native/sun/awt/utility/rect.h
+++ b/src/solaris/native/sun/awt/utility/rect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,18 @@
 #ifndef _AWT_RECT_H
 #define _AWT_RECT_H
 
+#ifndef MACOSX
 #include <X11/Xlib.h>
 typedef XRectangle RECT_T;
+#else
+// OSX still needs this for BitmapToYXBandedRectangles
+typedef struct {
+    int x;
+    int y;
+    int width;
+    int height;
+} RECT_T;
+#endif /* !MACOSX */
 
 #define RECT_EQ_X(r1,r2)        ((r1).x==(r2).x && (r1).width==(r2).width)
 
diff --git a/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c b/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
index 6b35df4..c94d58b 100644
--- a/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
+++ b/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
@@ -241,9 +241,12 @@
                                       width, height, 1);
         if (xsdo->bitmask == 0) {
             AWT_UNLOCK();
-            JNU_ThrowOutOfMemoryError(env,
-                                      "Cannot create bitmask for "
-                                      "offscreen surface");
+            if (!(*env)->ExceptionCheck(env))
+            {
+                JNU_ThrowOutOfMemoryError(env,
+                                          "Cannot create bitmask for "
+                                          "offscreen surface");
+            }
             return;
         }
     }
@@ -253,7 +256,10 @@
                          1, XYBitmap, 0, NULL, width, height, 32, 0);
     if (image == NULL) {
         AWT_UNLOCK();
-        JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
+        if (!(*env)->ExceptionCheck(env))
+        {
+             JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
+        }
         return;
     }
     dstScan = image->bytes_per_line;
@@ -261,7 +267,10 @@
     if (image->data == NULL) {
         XFree(image);
         AWT_UNLOCK();
-        JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
+        if (!(*env)->ExceptionCheck(env))
+        {
+            JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
+        }
         return;
     }
     pDst = (unsigned char *)image->data;
diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
index fd48e42..1f3e92d 100644
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
@@ -454,6 +454,7 @@
             AWT_LOCK();
             xsdo->drawable = X11SD_CreateSharedPixmap(xsdo);
             AWT_UNLOCK();
+            JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
             if (xsdo->drawable) {
                 xsdo->shmPMData.usingShmPixmap = JNI_TRUE;
                 xsdo->shmPMData.shmPixmap = xsdo->drawable;
@@ -469,6 +470,7 @@
                                      xsdo->configData->awt_visInfo.screen),
                           width, height, depth);
         AWT_UNLOCK();
+        JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
 #ifdef MITSHM
         xsdo->shmPMData.usingShmPixmap = JNI_FALSE;
         xsdo->shmPMData.pixmap = xsdo->drawable;
@@ -504,6 +506,7 @@
 
     if (xsdo->configData->awt_cmap == (Colormap)NULL) {
         awtJNI_CreateColorData(env, xsdo->configData, 1);
+        JNU_CHECK_EXCEPTION(env);
     }
     /* color_data will be initialized in awtJNI_CreateColorData for
        8-bit visuals */
@@ -805,7 +808,10 @@
          xsdo->cData->awt_icmLUT == NULL))
     {
         AWT_UNLOCK();
-        JNU_ThrowNullPointerException(env, "colormap lookup table");
+        if (!(*env)->ExceptionCheck(env))
+        {
+             JNU_ThrowNullPointerException(env, "colormap lookup table");
+        }
         return SD_FAILURE;
     }
     if ((lockflags & SD_LOCK_INVCOLOR) != 0 &&
@@ -816,7 +822,10 @@
          xsdo->cData->img_oda_blue == NULL))
     {
         AWT_UNLOCK();
-        JNU_ThrowNullPointerException(env, "inverse colormap lookup table");
+        if (!(*env)->ExceptionCheck(env))
+        {
+             JNU_ThrowNullPointerException(env, "inverse colormap lookup table");
+        }
         return SD_FAILURE;
     }
     if ((lockflags & SD_LOCK_INVGRAY) != 0 &&
@@ -824,7 +833,10 @@
          xsdo->cData->pGrayInverseLutData == NULL))
     {
         AWT_UNLOCK();
-        JNU_ThrowNullPointerException(env, "inverse gray lookup table");
+        if (!(*env)->ExceptionCheck(env))
+        {
+            JNU_ThrowNullPointerException(env, "inverse gray lookup table");
+        }
         return SD_FAILURE;
     }
     if (xsdo->dgaAvailable && (lockflags & (SD_LOCK_RD_WR))) {
diff --git a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
index c9d2011..403c15c 100644
--- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
+++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
@@ -34,6 +34,10 @@
 #include <fcntl.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#if defined(__linux__)
+#include <linux/fs.h>
+#include <sys/ioctl.h>
+#endif
 #include "nio.h"
 #include "nio_util.h"
 
@@ -177,10 +181,21 @@
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileDispatcherImpl_size0(JNIEnv *env, jobject this, jobject fdo)
 {
+    jint fd = fdval(env, fdo);
     struct stat64 fbuf;
 
-    if (fstat64(fdval(env, fdo), &fbuf) < 0)
+    if (fstat64(fd, &fbuf) < 0)
         return handle(env, -1, "Size failed");
+
+#ifdef BLKGETSIZE64
+    if (S_ISBLK(fbuf.st_mode)) {
+        uint64_t size;
+        if (ioctl(fd, BLKGETSIZE64, &size) < 0)
+            return handle(env, -1, "Size failed");
+        return (jlong)size;
+    }
+#endif
+
     return fbuf.st_size;
 }
 
diff --git a/src/solaris/native/sun/nio/ch/Net.c b/src/solaris/native/sun/nio/ch/Net.c
index 2846217..ae7f579 100644
--- a/src/solaris/native/sun/nio/ch/Net.c
+++ b/src/solaris/native/sun/nio/ch/Net.c
@@ -478,7 +478,8 @@
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level,
+                                  jint opt, jint arg, jboolean isIPv6)
 {
     int result;
     struct linger linger;
@@ -521,6 +522,12 @@
                                      JNU_JAVANETPKG "SocketException",
                                      "sun.nio.ch.Net.setIntOption");
     }
+#ifdef __linux__
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS && isIPv6) {
+        // set the V4 option also
+        setsockopt(fdval(env, fdo), IPPROTO_IP, IP_TOS, parg, arglen);
+    }
+#endif
 }
 
 JNIEXPORT jint JNICALL
diff --git a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
index 55233d0..c06efaf 100644
--- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
@@ -315,7 +315,7 @@
     int res = -1;
 
     RESTARTABLE(dup((int)fd), res);
-    if (fd == -1) {
+    if (res == -1) {
         throwUnixException(env, errno);
     }
     return (jint)res;
@@ -343,13 +343,14 @@
 JNIEXPORT void JNICALL
 Java_sun_nio_fs_UnixNativeDispatcher_fclose(JNIEnv* env, jclass this, jlong stream)
 {
-    int res;
     FILE* fp = jlong_to_ptr(stream);
 
-    do {
-        res = fclose(fp);
-    } while (res == EOF && errno == EINTR);
-    if (res == EOF) {
+    /* NOTE: fclose() wrapper is only used with read-only streams.
+     * If it ever is used with write streams, it might be better to add
+     * RESTARTABLE(fflush(fp)) before closing, to make sure the stream
+     * is completely written even if fclose() failed.
+     */
+    if (fclose(fp) == EOF && errno != EINTR) {
         throwUnixException(env, errno);
     }
 }
@@ -657,11 +658,9 @@
 
 JNIEXPORT void JNICALL
 Java_sun_nio_fs_UnixNativeDispatcher_closedir(JNIEnv* env, jclass this, jlong dir) {
-    int err;
     DIR* dirp = jlong_to_ptr(dir);
 
-    RESTARTABLE(closedir(dirp), err);
-    if (errno == -1) {
+    if (closedir(dirp) == -1 && errno != EINTR) {
         throwUnixException(env, errno);
     }
 }
diff --git a/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c b/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
index cf3ff20..f8283ab 100644
--- a/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -198,14 +198,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c b/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
index 8c8c4eb..beb5764 100644
--- a/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
@@ -416,14 +416,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c b/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
index 45b38ea..32dd249 100644
--- a/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -161,14 +161,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/solaris/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c b/src/solaris/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
deleted file mode 100644
index 10f151f..0000000
--- a/src/solaris/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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 "sun_util_locale_provider_HostLocaleProviderAdapterImpl.h"
-#include <gdefs.h>
-#include <string.h>
-#include <langinfo.h>
-#include <locale.h>
-
-#define BUFLEN 64
-
-/*
- * Class:     sun_util_locale_provider_HostLocaleProviderAdapterImpl
- * Method:    getPattern
- * Signature: (IILjava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern
-  (JNIEnv *env, jclass cls, jint dateStyle, jint timeStyle, jstring jlangtag) {
-
-    // TEMPORARY!
-    char locale[BUFLEN];
-    char * pch;
-    char * old;
-    char * ret;
-    const char *langtag = (*env)->GetStringUTFChars(env, jlangtag, JNI_FALSE);
-
-    strcpy(locale, langtag);
-    pch = strchr(locale, '-');
-    if (pch != NULL) {
-        *pch = '_';
-    }
-    pch = strchr(locale, '-');
-    if (pch != NULL) {
-        *pch = '\0';
-    }
-    strcat(locale, ".UTF-8");
-    old = setlocale(LC_TIME, "");
-    setlocale(LC_TIME, locale);
-
-    if (dateStyle != (-1) && timeStyle != (-1)) {
-        ret = nl_langinfo(D_T_FMT);
-    } else if (dateStyle != (-1)) {
-        ret = nl_langinfo(D_FMT);
-    } else if (timeStyle != (-1)) {
-        ret = nl_langinfo(T_FMT);
-    } else {
-        ret = "yyyy/MM/dd";
-    }
-
-    setlocale(LC_TIME, old);
-
-    (*env)->ReleaseStringUTFChars(env, jlangtag, langtag);
-
-    return (*env)->NewStringUTF(env, ret);
-}
diff --git a/src/solaris/native/sun/xawt/XlibWrapper.c b/src/solaris/native/sun/xawt/XlibWrapper.c
index 60298f7..f1d6318 100644
--- a/src/solaris/native/sun/xawt/XlibWrapper.c
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c
@@ -2011,10 +2011,14 @@
  * Toolkit thread to process PropertyNotify or SelectionNotify events.
  */
 static Bool
-secondary_loop_event(Display* dpy, XEvent* event, char* arg) {
-    return (event->type == SelectionNotify ||
-            event->type == SelectionClear  ||
-            event->type == PropertyNotify) ? True : False;
+secondary_loop_event(Display* dpy, XEvent* event, XPointer xawt_root_window) {
+    return (
+                event->type == SelectionNotify ||
+                event->type == SelectionClear  ||
+                event->type == PropertyNotify  ||
+                (event->type == ConfigureNotify
+                    && event->xany.window == *(Window*) xawt_root_window)
+            ) ? True : False;
 }
 
 
@@ -2025,8 +2029,11 @@
 
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     exitSecondaryLoop = False;
+    Window xawt_root_window = get_xawt_root_shell(env);
+
     while (!exitSecondaryLoop) {
-        if (XCheckIfEvent((Display*) jlong_to_ptr(display), (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, NULL)) {
+        if (XCheckIfEvent((Display*) jlong_to_ptr(display),
+                (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, (XPointer) &xawt_root_window)) {
             return JNI_TRUE;
         }
         timeout = (timeout < AWT_SECONDARY_LOOP_TIMEOUT) ? (timeout << 1) : AWT_SECONDARY_LOOP_TIMEOUT;
diff --git a/src/windows/classes/sun/awt/Win32FontManager.java b/src/windows/classes/sun/awt/Win32FontManager.java
index 5e925f3..3437622 100644
--- a/src/windows/classes/sun/awt/Win32FontManager.java
+++ b/src/windows/classes/sun/awt/Win32FontManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
 import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
 
-import sun.awt.Win32GraphicsEnvironment;
 import sun.awt.windows.WFontConfiguration;
 import sun.font.FontManager;
 import sun.font.SunFontManager;
@@ -48,9 +47,7 @@
 /**
  * The X11 implementation of {@link FontManager}.
  */
-public class Win32FontManager extends SunFontManager {
-
-    private static String[] defaultPlatformFont = null;
+public final class Win32FontManager extends SunFontManager {
 
     private static TrueTypeFont eudcFont;
 
@@ -215,12 +212,8 @@
 
     protected synchronized native String getFontPath(boolean noType1Fonts);
 
-    public String[] getDefaultPlatformFont() {
-
-        if (defaultPlatformFont != null) {
-            return defaultPlatformFont;
-        }
-
+    @Override
+    protected String[] getDefaultPlatformFont() {
         String[] info = new String[2];
         info[0] = "Arial";
         info[1] = "c:\\windows\\fonts";
@@ -247,8 +240,7 @@
             info[1] = dirs[0];
         }
         info[1] = info[1] + File.separator + "arial.ttf";
-        defaultPlatformFont = info;
-        return defaultPlatformFont;
+        return info;
     }
 
     /* register only TrueType/OpenType fonts
diff --git a/src/windows/classes/sun/awt/windows/ThemeReader.java b/src/windows/classes/sun/awt/windows/ThemeReader.java
index 3bd048a..26751e9 100644
--- a/src/windows/classes/sun/awt/windows/ThemeReader.java
+++ b/src/windows/classes/sun/awt/windows/ThemeReader.java
@@ -62,14 +62,20 @@
     private static final Lock writeLock = readWriteLock.writeLock();
     private static volatile boolean valid = false;
 
+    static volatile boolean xpStyleEnabled;
+
     static void flush() {
-        // Could be called on Toolkit thread, so do not try to aquire locks
+        // Could be called on Toolkit thread, so do not try to acquire locks
         // to avoid deadlock with theme initialization
         valid = false;
     }
 
     public static native boolean isThemed();
 
+    public static boolean isXPStyleEnabled() {
+        return xpStyleEnabled;
+    }
+
     // this should be called only with writeLock held
     private static Long getThemeImpl(String widget) {
         Long theme = widgetToTheme.get(widget);
diff --git a/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java b/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java
index 28f009a..a84aa49 100644
--- a/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java
+++ b/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java
@@ -27,6 +27,7 @@
 
 import java.awt.Component;
 import java.awt.Graphics;
+import java.awt.dnd.DropTarget;
 import java.awt.event.ComponentEvent;
 import java.awt.event.MouseEvent;
 
@@ -94,4 +95,14 @@
     public boolean isLightweightFramePeer() {
         return true;
     }
+
+    @Override
+    public void addDropTarget(DropTarget dt) {
+        getLwTarget().addDropTarget(dt);
+    }
+
+    @Override
+    public void removeDropTarget(DropTarget dt) {
+        getLwTarget().removeDropTarget(dt);
+    }
 }
diff --git a/src/windows/classes/sun/awt/windows/WPathGraphics.java b/src/windows/classes/sun/awt/windows/WPathGraphics.java
index 282d845..c3410a9 100644
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java
+++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java
@@ -1400,7 +1400,9 @@
          * The saved device transform is needed as the current transform
          * is not likely to be the same.
          */
-        deviceClip(savedClip.getPathIterator(savedTransform));
+        if (savedClip != null) {
+            deviceClip(savedClip.getPathIterator(savedTransform));
+        }
 
         /* Scale the bounding rectangle by the scale transform.
          * Because the scaling transform has only x and y
diff --git a/src/windows/classes/sun/awt/windows/WToolkit.java b/src/windows/classes/sun/awt/windows/WToolkit.java
index 5a72c9d..2171bc3 100644
--- a/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -36,9 +36,9 @@
 import java.beans.PropertyChangeListener;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import sun.awt.AppContext;
 import sun.awt.AWTAutoShutdown;
 import sun.awt.LightweightFrame;
-import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 import sun.misc.ThreadGroupUtils;
 import sun.awt.Win32GraphicsDevice;
@@ -73,6 +73,9 @@
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
 
+    // Desktop property which specifies whether XP visual styles are in effect
+    public static final String XPSTYLE_THEME_ACTIVE = "win.xpstyle.themeActive";
+
     static GraphicsConfiguration config;
 
     // System clipboard.
@@ -580,6 +583,7 @@
     /**
      * Returns <code>true</code> if this frame state is supported.
      */
+    @Override
     public boolean isFrameStateSupported(int state) {
         switch (state) {
           case Frame.NORMAL:
@@ -839,6 +843,11 @@
 
     @Override
     public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
+        if (f != null) {
+            return f.createDragSourceContextPeer(dge);
+        }
+
         return WDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
@@ -848,6 +857,11 @@
                                     DragSource ds, Component c, int srcActions,
                                     DragGestureListener dgl)
     {
+        final LightweightFrame f = SunToolkit.getLightweightFrame(c);
+        if (f != null) {
+            return f.createDragGestureRecognizer(abstractRecognizerClass, ds, c, srcActions, dgl);
+        }
+
         if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass))
             return (T)new WMouseDragGestureRecognizer(ds, c, srcActions, dgl);
         else
@@ -894,7 +908,7 @@
     private synchronized void lazilyInitWProps() {
         if (wprops == null) {
             wprops = new WDesktopProperties(this);
-            updateProperties();
+            updateProperties(wprops.getProperties());
         }
     }
 
@@ -929,25 +943,36 @@
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
     private void windowsSettingChange() {
+        // JDK-8039383: Have to update the value of XPSTYLE_THEME_ACTIVE property
+        // as soon as possible to prevent NPE and other errors because theme data
+        // has become unavailable.
+        final Map<String, Object> props = getWProps();
+        if (props == null) {
+            // props has not been initialized, so we have nothing to update
+            return;
+        }
+
+        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
         if (AppContext.getAppContext() == null) {
             // We cannot post the update to any EventQueue. Listeners will
             // be called on EDTs by DesktopPropertyChangeSupport
-            updateProperties();
+            updateProperties(props);
         } else {
             // Cannot update on Toolkit thread.
             // DesktopPropertyChangeSupport will call listeners on Toolkit
             // thread if it has AppContext (standalone mode)
-            EventQueue.invokeLater(this::updateProperties);
+            EventQueue.invokeLater(() -> updateProperties(props));
         }
     }
 
-    private synchronized void updateProperties() {
-        if (null == wprops) {
-            // wprops has not been initialized, so we have nothing to update
+    private synchronized void updateProperties(final Map<String, Object> props) {
+        if (null == props) {
             return;
         }
 
-        Map<String, Object> props = wprops.getProperties();
+        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
         for (String propName : props.keySet()) {
             Object val = props.get(propName);
             if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -957,6 +982,14 @@
         }
     }
 
+    private synchronized Map<String, Object> getWProps() {
+        return (wprops != null) ? wprops.getProperties() : null;
+    }
+
+    private void updateXPStyleEnabled(final Object dskProp) {
+        ThemeReader.xpStyleEnabled = Boolean.TRUE.equals(dskProp);
+    }
+
     @Override
     public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
         if (name == null) {
@@ -978,6 +1011,7 @@
      * initialize only static props here and do not try to initialize props which depends on wprops,
      * this should be done in lazilyLoadDesktopProperty() only.
      */
+    @Override
     protected synchronized void initializeDesktopProperties() {
         desktopProperties.put("DnD.Autoscroll.initialDelay",
                               Integer.valueOf(50));
diff --git a/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java b/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
index 6ea6677..3b34c0d 100644
--- a/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
+++ b/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,15 +24,15 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import sun.tools.attach.HotSpotVirtualMachine;
+
 import java.io.IOException;
-import java.io.File;
 import java.io.InputStream;
-import java.util.Properties;
 import java.util.Random;
 
 public class WindowsVirtualMachine extends HotSpotVirtualMachine {
@@ -105,11 +105,17 @@
             // read completion status
             int status = readInt(is);
             if (status != 0) {
+                // read from the stream and use that as the error message
+                String message = readErrorMessage(is);
                 // special case the load command so that the right exception is thrown
                 if (cmd.equals("load")) {
                     throw new AgentLoadException("Failed to load agent library");
                 } else {
-                    throw new IOException("Command failed in target VM");
+                    if (message == null) {
+                        throw new AttachOperationFailedException("Command failed in target VM");
+                    } else {
+                        throw new AttachOperationFailedException(message);
+                    }
                 }
             }
 
diff --git a/src/windows/lib/tzmappings b/src/windows/lib/tzmappings
index 953ea10..0a0b8ad 100644
--- a/src/windows/lib/tzmappings
+++ b/src/windows/lib/tzmappings
@@ -193,5 +193,10 @@
 Turkey Standard Time:926,926::Asia/Istanbul:
 Bahia Standard Time:927,927::America/Bahia:
 Libya Standard Time:928,928:LY:Africa/Tripoli:
-Western Brazilian Standard Time:929,929:BR:America/Rio_Branco:
-Armenian Standard Time:930,930:AM:Asia/Yerevan:
+Belarus Standard Time:929,929:BY:Europe/Minsk:
+Line Islands Standard Time:930,930::Pacific/Kiritimati:
+Russia Time Zone 10:931,931::Asia/Srednekolymsk:
+Russia Time Zone 11:932,932::Asia/Anadyr:
+Russia Time Zone 3:933,933::Europe/Samara:
+Western Brazilian Standard Time:934,934:BR:America/Rio_Branco:
+Armenian Standard Time:935,935:AM:Asia/Yerevan:
diff --git a/src/windows/native/java/io/FileOutputStream_md.c b/src/windows/native/java/io/FileOutputStream_md.c
index 567ebaa..02ea15e 100644
--- a/src/windows/native/java/io/FileOutputStream_md.c
+++ b/src/windows/native/java/io/FileOutputStream_md.c
@@ -54,8 +54,8 @@
  */
 
 JNIEXPORT void JNICALL
-Java_java_io_FileOutputStream_open(JNIEnv *env, jobject this,
-                                   jstring path, jboolean append) {
+Java_java_io_FileOutputStream_open0(JNIEnv *env, jobject this,
+                                    jstring path, jboolean append) {
     fileOpen(env, this, path, fos_fd,
              O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
 }
diff --git a/src/windows/native/java/lang/java_props_md.c b/src/windows/native/java/lang/java_props_md.c
index 54429b3..382e9df 100644
--- a/src/windows/native/java/lang/java_props_md.c
+++ b/src/windows/native/java/lang/java_props_md.c
@@ -28,6 +28,9 @@
 #define _WIN32_WINNT 0x0601
 #endif
 
+#include "jni.h"
+#include "jni_util.h"
+
 #include <windows.h>
 #include <shlobj.h>
 #include <objidl.h>
@@ -51,7 +54,7 @@
 #endif
 
 typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-static void SetupI18nProps(LCID lcid, char** language, char** script, char** country,
+static boolean SetupI18nProps(LCID lcid, char** language, char** script, char** country,
                char** variant, char** encoding);
 
 #define PROPSIZE 9      // eight-letter + null terminator
@@ -60,8 +63,11 @@
 static char *
 getEncodingInternal(LCID lcid)
 {
-    char * ret = malloc(16);
     int codepage;
+    char * ret = malloc(16);
+    if (ret == NULL) {
+        return NULL;
+    }
 
     if (GetLocaleInfo(lcid,
                       LOCALE_IDEFAULTANSICODEPAGE,
@@ -132,7 +138,11 @@
 static char* getConsoleEncoding()
 {
     char* buf = malloc(16);
-    int cp = GetConsoleCP();
+    int cp;
+    if (buf == NULL) {
+        return NULL;
+    }
+    cp = GetConsoleCP();
     if (cp >= 874 && cp <= 950)
         sprintf(buf, "ms%d", cp);
     else
@@ -152,11 +162,16 @@
 getJavaIDFromLangID(LANGID langID)
 {
     char * elems[5]; // lang, script, ctry, variant, encoding
-    char * ret = malloc(SNAMESIZE);
+    char * ret;
     int index;
 
-    SetupI18nProps(MAKELCID(langID, SORT_DEFAULT),
-                   &(elems[0]), &(elems[1]), &(elems[2]), &(elems[3]), &(elems[4]));
+    ret = malloc(SNAMESIZE);
+    if (ret == NULL) {
+        return NULL;
+    }
+
+    if (SetupI18nProps(MAKELCID(langID, SORT_DEFAULT),
+                   &(elems[0]), &(elems[1]), &(elems[2]), &(elems[3]), &(elems[4]))) {
 
     // there always is the "language" tag
     strcpy(ret, elems[0]);
@@ -172,6 +187,9 @@
     for (index = 0; index < 5; index++) {
         free(elems[index]);
     }
+    } else {
+        ret = NULL;
+    }
 
     return ret;
 }
@@ -259,12 +277,15 @@
     return NULL;
 }
 
-static void
+static boolean
 SetupI18nProps(LCID lcid, char** language, char** script, char** country,
                char** variant, char** encoding) {
     /* script */
     char tmp[SNAMESIZE];
     *script = malloc(PROPSIZE);
+    if (*script == NULL) {
+        return FALSE;
+    }
     if (GetLocaleInfo(lcid,
                       LOCALE_SNAME, tmp, SNAMESIZE) == 0 ||
         sscanf(tmp, "%*[a-z\\-]%1[A-Z]%[a-z]", *script, &((*script)[1])) == 0 ||
@@ -274,6 +295,9 @@
 
     /* country */
     *country = malloc(PROPSIZE);
+    if (*country == NULL) {
+        return FALSE;
+    }
     if (GetLocaleInfo(lcid,
                       LOCALE_SISO3166CTRYNAME, *country, PROPSIZE) == 0 &&
         GetLocaleInfo(lcid,
@@ -283,6 +307,9 @@
 
     /* language */
     *language = malloc(PROPSIZE);
+    if (*language == NULL) {
+        return FALSE;
+    }
     if (GetLocaleInfo(lcid,
                       LOCALE_SISO639LANGNAME, *language, PROPSIZE) == 0 &&
         GetLocaleInfo(lcid,
@@ -294,6 +321,9 @@
 
     /* variant */
     *variant = malloc(PROPSIZE);
+    if (*variant == NULL) {
+        return FALSE;
+    }
     (*variant)[0] = '\0';
 
     /* handling for Norwegian */
@@ -308,6 +338,10 @@
 
     /* encoding */
     *encoding = getEncodingInternal(lcid);
+    if (*encoding == NULL) {
+        return FALSE;
+    }
+    return TRUE;
 }
 
 java_props_t *
diff --git a/src/windows/native/java/net/NetworkInterface.c b/src/windows/native/java/net/NetworkInterface.c
index c436e86..6483f12 100644
--- a/src/windows/native/java/net/NetworkInterface.c
+++ b/src/windows/native/java/net/NetworkInterface.c
@@ -1014,9 +1014,11 @@
       case MIB_IF_TYPE_FDDI:
       case IF_TYPE_IEEE80211:
         len = ifRowP->dwPhysAddrLen;
-        ret = (*env)->NewByteArray(env, len);
-        if (!IS_NULL(ret)) {
-          (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *) ifRowP->bPhysAddr);
+        if (len > 0) {
+            ret = (*env)->NewByteArray(env, len);
+            if (!IS_NULL(ret)) {
+              (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *) ifRowP->bPhysAddr);
+            }
         }
         break;
       }
diff --git a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
index 958cf59..ed6efdf 100644
--- a/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+++ b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
@@ -489,6 +489,9 @@
                 }
             }
         } else {
+            /* NET_BindV6() closes both sockets upon a failure */
+            (*env)->SetObjectField(env, this, pdsi_fdID, NULL);
+            (*env)->SetObjectField(env, this, pdsi_fd1ID, NULL);
             NET_ThrowCurrent (env, "Cannot bind");
             return;
         }
diff --git a/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
index 3fb28f8..e7aa49b 100644
--- a/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+++ b/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
@@ -467,6 +467,10 @@
                     (*env)->SetIntField(env, fd1Obj, IO_fd_fdID, fd1);
                 }
             }
+        } else {
+            /* NET_BindV6() closes both sockets upon a failure */
+            (*env)->SetObjectField(env, this, psi_fdID, NULL);
+            (*env)->SetObjectField(env, this, psi_fd1ID, NULL);
         }
     } else {
         rv = NET_WinBind(fd, (struct sockaddr *)&him, len, exclBind);
diff --git a/src/windows/native/java/net/net_util_md.c b/src/windows/native/java/net/net_util_md.c
index f9a61bf..274d909 100644
--- a/src/windows/native/java/net/net_util_md.c
+++ b/src/windows/native/java/net/net_util_md.c
@@ -443,6 +443,13 @@
 {
     int rv;
 
+    if (level == IPPROTO_IPV6 && optname == IPV6_TCLASS) {
+        int *intopt = (int *)optval;
+        *intopt = 0;
+        *optlen = sizeof(*intopt);
+        return 0;
+    }
+
     rv = getsockopt(s, level, optname, optval, optlen);
 
 
@@ -620,7 +627,7 @@
  * and returns SOCKET_ERROR. Used in NET_BindV6 only.
  */
 
-#define CLOSE_SOCKETS_AND_RETURN {      \
+#define CLOSE_SOCKETS_AND_RETURN do {   \
     if (fd != -1) {                     \
         closesocket (fd);               \
         fd = -1;                        \
@@ -639,7 +646,7 @@
     }                                   \
     b->ipv4_fd = b->ipv6_fd = -1;       \
     return SOCKET_ERROR;                \
-}
+} while(0)
 
 /*
  * if ipv6 is available, call NET_BindV6 to bind to the required address/port.
diff --git a/src/windows/native/java/util/TimeZone_md.c b/src/windows/native/java/util/TimeZone_md.c
index 57d4b52..7cb23e0 100644
--- a/src/windows/native/java/util/TimeZone_md.c
+++ b/src/windows/native/java/util/TimeZone_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -394,31 +394,34 @@
  *
  * value_type is one of the following values:
  *      VALUE_KEY for exact key matching
- *      VALUE_MAPID for MapID and country-based mapping (this is
+ *      VALUE_MAPID for MapID (this is
  *      required for the old Windows, such as NT 4.0 SP3).
  */
 static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName,
-                         char *mapID, const char *country)
+                         char *mapID)
 {
     int line;
     int IDmatched = 0;
     FILE *fp;
     char *javaTZName = NULL;
     char *items[TZ_NITEMS];
-    char mapFileName[_MAX_PATH + 1];
+    char *mapFileName;
     char lineBuffer[MAX_ZONE_CHAR * 4];
-    char bestMatch[MAX_ZONE_CHAR];
-    int noMapID = *mapID == '\0';       /* no mapID on Vista */
+    int noMapID = *mapID == '\0';       /* no mapID on Vista and later */
 
-    bestMatch[0] = '\0';
-
+    mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
+    if (mapFileName == NULL) {
+        return NULL;
+    }
     strcpy(mapFileName, java_home_dir);
     strcat(mapFileName, MAPPINGS_FILE);
 
     if ((fp = fopen(mapFileName, "r")) == NULL) {
         jio_fprintf(stderr, "can't open %s.\n", mapFileName);
+        free((void *) mapFileName);
         return NULL;
     }
+    free((void *) mapFileName);
 
     line = 0;
     while (fgets(lineBuffer, sizeof(lineBuffer), fp) != NULL) {
@@ -469,18 +472,6 @@
                 javaTZName = _strdup(items[TZ_JAVA_NAME]);
                 break;
             }
-            /*
-             * Try to find the most likely time zone.
-             */
-            if (*items[TZ_REGION] == '\0') {
-                strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
-            } else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) {
-                if (value_type == VALUE_MAPID) {
-                    javaTZName = _strdup(items[TZ_JAVA_NAME]);
-                    break;
-                }
-                strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
-            }
         } else {
             if (IDmatched == 1) {
                 /*
@@ -492,9 +483,6 @@
     }
     fclose(fp);
 
-    if (javaTZName == NULL && bestMatch[0] != '\0') {
-        javaTZName = _strdup(bestMatch);
-    }
     return javaTZName;
 
  illegal_format:
@@ -506,7 +494,7 @@
 /*
  * Detects the platform time zone which maps to a Java time zone ID.
  */
-char *findJavaTZ_md(const char *java_home_dir, const char *country)
+char *findJavaTZ_md(const char *java_home_dir)
 {
     char winZoneName[MAX_ZONE_CHAR];
     char winMapID[MAX_MAPID_LENGTH];
@@ -521,7 +509,7 @@
             std_timezone = _strdup(winZoneName);
         } else {
             std_timezone = matchJavaTZ(java_home_dir, result,
-                                       winZoneName, winMapID, country);
+                                       winZoneName, winMapID);
         }
     }
 
diff --git a/src/windows/native/java/util/TimeZone_md.h b/src/windows/native/java/util/TimeZone_md.h
index 9d20bca..99e0192 100644
--- a/src/windows/native/java/util/TimeZone_md.h
+++ b/src/windows/native/java/util/TimeZone_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #ifndef _TIMEZONE_MD_H
 #define _TIMEZONE_MD_H
 
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
 char *getGMTOffsetID();
 
 #endif
diff --git a/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c b/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c
index 8e02c18..3c1fe7f 100644
--- a/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c
+++ b/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c
@@ -568,3 +568,11 @@
 {
     PostMessage(splash->hWnd, WM_SPLASHRECONFIGURE, 0, 0);
 }
+
+SPLASHEXPORT char*
+SplashGetScaledImageName(const char* jarName, const char* fileName,
+                           float *scaleFactor)
+{
+    *scaleFactor = 1;
+    return NULL;
+}
diff --git a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
index 91ee7b3..83aedad 100644
--- a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
+++ b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
@@ -51,131 +51,8 @@
 
 static const ADAPTER_INFO badHardware[] = {
 
-    // Intel HD
-    // Clarkdale (Desktop) GMA HD Lines
-    { 0x8086, 0x0042, NO_VERSION, OS_ALL },
-    // Arrandale (Mobile) GMA HD Lines
-    { 0x8086, 0x0046, NO_VERSION, OS_ALL },
-
-    // Sandy Bridge HD Graphics 3000/2000
-    { 0x8086, 0x0102, NO_VERSION, OS_ALL },
-    { 0x8086, 0x0106, NO_VERSION, OS_ALL },
-    { 0x8086, 0x0112, NO_VERSION, OS_ALL },
-    { 0x8086, 0x0116, NO_VERSION, OS_ALL },
-    { 0x8086, 0x0122, NO_VERSION, OS_ALL },
-    { 0x8086, 0x0126, NO_VERSION, OS_ALL },
-    { 0x8086, 0x010A, NO_VERSION, OS_ALL },
-
-    // Ivy Bridge
-    { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-
-    // Haswell
-    { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-
-    // Reason: workaround for 6620073, 6612195
-    // Intel 740
-    { 0x8086, 0x7800, NO_VERSION, OS_ALL },
-    { 0x8086, 0x1240, NO_VERSION, OS_ALL },
-    { 0x8086, 0x7121, NO_VERSION, OS_ALL },
-    { 0x8086, 0x7123, NO_VERSION, OS_ALL },
-    { 0x8086, 0x7125, NO_VERSION, OS_ALL },
-    { 0x8086, 0x1132, NO_VERSION, OS_ALL },
-    // IEG
-    { 0x8086, 0x2562, NO_VERSION, OS_ALL },
-    { 0x8086, 0x3577, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2572, NO_VERSION, OS_ALL },
-    { 0x8086, 0x3582, NO_VERSION, OS_ALL },
-    { 0x8086, 0x358E, NO_VERSION, OS_ALL },
-    // GMA
-    { 0x8086, 0x2582, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2782, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2592, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2792, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2772, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2776, NO_VERSION, OS_ALL },
-    { 0x8086, 0x27A2, NO_VERSION, OS_ALL },
-    { 0x8086, 0x27A6, NO_VERSION, OS_ALL },
-    { 0x8086, 0x27AE, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29D2, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29D3, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29B2, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29B3, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29C2, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29C3, NO_VERSION, OS_ALL },
-    { 0x8086, 0xA001, NO_VERSION, OS_ALL },
-    { 0x8086, 0xA002, NO_VERSION, OS_ALL },
-    { 0x8086, 0xA011, NO_VERSION, OS_ALL },
-    { 0x8086, 0xA012, NO_VERSION, OS_ALL },
-    // GMA
-    { 0x8086, 0x2972, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2973, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2992, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2993, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29A2, NO_VERSION, OS_ALL },
-    { 0x8086, 0x29A3, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2982, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2983, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2A02, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2A03, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2A12, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2A13, NO_VERSION, OS_ALL },
-
-    // Eaglelake (Desktop) GMA 4500 Lines
-    { 0x8086, 0x2E42, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E43, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E92, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E93, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E12, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E13, NO_VERSION, OS_ALL },
-    // Eaglelake (Desktop) GMA X4500 Lines
-    { 0x8086, 0x2E32, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E33, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2E22, NO_VERSION, OS_ALL },
-    // Eaglelake (Desktop) GMA X4500HD Lines
-    { 0x8086, 0x2E23, NO_VERSION, OS_ALL },
-    // Cantiga (Mobile) GMA 4500MHD Lines
-    { 0x8086, 0x2A42, NO_VERSION, OS_ALL },
-    { 0x8086, 0x2A43, NO_VERSION, OS_ALL },
+    // All Intel Chips.
+    { 0x8086, ALL_DEVICEIDS, NO_VERSION, OS_ALL },
 
     // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
     // Reason: workaround for 6613066, 6687166
diff --git a/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp b/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp
index 5cf4842..b8b1ec8 100644
--- a/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp
+++ b/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp
@@ -201,6 +201,9 @@
     int i;
     jint flags = 0;
 
+    for (i = 0; i < 4; i++) {
+        bands[i] = NULL;
+    }
     J2dTraceLn4(J2D_TRACE_INFO,
                 "D3DBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d",
                 shortData, numBands, bandLength, offset);
diff --git a/src/windows/native/sun/java2d/windows/GDIRenderer.cpp b/src/windows/native/sun/java2d/windows/GDIRenderer.cpp
index 643d64d..36991f4 100644
--- a/src/windows/native/sun/java2d/windows/GDIRenderer.cpp
+++ b/src/windows/native/sun/java2d/windows/GDIRenderer.cpp
@@ -670,7 +670,7 @@
         if (ypoints != NULL) {
             pPoints = TransformPoly(xpoints, ypoints, transx, transy,
                                 tmpPts, &npoints, FALSE, FALSE);
-            env->ReleasePrimitiveArrayCritical(ypointsarray, xpoints, JNI_ABORT);
+            env->ReleasePrimitiveArrayCritical(ypointsarray, ypoints, JNI_ABORT);
         }
         env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
     }
diff --git a/src/windows/native/sun/management/OperatingSystemImpl.c b/src/windows/native/sun/management/OperatingSystemImpl.c
index fc9cb48..e810063 100644
--- a/src/windows/native/sun/management/OperatingSystemImpl.c
+++ b/src/windows/native/sun/management/OperatingSystemImpl.c
@@ -53,8 +53,6 @@
 typedef unsigned __int32 juint;
 typedef unsigned __int64 julong;
 
-typedef enum boolean_values { false=0, true=1};
-
 static void set_low(jlong* value, jint low) {
     *value &= (jlong)0xffffffff << 32;
     *value |= (jlong)(julong)(juint)low;
@@ -66,22 +64,22 @@
 }
 
 static jlong jlong_from(jint h, jint l) {
-  jlong result = 0; // initialization to avoid warning
-  set_high(&result, h);
-  set_low(&result,  l);
-  return result;
+    jlong result = 0; // initialization to avoid warning
+    set_high(&result, h);
+    set_low(&result,  l);
+    return result;
 }
 
 static HANDLE main_process;
 
-int perfiInit(void);
+static void perfInit(void);
 
 JNIEXPORT void JNICALL
 Java_sun_management_OperatingSystemImpl_initialize
   (JNIEnv *env, jclass cls)
 {
     main_process = GetCurrentProcess();
-     perfiInit();
+    perfInit();
 }
 
 JNIEXPORT jlong JNICALL
@@ -155,26 +153,7 @@
     return (jlong) ms.ullTotalPhys;
 }
 
-// Seems WinXP PDH returns PDH_MORE_DATA whenever we send in a NULL buffer.
-// Let's just ignore it, since we make sure we have enough buffer anyway.
-static int
-pdh_fail(PDH_STATUS pdhStat) {
-    return pdhStat != ERROR_SUCCESS && pdhStat != PDH_MORE_DATA;
-}
-
-// INFO: Using PDH APIs Correctly in a Localized Language (Q287159)
-//       http://support.microsoft.com/default.aspx?scid=kb;EN-US;q287159
-// The index value for the base system counters and objects like processor,
-// process, thread, memory, and so forth are always the same irrespective
-// of the localized version of the operating system or service pack installed.
-#define PDH_PROCESSOR_IDX        ((DWORD) 238)
-#define PDH_PROCESSOR_TIME_IDX        ((DWORD)   6)
-#define PDH_PRIV_PROCESSOR_TIME_IDX ((DWORD) 144)
-#define PDH_PROCESS_IDX            ((DWORD) 230)
-#define PDH_ID_PROCESS_IDX        ((DWORD) 784)
-#define PDH_CONTEXT_SWITCH_RATE_IDX ((DWORD) 146)
-#define PDH_SYSTEM_IDX            ((DWORD)   2)
-#define PDH_VIRTUAL_BYTES_IDX        ((DWORD) 174)
+/* Performance Data Helper API (PDH) support */
 
 typedef PDH_STATUS (WINAPI *PdhAddCounterFunc)(
                            HQUERY      hQuery,
@@ -183,48 +162,44 @@
                            HCOUNTER    *phCounter
                            );
 typedef PDH_STATUS (WINAPI *PdhOpenQueryFunc)(
-                          LPCWSTR     szDataSource,
-                          DWORD       dwUserData,
-                          HQUERY      *phQuery
-                          );
+                           LPCWSTR     szDataSource,
+                           DWORD       dwUserData,
+                           HQUERY      *phQuery
+                           );
+typedef PDH_STATUS (WINAPI *PdhCollectQueryDataFunc)(
+                           HQUERY      hQuery
+                           );
+
+typedef PDH_STATUS (WINAPI *PdhEnumObjectItemsFunc)(
+                           LPCTSTR     szDataSource,
+                           LPCTSTR     szMachineName,
+                           LPCTSTR     szObjectName,
+                           LPTSTR      mszCounterList,
+                           LPDWORD     pcchCounterListLength,
+                           LPTSTR      mszInstanceList,
+                           LPDWORD     pcchInstanceListLength,
+                           DWORD       dwDetailLevel,
+                           DWORD       dwFlags
+                           );
+typedef PDH_STATUS (WINAPI *PdhRemoveCounterFunc)(
+                           HCOUNTER   hCounter
+                           );
+typedef PDH_STATUS (WINAPI *PdhLookupPerfNameByIndexFunc)(
+                           LPCSTR     szMachineName,
+                           DWORD      dwNameIndex,
+                           LPSTR      szNameBuffer,
+                           LPDWORD    pcchNameBufferSize
+                           );
 typedef DWORD (WINAPI *PdhCloseQueryFunc)(
                       HQUERY      hQuery
                       );
-typedef PDH_STATUS (WINAPI *PdhCollectQueryDataFunc)(
-                             HQUERY      hQuery
-                             );
+
 typedef DWORD (WINAPI *PdhGetFormattedCounterValueFunc)(
-                            HCOUNTER                hCounter,
-                            DWORD                   dwFormat,
-                            LPDWORD                 lpdwType,
-                            PPDH_FMT_COUNTERVALUE   pValue
-                            );
-typedef PDH_STATUS (WINAPI *PdhEnumObjectItemsFunc)(
-                            LPCTSTR    szDataSource,
-                            LPCTSTR    szMachineName,
-                            LPCTSTR    szObjectName,
-                            LPTSTR     mszCounterList,
-                            LPDWORD    pcchCounterListLength,
-                            LPTSTR     mszInstanceList,
-                            LPDWORD    pcchInstanceListLength,
-                            DWORD      dwDetailLevel,
-                            DWORD      dwFlags
-                            );
-typedef PDH_STATUS (WINAPI *PdhRemoveCounterFunc)(
-                          HCOUNTER  hCounter
-                          );
-typedef PDH_STATUS (WINAPI *PdhLookupPerfNameByIndexFunc)(
-                              LPCSTR  szMachineName,
-                              DWORD   dwNameIndex,
-                              LPSTR   szNameBuffer,
-                              LPDWORD pcchNameBufferSize
-                              );
-typedef PDH_STATUS (WINAPI *PdhMakeCounterPathFunc)(
-                            PDH_COUNTER_PATH_ELEMENTS *pCounterPathElements,
-                            LPTSTR szFullPathBuffer,
-                            LPDWORD pcchBufferSize,
-                            DWORD dwFlags
-                            );
+                      HCOUNTER                hCounter,
+                      DWORD                   dwFormat,
+                      LPDWORD                 lpdwType,
+                      PPDH_FMT_COUNTERVALUE   pValue
+                      );
 
 static PdhAddCounterFunc PdhAddCounter_i;
 static PdhOpenQueryFunc PdhOpenQuery_i;
@@ -234,76 +209,757 @@
 static PdhEnumObjectItemsFunc PdhEnumObjectItems_i;
 static PdhRemoveCounterFunc PdhRemoveCounter_i;
 static PdhLookupPerfNameByIndexFunc PdhLookupPerfNameByIndex_i;
-static PdhMakeCounterPathFunc PdhMakeCounterPath_i;
 
-static HANDLE thisProcess;
-static double cpuFactor;
-static DWORD  num_cpus;
-
-#define FT2JLONG(X)  ((((jlong)X.dwHighDateTime) << 32) | ((jlong)X.dwLowDateTime))
-#define COUNTER_BUF_SIZE 256
-// Min time between query updates.
-#define MIN_UPDATE_INTERVAL 500
-#define CONFIG_SUCCESSFUL 0
-
-/**
+/*
  * Struct for PDH queries.
  */
 typedef struct {
     HQUERY      query;
-    uint64_t      lastUpdate; // Last time query was updated (current millis).
+    uint64_t    lastUpdate; // Last time query was updated (ticks)
 } UpdateQueryS, *UpdateQueryP;
 
-/**
- * Struct for the processor load counters.
+// Min time between query updates (ticks)
+static const int MIN_UPDATE_INTERVAL = 500;
+
+/*
+ * Struct for a PDH query with multiple counters.
  */
 typedef struct {
-    UpdateQueryS      query;
-    HCOUNTER*      counters;
-    int          noOfCounters;
+    UpdateQueryS  query;
+    HCOUNTER*     counters;
+    int           noOfCounters;
 } MultipleCounterQueryS, *MultipleCounterQueryP;
 
-/**
- * Struct for the jvm process load counter.
+/*
+ * Struct for a PDH query with a single counter.
  */
 typedef struct {
-    UpdateQueryS      query;
+    UpdateQueryS  query;
     HCOUNTER      counter;
 } SingleCounterQueryS, *SingleCounterQueryP;
 
-static char* getProcessPDHHeader(void);
 
-/**
- * Currently available counters.
+typedef struct {
+    CRITICAL_SECTION cs;
+    DWORD owningThread;
+    DWORD recursionCount;
+} PdhCriticalSectionS, *PdhCriticalSectionP;
+
+static PdhCriticalSectionS initializationLock;
+
+static void InitializePdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+
+    InitializeCriticalSection(&criticalSection->cs);
+    criticalSection->owningThread = 0;
+    criticalSection->recursionCount = 0;
+}
+
+static void EnterPdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+
+    EnterCriticalSection(&criticalSection->cs);
+    criticalSection->recursionCount++;
+    if (!criticalSection->owningThread) {
+        criticalSection->owningThread = GetCurrentThreadId();
+    }
+}
+
+static void LeavePdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+    assert(GetCurrentThreadId() == criticalSection->owningThread);
+    assert(criticalSection->recursionCount >= 1);
+
+    criticalSection->recursionCount--;
+    if (!criticalSection->recursionCount) {
+        criticalSection->owningThread = 0;
+    }
+    LeaveCriticalSection(&criticalSection->cs);
+}
+
+/*
+ * INFO: Using PDH APIs Correctly in a Localized Language (Q287159)
+ *   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q287159
+ * The index value for the base system counters and objects like processor,
+ * process, thread, memory, and so forth are always the same irrespective
+ * of the localized version of the operating system or service pack installed.
+ * To find the correct index for an object or counter, inspect the registry key/value:
+ * [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter]
  */
-static SingleCounterQueryS cntCtxtSwitchRate;
-static SingleCounterQueryS cntVirtualSize;
-static SingleCounterQueryS cntProcLoad;
-static SingleCounterQueryS cntProcSystemLoad;
-static MultipleCounterQueryS multiCounterCPULoad;
+static const DWORD PDH_PROCESSOR_IDX = 238;
+static const DWORD PDH_PROCESSOR_TIME_IDX = 6;
+static const DWORD PDH_PROCESS_IDX = 230;
+static const DWORD PDH_ID_PROCESS_IDX = 784;
 
-static CRITICAL_SECTION processHeaderLock;
-static CRITICAL_SECTION initializationLock;
+/* useful pdh fmt's */
+static const char* const OBJECT_COUNTER_FMT = "\\%s\\%s";
+static const size_t OBJECT_COUNTER_FMT_LEN = 2;
+static const char* const OBJECT_WITH_INSTANCES_COUNTER_FMT = "\\%s(%s)\\%s";
+static const size_t OBJECT_WITH_INSTANCES_COUNTER_FMT_LEN = 4;
+static const char* const PROCESS_OBJECT_INSTANCE_COUNTER_FMT = "\\%s(%s#%s)\\%s";
+static const size_t PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN = 5;
 
-/**
- * Initialize the perf module at startup.
+static const char* pdhProcessImageName = NULL; /* "java" */
+static char* pdhIDProcessCounterFmt = NULL;    /* "\Process(java#%d)\ID Process" */
+
+static int numberOfJavaProcessesAtInitialization = 0;
+
+/*
+ * Currently used CPU queries/counters and variables
  */
-int
-perfiInit(void)
-{
-    InitializeCriticalSection(&processHeaderLock);
-    InitializeCriticalSection(&initializationLock);
+static SingleCounterQueryP processTotalCPULoad = NULL;
+static MultipleCounterQueryP multiCounterCPULoad = NULL;
+static double cpuFactor = .0;
+static DWORD  numCpus = 0;
+
+/*
+ * Seems WinXP PDH returns PDH_MORE_DATA whenever we send in a NULL buffer.
+ * Let's just ignore it, since we make sure we have enough buffer anyway.
+ */
+static int
+pdhFail(PDH_STATUS pdhStat) {
+    return pdhStat != ERROR_SUCCESS && pdhStat != PDH_MORE_DATA;
+}
+
+static const char*
+allocateAndCopy(const char* const originalString) {
+    size_t len;
+    char* allocatedString;
+
+    assert(originalString);
+
+    len = strlen(originalString);
+
+    allocatedString = malloc(len + 1);
+
+    if (!allocatedString) {
+        return NULL;
+    }
+
+    strncpy(allocatedString, originalString, len);
+    allocatedString[len] = '\0';
+
+    return allocatedString;
+}
+
+/*
+ * Allocates memory into the supplied pointer and
+ * fills it with the localized PDH artifact description, if indexed correctly.
+ * Caller owns the memory from the point of returning from this function.
+ *
+ * @param index    the PDH counter index as specified in the registry
+ * @param ppBuffer pointer to a char*.
+ * @return         0 if successful, negative on failure.
+ */
+static int
+lookupNameByIndex(DWORD index, char** ppBuffer) {
+    DWORD size;
+
+    assert(ppBuffer);
+
+    /* determine size needed */
+    if (PdhLookupPerfNameByIndex_i(NULL, index, NULL, &size) != PDH_MORE_DATA) {
+      /* invalid index? */
+      return -1;
+    }
+
+    *ppBuffer = malloc((size_t)size);
+
+    if (!*ppBuffer) {
+        return -1;
+    }
+
+    if (PdhLookupPerfNameByIndex_i(NULL, index, *ppBuffer, &size) != ERROR_SUCCESS) {
+        free(*ppBuffer);
+        *ppBuffer = NULL;
+        return -1;
+    }
+
+    /* windows vista does not null-terminate the string
+     * (although the docs says it will) */
+    (*ppBuffer)[size - 1] = '\0';
+
     return 0;
 }
 
-/**
- * Dynamically sets up function pointers to the PDH library.
+/*
+* Construct a fully qualified PDH path
+*
+* @param objectName   a PDH Object string representation (required)
+* @param counterName  a PDH Counter string representation (required)
+* @param imageName    a process image name string, ex. "java" (opt)
+* @param instance     an instance string, ex. "0", "1", ... (opt)
+* @return             the fully qualified PDH path.
+*
+* Caller will own the returned malloc:ed string
+*/
+static const char*
+makeFullCounterPath(const char* const objectName,
+                    const char* const counterName,
+                    const char* const imageName,
+                    const char* const instance) {
+
+    size_t fullCounterPathLen;
+    char* fullCounterPath;
+
+    assert(objectName);
+    assert(counterName);
+
+    fullCounterPathLen = strlen(objectName);
+    fullCounterPathLen += strlen(counterName);
+
+    if (imageName) {
+        /*
+         * For paths using the "Process" Object.
+         *
+         * Examples:
+         * abstract: "\Process(imageName#instance)\Counter"
+         * actual:   "\Process(java#2)\ID Process"
+         */
+        fullCounterPathLen += PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN;
+        fullCounterPathLen += strlen(imageName);
+
+        /*
+         * imageName must be passed together with an associated
+         * instance "number" ("0", "1", "2", ...).
+         * This is required in order to create valid "Process" Object paths.
+         *
+         * Examples: "\Process(java#0)", \Process(java#1"), ...
+         */
+        assert(instance);
+
+        fullCounterPathLen += strlen(instance);
+
+        fullCounterPath = malloc(fullCounterPathLen + 1);
+
+        if (!fullCounterPath) {
+            return NULL;
+        }
+
+        _snprintf(fullCounterPath,
+                  fullCounterPathLen,
+                  PROCESS_OBJECT_INSTANCE_COUNTER_FMT,
+                  objectName,
+                  imageName,
+                  instance,
+                  counterName);
+    } else {
+        if (instance) {
+            /*
+             * For paths where the Object has multiple instances.
+             *
+             * Examples:
+             * abstract: "\Object(instance)\Counter"
+             * actual:   "\Processor(0)\% Privileged Time"
+             */
+            fullCounterPathLen += strlen(instance);
+            fullCounterPathLen += OBJECT_WITH_INSTANCES_COUNTER_FMT_LEN;
+        } else {
+            /*
+             * For "normal" paths.
+             *
+             * Examples:
+             * abstract: "\Object\Counter"
+             * actual:   "\Memory\Available Mbytes"
+             */
+            fullCounterPathLen += OBJECT_COUNTER_FMT_LEN;
+        }
+
+        fullCounterPath = malloc(fullCounterPathLen + 1);
+
+        if (!fullCounterPath) {
+            return NULL;
+        }
+
+        if (instance) {
+            _snprintf(fullCounterPath,
+                      fullCounterPathLen,
+                      OBJECT_WITH_INSTANCES_COUNTER_FMT,
+                      objectName,
+                      instance,
+                      counterName);
+        } else {
+            _snprintf(fullCounterPath,
+                      fullCounterPathLen,
+                      OBJECT_COUNTER_FMT,
+                      objectName,
+                      counterName);
+        }
+    }
+
+    fullCounterPath[fullCounterPathLen] = '\0';
+
+    return fullCounterPath;
+}
+
+/*
+ * Resolves an index for a PDH artifact to
+ * a localized, malloc:ed string representation.
+ * Caller will own the returned malloc:ed string.
  *
- * @return CONFIG_SUCCESSFUL on success, negative on failure.
+ * @param pdhArtifactIndex  PDH index
+ * @return                  malloc:ed string representation
+ *                          of the requested pdh artifact (localized).
+ *                          NULL on failure.
+ */
+static const char*
+getPdhLocalizedArtifact(DWORD pdhArtifactIndex) {
+    char* pdhLocalizedArtifactString;
+
+    if (lookupNameByIndex(pdhArtifactIndex,
+                          &pdhLocalizedArtifactString) != 0) {
+        return NULL;
+    }
+
+    return pdhLocalizedArtifactString;
+}
+
+static void
+pdhCleanup(HQUERY* const query, HCOUNTER* const counter) {
+    if (counter && *counter) {
+        PdhRemoveCounter_i(*counter);
+        *counter = NULL;
+    }
+    if (query && *query) {
+        PdhCloseQuery_i(*query);
+        *query = NULL;
+    }
+}
+
+static void
+destroySingleCounter(SingleCounterQueryP counterQuery) {
+    if (counterQuery) {
+        pdhCleanup(&counterQuery->query.query, &counterQuery->counter);
+    }
+}
+
+static void
+destroyMultiCounter(MultipleCounterQueryP multiCounterQuery) {
+    int i;
+    if (multiCounterQuery) {
+        if (multiCounterQuery->counters) {
+            for (i = 0; i < multiCounterQuery->noOfCounters; i++) {
+                pdhCleanup(NULL, &multiCounterQuery->counters[i]);
+            }
+            free(multiCounterQuery->counters);
+            multiCounterQuery->counters = NULL;
+        }
+        pdhCleanup(&multiCounterQuery->query.query, NULL);
+    }
+}
+
+static int
+openQuery(HQUERY* const query) {
+    assert(query);
+
+    if (PdhOpenQuery_i(NULL, 0, query) != ERROR_SUCCESS) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static int
+addCounter(HQUERY query,
+           const char* const fullCounterPath,
+           HCOUNTER* const counter) {
+
+    assert(fullCounterPath);
+    assert(counter);
+
+    if (PdhAddCounter_i(query,
+                        fullCounterPath,
+                        0,
+                        counter) != ERROR_SUCCESS) {
+        return -1;
+    }
+
+    return 0;
+}
+
+/*
+ * Sets up the supplied SingleCounterQuery to listen for the specified counter.
+ *
+ * @param counterQuery       the counter query to set up.
+ * @param fullCounterPath    the string specifying the full path to the counter.
+ * @returns                  0 if successful, negative on failure.
  */
 static int
-get_functions(HMODULE h, char *ebuf, size_t elen) {
-    // The 'A' at the end means the ANSI (not the UNICODE) vesions of the methods
+initializeSingleCounterQuery(SingleCounterQueryP counterQuery,
+                             const char* const fullCounterPath) {
+    assert(counterQuery);
+    assert(fullCounterPath);
+
+    if (openQuery(&counterQuery->query.query) == 0) {
+        if (addCounter(counterQuery->query.query,
+                       fullCounterPath,
+                       &counterQuery->counter) == 0) {
+            return 0;
+        }
+    }
+
+    return -1;
+}
+
+/*
+ * Sets up a SingleCounterQuery
+ *
+ * param counter             the counter query to set up.
+ * param localizedObject     string representing the PDH object to query
+ * param localizedCounter    string representing the PDH counter to query
+ * param processImageName    if the counter query needs the process image name ("java")
+ * param instance            if the counter has instances, this is the instance ("\Processor(0)\")
+                                 where 0 is the instance
+ * param firstSampleOnInit   for counters that need two queries to yield their values,
+                                 the first query can be issued just after initialization
+ *
+ * @returns                   0 if successful, negative on failure.
+ */
+static int
+initializeSingleCounter(SingleCounterQueryP const counter,
+                        const char* const localizedObject,
+                        const char* const localizedCounter,
+                        const char* const processImageName,
+                        const char* const instance,
+                        BOOL firstSampleOnInit) {
+    int retValue = -1;
+
+    const char* fullCounterPath = makeFullCounterPath(localizedObject,
+                                                      localizedCounter,
+                                                      processImageName,
+                                                      instance);
+
+    if (fullCounterPath) {
+
+        assert(counter);
+
+        if (initializeSingleCounterQuery(counter, fullCounterPath) == 0) {
+            /*
+             * According to the MSDN documentation, rate counters must be read twice:
+             *
+             * "Obtaining the value of rate counters such as Page faults/sec requires that
+             *  PdhCollectQueryData be called twice, with a specific time interval between
+             *  the two calls, before calling PdhGetFormattedCounterValue. Call Sleep to
+             *  implement the waiting period between the two calls to PdhCollectQueryData."
+             *
+             *  Take the first sample here already to allow for the next (first) "real" sample
+             *  to succeed.
+             */
+            if (firstSampleOnInit) {
+                PdhCollectQueryData_i(counter->query.query);
+            }
+
+            retValue = 0;
+        }
+        free((char*)fullCounterPath);
+    }
+
+    return retValue;
+}
+
+static void
+perfInit(void) {
+    InitializePdhCriticalSection(&initializationLock);
+}
+
+static int
+getProcessID() {
+    static int myPid = 0;
+    if (0 == myPid) {
+        myPid = _getpid();
+    }
+    return myPid;
+}
+
+/*
+ * Working against the Process object and it's related counters is inherently problematic
+ * when using the PDH API:
+ *
+ * For PDH, a process is not primarily identified by it's process id,
+ * but with a sequential number, for example \Process(java#0), \Process(java#1), ....
+ * The really bad part is that this list is reset as soon as one process exits:
+ * If \Process(java#1) exits, \Process(java#3) now becomes \Process(java#2) etc.
+ *
+ * The PDH query api requires a process identifier to be submitted when registering
+ * a query, but as soon as the list resets, the query is invalidated (since the name
+ * changed).
+ *
+ * Solution:
+ * The #number identifier for a Process query can only decrease after process creation.
+ *
+ * Therefore we create an array of counter queries for all process object instances
+ * up to and including ourselves:
+ *
+ * Ex. we come in as third process instance (java#2), we then create and register
+ * queries for the following Process object instances:
+ * java#0, java#1, java#2
+ *
+ * currentQueryIndexForProcess() keeps track of the current "correct" query
+ * (in order to keep this index valid when the list resets from underneath,
+ * ensure to call getCurrentQueryIndexForProcess() before every query involving
+ * Process object instance data).
+ */
+static int
+currentQueryIndexForProcess(void) {
+    HQUERY tmpQuery = NULL;
+    HCOUNTER handleCounter = NULL;
+    int retValue = -1;
+
+    assert(pdhProcessImageName);
+    assert(pdhIDProcessCounterFmt);
+
+    if (openQuery(&tmpQuery) == 0) {
+        int index;
+
+        /* iterate over all instance indexes and try to find our own pid */
+        for (index = 0; index < INT_MAX; ++index) {
+            char fullIDProcessCounterPath[MAX_PATH];
+            PDH_FMT_COUNTERVALUE counterValue;
+            PDH_STATUS res;
+
+            _snprintf(fullIDProcessCounterPath,
+                      MAX_PATH,
+                      pdhIDProcessCounterFmt,
+                      index);
+
+            if (addCounter(tmpQuery, fullIDProcessCounterPath, &handleCounter) != 0) {
+                break;
+            }
+
+            res = PdhCollectQueryData_i(tmpQuery);
+
+            if (PDH_INVALID_HANDLE == res || PDH_NO_DATA == res) {
+                break;
+            }
+
+            PdhGetFormattedCounterValue_i(handleCounter,
+                                          PDH_FMT_LONG,
+                                          NULL,
+                                          &counterValue);
+            /*
+             * This check seems to be needed for Win2k SMP boxes, since
+             * they for some reason don't return PDH_NO_DATA for non existing
+             * counters.
+             */
+            if (counterValue.CStatus != PDH_CSTATUS_VALID_DATA) {
+                break;
+            }
+
+            if ((LONG)getProcessID() == counterValue.longValue) {
+                retValue = index;
+                break;
+            }
+        }
+    }
+
+    pdhCleanup(&tmpQuery, &handleCounter);
+
+    return retValue;
+}
+
+/*
+ * If successful, returns the #index corresponding to our PID
+ * as resolved by the pdh query:
+ * "\Process(java#index)\ID Process" (or localized equivalent)
+ *
+ * This function should be called before attempting to read
+ * from any Process related counter(s), and the return value
+ * is the index to be used for indexing an array of Process object query's:
+ *
+ * Example:
+ * processTotalCPULoad[currentQueryIndex].query
+ *
+ * Returns -1 on failure.
+ */
+static int
+getCurrentQueryIndexForProcess() {
+    int currentQueryIndex = currentQueryIndexForProcess();
+
+    assert(currentQueryIndex >= 0 &&
+           currentQueryIndex < numberOfJavaProcessesAtInitialization);
+
+    return currentQueryIndex;
+}
+
+/*
+ * Returns the PDH string identifying the current process image name.
+ * Use this name as a qualifier when getting counters from the PDH Process Object
+ * representing your process.
+
+ * Example:
+ * "\Process(java#0)\Virtual Bytes" - where "java" is the PDH process
+ * image name.
+ *
+ * Please note that the process image name is not necessarily "java",
+ * hence the use of GetModuleFileName() to detect the process image name.
+ *
+ * @return   the process image name to be used when retrieving
+ *           PDH counters from the current process. The caller will
+             own the returned malloc:ed string. NULL if failure.
+ */
+static const char*
+getPdhProcessImageName() {
+    char moduleName[MAX_PATH];
+    char* processImageName;
+    char* dotPos;
+
+    // Find our module name and use it to extract the image name used by PDH
+    DWORD getmfnReturn = GetModuleFileName(NULL, moduleName, sizeof(moduleName));
+
+    if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+        return NULL;
+    }
+
+    if (getmfnReturn >= MAX_PATH || 0 == getmfnReturn) {
+        return NULL;
+    }
+
+    processImageName = strrchr(moduleName, '\\'); //drop path
+    processImageName++;                           //skip slash
+    dotPos = strrchr(processImageName, '.');      //drop .exe
+    dotPos[0] = '\0';
+
+    return allocateAndCopy(processImageName);
+}
+
+/*
+ * Sets up the supplied MultipleCounterQuery to check on the processors via PDH CPU counters.
+ * TODO: Refactor and prettify as with the the SingleCounter queries
+ * if more MultipleCounterQueries are discovered/needed.
+ *
+ * @param multiCounterCPULoad  a pointer to a MultipleCounterQueryS, will be filled in with
+ *                             the necessary info to check the PDH processor counters.
+ * @return                     0 if successful, negative on failure.
+ */
+static int
+initializeMultipleCounterForCPUs(MultipleCounterQueryP multiCounterCPULoad) {
+    DWORD cSize = 0;
+    DWORD iSize = 0;
+    DWORD pCount;
+    DWORD index;
+    char* processor = NULL; //'Processor' == PDH_PROCESSOR_IDX
+    char* time = NULL;      //'Time' == PDH_PROCESSOR_TIME_IDX
+    char* instances = NULL;
+    char* tmp;
+    int   retValue = -1;
+    PDH_STATUS pdhStat;
+
+    if (lookupNameByIndex(PDH_PROCESSOR_IDX, &processor) != 0) {
+        goto end;
+    }
+
+    if (lookupNameByIndex(PDH_PROCESSOR_TIME_IDX, &time) != 0) {
+        goto end;
+    }
+
+    //ok, now we have enough to enumerate all processors.
+    pdhStat = PdhEnumObjectItems_i(
+                                   NULL, // reserved
+                                   NULL, // local machine
+                                   processor, // object to enumerate
+                                   NULL, // pass in NULL buffers
+                                   &cSize, // and 0 length to get
+                                   NULL, // required size
+                                   &iSize, // of the buffers in chars
+                                   PERF_DETAIL_WIZARD, // counter detail level
+                                   0);
+
+    if (pdhFail(pdhStat)) {
+        goto end;
+    }
+
+    instances = calloc(iSize, 1);
+
+    if (!instances) {
+        goto end;
+    }
+
+    cSize = 0;
+
+    pdhStat = PdhEnumObjectItems_i(
+                                   NULL, // reserved
+                                   NULL, // local machine
+                                   processor, // object to enumerate
+                                   NULL, // pass in NULL buffers
+                                   &cSize,
+                                   instances, // now allocated to be filled in
+                                   &iSize, // and size is known
+                                   PERF_DETAIL_WIZARD, // counter detail level
+                                   0);
+
+    if (pdhFail(pdhStat)) {
+        goto end;
+    }
+
+    // enumerate the Processor instances ("\Processor(0)", "\Processor(1)", ..., "\Processor(_Total)")
+    for (pCount = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[strlen(tmp)+1], pCount++);
+
+    assert(pCount == numCpus+1);
+
+    //ok, we now have the number of Processor instances - allocate an HCOUNTER for each
+    multiCounterCPULoad->counters = (HCOUNTER*)malloc(pCount * sizeof(HCOUNTER));
+
+    if (!multiCounterCPULoad->counters) {
+        goto end;
+    }
+
+    multiCounterCPULoad->noOfCounters = pCount;
+
+    if (openQuery(&multiCounterCPULoad->query.query) != 0) {
+        goto end;
+    }
+
+    // fetch instance and register its corresponding HCOUNTER with the query
+    for (index = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[strlen(tmp)+1], ++index) {
+        const char* const fullCounterPath = makeFullCounterPath(processor, time, NULL, tmp);
+
+        if (!fullCounterPath) {
+            goto end;
+        }
+
+        retValue = addCounter(multiCounterCPULoad->query.query,
+                              fullCounterPath,
+                              &multiCounterCPULoad->counters[index]);
+
+        free((char*)fullCounterPath);
+
+        if (retValue != 0) {
+            goto end;
+        }
+    }
+
+    // Query once to initialize the counters which require at least two samples
+    // (like the % CPU usage) to calculate correctly.
+    PdhCollectQueryData_i(multiCounterCPULoad->query.query);
+
+  end:
+    if (processor) {
+        free(processor);
+    }
+
+    if (time) {
+        free(time);
+    }
+
+    if (instances) {
+        free(instances);
+    }
+
+    return retValue;
+}
+
+/*
+ * Dynamically sets up function pointers to the PDH library.
+ *
+ * @param h  HMODULE for the PDH library
+ * @return   0 on success, negative on failure.
+ */
+static int
+bindPdhFunctionPointers(HMODULE h) {
+    assert(h);
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    /* The 'A' at the end means the ANSI (not the UNICODE) vesions of the methods */
     PdhAddCounter_i         = (PdhAddCounterFunc)GetProcAddress(h, "PdhAddCounterA");
     PdhOpenQuery_i         = (PdhOpenQueryFunc)GetProcAddress(h, "PdhOpenQueryA");
     PdhCloseQuery_i         = (PdhCloseQueryFunc)GetProcAddress(h, "PdhCloseQuery");
@@ -312,42 +968,41 @@
     PdhEnumObjectItems_i         = (PdhEnumObjectItemsFunc)GetProcAddress(h, "PdhEnumObjectItemsA");
     PdhRemoveCounter_i         = (PdhRemoveCounterFunc)GetProcAddress(h, "PdhRemoveCounter");
     PdhLookupPerfNameByIndex_i     = (PdhLookupPerfNameByIndexFunc)GetProcAddress(h, "PdhLookupPerfNameByIndexA");
-    PdhMakeCounterPath_i         = (PdhMakeCounterPathFunc)GetProcAddress(h, "PdhMakeCounterPathA");
 
-    if (PdhAddCounter_i == NULL || PdhOpenQuery_i == NULL ||
-    PdhCloseQuery_i == NULL || PdhCollectQueryData_i == NULL ||
-    PdhGetFormattedCounterValue_i == NULL || PdhEnumObjectItems_i == NULL ||
-    PdhRemoveCounter_i == NULL || PdhLookupPerfNameByIndex_i == NULL || PdhMakeCounterPath_i == NULL)
+    if (!PdhAddCounter_i || !PdhOpenQuery_i ||
+        !PdhCloseQuery_i || !PdhCollectQueryData_i ||
+        !PdhGetFormattedCounterValue_i || !PdhEnumObjectItems_i ||
+        !PdhRemoveCounter_i || !PdhLookupPerfNameByIndex_i)
     {
-        _snprintf(ebuf, elen, "Required method could not be found.");
         return -1;
     }
-    return CONFIG_SUCCESSFUL;
+    return 0;
 }
 
-/**
+/*
  * Returns the counter value as a double for the specified query.
  * Will collect the query data and update the counter values as necessary.
  *
  * @param query       the query to update (if needed).
- * @param c          the counter to read.
+ * @param c           the counter to read.
  * @param value       where to store the formatted value.
  * @param format      the format to use (i.e. PDH_FMT_DOUBLE, PDH_FMT_LONG etc)
- * @return            CONFIG_SUCCESSFUL if no error
+ * @return            0 if no error
  *                    -1 if PdhCollectQueryData fails
  *                    -2 if PdhGetFormattedCounterValue fails
  */
 static int
 getPerformanceData(UpdateQueryP query, HCOUNTER c, PDH_FMT_COUNTERVALUE* value, DWORD format) {
-    clock_t now;
-    now = clock();
+    clock_t now = clock();
 
-    // Need to limit how often we update the query
-    // to mimise the heisenberg effect.
-    // (PDH behaves erratically if the counters are
-    // queried too often, especially counters that
-    // store and use values from two consecutive updates,
-    // like cpu load.)
+    /*
+     * Need to limit how often we update the query
+     * to minimize the Heisenberg effect.
+     * (PDH behaves erratically if the counters are
+     * queried too often, especially counters that
+     * store and use values from two consecutive updates,
+     * like cpu load.)
+     */
     if (now - query->lastUpdate > MIN_UPDATE_INTERVAL) {
         if (PdhCollectQueryData_i(query->query) != ERROR_SUCCESS) {
             return -1;
@@ -358,500 +1013,308 @@
     if (PdhGetFormattedCounterValue_i(c, format, NULL, value) != ERROR_SUCCESS) {
         return -2;
     }
-    return CONFIG_SUCCESSFUL;
-}
 
-/**
- * Places the resolved counter name of the counter at the specified index in the
- * supplied buffer. There must be enough space in the buffer to hold the counter name.
- *
- * @param index   the counter index as specified in the registry.
- * @param buf     the buffer in which to place the counter name.
- * @param size      the size of the counter name buffer.
- * @param ebuf    the error message buffer.
- * @param elen    the length of the error buffer.
- * @return        CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-find_name(DWORD index, char *buf, DWORD size) {
-    PDH_STATUS res;
-
-    if ((res = PdhLookupPerfNameByIndex_i(NULL, index, buf, &size)) != ERROR_SUCCESS) {
-
-        /* printf("Could not open counter %d: error=0x%08x", index, res); */
-        /* if (res == PDH_CSTATUS_NO_MACHINE) { */
-        /*      printf("User probably does not have sufficient privileges to use"); */
-        /*      printf("performance counters. If you are running on Windows 2003"); */
-        /*      printf("or Windows Vista, make sure the user is in the"); */
-        /*      printf("Performance Logs user group."); */
-        /* } */
-        return -1;
-    }
-
-    if (size == 0) {
-        /* printf("Failed to get counter name for %d: empty string", index); */
-        return -1;
-    }
-
-    // windows vista does not null-terminate the string (allthough the docs says it will)
-    buf[size - 1] = '\0';
-    return CONFIG_SUCCESSFUL;
-}
-
-/**
- * Sets up the supplied SingleCounterQuery to listen for the specified counter.
- * initPDH() must have been run prior to calling this function!
- *
- * @param counterQuery   the counter query to set up.
- * @param counterString  the string specifying the path to the counter.
- * @param ebuf           the error buffer.
- * @param elen           the length of the error buffer.
- * @returns              CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initSingleCounterQuery(SingleCounterQueryP counterQuery, char *counterString) {
-    if (PdhOpenQuery_i(NULL, 0, &counterQuery->query.query) != ERROR_SUCCESS) {
-        /* printf("Could not open query for %s", counterString); */
-        return -1;
-    }
-    if (PdhAddCounter_i(counterQuery->query.query, counterString, 0, &counterQuery->counter) != ERROR_SUCCESS) {
-        /* printf("Could not add counter %s for query", counterString); */
-        if (counterQuery->counter != NULL) {
-            PdhRemoveCounter_i(counterQuery->counter);
-        }
-        if (counterQuery->query.query != NULL) {
-            PdhCloseQuery_i(counterQuery->query.query);
-        }
-        memset(counterQuery, 0, sizeof(SingleCounterQueryS));
-        return -1;
-    }
-    return CONFIG_SUCCESSFUL;
-}
-
-/**
- * Sets up the supplied SingleCounterQuery to listen for the time spent
- * by the HotSpot process.
- *
- * @param counterQuery   the counter query to set up as a process counter.
- * @param ebuf           the error buffer.
- * @param elen           the length of the error buffer.
- * @returns              CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initProcLoadCounter(void) {
-    char time[COUNTER_BUF_SIZE];
-    char counter[COUNTER_BUF_SIZE*2];
-
-    if (find_name(PDH_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    _snprintf(counter, sizeof(counter)-1, "%s\\%s", getProcessPDHHeader(), time);
-    return initSingleCounterQuery(&cntProcLoad, counter);
+    return 0;
 }
 
 static int
-initProcSystemLoadCounter(void) {
-    char time[COUNTER_BUF_SIZE];
-    char counter[COUNTER_BUF_SIZE*2];
+allocateAndInitializePdhConstants() {
+    const char* pdhLocalizedProcessObject = NULL;
+    const char* pdhLocalizedIDProcessCounter = NULL;
+    size_t pdhIDProcessCounterFmtLen;
+    int currentQueryIndex;
+    int retValue = -1;
 
-    if (find_name(PDH_PRIV_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    _snprintf(counter, sizeof(counter)-1, "%s\\%s", getProcessPDHHeader(), time);
-    return initSingleCounterQuery(&cntProcSystemLoad, counter);
-}
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
 
-/**
- * Sets up the supplied MultipleCounterQuery to check on the processors.
- * (Comment: Refactor and prettify as with the the SingleCounter queries
- * if more MultipleCounterQueries are discovered.)
- *
- * initPDH() must have been run prior to calling this function.
- *
- * @param multiQuery  a pointer to a MultipleCounterQueryS, will be filled in with
- *                    the necessary info to check the PDH processor counters.
- * @return            CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initProcessorCounters(void) {
-    char          processor[COUNTER_BUF_SIZE]; //'Processor' == #238
-    char          time[COUNTER_BUF_SIZE];      //'Time' == 6
-    DWORD      c_size, i_size;
-    HQUERY     tmpQuery;
-    DWORD      i, p_count;
-    BOOL          error;
-    char         *instances, *tmp;
-    PDH_STATUS pdhStat;
-
-    c_size   = i_size = 0;
-    tmpQuery = NULL;
-    error    = false;
-
-    // This __try / __except stuff is there since Windows 2000 beta (or so) sometimes triggered
-    // an access violation when the user had insufficient privileges to use the performance
-    // counters. This was previously guarded by a very ugly piece of code which disabled the
-    // global trap handling in JRockit. Don't know if this really is needed anymore, but otoh,
-    // if we keep it we don't crash on Win2k beta. /Ihse, 2005-05-30
-    __try {
-        if (find_name(PDH_PROCESSOR_IDX, processor, sizeof(processor)-1) < 0) {
-            return -1;
-        }
-    } __except (EXCEPTION_EXECUTE_HANDLER) { // We'll catch all exceptions here.
-        /* printf("User does not have sufficient privileges to use performance counters"); */
-        return -1;
-    }
-
-    if (find_name(PDH_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    //ok, now we have enough to enumerate all processors.
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processor,          // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    NULL,              // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-    if (pdh_fail(pdhStat)) {
-        /* printf("could not enumerate processors (1) error=%d", pdhStat); */
-        return -1;
-    }
-
-    // use calloc because windows vista does not null terminate the instance names (allthough the docs says it will)
-    instances = calloc(i_size, 1);
-    if (instances == NULL) {
-        /* printf("could not allocate memory (1) %d bytes", i_size); */
-        error = true;
+    assert(!pdhProcessImageName);
+    pdhProcessImageName = getPdhProcessImageName();
+    if (!pdhProcessImageName) {
         goto end;
     }
 
-    c_size  = 0;
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processor,              // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    instances,          // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-
-    if (pdh_fail(pdhStat)) {
-        /* printf("could not enumerate processors (2) error=%d", pdhStat); */
-        error = true;
-        goto end;
-    }
-    //count perf count instances.
-    for (p_count = 0, tmp = instances; *tmp != 0; tmp = &tmp[lstrlen(tmp)+1], p_count++);
-
-    //is this correct for HT?
-    assert(p_count == num_cpus+1);
-
-    //ok, have number of perf counters.
-    multiCounterCPULoad.counters = calloc(p_count, sizeof(HCOUNTER));
-    if (multiCounterCPULoad.counters == NULL) {
-        /* printf("could not allocate memory (2) count=%d", p_count); */
-        error = true;
+    pdhLocalizedProcessObject = getPdhLocalizedArtifact(PDH_PROCESS_IDX);
+    if (!pdhLocalizedProcessObject) {
         goto end;
     }
 
-    multiCounterCPULoad.noOfCounters = p_count;
-
-    if (PdhOpenQuery_i(NULL, 0, &multiCounterCPULoad.query.query) != ERROR_SUCCESS) {
-        /* printf("could not create query"); */
-        error = true;
+    pdhLocalizedIDProcessCounter = getPdhLocalizedArtifact(PDH_ID_PROCESS_IDX);
+    if (!pdhLocalizedIDProcessCounter) {
         goto end;
     }
-    //now, fetch the counters.
-    for (i = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[lstrlen(tmp)+1], i++) {
-    char counter[2*COUNTER_BUF_SIZE];
 
-    _snprintf(counter, sizeof(counter)-1, "\\%s(%s)\\%s", processor, tmp, time);
+    assert(!pdhIDProcessCounterFmt);
 
-    if (PdhAddCounter_i(multiCounterCPULoad.query.query, counter, 0, &multiCounterCPULoad.counters[i]) != ERROR_SUCCESS) {
-            /* printf("error adding processor counter %s", counter); */
-            error = true;
-            goto end;
-        }
+    pdhIDProcessCounterFmtLen = strlen(pdhProcessImageName);
+    pdhIDProcessCounterFmtLen += strlen(pdhLocalizedProcessObject);
+    pdhIDProcessCounterFmtLen += strlen(pdhLocalizedIDProcessCounter);
+    pdhIDProcessCounterFmtLen += PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN;
+    pdhIDProcessCounterFmtLen += 2; // "%d"
+
+    assert(pdhIDProcessCounterFmtLen < MAX_PATH);
+    pdhIDProcessCounterFmt = malloc(pdhIDProcessCounterFmtLen + 1);
+    if (!pdhIDProcessCounterFmt) {
+        goto end;
     }
 
-    free(instances);
-    instances = NULL;
+    /* "\Process(java#%d)\ID Process" */
+    _snprintf(pdhIDProcessCounterFmt,
+              pdhIDProcessCounterFmtLen,
+              PROCESS_OBJECT_INSTANCE_COUNTER_FMT,
+              pdhLocalizedProcessObject,
+              pdhProcessImageName,
+              "%d",
+              pdhLocalizedIDProcessCounter);
 
-    // Query once to initialize the counters needing at least two queries
-    // (like the % CPU usage) to calculate correctly.
-    if (PdhCollectQueryData_i(multiCounterCPULoad.query.query) != ERROR_SUCCESS)
-        error = true;
+    pdhIDProcessCounterFmt[pdhIDProcessCounterFmtLen] = '\0';
 
- end:
-    if (instances != NULL) {
-        free(instances);
+    assert(0 == numberOfJavaProcessesAtInitialization);
+    currentQueryIndex = currentQueryIndexForProcess();
+    if (-1 == currentQueryIndex) {
+        goto end;
     }
-    if (tmpQuery != NULL) {
-        PdhCloseQuery_i(tmpQuery);
-    }
-    if (error) {
-        int i;
 
-        if (multiCounterCPULoad.counters != NULL) {
-            for (i = 0; i < multiCounterCPULoad.noOfCounters; i++) {
-                if (multiCounterCPULoad.counters[i] != NULL) {
-                    PdhRemoveCounter_i(multiCounterCPULoad.counters[i]);
+    numberOfJavaProcessesAtInitialization = currentQueryIndex + 1;
+    assert(numberOfJavaProcessesAtInitialization >= 1);
+
+    retValue = 0;
+
+  end:
+
+    if (pdhLocalizedProcessObject) {
+        free((char*)pdhLocalizedProcessObject);
+    }
+
+    if (pdhLocalizedIDProcessCounter) {
+        free((char*)pdhLocalizedIDProcessCounter);
+    }
+
+    return retValue;
+}
+
+static void
+deallocatePdhConstants() {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    if (pdhProcessImageName) {
+        free((char*)pdhProcessImageName);
+        pdhProcessImageName = NULL;
+    }
+
+    if (pdhIDProcessCounterFmt) {
+      free(pdhIDProcessCounterFmt);
+      pdhIDProcessCounterFmt = NULL;
+    }
+
+    numberOfJavaProcessesAtInitialization = 0;
+}
+
+static int
+initializeCPUCounters() {
+    SYSTEM_INFO si;
+    char* localizedProcessObject;
+    char* localizedProcessorTimeCounter;
+    int i;
+    int retValue = -1;
+
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    assert(0 == numCpus);
+    GetSystemInfo(&si);
+    numCpus = si.dwNumberOfProcessors;
+    assert(numCpus >= 1);
+
+    /* Initialize the denominator for the jvm load calculations */
+    assert(.0 == cpuFactor);
+    cpuFactor = numCpus * 100;
+
+    if (lookupNameByIndex(PDH_PROCESS_IDX,
+                          &localizedProcessObject) == 0) {
+
+        if (lookupNameByIndex(PDH_PROCESSOR_TIME_IDX,
+                              &localizedProcessorTimeCounter) == 0) {
+
+            assert(processTotalCPULoad);
+            assert(pdhProcessImageName);
+
+            for (i = 0; i < numberOfJavaProcessesAtInitialization; ++i) {
+                char instanceIndexBuffer[32];
+                retValue = initializeSingleCounter(&processTotalCPULoad[i],
+                                                   localizedProcessObject,
+                                                   localizedProcessorTimeCounter,
+                                                   pdhProcessImageName,
+                                                   itoa(i, instanceIndexBuffer, 10),
+                                                   TRUE);
+                if (retValue != 0) {
+                    break;
                 }
             }
-            free(multiCounterCPULoad.counters[i]);
+            free(localizedProcessorTimeCounter);
         }
-        if (multiCounterCPULoad.query.query != NULL) {
-            PdhCloseQuery_i(multiCounterCPULoad.query.query);
-        }
-        memset(&multiCounterCPULoad, 0, sizeof(MultipleCounterQueryS));
+        free(localizedProcessObject);
+    }
+
+    if (retValue != 0) {
         return -1;
     }
-    return CONFIG_SUCCESSFUL;
+
+    assert(multiCounterCPULoad);
+    return initializeMultipleCounterForCPUs(multiCounterCPULoad);
 }
 
-/**
- * Help function that initializes the PDH process header for the JRockit process.
- * (You should probably use getProcessPDHHeader() instead!)
- *
- * initPDH() must have been run prior to calling this function.
- *
- * @param ebuf the error buffer.
- * @param elen the length of the error buffer.
- *
- * @return the PDH instance description corresponding to the JVM process.
- */
-static char*
-initProcessPDHHeader(void) {
-    static char hotspotheader[2*COUNTER_BUF_SIZE];
+static void
+deallocateCPUCounters() {
+    int i;
 
-    char           counter[2*COUNTER_BUF_SIZE];
-    char           processes[COUNTER_BUF_SIZE];   //'Process' == #230
-    char           pid[COUNTER_BUF_SIZE];           //'ID Process' == 784
-    char           module_name[MAX_PATH];
-    PDH_STATUS  pdhStat;
-    DWORD       c_size = 0, i_size = 0;
-    HQUERY      tmpQuery = NULL;
-    int           i, myPid = _getpid();
-    BOOL           error = false;
-    char          *instances, *tmp, *instance_name, *dot_pos;
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
 
-    tmpQuery = NULL;
-    myPid    = _getpid();
-    error    = false;
-
-    if (find_name(PDH_PROCESS_IDX, processes, sizeof(processes) - 1) < 0) {
-        return NULL;
-    }
-
-    if (find_name(PDH_ID_PROCESS_IDX, pid, sizeof(pid) - 1) < 0) {
-        return NULL;
-    }
-    //time is same.
-
-    c_size = 0;
-    i_size = 0;
-
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processes,              // object to enumerate
-                    NULL,                   // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    NULL,              // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-
-    //ok, now we have enough to enumerate all processes
-    if (pdh_fail(pdhStat)) {
-        /* printf("Could not enumerate processes (1) error=%d", pdhStat); */
-        return NULL;
-    }
-
-    // use calloc because windows vista does not null terminate the instance names (allthough the docs says it will)
-    if ((instances = calloc(i_size, 1)) == NULL) {
-        /* printf("Could not allocate memory %d bytes", i_size); */
-        error = true;
-        goto end;
-    }
-
-    c_size = 0;
-
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processes,              // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    instances,          // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-
-    // ok, now we have enough to enumerate all processes
-    if (pdh_fail(pdhStat)) {
-        /* printf("Could not enumerate processes (2) error=%d", pdhStat); */
-        error = true;
-        goto end;
-    }
-
-    if (PdhOpenQuery_i(NULL, 0, &tmpQuery) != ERROR_SUCCESS) {
-        /* printf("Could not create temporary query"); */
-        error = true;
-        goto end;
-    }
-
-    // Find our module name and use it to extract the instance name used by PDH
-    if (GetModuleFileName(NULL, module_name, MAX_PATH) >= MAX_PATH-1) {
-        /* printf("Module name truncated"); */
-        error = true;
-        goto end;
-    }
-    instance_name = strrchr(module_name, '\\'); //drop path
-    instance_name++;                            //skip slash
-    dot_pos = strchr(instance_name, '.');       //drop .exe
-    dot_pos[0] = '\0';
-
-    //now, fetch the counters.
-    for (tmp = instances; *tmp != 0 && !error; tmp = &tmp[lstrlen(tmp)+1]) {
-        HCOUNTER  hc = NULL;
-        BOOL done = false;
-
-        // Skip until we find our own process name
-        if (strcmp(tmp, instance_name) != 0) {
-            continue;
+    if (processTotalCPULoad) {
+        for (i = 0; i < numberOfJavaProcessesAtInitialization; ++i) {
+            destroySingleCounter(&processTotalCPULoad[i]);
         }
+        free(processTotalCPULoad);
+        processTotalCPULoad = NULL;
+    }
 
-        // iterate over all instance indexes and try to find our own pid
-        for (i = 0; !done && !error; i++){
-            PDH_STATUS res;
-            _snprintf(counter, sizeof(counter)-1, "\\%s(%s#%d)\\%s", processes, tmp, i, pid);
+    if (multiCounterCPULoad) {
+        destroyMultiCounter(multiCounterCPULoad);
+        free(multiCounterCPULoad);
+        multiCounterCPULoad = NULL;
+    }
 
-            if (PdhAddCounter_i(tmpQuery, counter, 0, &hc) != ERROR_SUCCESS) {
-                /* printf("Failed to create process id query"); */
-                error = true;
-                goto end;
+    cpuFactor = .0;
+    numCpus = 0;
+}
+
+static void
+pdhInitErrorHandler(HMODULE h) {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    deallocatePdhConstants();
+
+    if (h) {
+        FreeLibrary(h);
+    }
+}
+
+/*
+ * Helper to initialize the PDH library, function pointers and constants.
+ *
+ * @return  0 if successful, negative on failure.
+ */
+static int
+pdhInit() {
+    static BOOL initialized = FALSE;
+    int retValue;
+
+    if (initialized) {
+        return 0;
+    }
+
+    retValue = 0;
+
+    EnterPdhCriticalSection(&initializationLock); {
+        if (!initialized) {
+            HMODULE h = NULL;
+            if ((h = LoadLibrary("pdh.dll")) == NULL) {
+                retValue = -1;
+            } else if (bindPdhFunctionPointers(h) < 0) {
+                retValue = -1;
+            } else if (allocateAndInitializePdhConstants() < 0) {
+                retValue = -1;
             }
 
-            res = PdhCollectQueryData_i(tmpQuery);
-
-            if (res == PDH_INVALID_HANDLE) {
-                /* printf("Failed to query process id"); */
-                res = -1;
-                done = true;
-            } else if (res == PDH_NO_DATA) {
-                done = true;
+            if (0 == retValue) {
+                initialized = TRUE;
             } else {
-                PDH_FMT_COUNTERVALUE cv;
-
-                PdhGetFormattedCounterValue_i(hc, PDH_FMT_LONG, NULL, &cv);
-               /*
-                 * This check seems to be needed for Win2k SMP boxes, since
-                 * they for some reason don't return PDH_NO_DATA for non existing
-                 * counters.
-                 */
-                if (cv.CStatus != PDH_CSTATUS_VALID_DATA) {
-                    done = true;
-                } else if (cv.longValue == myPid) {
-                    _snprintf(hotspotheader, sizeof(hotspotheader)-1, "\\%s(%s#%d)\0", processes, tmp, i);
-                    PdhRemoveCounter_i(hc);
-                    goto end;
-                }
+                pdhInitErrorHandler(h);
             }
-            PdhRemoveCounter_i(hc);
         }
-    }
- end:
-    if (instances != NULL) {
-        free(instances);
-    }
-    if (tmpQuery != NULL) {
-        PdhCloseQuery_i(tmpQuery);
-    }
-    if (error) {
-        return NULL;
-    }
-    return hotspotheader;
+    } LeavePdhCriticalSection(&initializationLock);
+
+    return retValue;
 }
 
-/**
- * Returns the PDH string prefix identifying the HotSpot process. Use this prefix when getting
- * counters from the PDH process object representing HotSpot.
- *
- * Note: this call may take some time to complete.
- *
- * @param ebuf error buffer.
- * @param elen error buffer length.
- *
- * @return the header to be used when retrieving PDH counters from the HotSpot process.
- * Will return NULL if the call failed.
- */
-static char *
-getProcessPDHHeader(void) {
-    static char *processHeader = NULL;
+static int
+allocateCPUCounters() {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+    assert(numberOfJavaProcessesAtInitialization >= 1);
+    assert(!processTotalCPULoad);
+    assert(!multiCounterCPULoad);
 
-    EnterCriticalSection(&processHeaderLock); {
-        if (processHeader == NULL) {
-            processHeader = initProcessPDHHeader();
-        }
-    } LeaveCriticalSection(&processHeaderLock);
-    return processHeader;
+    /*
+     * Create an array of Process object queries, for each instance
+     * up to and including our own (java#0, java#1, java#2, ...).
+     */
+    processTotalCPULoad = calloc(numberOfJavaProcessesAtInitialization,
+                                 sizeof(SingleCounterQueryS));
+
+    if (!processTotalCPULoad) {
+        return -1;
+    }
+
+    multiCounterCPULoad = calloc(1, sizeof(MultipleCounterQueryS));
+
+    if (!multiCounterCPULoad) {
+        return -1;
+    }
+
+    return 0;
 }
 
-int perfInit(void);
+static int
+initializePdhCPUCounters() {
+    static BOOL initialized = FALSE;
+    int retValue;
 
-double
-perfGetCPULoad(int which)
-{
+    if (initialized) {
+        return 0;
+    }
+
+    retValue = 0;
+
+    EnterPdhCriticalSection(&initializationLock); {
+        if (!initialized) {
+            if (pdhInit() < 0) {
+                retValue = -1;
+            }  else if (allocateCPUCounters() < 0) {
+                retValue = -1;
+            } else if (initializeCPUCounters() < 0) {
+                retValue = -1;
+            }
+
+            if (0 == retValue) {
+                initialized = TRUE;
+            } else {
+              deallocateCPUCounters();
+            }
+        }
+    } LeavePdhCriticalSection(&initializationLock);
+
+    return retValue;
+}
+
+static int
+perfCPUInit() {
+    return initializePdhCPUCounters();
+}
+
+static double
+perfGetProcessCPULoad() {
     PDH_FMT_COUNTERVALUE cv;
-    HCOUNTER            c;
+    int currentQueryIndex;
 
-    if (perfInit() < 0) {
+    if (perfCPUInit() < 0) {
         // warn?
         return -1.0;
     }
 
-    if (multiCounterCPULoad.query.query == NULL) {
-        // warn?
-        return -1.0;
-    }
+    currentQueryIndex = getCurrentQueryIndexForProcess();
 
-    if (which == -1) {
-        c = multiCounterCPULoad.counters[multiCounterCPULoad.noOfCounters - 1];
-    } else {
-        if (which < multiCounterCPULoad.noOfCounters) {
-            c = multiCounterCPULoad.counters[which];
-        } else {
-            return -1.0;
-        }
-    }
-    if (getPerformanceData(&multiCounterCPULoad.query, c, &cv, PDH_FMT_DOUBLE ) == CONFIG_SUCCESSFUL) {
-        return cv.doubleValue / 100;
-    }
-    return -1.0;
-}
-
-double
-perfGetProcessLoad(void)
-{
-    PDH_FMT_COUNTERVALUE cv;
-
-    if (perfInit() < 0) {
-        // warn?
-        return -1.0;
-    }
-
-    if (cntProcLoad.query.query == NULL) {
-        // warn?
-        return -1.0;
-    }
-
-    if (getPerformanceData(&cntProcLoad.query, cntProcLoad.counter, &cv, PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == CONFIG_SUCCESSFUL) {
+    if (getPerformanceData(&processTotalCPULoad[currentQueryIndex].query,
+                           processTotalCPULoad[currentQueryIndex].counter,
+                           &cv,
+                           PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == 0) {
         double d = cv.doubleValue / cpuFactor;
         d = min(1, d);
         d = max(0, d);
@@ -860,70 +1323,29 @@
     return -1.0;
 }
 
-/**
- * Helper to initialize the PDH library. Loads the library and sets up the functions.
- * Note that once loaded, we will never unload the PDH library.
- *
- * @return  CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-int
-perfInit(void) {
-    static HMODULE    h;
-    static BOOL        running, inited;
+static double
+perfGetCPULoad(int which) {
+    PDH_FMT_COUNTERVALUE cv;
+    HCOUNTER c;
 
-    int error;
-
-    if (running) {
-        return CONFIG_SUCCESSFUL;
+    if (perfCPUInit() < 0) {
+        // warn?
+        return -1.0;
     }
 
-    error = CONFIG_SUCCESSFUL;
-
-    // this is double checked locking again, but we try to bypass the worst by
-    // implicit membar at end of lock.
-    EnterCriticalSection(&initializationLock); {
-        if (!inited) {
-            char         buf[64] = "";
-            SYSTEM_INFO si;
-
-            // CMH. But windows will not care about our affinity when giving
-            // us measurements. Need the real, raw num cpus.
-
-            GetSystemInfo(&si);
-            num_cpus  = si.dwNumberOfProcessors;
-            // Initialize the denominator for the jvm load calculations
-            cpuFactor = num_cpus * 100;
-
-            /**
-             * Do this dynamically, so we don't fail to start on systems without pdh.
-             */
-            if ((h = LoadLibrary("pdh.dll")) == NULL) {
-                /* printf("Could not load pdh.dll (%d)", GetLastError()); */
-                error = -2;
-            } else if (get_functions(h, buf, sizeof(buf)) < 0) {
-                FreeLibrary(h);
-                h = NULL;
-                error = -2;
-               /* printf("Failed to init pdh functions: %s.\n", buf); */
-            } else {
-                if (initProcessorCounters() != 0) {
-                    /* printf("Failed to init system load counters.\n"); */
-                } else if (initProcLoadCounter() != 0) {
-                    /* printf("Failed to init process load counter.\n"); */
-                } else if (initProcSystemLoadCounter() != 0) {
-                    /* printf("Failed to init process system load counter.\n"); */
-                } else {
-                    inited = true;
-                }
-            }
+    if (-1 == which) {
+        c = multiCounterCPULoad->counters[multiCounterCPULoad->noOfCounters - 1];
+    } else {
+        if (which < multiCounterCPULoad->noOfCounters) {
+            c = multiCounterCPULoad->counters[which];
+        } else {
+            return -1.0;
         }
-    } LeaveCriticalSection(&initializationLock);
-
-    if (inited && error == CONFIG_SUCCESSFUL) {
-        running = true;
     }
-
-    return error;
+    if (getPerformanceData(&multiCounterCPULoad->query, c, &cv, PDH_FMT_DOUBLE ) == 0) {
+        return cv.doubleValue / 100;
+    }
+    return -1.0;
 }
 
 JNIEXPORT jdouble JNICALL
@@ -937,5 +1359,5 @@
 Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
 (JNIEnv *env, jobject dummy)
 {
-    return perfGetProcessLoad();
+    return perfGetProcessCPULoad();
 }
diff --git a/src/windows/native/sun/nio/ch/Net.c b/src/windows/native/sun/nio/ch/Net.c
index 9720d80..fb0faa8 100644
--- a/src/windows/native/sun/nio/ch/Net.c
+++ b/src/windows/native/sun/nio/ch/Net.c
@@ -295,9 +295,9 @@
     /**
      * HACK: IP_TOS is deprecated on Windows and querying the option
      * returns a protocol error. NET_GetSockOpt handles this and uses
-     * a fallback mechanism.
+     * a fallback mechanism. Same applies to IPV6_TCLASS
      */
-    if (level == IPPROTO_IP && opt == IP_TOS) {
+    if ((level == IPPROTO_IP && opt == IP_TOS) || (level == IPPROTO_IPV6 && opt == IPV6_TCLASS)) {
         mayNeedConversion = JNI_TRUE;
     }
 
@@ -319,7 +319,7 @@
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level, jint opt, jint arg, jboolean ipv6)
 {
     struct linger linger;
     char *parg;
@@ -340,6 +340,11 @@
         arglen = sizeof(arg);
     }
 
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS) {
+        /* No op */
+        return;
+    }
+
     if (mayNeedConversion) {
         n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen);
     } else {
diff --git a/src/windows/native/sun/security/krb5/NativeCreds.c b/src/windows/native/sun/security/krb5/NativeCreds.c
index 7431333..ab0ee03 100644
--- a/src/windows/native/sun/security/krb5/NativeCreds.c
+++ b/src/windows/native/sun/security/krb5/NativeCreds.c
@@ -463,6 +463,10 @@
         netypes = (*env)->GetArrayLength(env, jetypes);
         etypes = (jint *) (*env)->GetIntArrayElements(env, jetypes, NULL);
 
+        if (etypes == NULL) {
+            break;
+        }
+
         // check TGT validity
         if (native_debug) {
             printf("LSA: TICKET SessionKey KeyType is %d\n", msticket->SessionKey.KeyType);
@@ -952,8 +956,7 @@
         if (native_debug) {
             printf("LSA: Can't allocate String array for Principal\n");
         }
-        LocalFree(realm);
-        return principal;
+        goto cleanup;
     }
 
     for (i=0; i<nameCount; i++) {
@@ -963,18 +966,32 @@
         // OK, got a Char array, so construct a String
         tempString = (*env)->NewString(env, (const jchar*)scanner->Buffer,
                             scanner->Length/sizeof(WCHAR));
+
+        if (tempString == NULL) {
+            goto cleanup;
+        }
+
         // Set the String into the StringArray
         (*env)->SetObjectArrayElement(env, stringArray, i, tempString);
 
+        if ((*env)->ExceptionCheck(env)) {
+            goto cleanup;
+        }
+
         // Do I have to worry about storage reclamation here?
     }
     // now set the realm in the principal
     realmLen = (ULONG)wcslen((PWCHAR)realm);
     realmStr = (*env)->NewString(env, (PWCHAR)realm, (USHORT)realmLen);
 
+    if (realmStr == NULL) {
+        goto cleanup;
+    }
+
     principal = (*env)->NewObject(env, principalNameClass,
                     principalNameConstructor, stringArray, realmStr);
 
+cleanup:
     // free local resources
     LocalFree(realm);
 
diff --git a/src/windows/native/sun/security/mscapi/security.cpp b/src/windows/native/sun/security/mscapi/security.cpp
index 49cbe81..8b5d8ae 100644
--- a/src/windows/native/sun/security/mscapi/security.cpp
+++ b/src/windows/native/sun/security/mscapi/security.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,10 @@
     const char* pszHashAlgorithm = NULL;
     ALG_ID algId = 0;
 
-    pszHashAlgorithm = env->GetStringUTFChars(jHashAlgorithm, NULL);
+    if ((pszHashAlgorithm = env->GetStringUTFChars(jHashAlgorithm, NULL))
+        == NULL) {
+        return algId;
+    }
 
     if ((strcmp("SHA", pszHashAlgorithm) == 0) ||
         (strcmp("SHA1", pszHashAlgorithm) == 0) ||
@@ -179,7 +182,9 @@
          */
         if (length < 0) {
             length = env->GetArrayLength(seed);
-            reseedBytes = env->GetByteArrayElements(seed, 0);
+            if ((reseedBytes = env->GetByteArrayElements(seed, 0)) == NULL) {
+                __leave;
+            }
 
             if (::CryptGenRandom(
                 hCryptProv,
@@ -211,7 +216,9 @@
         } else { // length == 0
 
             length = env->GetArrayLength(seed);
-            seedBytes = env->GetByteArrayElements(seed, 0);
+            if ((seedBytes = env->GetByteArrayElements(seed, 0)) == NULL) {
+                __leave;
+            }
 
             if (::CryptGenRandom(
                 hCryptProv,
@@ -275,7 +282,10 @@
     __try
     {
         // Open a system certificate store.
-        pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL);
+        if ((pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL))
+            == NULL) {
+            __leave;
+        }
         if ((hCertStore = ::CertOpenSystemStore(NULL, pszCertStoreName))
             == NULL) {
 
@@ -710,7 +720,10 @@
 
     __try
     {
-        pszKeyContainerName = env->GetStringUTFChars(keyContainerName, NULL);
+        if ((pszKeyContainerName =
+            env->GetStringUTFChars(keyContainerName, NULL)) == NULL) {
+            __leave;
+        }
 
         // Acquire a CSP context (create a new key container).
         // Prefer a PROV_RSA_AES CSP, when available, due to its support
@@ -847,7 +860,10 @@
     __try
     {
         // Open a system certificate store.
-        pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL);
+        if ((pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL))
+            == NULL) {
+            __leave;
+        }
         if ((hCertStore = ::CertOpenSystemStore(NULL, pszCertStoreName)) == NULL) {
             ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
             __leave;
@@ -1086,7 +1102,10 @@
     __try
     {
         // Open a system certificate store.
-        pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL);
+        if ((pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL))
+            == NULL) {
+            __leave;
+        }
         if ((hCertStore = ::CertOpenSystemStore(NULL, pszCertStoreName)) == NULL) {
             ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
             __leave;
@@ -1123,7 +1142,10 @@
                 cchNameString);
 
             // Compare the certificate's friendly name with supplied alias name
-            pszCertAliasName = env->GetStringUTFChars(jCertAliasName, NULL);
+            if ((pszCertAliasName = env->GetStringUTFChars(jCertAliasName, NULL))
+                == NULL) {
+                __leave;
+            }
             if (strcmp(pszCertAliasName, pszNameString) == 0) {
 
                 // Only delete the certificate if the alias names matches
@@ -1181,7 +1203,10 @@
 
     __try
     {
-        pszKeyContainerName = env->GetStringUTFChars(keyContainerName, NULL);
+        if ((pszKeyContainerName =
+            env->GetStringUTFChars(keyContainerName, NULL)) == NULL) {
+            __leave;
+        }
 
         // Destroying the default key container is not permitted
         // (because it may contain more one keypair).
@@ -1234,8 +1259,14 @@
 
     __try
     {
-        pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL);
-        pszCertAliasName = env->GetStringUTFChars(jCertAliasName, NULL);
+        if ((pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL))
+            == NULL) {
+            __leave;
+        }
+        if ((pszCertAliasName = env->GetStringUTFChars(jCertAliasName, NULL))
+            == NULL) {
+            __leave;
+        }
 
         // Open a system certificate store.
         if ((hCertStore = ::CertOpenSystemStore(NULL, pszCertStoreName)) == NULL) {
@@ -1530,7 +1561,9 @@
     __try {
 
         jsize length = env->GetArrayLength(jKeyBlob);
-        keyBlob = env->GetByteArrayElements(jKeyBlob, 0);
+        if ((keyBlob = env->GetByteArrayElements(jKeyBlob, 0)) == NULL) {
+            __leave;
+        }
 
         PUBLICKEYSTRUC* pPublicKeyStruc = (PUBLICKEYSTRUC *) keyBlob;
 
@@ -1580,7 +1613,9 @@
     __try {
 
         jsize length = env->GetArrayLength(jKeyBlob);
-        keyBlob = env->GetByteArrayElements(jKeyBlob, 0);
+        if ((keyBlob = env->GetByteArrayElements(jKeyBlob, 0)) == NULL) {
+            __leave;
+        }
 
         PUBLICKEYSTRUC* pPublicKeyStruc = (PUBLICKEYSTRUC *) keyBlob;
 
@@ -1632,6 +1667,9 @@
     }
 
     jbyte* sourceBytes = env->GetByteArrayElements(source, 0);
+    if (sourceBytes == NULL) {
+        return -1;
+    }
 
     // Copy bytes from the end of the source array to the beginning of the
     // destination array (until the destination array is full).
@@ -1740,45 +1778,61 @@
         }
         // The length argument must be the smaller of jPublicExponentLength
         // and sizeof(pRsaPubKey->pubkey)
-        convertToLittleEndian(env, jPublicExponent,
-            (jbyte *) &(pRsaPubKey->pubexp), jPublicExponentLength);
+        if ((jElementLength = convertToLittleEndian(env, jPublicExponent,
+            (jbyte *) &(pRsaPubKey->pubexp), jPublicExponentLength)) < 0) {
+            __leave;
+        }
 
         // Modulus n
         jBlobElement =
             (jbyte *) (jBlobBytes + sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY));
-        jElementLength = convertToLittleEndian(env, jModulus, jBlobElement,
-            jKeyByteLength);
+        if ((jElementLength = convertToLittleEndian(env, jModulus, jBlobElement,
+            jKeyByteLength)) < 0) {
+            __leave;
+        }
 
         if (bGeneratePrivateKeyBlob) {
             // Prime p
             jBlobElement += jElementLength;
-            jElementLength = convertToLittleEndian(env, jPrimeP, jBlobElement,
-                jKeyByteLength / 2);
+            if ((jElementLength = convertToLittleEndian(env, jPrimeP,
+                jBlobElement, jKeyByteLength / 2)) < 0) {
+                __leave;
+            }
 
             // Prime q
             jBlobElement += jElementLength;
-            jElementLength = convertToLittleEndian(env, jPrimeQ, jBlobElement,
-                jKeyByteLength / 2);
+            if ((jElementLength = convertToLittleEndian(env, jPrimeQ,
+                jBlobElement, jKeyByteLength / 2)) < 0) {
+                __leave;
+            }
 
             // Prime exponent p
             jBlobElement += jElementLength;
-            jElementLength = convertToLittleEndian(env, jExponentP,
-                jBlobElement, jKeyByteLength / 2);
+            if ((jElementLength = convertToLittleEndian(env, jExponentP,
+                jBlobElement, jKeyByteLength / 2)) < 0) {
+                __leave;
+            }
 
             // Prime exponent q
             jBlobElement += jElementLength;
-            jElementLength = convertToLittleEndian(env, jExponentQ,
-                jBlobElement, jKeyByteLength / 2);
+            if ((jElementLength = convertToLittleEndian(env, jExponentQ,
+                jBlobElement, jKeyByteLength / 2)) < 0) {
+                __leave;
+            }
 
             // CRT coefficient
             jBlobElement += jElementLength;
-            jElementLength = convertToLittleEndian(env, jCrtCoefficient,
-                jBlobElement, jKeyByteLength / 2);
+            if ((jElementLength = convertToLittleEndian(env, jCrtCoefficient,
+                jBlobElement, jKeyByteLength / 2)) < 0) {
+                __leave;
+            }
 
             // Private exponent
             jBlobElement += jElementLength;
-            convertToLittleEndian(env, jPrivateExponent, jBlobElement,
-                jKeyByteLength);
+            if ((jElementLength = convertToLittleEndian(env, jPrivateExponent,
+                jBlobElement, jKeyByteLength)) < 0) {
+                __leave;
+            }
         }
 
         jBlob = env->NewByteArray(jBlobLength);
@@ -1849,9 +1903,15 @@
 
     __try
     {
-        pszKeyContainerName = env->GetStringUTFChars(keyContainerName, NULL);
+        if ((pszKeyContainerName =
+            env->GetStringUTFChars(keyContainerName, NULL)) == NULL) {
+            __leave;
+        }
         dwBlobLen = env->GetArrayLength(keyBlob);
-        pbKeyBlob = (BYTE *) env->GetByteArrayElements(keyBlob, 0);
+        if ((pbKeyBlob = (BYTE *) env->GetByteArrayElements(keyBlob, 0))
+            == NULL) {
+            __leave;
+        }
 
         // Acquire a CSP context (create a new key container).
         if (::CryptAcquireContext(
@@ -1923,7 +1983,10 @@
     __try
     {
         dwBlobLen = env->GetArrayLength(keyBlob);
-        pbKeyBlob = (BYTE *) env->GetByteArrayElements(keyBlob, 0);
+        if ((pbKeyBlob = (BYTE *) env->GetByteArrayElements(keyBlob, 0))
+            == NULL) {
+            __leave;
+        }
 
         // Acquire a CSP context (create a new key container).
         // Prefer a PROV_RSA_AES CSP, when available, due to its support
diff --git a/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c b/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
index 8d7f753..d239f02 100644
--- a/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
+++ b/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,11 +59,16 @@
 
     numBytes = (*env)->GetArrayLength(env, randArray);
     randBytes = (*env)->GetByteArrayElements(env, randArray, NULL);
+    if (randBytes == NULL) {
+        goto cleanup;
+    }
+
     if (CryptGenRandom(hCryptProv, numBytes, randBytes)) {
         result = JNI_TRUE;
     }
     (*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0);
 
+cleanup:
     CryptReleaseContext(hCryptProv, 0);
 
     return result;
diff --git a/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
index 4938b0a..c072b0c 100644
--- a/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
+++ b/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
@@ -23,6 +23,7 @@
  * questions.
  */
 #include <windows.h>
+#include <Sddl.h>
 #include <string.h>
 
 #include "jni.h"
@@ -258,6 +259,25 @@
     HANDLE hPipe;
     char name[MAX_PIPE_NAME_LENGTH];
 
+    SECURITY_ATTRIBUTES sa;
+    LPSECURITY_ATTRIBUTES lpSA = NULL;
+    // Custom Security Descriptor is required here to "get" Medium Integrity Level.
+    // In order to allow Medium Integrity Level clients to open
+    // and use a NamedPipe created by an High Integrity Level process.
+    TCHAR *szSD = TEXT("D:")                  // Discretionary ACL
+                  TEXT("(A;OICI;GRGW;;;WD)")  // Allow read/write to Everybody
+                  TEXT("(A;OICI;GA;;;SY)")    // Allow full control to System
+                  TEXT("(A;OICI;GA;;;BA)");   // Allow full control to Administrators
+
+    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+    sa.bInheritHandle = FALSE;
+    sa.lpSecurityDescriptor = NULL;
+
+    if (ConvertStringSecurityDescriptorToSecurityDescriptor
+          (szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) {
+        lpSA = &sa;
+    }
+
     jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH);
 
     hPipe = CreateNamedPipe(
@@ -270,7 +290,9 @@
           128,                          // output buffer size
           8192,                         // input buffer size
           NMPWAIT_USE_DEFAULT_WAIT,     // client time-out
-          NULL);                        // default security attribute
+          lpSA);        // security attributes
+
+    LocalFree(sa.lpSecurityDescriptor);
 
     if (hPipe == INVALID_HANDLE_VALUE) {
         JNU_ThrowIOExceptionWithLastError(env, "CreateNamedPipe failed");
@@ -341,7 +363,7 @@
         if (nread == 0) {
             return (jint)-1;        // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)nread, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)nread, (jbyte *)(buf));
         }
     }
 
@@ -386,6 +408,7 @@
     if (argsLen > 0) {
         if (argsLen > MAX_ARGS) {
             JNU_ThrowInternalError(env, "Too many arguments");
+            return;
         }
         for (i=0; i<argsLen; i++) {
             jobject obj = (*env)->GetObjectArrayElement(env, args, i);
@@ -421,6 +444,8 @@
     stubLen = (DWORD)(*env)->GetArrayLength(env, stub);
     stubCode = (*env)->GetByteArrayElements(env, stub, &isCopy);
 
+    if ((*env)->ExceptionOccurred(env)) return;
+
     pCode = (PDWORD) VirtualAllocEx( hProcess, 0, stubLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
     if (pCode == NULL) {
         JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
@@ -590,6 +615,8 @@
         cstr[0] = '\0';
     } else {
         str = JNU_GetStringPlatformChars(env, jstr, &isCopy);
+        if ((*env)->ExceptionOccurred(env)) return;
+
         strncpy(cstr, str, len);
         cstr[len-1] = '\0';
         if (isCopy) {
diff --git a/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c b/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
index 148282c..7bb1a24 100644
--- a/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
+++ b/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
@@ -24,6 +24,7 @@
  */
 
 #include "sun_util_locale_provider_HostLocaleProviderAdapterImpl.h"
+#include "jni_util.h"
 #include <windows.h>
 #include <gdefs.h>
 #include <stdlib.h>
@@ -197,8 +198,13 @@
     }
 
     localeString = (char *)getJavaIDFromLangID(langid);
+    if (localeString != NULL) {
     ret = (*env)->NewStringUTF(env, localeString);
     free(localeString);
+    } else {
+        JNU_ThrowOutOfMemoryError(env, "memory allocation error");
+        ret = NULL;
+    }
     return ret;
 }
 
@@ -211,6 +217,7 @@
   (JNIEnv *env, jclass cls, jint dateStyle, jint timeStyle, jstring jlangtag) {
     WCHAR pattern[BUFLEN];
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, NULL);
 
     pattern[0] = L'\0';
 
@@ -228,7 +235,7 @@
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
-    return (*env)->NewString(env, pattern, wcslen(pattern));
+    return (*env)->NewString(env, pattern, (jsize)wcslen(pattern));
 }
 
 /*
@@ -238,8 +245,11 @@
  */
 JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarID
   (JNIEnv *env, jclass cls, jstring jlangtag) {
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    jint ret = getCalendarID(langtag);
+    const jchar *langtag;
+    jint ret;
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, 0);
+    ret = getCalendarID(langtag);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
     return ret;
 }
@@ -252,18 +262,30 @@
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getAmPmStrings
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray ampms) {
     WCHAR buf[BUFLEN];
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    const jchar *langtag;
+    jstring tmp_string;
 
     // AM
-    int got = getLocaleInfoWrapper(langtag, LOCALE_S1159, buf, BUFLEN);
+    int got;
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, NULL);
+    got = getLocaleInfoWrapper(langtag, LOCALE_S1159, buf, BUFLEN);
     if (got) {
-        (*env)->SetObjectArrayElement(env, ampms, 0, (*env)->NewString(env, buf, wcslen(buf)));
+        tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf));
+        if (tmp_string != NULL) {
+            (*env)->SetObjectArrayElement(env, ampms, 0, tmp_string);
+        }
     }
 
+    if (!(*env)->ExceptionCheck(env)){
     // PM
     got = getLocaleInfoWrapper(langtag, LOCALE_S2359, buf, BUFLEN);
     if (got) {
-        (*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewString(env, buf, wcslen(buf)));
+            tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf));
+            if (tmp_string != NULL) {
+                (*env)->SetObjectArrayElement(env, ampms, 1, tmp_string);
+            }
+        }
     }
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
@@ -280,12 +302,17 @@
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray eras) {
     WCHAR ad[BUFLEN];
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    jstring tmp_string;
+    CHECK_NULL_RETURN(langtag, eras);
 
     getCalendarInfoWrapper(langtag, getCalendarID(langtag), NULL,
                       CAL_SERASTRING, ad, BUFLEN, NULL);
 
     // Windows does not provide B.C. era.
-    (*env)->SetObjectArrayElement(env, eras, 1, (*env)->NewString(env, ad, wcslen(ad)));
+    tmp_string = (*env)->NewString(env, ad, (jsize)wcslen(ad));
+    if (tmp_string != NULL) {
+        (*env)->SetObjectArrayElement(env, eras, 1, tmp_string);
+    }
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
@@ -347,13 +374,17 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNumberPattern
   (JNIEnv *env, jclass cls, jint numberStyle, jstring jlangtag) {
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    const jchar *langtag;
     jstring ret;
+    WCHAR * pattern;
 
-    WCHAR * pattern = getNumberPattern(langtag, numberStyle);
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, NULL);
+    pattern = getNumberPattern(langtag, numberStyle);
+    CHECK_NULL_RETURN(pattern, NULL);
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
-    ret = (*env)->NewString(env, pattern, wcslen(pattern));
+    ret = (*env)->NewString(env, pattern, (jsize)wcslen(pattern));
     free(pattern);
 
     return ret;
@@ -367,8 +398,10 @@
 JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_isNativeDigit
   (JNIEnv *env, jclass cls, jstring jlangtag) {
     DWORD num;
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag,
+    CHECK_NULL_RETURN(langtag, JNI_FALSE);
+    got = getLocaleInfoWrapper(langtag,
         LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER,
         (LPWSTR)&num, sizeof(num));
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
@@ -384,12 +417,14 @@
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCurrencySymbol
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring currencySymbol) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SCURRENCY, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, currencySymbol);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SCURRENCY, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return currencySymbol;
     }
@@ -403,8 +438,10 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDecimalSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar decimalSeparator) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SDECIMAL, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, decimalSeparator);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SDECIMAL, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -422,8 +459,10 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getGroupingSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar groupingSeparator) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_STHOUSAND, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, groupingSeparator);
+    got = getLocaleInfoWrapper(langtag, LOCALE_STHOUSAND, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -441,12 +480,14 @@
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInfinity
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring infinity) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SPOSINFINITY, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, infinity);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SPOSINFINITY, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return infinity;
     }
@@ -460,12 +501,14 @@
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInternationalCurrencySymbol
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring internationalCurrencySymbol) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SINTLSYMBOL, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, internationalCurrencySymbol);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SINTLSYMBOL, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return internationalCurrencySymbol;
     }
@@ -479,8 +522,10 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMinusSign
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar minusSign) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SNEGATIVESIGN, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, minusSign);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SNEGATIVESIGN, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -498,8 +543,10 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonetaryDecimalSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar monetaryDecimalSeparator) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SMONDECIMALSEP, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, monetaryDecimalSeparator);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SMONDECIMALSEP, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -517,12 +564,14 @@
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNaN
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring nan) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SNAN, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, nan);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SNAN, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return nan;
     }
@@ -536,8 +585,10 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPercent
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar percent) {
     WCHAR buf[BUFLEN];
+    int got;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SPERCENT, buf, BUFLEN);
+    CHECK_NULL_RETURN(langtag, percent);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SPERCENT, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -555,8 +606,12 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPerMill
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar perMill) {
     WCHAR buf[BUFLEN];
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SPERMILLE, buf, BUFLEN);
+    const jchar *langtag;
+    int got;
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, perMill);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SPERMILLE, buf, BUFLEN);
+
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -574,8 +629,12 @@
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getZeroDigit
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar zeroDigit) {
     WCHAR buf[BUFLEN];
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_SNATIVEDIGITS, buf, BUFLEN);
+    const jchar *langtag;
+    int got;
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, zeroDigit);
+    got = getLocaleInfoWrapper(langtag, LOCALE_SNATIVEDIGITS, buf, BUFLEN);
+
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
@@ -593,9 +652,11 @@
 JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDataValue
   (JNIEnv *env, jclass cls, jstring jlangtag, jint type) {
     DWORD num;
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    const jchar *langtag;
     int got = 0;
 
+    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    CHECK_NULL_RETURN(langtag, -1);
     switch (type) {
     case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK:
         got = getLocaleInfoWrapper(langtag,
@@ -648,11 +709,12 @@
     }
 
     pjChar = (*env)->GetStringChars(env, jStr, JNI_FALSE);
+    CHECK_NULL_RETURN(pjChar, NULL);
     got = getLocaleInfoWrapper(pjChar, lcType, buf, BUFLEN);
     (*env)->ReleaseStringChars(env, jStr, pjChar);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return NULL;
     }
@@ -706,15 +768,21 @@
 void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jobjectArray jarray, CALTYPE* pCalTypes, int offset, int length) {
     WCHAR name[BUFLEN];
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int calid = getCalendarID(langtag);
+    int calid;
+    jstring tmp_string;
+
+    CHECK_NULL(langtag);
+    calid = getCalendarID(langtag);
 
     if (calid != -1) {
         int i;
         for (i = 0; i < length; i++) {
             getCalendarInfoWrapper(langtag, calid, NULL,
                               pCalTypes[i], name, BUFLEN, NULL);
-            (*env)->SetObjectArrayElement(env, jarray, i + offset,
-                          (*env)->NewString(env, name, wcslen(name)));
+            tmp_string = (*env)->NewString(env, name, (jsize)wcslen(name));
+            if (tmp_string != NULL) {
+                (*env)->SetObjectArrayElement(env, jarray, i + offset, tmp_string);
+            }
         }
     }
 
diff --git a/src/windows/native/sun/windows/WPrinterJob.cpp b/src/windows/native/sun/windows/WPrinterJob.cpp
index b554b39..11a6b4b 100644
--- a/src/windows/native/sun/windows/WPrinterJob.cpp
+++ b/src/windows/native/sun/windows/WPrinterJob.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -995,14 +995,7 @@
     if (type == GETJOBCOUNT) {
         ret = pPrinterInfo->cJobs;
     } else if (type == ACCEPTJOB) {
-        if (pPrinterInfo->Status &
-            (PRINTER_STATUS_ERROR |
-             PRINTER_STATUS_NOT_AVAILABLE |
-             PRINTER_STATUS_NO_TONER |
-             PRINTER_STATUS_OUT_OF_MEMORY |
-             PRINTER_STATUS_OFFLINE |
-             PRINTER_STATUS_USER_INTERVENTION |
-             PRINTER_STATUS_DOOR_OPEN)) {
+        if (pPrinterInfo->Status & PRINTER_STATUS_PENDING_DELETION) {
             ret = 0;
         }
         else {
diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp
index a966e67..3baae0f 100644
--- a/src/windows/native/sun/windows/awt_Component.cpp
+++ b/src/windows/native/sun/windows/awt_Component.cpp
@@ -467,7 +467,9 @@
         jclass win32GCCls = env->FindClass("sun/awt/Win32GraphicsConfig");
         DASSERT(win32GCCls != NULL);
         DASSERT(env->IsInstanceOf(compGC, win32GCCls));
-        CHECK_NULL(win32GCCls);
+        if (win32GCCls == NULL) {
+            throw std::bad_alloc();
+        }
         env->SetObjectField(peer, AwtComponent::peerGCID, compGC);
     }
 }
@@ -2141,19 +2143,7 @@
     }
 
     jlong getMessageTimeUTC() {
-        return windowsToUTC(getMessageTimeWindows());
-    }
-
-    // If calling order of GetTickCount and JVM_CurrentTimeMillis
-    // is swapped, it would sometimes give different result.
-    // Anyway, we would not always have determinism
-    // and sortedness of time conversion here (due to Windows's
-    // timers peculiarities). Having some euristic algorithm might
-    // help here.
-    jlong windowsToUTC(DWORD windowsTime) {
-        jlong offset = ::GetTickCount() - windowsTime;
-        jlong jvm_time = ::JVM_CurrentTimeMillis(NULL, 0);
-        return jvm_time - offset;
+        return ::JVM_CurrentTimeMillis(NULL, 0);
     }
 } //TimeHelper
 
@@ -3578,7 +3568,7 @@
 
 
     SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_PRESSED,
-                             TimeHelper::windowsToUTC(msg.time), jkey, character,
+                             TimeHelper::getMessageTimeUTC(), jkey, character,
                              modifiers, keyLocation, (jlong)wkey, &msg);
 
     // bugid 4724007: Windows does not create a WM_CHAR for the Del key
@@ -3588,7 +3578,7 @@
     // for Java - we don't want Windows trying to process it).
     if (jkey == java_awt_event_KeyEvent_VK_DELETE) {
         SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_TYPED,
-                                 TimeHelper::windowsToUTC(msg.time),
+                                 TimeHelper::getMessageTimeUTC(),
                                  java_awt_event_KeyEvent_VK_UNDEFINED,
                                  character, modifiers,
                                  java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0);
@@ -3620,7 +3610,7 @@
     UpdateDynPrimaryKeymap(wkey, jkey, keyLocation, modifiers);
 
     SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_RELEASED,
-                             TimeHelper::windowsToUTC(msg.time), jkey, character,
+                             TimeHelper::getMessageTimeUTC(), jkey, character,
                              modifiers, keyLocation, (jlong)wkey, &msg);
     return mrConsume;
 }
@@ -3665,7 +3655,7 @@
 
     jint modifiers = GetJavaModifiers();
     SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_TYPED,
-                             TimeHelper::windowsToUTC(msg.time),
+                             TimeHelper::getMessageTimeUTC(),
                              java_awt_event_KeyEvent_VK_UNDEFINED,
                              unicodeChar, modifiers,
                              java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
@@ -3734,7 +3724,7 @@
     InitMessage(&msg, message, character,
                               MAKELPARAM(repCnt, flags));
     SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_TYPED,
-                             TimeHelper::windowsToUTC(msg.time),
+                             TimeHelper::getMessageTimeUTC(),
                              java_awt_event_KeyEvent_VK_UNDEFINED,
                              unicodeChar, modifiers,
                              java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
diff --git a/src/windows/native/sun/windows/awt_Cursor.cpp b/src/windows/native/sun/windows/awt_Cursor.cpp
index 6c10266..3cdf9d8 100644
--- a/src/windows/native/sun/windows/awt_Cursor.cpp
+++ b/src/windows/native/sun/windows/awt_Cursor.cpp
@@ -229,9 +229,10 @@
                 if (cur != NULL) {
                     ::SetCursor(cur);
                 } else {
-                    safe_ExceptionOccurred(env);
+                    if (safe_ExceptionOccurred(env)) {
+                        env->ExceptionClear();
+                    }
                 }
-
                 if (AwtCursor::updateCursorID == NULL) {
                     jclass cls =
                     env->FindClass("sun/awt/windows/WGlobalCursorManager");
diff --git a/src/windows/native/sun/windows/awt_InputMethod.cpp b/src/windows/native/sun/windows/awt_InputMethod.cpp
index 6447504..572b9bb 100644
--- a/src/windows/native/sun/windows/awt_InputMethod.cpp
+++ b/src/windows/native/sun/windows/awt_InputMethod.cpp
@@ -482,6 +482,7 @@
         for (current = 0; current < destIndex; current++) {
             if (strcmp(javaLocaleNames[current], srcLocaleName) == 0) {
                 // duplicated. ignore this HKL
+                free((void *)srcLocaleName);
                 break;
             }
         }
diff --git a/src/windows/native/sun/windows/awt_PrintJob.cpp b/src/windows/native/sun/windows/awt_PrintJob.cpp
index b9d818e..7217f53 100644
--- a/src/windows/native/sun/windows/awt_PrintJob.cpp
+++ b/src/windows/native/sun/windows/awt_PrintJob.cpp
@@ -758,6 +758,7 @@
   // through print dialog or start of printing
   // None of those may have happened yet, so call initPrinter()
   initPrinter(env, self);
+  JNU_CHECK_EXCEPTION(env);
   HANDLE hDevNames = AwtPrintControl::getPrintHDName(env, self);
   HDC hdc = AwtPrintControl::getPrintDC(env, self);
 
@@ -1102,6 +1103,7 @@
     jboolean err;
 
     initPrinter(env, self);
+    JNU_CHECK_EXCEPTION(env);
 
     // check for collation
     HGLOBAL hDevNames = AwtPrintControl::getPrintHDName(env, self);
@@ -1362,6 +1364,13 @@
     }
 
     initPrinter(env, self);
+    if (env->ExceptionCheck()) {
+        if (dest != NULL) {
+            JNU_ReleaseStringPlatformChars(env, dest, destination);
+        }
+        return JNI_FALSE;
+    }
+
     HDC printDC = AwtPrintControl::getPrintDC(env, self);
 
     SAVE_CONTROLWORD
@@ -3827,6 +3836,7 @@
     // pixels per inch in y direction
     jint yRes = GetDeviceCaps(printDC, LOGPIXELSY);
     err = setIntField(env, self, YRES_STR, yRes);
+    if (err) return;
 
     // x coord of printable area in pixels
     jint xOrg = GetDeviceCaps(printDC, PHYSICALOFFSETX);
diff --git a/src/windows/native/sun/windows/awt_TextArea.cpp b/src/windows/native/sun/windows/awt_TextArea.cpp
index 938da4c..427a0b8 100644
--- a/src/windows/native/sun/windows/awt_TextArea.cpp
+++ b/src/windows/native/sun/windows/awt_TextArea.cpp
@@ -47,16 +47,12 @@
 
 jfieldID AwtTextArea::scrollbarVisibilityID;
 
-WNDPROC AwtTextArea::sm_pDefWindowProc = NULL;
-
 /************************************************************************
  * AwtTextArea methods
  */
 
 AwtTextArea::AwtTextArea() {
-    m_bIgnoreEnChange = FALSE;
     m_bCanUndo        = FALSE;
-    m_hEditCtrl       = NULL;
     m_lHDeltaAccum    = 0;
     m_lVDeltaAccum    = 0;
 }
@@ -67,10 +63,6 @@
 
 void AwtTextArea::Dispose()
 {
-    if (m_hEditCtrl != NULL) {
-        VERIFY(::DestroyWindow(m_hEditCtrl));
-        m_hEditCtrl = NULL;
-    }
     AwtTextComponent::Dispose();
 }
 
@@ -91,10 +83,6 @@
     }
 }
 
-void AwtTextArea::EditGetSel(CHARRANGE &cr) {
-    SendMessage(EM_EXGETSEL, 0, reinterpret_cast<LPARAM>(&cr));
-}
-
 /* Count how many '\n's are there in jStr */
 size_t AwtTextArea::CountNewLines(JNIEnv *env, jstring jStr, size_t maxlen)
 {
@@ -149,159 +137,6 @@
     return retValue;
 }
 
-/*
- * This routine is a window procedure for the subclass of the standard edit control
- * used to generate context menu. RichEdit controls don't have built-in context menu.
- * To implement this functionality we have to create an invisible edit control and
- * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
- * While the edit control context menu is active we intercept the message generated in
- * response to particular item selection and forward it back to the RichEdit control.
- * (See AwtTextArea::WmContextMenu for more details).
- */
-LRESULT
-AwtTextArea::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
-
-    static BOOL bContextMenuActive = FALSE;
-
-    LRESULT retValue = 0;
-    MsgRouting mr = mrDoDefault;
-
-    DASSERT(::IsWindow(::GetParent(hWnd)));
-
-    switch (message) {
-    case WM_UNDO:
-    case WM_CUT:
-    case WM_COPY:
-    case WM_PASTE:
-    case WM_CLEAR:
-    case EM_SETSEL:
-        if (bContextMenuActive) {
-            ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
-            mr = mrConsume;
-        }
-        break;
-    case WM_CONTEXTMENU:
-        bContextMenuActive = TRUE;
-        break;
-    }
-
-    if (mr == mrDoDefault) {
-        DASSERT(sm_pDefWindowProc != NULL);
-        retValue = ::CallWindowProc(sm_pDefWindowProc,
-                                    hWnd, message, wParam, lParam);
-    }
-
-    if (message == WM_CONTEXTMENU) {
-        bContextMenuActive = FALSE;
-    }
-
-    return retValue;
-}
-
-MsgRouting
-AwtTextArea::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
-    /* Use the system provided edit control class to generate context menu. */
-    if (m_hEditCtrl == NULL) {
-        DWORD dwStyle = WS_CHILD;
-        DWORD dwExStyle = 0;
-        m_hEditCtrl = ::CreateWindowEx(dwExStyle,
-                                        L"EDIT",
-                                        L"TEXT",
-                                        dwStyle,
-                                        0, 0, 0, 0,
-                                        GetHWnd(),
-                                        reinterpret_cast<HMENU>(
-                                         static_cast<INT_PTR>(
-                                             CreateControlID())),
-                                        AwtToolkit::GetInstance().GetModuleHandle(),
-                                        NULL);
-        DASSERT(m_hEditCtrl != NULL);
-        if (sm_pDefWindowProc == NULL) {
-            sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
-                                                         GWLP_WNDPROC);
-        }
-        ::SetLastError(0);
-        INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
-                                   (INT_PTR)AwtTextArea::EditProc);
-        DASSERT(ret != 0 || ::GetLastError() == 0);
-    }
-
-    /*
-     * Tricks on the edit control to ensure that its context menu has
-     * the correct set of enabled items according to the RichEdit state.
-     */
-    ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
-
-    if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
-        /* Enable 'Undo' item. */
-        ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
-    }
-
-    {
-        /*
-         * Initial selection for the edit control - (0,1).
-         * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
-         */
-        INT nStart = 0;
-        INT nEnd = 1;
-        if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
-            /*
-             * RichEdit selection is empty - clear selection of the edit control.
-             * This disables 'Cut', 'Copy' and 'Delete'.
-             */
-            nStart = -1;
-            nEnd = 0;
-        } else {
-
-            CHARRANGE cr;
-            EditGetSel(cr);
-            /* Check if all the text is selected. */
-            if (cr.cpMin == 0) {
-
-                int len = ::GetWindowTextLength(GetHWnd());
-                if (cr.cpMin == 0 && cr.cpMax >= len) {
-                    /*
-                     * All the text is selected in RichEdit - select all the
-                     * text in the edit control. This disables 'Select All'.
-                     */
-                    nStart = 0;
-                    nEnd = -1;
-                }
-            }
-        }
-        ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
-    }
-
-    /* Disable 'Paste' item if the RichEdit control is read-only. */
-    ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
-                  GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
-
-    POINT p;
-    p.x = xPos;
-    p.y = yPos;
-
-    /*
-     * If the context menu is requested with SHIFT+F10 or VK_APPS key,
-     * we position its top left corner to the center of the RichEdit
-     * client rect.
-     */
-    if (p.x == -1 && p.y == -1) {
-        RECT r;
-        VERIFY(::GetClientRect(GetHWnd(), &r));
-        p.x = (r.left + r.right) / 2;
-        p.y = (r.top + r.bottom) / 2;
-        VERIFY(::ClientToScreen(GetHWnd(), &p));
-    }
-
-    // The context menu steals focus from the proxy.
-    // So, set the focus-restore flag up.
-    SetRestoreFocus(TRUE);
-    ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
-    SetRestoreFocus(FALSE);
-
-    return mrConsume;
-}
-
 MsgRouting
 AwtTextArea::WmNcHitTest(UINT x, UINT y, LRESULT& retVal)
 {
@@ -314,27 +149,8 @@
 
 
 MsgRouting
-AwtTextArea::WmNotify(UINT notifyCode)
-{
-    if (notifyCode == EN_CHANGE) {
-        /*
-         * Ignore notifications if the text hasn't been changed.
-         * EN_CHANGE sent on character formatting changes as well.
-         */
-        if (m_bIgnoreEnChange == FALSE) {
-            m_bCanUndo = TRUE;
-            DoCallback("valueChanged", "()V");
-        } else {
-            m_bCanUndo = FALSE;
-        }
-    }
-    return mrDoDefault;
-}
-
-MsgRouting
 AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
 {
-    MsgRouting returnVal;
     /*
      * RichEdit 1.0 control starts internal message loop if the
      * left mouse button is pressed while the cursor is not over
@@ -486,26 +302,6 @@
         }
         delete msg;
         return mrConsume;
-    } else if (msg->message == WM_RBUTTONUP ||
-               (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
-                HIBYTE(::GetKeyState(VK_SHIFT)))) {
-        POINT p;
-        if (msg->message == WM_RBUTTONUP) {
-            VERIFY(::GetCursorPos(&p));
-        } else {
-            p.x = -1;
-            p.y = -1;
-        }
-
-        if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
-                           MAKELPARAM(p.x, p.y))) {
-            JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-            JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
-            env->ExceptionDescribe();
-            env->ExceptionClear();
-        }
-        delete msg;
-        return mrConsume;
     } else if (msg->message == WM_MOUSEWHEEL) {
         // 4417236: If there is an old version of RichEd32.dll which
         // does not provide the mouse wheel scrolling we have to
@@ -596,15 +392,7 @@
         // 4417236: end of fix
     }
 
-    /*
-     * Store the 'synthetic' parameter so that the WM_PASTE security check
-     * happens only for synthetic events.
-     */
-    m_synthetic = synthetic;
-    returnVal = AwtComponent::HandleEvent(msg, synthetic);
-    m_synthetic = FALSE;
-
-    return returnVal;
+    return AwtTextComponent::HandleEvent(msg, synthetic);
 }
 
 
diff --git a/src/windows/native/sun/windows/awt_TextArea.h b/src/windows/native/sun/windows/awt_TextArea.h
index 931a319..1738e64 100644
--- a/src/windows/native/sun/windows/awt_TextArea.h
+++ b/src/windows/native/sun/windows/awt_TextArea.h
@@ -57,17 +57,11 @@
     static size_t GetALength(JNIEnv* env, jstring jStr, size_t maxlen);
 
     LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
-    static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
-                                     WPARAM wParam, LPARAM lParam);
 
     MsgRouting WmEnable(BOOL fEnabled);
-    MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
-    MsgRouting WmNotify(UINT notifyCode);
     MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT &retVal);
     MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
 
-    INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
-
     virtual BOOL InheritsNativeMouseWheelBehavior();
     virtual void Reshape(int x, int y, int w, int h);
 
@@ -81,22 +75,7 @@
 protected:
 
     void EditSetSel(CHARRANGE &cr);
-    void EditGetSel(CHARRANGE &cr);
   private:
-    // RichEdit 1.0 control generates EN_CHANGE notifications not only
-    // on text changes, but also on any character formatting change.
-    // This flag is true when the latter case is detected.
-    BOOL    m_bIgnoreEnChange;
-
-    // RichEdit 1.0 control undoes a character formatting change
-    // if it is the latest. We don't create our own undo buffer,
-    // but just prohibit undo in case if the latest operation
-    // is a formatting change.
-    BOOL    m_bCanUndo;
-
-    HWND    m_hEditCtrl;
-    static WNDPROC sm_pDefWindowProc;
-
     LONG    m_lHDeltaAccum;
     LONG    m_lVDeltaAccum;
 
diff --git a/src/windows/native/sun/windows/awt_TextComponent.cpp b/src/windows/native/sun/windows/awt_TextComponent.cpp
index d96a194..eaa8bca 100644
--- a/src/windows/native/sun/windows/awt_TextComponent.cpp
+++ b/src/windows/native/sun/windows/awt_TextComponent.cpp
@@ -66,6 +66,8 @@
     m_lLastPos  = -1;
     m_isLFonly        = FALSE;
     m_EOLchecked      = FALSE;
+    m_hEditCtrl       = NULL;
+    m_bIgnoreEnChange = FALSE;
 //    javaEventsMask = 0;    // accessibility support
 }
 
@@ -213,6 +215,16 @@
     return c;
 }
 
+void AwtTextComponent::Dispose()
+{
+    if (m_hEditCtrl != NULL) {
+        VERIFY(::DestroyWindow(m_hEditCtrl));
+        m_hEditCtrl = NULL;
+    }
+    AwtComponent::Dispose();
+}
+
+
 LRESULT
 AwtTextComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
 
@@ -322,7 +334,16 @@
 AwtTextComponent::WmNotify(UINT notifyCode)
 {
     if (notifyCode == EN_CHANGE) {
-      DoCallback("valueChanged", "()V");
+        /*
+         * Ignore notifications if the text hasn't been changed.
+         * EN_CHANGE sent on character formatting changes as well.
+         */
+        if (m_bIgnoreEnChange == FALSE) {
+            m_bCanUndo = TRUE;
+            DoCallback("valueChanged", "()V");
+        } else {
+            m_bCanUndo = FALSE;
+        }
     }
     return mrDoDefault;
 }
@@ -337,6 +358,28 @@
 {
     MsgRouting returnVal;
 
+    if (msg->message == WM_RBUTTONUP ||
+               (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
+                HIBYTE(::GetKeyState(VK_SHIFT)))) {
+        POINT p;
+        if (msg->message == WM_RBUTTONUP) {
+            VERIFY(::GetCursorPos(&p));
+        } else {
+            p.x = -1;
+            p.y = -1;
+        }
+
+        if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
+                           MAKELPARAM(p.x, p.y))) {
+            JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+            JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
+            env->ExceptionDescribe();
+            env->ExceptionClear();
+        }
+        delete msg;
+        return mrConsume;
+    }
+
     /*
      * Store the 'synthetic' parameter so that the WM_PASTE security check
      * happens only for synthetic events.
@@ -701,6 +744,10 @@
     SendMessage(EM_SETBKGNDCOLOR, (WPARAM)FALSE, (LPARAM)GetBackgroundColor());
 }
 
+void AwtTextComponent::EditGetSel(CHARRANGE &cr) {
+    SendMessage(EM_EXGETSEL, 0, reinterpret_cast<LPARAM>(&cr));
+}
+
 
 /************************************************************************
  * WTextComponentPeer native methods
@@ -983,6 +1030,161 @@
 }
 
 
+/*
+ * This routine is a window procedure for the subclass of the standard edit control
+ * used to generate context menu. RichEdit controls don't have built-in context menu.
+ * To implement this functionality we have to create an invisible edit control and
+ * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
+ * While the edit control context menu is active we intercept the message generated in
+ * response to particular item selection and forward it back to the RichEdit control.
+ * (See AwtTextArea::WmContextMenu for more details).
+ */
+
+WNDPROC AwtTextComponent::sm_pDefWindowProc = NULL;
+
+LRESULT
+AwtTextComponent::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
+
+    static BOOL bContextMenuActive = FALSE;
+
+    LRESULT retValue = 0;
+    MsgRouting mr = mrDoDefault;
+
+    DASSERT(::IsWindow(::GetParent(hWnd)));
+
+    switch (message) {
+    case WM_UNDO:
+    case WM_CUT:
+    case WM_COPY:
+    case WM_PASTE:
+    case WM_CLEAR:
+    case EM_SETSEL:
+        if (bContextMenuActive) {
+            ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
+            mr = mrConsume;
+        }
+        break;
+    case WM_CONTEXTMENU:
+        bContextMenuActive = TRUE;
+        break;
+    }
+
+    if (mr == mrDoDefault) {
+        DASSERT(sm_pDefWindowProc != NULL);
+        retValue = ::CallWindowProc(sm_pDefWindowProc,
+                                    hWnd, message, wParam, lParam);
+    }
+
+    if (message == WM_CONTEXTMENU) {
+        bContextMenuActive = FALSE;
+    }
+
+    return retValue;
+}
+
+MsgRouting
+AwtTextComponent::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
+    /* Use the system provided edit control class to generate context menu. */
+    if (m_hEditCtrl == NULL) {
+        DWORD dwStyle = WS_CHILD;
+        DWORD dwExStyle = 0;
+        m_hEditCtrl = ::CreateWindowEx(dwExStyle,
+                                        L"EDIT",
+                                        L"TEXT",
+                                        dwStyle,
+                                        0, 0, 0, 0,
+                                        GetHWnd(),
+                                        reinterpret_cast<HMENU>(
+                                         static_cast<INT_PTR>(
+                                             CreateControlID())),
+                                        AwtToolkit::GetInstance().GetModuleHandle(),
+                                        NULL);
+        DASSERT(m_hEditCtrl != NULL);
+        if (sm_pDefWindowProc == NULL) {
+            sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
+                                                         GWLP_WNDPROC);
+        }
+        ::SetLastError(0);
+        INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
+                                   (INT_PTR)AwtTextArea::EditProc);
+        DASSERT(ret != 0 || ::GetLastError() == 0);
+    }
+
+    /*
+     * Tricks on the edit control to ensure that its context menu has
+     * the correct set of enabled items according to the RichEdit state.
+     */
+    ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
+
+    if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
+        /* Enable 'Undo' item. */
+        ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
+    }
+
+    {
+        /*
+         * Initial selection for the edit control - (0,1).
+         * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
+         */
+        INT nStart = 0;
+        INT nEnd = 1;
+        if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
+            /*
+             * RichEdit selection is empty - clear selection of the edit control.
+             * This disables 'Cut', 'Copy' and 'Delete'.
+             */
+            nStart = -1;
+            nEnd = 0;
+        } else {
+
+            CHARRANGE cr;
+            EditGetSel(cr);
+            /* Check if all the text is selected. */
+            if (cr.cpMin == 0) {
+
+                int len = ::GetWindowTextLength(GetHWnd());
+                if (cr.cpMin == 0 && cr.cpMax >= len) {
+                    /*
+                     * All the text is selected in RichEdit - select all the
+                     * text in the edit control. This disables 'Select All'.
+                     */
+                    nStart = 0;
+                    nEnd = -1;
+                }
+            }
+        }
+        ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
+    }
+
+    /* Disable 'Paste' item if the RichEdit control is read-only. */
+    ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
+                  GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
+
+    POINT p;
+    p.x = xPos;
+    p.y = yPos;
+
+    /*
+     * If the context menu is requested with SHIFT+F10 or VK_APPS key,
+     * we position its top left corner to the center of the RichEdit
+     * client rect.
+     */
+    if (p.x == -1 && p.y == -1) {
+        RECT r;
+        VERIFY(::GetClientRect(GetHWnd(), &r));
+        p.x = (r.left + r.right) / 2;
+        p.y = (r.top + r.bottom) / 2;
+        VERIFY(::ClientToScreen(GetHWnd(), &p));
+    }
+
+    // The context menu steals focus from the proxy.
+    // So, set the focus-restore flag up.
+    SetRestoreFocus(TRUE);
+    ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
+    SetRestoreFocus(FALSE);
+
+    return mrConsume;
+}
 
 //
 // Accessibility support
diff --git a/src/windows/native/sun/windows/awt_TextComponent.h b/src/windows/native/sun/windows/awt_TextComponent.h
index 356ed64..2a9eecc 100644
--- a/src/windows/native/sun/windows/awt_TextComponent.h
+++ b/src/windows/native/sun/windows/awt_TextComponent.h
@@ -47,6 +47,8 @@
 
     static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
 
+    virtual void Dispose();
+
     virtual LPCTSTR GetClassName();
     LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
 
@@ -83,6 +85,8 @@
     MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
     MsgRouting WmPaste();
 
+    INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
+
     virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
 
 /*  To be fully implemented in a future release
@@ -115,11 +119,24 @@
     INLINE VOID SetEndSelectionPos(LONG lPos) { m_lEndPos = lPos; }
     INLINE VOID SetLastSelectionPos(LONG lPos) { m_lLastPos = lPos; }
 
+    void EditGetSel(CHARRANGE &cr);
+
     // Used to prevent untrusted code from synthesizing a WM_PASTE message
     // by posting a <CTRL>-V KeyEvent
     BOOL    m_synthetic;
     LONG EditGetCharFromPos(POINT& pt);
 
+    // RichEdit 1.0 control generates EN_CHANGE notifications not only
+    // on text changes, but also on any character formatting change.
+    // This flag is true when the latter case is detected.
+    BOOL    m_bIgnoreEnChange;
+
+    // RichEdit 1.0 control undoes a character formatting change
+    // if it is the latest. We don't create our own undo buffer,
+    // but just prohibit undo in case if the latest operation
+    // is a formatting change.
+    BOOL    m_bCanUndo;
+
     /*****************************************************************
      * Inner class OleCallback declaration.
      */
@@ -166,6 +183,13 @@
 
     static OleCallback sm_oleCallback;
 
+    static WNDPROC sm_pDefWindowProc;
+    HWND    m_hEditCtrl;
+
+    static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
+                                     WPARAM wParam, LPARAM lParam);
+    MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
+
     //
     // Accessibility support
     //
diff --git a/src/windows/native/sun/windows/awt_TextField.cpp b/src/windows/native/sun/windows/awt_TextField.cpp
index b37b5c7..1c966aa 100644
--- a/src/windows/native/sun/windows/awt_TextField.cpp
+++ b/src/windows/native/sun/windows/awt_TextField.cpp
@@ -249,13 +249,7 @@
         }
     }
 
-    /*
-     * Store the 'synthetic' parameter so that the WM_PASTE security check
-     * happens only for synthetic events.
-     */
-    m_synthetic = synthetic;
-    returnVal = AwtComponent::HandleEvent(msg, synthetic);
-    m_synthetic = FALSE;
+    returnVal = AwtTextComponent::HandleEvent(msg, synthetic);
 
     if(systemBeeperEnabled){
         SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
diff --git a/src/windows/native/sun/windows/awt_TrayIcon.cpp b/src/windows/native/sun/windows/awt_TrayIcon.cpp
index d453101..a7e7078 100644
--- a/src/windows/native/sun/windows/awt_TrayIcon.cpp
+++ b/src/windows/native/sun/windows/awt_TrayIcon.cpp
@@ -325,7 +325,7 @@
 
 MsgRouting AwtTrayIcon::WmMouseDown(UINT flags, int x, int y, int button)
 {
-    jlong now = TimeHelper::windowsToUTC(::GetTickCount());
+    jlong now = TimeHelper::getMessageTimeUTC();
     jint javaModif = AwtComponent::GetJavaModifiers();
 
     if (lastClickTrIc == this &&
@@ -361,14 +361,14 @@
     MSG msg;
     AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 
-    SendMouseEvent(java_awt_event_MouseEvent_MOUSE_RELEASED, TimeHelper::windowsToUTC(::GetTickCount()),
+    SendMouseEvent(java_awt_event_MouseEvent_MOUSE_RELEASED, TimeHelper::getMessageTimeUTC(),
                    x, y, AwtComponent::GetJavaModifiers(), clickCount,
                    (AwtComponent::GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ?
                     TRUE : FALSE), AwtComponent::GetButton(button), &msg);
 
     if ((m_mouseButtonClickAllowed & AwtComponent::GetButtonMK(button)) != 0) { // No up-button in the drag-state
         SendMouseEvent(java_awt_event_MouseEvent_MOUSE_CLICKED,
-                       TimeHelper::windowsToUTC(::GetTickCount()), x, y, AwtComponent::GetJavaModifiers(),
+                       TimeHelper::getMessageTimeUTC(), x, y, AwtComponent::GetJavaModifiers(),
                        clickCount, JNI_FALSE, AwtComponent::GetButton(button));
     }
     m_mouseButtonClickAllowed &= ~AwtComponent::GetButtonMK(button); // Exclude the up-button from the drag-state
@@ -395,7 +395,7 @@
         if ((flags & ALL_MK_BUTTONS) != 0) {
             m_mouseButtonClickAllowed = 0;
         } else {
-            SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, TimeHelper::windowsToUTC(::GetTickCount()), x, y,
+            SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, TimeHelper::getMessageTimeUTC(), x, y,
                            AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
                            java_awt_event_MouseEvent_NOBUTTON, &msg);
         }
@@ -408,7 +408,7 @@
     if (AwtComponent::GetJavaModifiers() & java_awt_event_InputEvent_BUTTON1_DOWN_MASK) {
         MSG msg;
         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
-        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::windowsToUTC(::GetTickCount()),
+        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::getMessageTimeUTC(),
                         AwtComponent::GetJavaModifiers(), &msg);
     }
     return mrConsume;
@@ -417,14 +417,14 @@
 MsgRouting AwtTrayIcon::WmKeySelect(UINT flags, int x, int y)
 {
     static jlong lastKeySelectTime = 0;
-    jlong now = TimeHelper::windowsToUTC(::GetTickCount());
+    jlong now = TimeHelper::getMessageTimeUTC();
 
     // If a user selects a notify icon with the ENTER key,
     // Shell 5.0 sends double NIN_KEYSELECT notification.
     if (lastKeySelectTime != now) {
         MSG msg;
         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
-        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::windowsToUTC(::GetTickCount()),
+        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::getMessageTimeUTC(),
                         AwtComponent::GetJavaModifiers(), &msg);
     }
     lastKeySelectTime = now;
@@ -441,7 +441,7 @@
     if (clickCount == 2) {
         MSG msg;
         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
-        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::windowsToUTC(::GetTickCount()),
+        SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, TimeHelper::getMessageTimeUTC(),
                         AwtComponent::GetJavaModifiers(), &msg);
     }
     return mrConsume;
diff --git a/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp b/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp
index 9b10c7d..825a69c 100644
--- a/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp
+++ b/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp
@@ -835,13 +835,17 @@
     TRY;
 
     /* class ids */
-    AwtWin32GraphicsDevice::indexCMClass =
-        (jclass)env->NewGlobalRef(env->FindClass("java/awt/image/IndexColorModel"));
+    jclass iCMClass = env->FindClass("java/awt/image/IndexColorModel");
+    CHECK_NULL(iCMClass);
+    AwtWin32GraphicsDevice::indexCMClass = (jclass) env->NewGlobalRef(iCMClass);
+    env->DeleteLocalRef(iCMClass);
     DASSERT(AwtWin32GraphicsDevice::indexCMClass);
     CHECK_NULL(AwtWin32GraphicsDevice::indexCMClass);
 
-    AwtWin32GraphicsDevice::wToolkitClass =
-        (jclass)env->NewGlobalRef(env->FindClass("sun/awt/windows/WToolkit"));
+    jclass wTClass = env->FindClass("sun/awt/windows/WToolkit");
+    CHECK_NULL(wTClass);
+    AwtWin32GraphicsDevice::wToolkitClass = (jclass)env->NewGlobalRef(wTClass);
+    env->DeleteLocalRef(wTClass);
     DASSERT(AwtWin32GraphicsDevice::wToolkitClass);
     CHECK_NULL(AwtWin32GraphicsDevice::wToolkitClass);
 
diff --git a/test/ProblemList.txt b/test/ProblemList.txt
index 4cb9693..93fdaed 100644
--- a/test/ProblemList.txt
+++ b/test/ProblemList.txt
@@ -199,6 +199,9 @@
 
 # jdk_rmi
 
+# 7140992
+java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java  generic-all
+
 # 7146541
 java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	linux-all
 
@@ -251,9 +254,6 @@
 
 # jdk_tools
 
-# 8028474
-sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh      generic-all
-
 # Tests take too long, on sparcs see 7143279
 tools/pack200/CommandLineTests.java                             solaris-all, macosx-all
 tools/pack200/Pack200Test.java                                  solaris-all, macosx-all
diff --git a/test/TEST.groups b/test/TEST.groups
index c3b43e6..15c2f44 100644
--- a/test/TEST.groups
+++ b/test/TEST.groups
@@ -124,15 +124,27 @@
 
 jdk_security3 = \
     javax/security  \
+    -javax/security/auth/kerberos \
     com/sun/security \
+    -com/sun/security/jgss \
     com/sun/org/apache/xml/internal/security \
     sun/security \
+    -sun/security/krb5 \
+    -sun/security/jgss \
+    javax/net \
     lib/security
 
+jdk_security4 = \
+    com/sun/security/jgss \
+    javax/security/auth/kerberos \
+    sun/security/krb5 \
+    sun/security/jgss
+
 jdk_security = \
     :jdk_security1 \
     :jdk_security2 \
-    :jdk_security3
+    :jdk_security3 \
+    :jdk_security4
 
 jdk_text = \
     java/text \
@@ -314,6 +326,7 @@
   java/io/Serializable/serialver \
   java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java \
   java/lang/invoke/lambda/LambdaAccessControlTest.java \
+  java/lang/invoke/lambda/LambdaAsm.java \
   java/lang/System/MacEncoding/TestFileEncoding.java \
   java/net/URLClassLoader/closetest/GetResourceAsStream.java \
   java/util/Collections/EmptyIterator.java \
@@ -333,7 +346,8 @@
   sun/reflect/CallerSensitive/CallerSensitiveFinder.java \
   sun/reflect/CallerSensitive/MissingCallerSensitive.java \
   sun/security/util/Resources/NewNamesFormat.java \
-  vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java
+  vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java \
+  javax/xml/ws/clientjar/TestWsImport.java 
 
 # JRE adds further tests to compact3
 #
@@ -361,14 +375,19 @@
   java/util/logging/Listeners.java \
   java/util/logging/ListenersWithSM.java \
   java/util/logging/TestMainAppContext.java \
+  java/util/logging/TestLoggingWithMainAppContext.java \
   java/util/ResourceBundle/Control/Bug6530694.java \
   java/text/Bidi/BidiConformance.java \
   java/text/Bidi/BidiEmbeddingTest.java \
-  java/text/Bidi/Bug6665028.java \
   java/text/Bidi/Bug7042148.java \
   java/text/Bidi/Bug7051769.java \
   javax/crypto/Cipher/CipherStreamClose.java \
   javax/management/monitor/AttributeArbitraryDataTypeTest.java \
+  javax/management/mxbean/AmbiguousConstructorTest.java \
+  javax/management/mxbean/ExceptionDiagnosisTest.java \
+  javax/management/mxbean/LeakTest.java \
+  javax/management/mxbean/MXBeanTest.java \
+  javax/management/mxbean/PropertyNamesTest.java \
   jdk/lambda/vm/InterfaceAccessFlagsTest.java \
   sun/misc/URLClassPath/ClassnameCharTest.java
 
@@ -464,6 +483,7 @@
   sun/security/acl \
   sun/security/jgss \
   sun/security/krb5 \
+  java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java \
   java/lang/System/MacEncoding/TestFileEncoding.java \
   java/nio/channels/AsynchronousSocketChannel/Leaky.java \
   java/security/PermissionCollection/Concurrent.java \
@@ -471,6 +491,8 @@
   java/security/cert/GetInstance.java \
   java/util/logging/DrainFindDeadlockTest.java \
   java/util/logging/LoggingMXBeanTest.java \
+  java/util/logging/TestLogConfigurationDeadLock.java \
+  java/util/logging/TestLoggerBundleSync.java \
   sun/net/www/http/KeepAliveCache/B5045306.java \
   sun/security/provider/PolicyFile/Alias.java \
   sun/security/provider/PolicyFile/Comparator.java \
@@ -522,6 +544,7 @@
   java/lang/PrimitiveSumMinMaxTest.java  \
   java/lang/String/StringJoinTest.java  \
   java/lang/Thread/StopThrowable.java  \
+  java/net/Authenticator/B4769350.java \
   java/net/Authenticator/Deadlock.java \
   java/net/CookieHandler/LocalHostCookie.java \
   java/net/CookieHandler/CookieManagerTest.java \
@@ -572,7 +595,6 @@
   java/util/zip/ZipFile/StreamZipEntriesTest.java \
   java/util/zip/ZipFile/DeleteTempJar.java \
   javax/crypto/Cipher/CipherStreamClose.java \
-  sun/misc/URLClassPath/ClassnameCharTest.java \
   sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java \
   sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java 
 
diff --git a/test/com/sun/corba/se/impl/io/CustomOutputStream.java b/test/com/sun/corba/se/impl/io/CustomOutputStream.java
new file mode 100644
index 0000000..4a05757
--- /dev/null
+++ b/test/com/sun/corba/se/impl/io/CustomOutputStream.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+public class CustomOutputStream extends OutputStream {
+
+    @Override
+    public void write_value(Serializable value, Class clz) {
+    }
+
+    @Override
+    public InputStream create_input_stream() {
+        return null;
+    }
+
+    @Override
+    public void write_boolean(boolean value) {
+    }
+
+    @Override
+    public void write_char(char value) {
+    }
+
+    @Override
+    public void write_wchar(char value) {
+    }
+
+    @Override
+    public void write_octet(byte value) {
+    }
+
+    @Override
+    public void write_short(short value) {
+    }
+
+    @Override
+    public void write_ushort(short value) {
+    }
+
+    @Override
+    public void write_long(int value) {
+    }
+
+    @Override
+    public void write_ulong(int value) {
+    }
+
+    @Override
+    public void write_longlong(long value) {
+    }
+
+    @Override
+    public void write_ulonglong(long value) {
+    }
+
+    @Override
+    public void write_float(float value) {
+    }
+
+    @Override
+    public void write_double(double value) {
+    }
+
+    @Override
+    public void write_string(String value) {
+    }
+
+    @Override
+    public void write_wstring(String value) {
+    }
+
+    @Override
+    public void write_boolean_array(boolean[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_char_array(char[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_wchar_array(char[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_octet_array(byte[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_short_array(short[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ushort_array(short[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_long_array(int[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ulong_array(int[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_longlong_array(long[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ulonglong_array(long[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_float_array(float[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_double_array(double[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_Object(org.omg.CORBA.Object value) {
+    }
+
+    @Override
+    public void write_TypeCode(TypeCode value) {
+    }
+
+    @Override
+    public void write_any(Any value) {
+    }
+
+    @Override
+    public void write_Principal(Principal value) {
+    }
+
+    @Override
+    public void write(int b) throws java.io.IOException {
+    }
+
+    @Override
+    public void write_fixed(java.math.BigDecimal value) {
+    }
+
+    @Override
+    public void write_Context(org.omg.CORBA.Context ctx,
+            org.omg.CORBA.ContextList contexts) {
+    }
+
+    @Override
+    public org.omg.CORBA.ORB orb() {
+        return null;
+    }
+}
diff --git a/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java b/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java
new file mode 100644
index 0000000..cd7c50b
--- /dev/null
+++ b/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7095856
+ * @summary OutputStreamHook doesn't handle null values
+ */
+
+import java.net.InetAddress;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+public class HookPutFieldsTest  {
+
+    public static void main(String[] args ) throws Exception {
+        CustomOutputStream os = new CustomOutputStream();
+        InetAddress a = InetAddress.getByAddress(null, new byte[] {1,2,3,4});
+        ValueHandler vh = Util.createValueHandler();
+        vh.writeValue(os, a);
+    }
+}
diff --git a/test/com/sun/jdi/EvalInterfaceStatic.sh b/test/com/sun/jdi/EvalInterfaceStatic.sh
new file mode 100644
index 0000000..92340b3
--- /dev/null
+++ b/test/com/sun/jdi/EvalInterfaceStatic.sh
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#  @test
+#  @bug 8031195
+#  @summary JDB allows evaluation of calls to static interface methods
+#  @author Jaroslav Bachorik
+#
+#  @run shell/timeout=300 EvalInterfaceStatic.sh
+
+#  The test exercises the ability to invoke static methods on interfaces.
+#  Static interface methods are a new feature added in JDK8.
+#
+#  The test makes sure that it is, at all, possible to invoke an interface
+#  static method and that the static methods are not inherited by extending
+#  interfaces.
+
+classname=EvalStaticInterfaces
+
+createJavaFile()
+{
+    cat <<EOF > $classname.java.1
+public interface $classname {
+    static String staticMethod1() {
+        return "base:staticMethod1";
+    }
+
+    static String staticMethod2() {
+        return "base:staticMethod2";
+    }
+
+    public static void main(String[] args) {
+        // prove that these work
+        System.out.println("base staticMethod1(): " + $classname.staticMethod1());
+        System.out.println("base staticMethod2(): " + $classname.staticMethod2());
+        System.out.println("overridden staticMethod2(): " + Extended$classname.staticMethod2());
+        System.out.println("base staticMethod3(): " + Extended$classname.staticMethod3());
+
+        gus();
+    }
+
+    static void gus() {
+        int x = 0;             // @1 breakpoint
+    }
+}
+
+interface Extended$classname extends $classname {
+    static String staticMethod2() {
+        return "extended:staticMethod2";
+    }
+
+    static String staticMethod3() {
+        return "extended:staticMethod3";
+    }
+}
+
+
+
+EOF
+}
+
+# drive jdb by sending cmds to it and examining its output
+dojdbCmds()
+{
+    setBkpts @1
+    runToBkpt @1
+
+    cmd eval "$classname.staticMethod1()"
+    jdbFailIfNotPresent "base:staticMethod1" 2
+
+    cmd eval "$classname.staticMethod2()"
+    jdbFailIfNotPresent "base:staticMethod2" 2
+
+    cmd eval "Extended$classname.staticMethod1()"
+    jdbFailIfPresent "base:staticMethod1" 2
+
+    cmd eval "Extended$classname.staticMethod2()"
+    jdbFailIfNotPresent "extended:staticMethod2" 2
+
+    cmd eval "Extended$classname.staticMethod3()"
+    jdbFailIfNotPresent "extended:staticMethod3" 2
+}
+
+
+mysetup()
+{
+    if [ -z "$TESTSRC" ] ; then
+        TESTSRC=.
+    fi
+
+    for ii in . $TESTSRC $TESTSRC/.. ; do
+        if [ -r "$ii/ShellScaffold.sh" ] ; then
+            . $ii/ShellScaffold.sh
+            break
+        fi
+    done
+}
+
+# You could replace this next line with the contents
+# of ShellScaffold.sh and this script will run just the same.
+mysetup
+
+runit
+pass
diff --git a/test/com/sun/jdi/InterfaceMethodsTest.java b/test/com/sun/jdi/InterfaceMethodsTest.java
new file mode 100644
index 0000000..e127fa5
--- /dev/null
+++ b/test/com/sun/jdi/InterfaceMethodsTest.java
@@ -0,0 +1,422 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *  @test
+ *  @bug 8031195
+ *  @summary  JDI: Add support for static and default methods in interfaces
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run build InterfaceMethodsTest
+ *  @run main InterfaceMethodsTest
+ */
+import com.sun.jdi.*;
+import com.sun.jdi.event.*;
+import java.util.Collections;
+
+public class InterfaceMethodsTest extends TestScaffold {
+    private static final int RESULT_A = 1;
+    private static final int RESULT_B = 1;
+    private static final int RESULT_TARGET = 1;
+    static interface InterfaceA {
+        static int staticMethodA() {
+            System.out.println("-InterfaceA: static interface method A-");
+            return RESULT_A;
+        }
+        static int staticMethodB() {
+            System.out.println("-InterfaceA: static interface method B-");
+            return RESULT_A;
+        }
+        default int defaultMethodA() {
+            System.out.println("-InterfaceA: default interface method A-");
+            return RESULT_A;
+        }
+        default int defaultMethodB() {
+            System.out.println("-InterfaceA: default interface method B-");
+            return RESULT_A;
+        }
+        default int defaultMethodC() {
+            System.out.println("-InterfaceA: default interface method C-");
+            return RESULT_A;
+        }
+
+        int implementedMethod();
+    }
+
+    static interface InterfaceB extends InterfaceA {
+        @Override
+        default int defaultMethodC() {
+            System.out.println("-InterfaceB: overridden default interface method C-");
+            return RESULT_B;
+        }
+        default int defaultMethodD() {
+            System.out.println("-InterfaceB: default interface method D-");
+            return RESULT_B;
+        }
+
+        static int staticMethodB() {
+            System.out.println("-InterfaceB: overridden static interface method B-");
+            return RESULT_B;
+        }
+
+        static int staticMethodC() {
+            System.out.println("-InterfaceB: static interface method C-");
+            return RESULT_B;
+        }
+    }
+
+    final static class TargetClass implements InterfaceB {
+        public int classMethod() {
+            System.out.println("-TargetClass: class only method-");
+            return RESULT_TARGET;
+        }
+
+        @Override
+        public int implementedMethod() {
+            System.out.println("-TargetClass: implemented non-default interface method-");
+            return RESULT_TARGET;
+        }
+
+        @Override
+        public int defaultMethodB() {
+            System.out.println("-TargetClass: overridden default interface method D");
+
+            return RESULT_TARGET;
+        }
+
+        public static void main(String[] args) {
+            TargetClass tc = new TargetClass();
+            tc.doTests(tc);
+        }
+
+        private void doTests(TargetClass ref) {
+            // break
+        }
+    }
+
+    public InterfaceMethodsTest(String[] args) {
+        super(args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new InterfaceMethodsTest(args).startTests();
+    }
+
+    private static final String TEST_CLASS_NAME = InterfaceMethodsTest.class.getName().replace('.', '/');
+    private static final String TARGET_CLASS_NAME = TargetClass.class.getName().replace('.', '/');
+    private static final String INTERFACEA_NAME = InterfaceA.class.getName().replace('.', '/');
+    private static final String INTERFACEB_NAME = InterfaceB.class.getName().replace('.', '/');
+
+    protected void runTests() throws Exception {
+        /*
+         * Get to the top of main()
+         * to determine targetClass and mainThread
+         */
+        BreakpointEvent bpe = startToMain(TARGET_CLASS_NAME);
+
+        bpe = resumeTo(TARGET_CLASS_NAME, "doTests", "(L" + TARGET_CLASS_NAME +";)V");
+
+        mainThread = bpe.thread();
+
+        StackFrame frame = mainThread.frame(0);
+        ObjectReference thisObject = frame.thisObject();
+        ObjectReference ref = (ObjectReference)frame.getArgumentValues().get(0);
+
+        ReferenceType targetClass = bpe.location().declaringType();
+        testImplementationClass(targetClass, thisObject);
+
+        testInterfaceA(ref);
+
+        testInterfaceB(ref);
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+
+        /*
+         * deal with results of test
+         * if anything has called failure("foo") testFailed will be true
+         */
+        if (!testFailed) {
+            println("InterfaceMethodsTest: passed");
+        } else {
+            throw new Exception("InterfaceMethodsTest: failed");
+        }
+    }
+
+    private void testInterfaceA(ObjectReference ref) {
+        // Test non-virtual calls on InterfaceA
+
+        ReferenceType ifaceClass = (ReferenceType)vm().classesByName(INTERFACEA_NAME).get(0);
+        /* Default method calls */
+
+        // invoke the InterfaceA's "defaultMethodA"
+        testInvokePos(ifaceClass, ref, "defaultMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the InterfaceA's "defaultMethodB"
+        testInvokePos(ifaceClass, ref, "defaultMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the InterfaceA's "defaultMethodC"
+        testInvokePos(ifaceClass, ref, "defaultMethodC", "()I", vm().mirrorOf(RESULT_A));
+
+        // "defaultMethodD" from InterfaceB is not accessible from here
+        testInvokeNeg(ifaceClass, ref, "defaultMethodD", "()I", vm().mirrorOf(RESULT_B),
+                "Attempted to invoke non-existing method");
+
+        // trying to invoke the asbtract method "implementedMethod"
+        testInvokeNeg(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(TARGET_CLASS_NAME),
+                "Invocation of non-default methods is not supported");
+
+
+        /* Static method calls */
+
+        // invoke interface static method A
+        testInvokePos(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // try to invoke static method A on the instance
+        testInvokePos(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke interface static method B
+        testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // try to invoke static method B on the instance
+        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+    }
+
+    private void testInterfaceB(ObjectReference ref) {
+        // Test non-virtual calls on InterfaceB
+        ReferenceType ifaceClass = (ReferenceType)vm().classesByName(INTERFACEB_NAME).get(0);
+
+        /* Default method calls */
+
+        // invoke the inherited "defaultMethodA"
+        testInvokePos(ifaceClass, ref, "defaultMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the inherited "defaultMethodB"
+        testInvokePos(ifaceClass, ref, "defaultMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the inherited and overridden "defaultMethodC"
+        testInvokePos(ifaceClass, ref, "defaultMethodC", "()I", vm().mirrorOf(RESULT_B));
+
+        // invoke InterfaceB only "defaultMethodD"
+        testInvokePos(ifaceClass, ref, "defaultMethodD", "()I", vm().mirrorOf(RESULT_B));
+
+        // "implementedMethod" is not present in InterfaceB
+        testInvokeNeg(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(RESULT_TARGET),
+                "Invocation of non-default methods is not supported");
+
+
+        /* Static method calls*/
+
+        // "staticMethodA" must not be inherited by InterfaceB
+        testInvokeNeg(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        // however it is possible to call "staticMethodA" on the actual instance
+        testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        // "staticMethodB" is overridden in InterfaceB
+        testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+
+        // the instance invokes the overriden form of "staticMethodB" from InterfaceB
+        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+
+        // "staticMethodC" is present only in InterfaceB
+        testInvokePos(ifaceClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+
+        // "staticMethodC" should be reachable from the instance too
+        testInvokePos(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+    }
+
+    private void testImplementationClass(ReferenceType targetClass, ObjectReference thisObject) {
+        // Test invocations on the implementation object
+
+        /* Default method calls */
+
+        // "defaultMethodA" is accessible and not overridden
+        testInvokePos(targetClass, thisObject, "defaultMethodA", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodB" is accessible and overridden in TargetClass
+        testInvokePos(targetClass, thisObject, "defaultMethodB", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodC" is accessible and overridden in InterfaceB
+        testInvokePos(targetClass, thisObject, "defaultMethodC", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodD" is accessible
+        testInvokePos(targetClass, thisObject, "defaultMethodD", "()I", vm().mirrorOf(RESULT_TARGET));
+
+
+        /* Non-default instance method calls */
+
+        // "classMethod" declared in TargetClass is accessible
+        testInvokePos(targetClass, thisObject, "classMethod", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // the abstract "implementedMethod" has been implemented in TargetClass
+        testInvokePos(targetClass, thisObject, "implementedMethod", "()I", vm().mirrorOf(RESULT_TARGET));
+
+
+        /* Static method calls */
+
+        // All the static methods declared by the interfaces are not reachable from the instance of the implementor class
+        testInvokeNeg(targetClass, thisObject, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, thisObject, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, thisObject, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        // All the static methods declared by the interfaces are not reachable through the implementor class
+        testInvokeNeg(targetClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+    }
+
+    private void testInvokePos(ReferenceType targetClass, ObjectReference ref, String methodName,
+                               String methodSig, Value value) {
+        logInvocation(ref, methodName, methodSig, targetClass);
+        try {
+            invoke(targetClass, ref, methodName, methodSig, value);
+            System.err.println("--- PASSED");
+        } catch (Exception e) {
+            System.err.println("--- FAILED");
+            failure("FAILED: Invocation failed with error message " + e.getLocalizedMessage());
+        }
+    }
+
+    private void testInvokeNeg(ReferenceType targetClass, ObjectReference ref, String methodName,
+                               String methodSig, Value value, String msg) {
+        logInvocation(ref, methodName, methodSig, targetClass);
+        try {
+            invoke(targetClass, ref, methodName, methodSig, value);
+            System.err.println("--- FAILED");
+            failure("FAILED: " + msg);
+        } catch (Exception e) {
+            System.err.println("--- PASSED");
+
+        }
+    }
+
+    private void invoke(ReferenceType targetClass, ObjectReference ref, String methodName,
+                        String methodSig, Value value)
+    throws Exception {
+        Method method = getMethod(targetClass, methodName, methodSig);
+        if (method == null) {
+            throw new Exception("Can't find method: " + methodName  + " for class = " + targetClass);
+        }
+
+        println("Invoking " + (method.isAbstract() ? "abstract " : " ") + "method: " + method);
+
+        Value returnValue = null;
+        if (ref != null) {
+            returnValue = invokeInstance(ref, method);
+        } else {
+            returnValue = invokeStatic(targetClass, method);
+        }
+
+        println("        return val = " + returnValue);
+        // It has to be the same value as what we passed in!
+        if (returnValue.equals(value)) {
+            println("         " + method.name() + " return value matches: "
+                    + value);
+        } else {
+            if (value != null) {
+                throw new Exception(method.name() + " returned: " + returnValue +
+                                    " expected: " + value );
+            } else {
+                println("         " + method.name() + " return value : " + returnValue);
+            }
+
+        }
+    }
+
+    private Value invokeInstance(ObjectReference ref, Method method) throws Exception {
+        return ref.invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+    }
+
+    private Value invokeStatic(ReferenceType refType, Method method) throws Exception {
+        if (refType instanceof ClassType) {
+            return ((ClassType)refType).invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+        } else {
+            return ((InterfaceType)refType).invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+        }
+    }
+
+    private Method getMethod(ReferenceType rt, String name, String signature) {
+        if (rt == null) return null;
+        Method m = findMethod(rt, name, signature);
+        if (m == null) {
+            if (rt instanceof ClassType) {
+                for (Object ifc : ((ClassType)rt).interfaces()) {
+                    m = getMethod((ReferenceType)ifc, name, signature);
+                    if (m != null) {
+                        break;
+                    }
+                }
+                if (m == null) {
+                    m = getMethod(((ClassType)rt).superclass(), name, signature);
+                } else {
+                    if (m.isStatic()) {
+                        // interface static methods are not inherited
+                        m = null;
+                    }
+                }
+            } else if (rt instanceof InterfaceType) {
+                for(Object ifc : ((InterfaceType)rt).superinterfaces()) {
+                    m = getMethod((ReferenceType)ifc, name, signature);
+                    if (m != null) {
+                        if (m.isStatic()) {
+                            // interface static methods are not inherited
+                            m = null;
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+
+        return m;
+    }
+
+    private void logInvocation(ObjectReference ref, String methodName, String methodSig, ReferenceType targetClass) {
+        if (ref != null) {
+            System.err.println("Invoking: " + ref.referenceType().name() + "." +
+                    methodName + methodSig + " with target of type " +
+                    targetClass.name());
+        } else {
+            System.err.println("Invoking static : " + targetClass.name() + "." +
+                    methodName + methodSig);
+        }
+    }
+}
+
+
+
diff --git a/test/com/sun/jdi/VisibleMethods.java b/test/com/sun/jdi/VisibleMethods.java
new file mode 100644
index 0000000..70f7f5a
--- /dev/null
+++ b/test/com/sun/jdi/VisibleMethods.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *  @test
+ *  @summary Test ReferenceType.visibleMethods
+ *  @bug 8028430
+ *
+ *  @author Staffan Larsen
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run compile -g VisibleMethods.java
+ *  @run main VisibleMethods
+ */
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.BreakpointEvent;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/********** target program **********/
+
+interface Super {
+    public void m(Object o); // This method should not be visible in AC
+    public void m(String s); // This method should not be visible in AC
+}
+
+interface One extends Super {
+    public void m(Object o);
+    public void m1(); // Either this method or Two.m1 should be visible in AC
+}
+
+interface Two extends Super {
+    public void m(String s);
+    public void m1(); // Either this method or One.m1 should be visible in AC
+}
+
+abstract class AC implements One, Two {
+}
+
+class CC extends AC {
+    public void m(Object o) {
+    }
+    public void m(String s) {
+    }
+    public void m1() {
+    }
+    public static void main(String[] args) {
+        System.out.println("Goodbye from VisibleMethods!");
+    }
+}
+
+/********** test program **********/
+
+public class VisibleMethods extends TestScaffold {
+    ReferenceType targetClass;
+    ThreadReference mainThread;
+
+    VisibleMethods(String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new VisibleMethods(args).startTests();
+    }
+
+    /********** test core **********/
+
+    protected void runTests()
+        throws Exception
+    {
+        /*
+         * Run to String.<init>
+         */
+        startToMain("CC");
+
+        ReferenceType ac = findReferenceType("AC");
+        List<String> visible = ac.visibleMethods().
+                stream().
+                map(Method::toString).
+                collect(Collectors.toList());
+
+        System.out.println("visibleMethods(): " + visible);
+
+        verifyContains(visible, 1, "Two.m(java.lang.String)");
+        verifyContains(visible, 1, "One.m(java.lang.Object)");
+        verifyContains(visible, 0, "Super.m(java.lang.Object)");
+        verifyContains(visible, 0, "Super.m(java.lang.String)");
+        verifyContains(visible, 1, "Two.m1()", "One.m1()");
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+    }
+
+    private void verifyContains(List<String> methods, int matches,
+            String... sigs) throws Exception {
+        if (countMatches(methods, sigs) != matches) {
+            throw new Exception("visibleMethods() should have contained "
+                    + matches + " entry/entries from " + Arrays.toString(sigs));
+        }
+    }
+
+    private int countMatches(List<String> list1, String[] list2) {
+        int count = 0;
+        for (String s1 : list1) {
+            for (String s2 : list2) {
+                if (s1.equals(s2)) {
+                    count++;
+                }
+            }
+        }
+        return count;
+    }
+}
diff --git a/test/com/sun/jndi/ldap/LdapTimeoutTest.java b/test/com/sun/jndi/ldap/LdapTimeoutTest.java
index 3927037..092416e 100644
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java
+++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java
@@ -23,10 +23,13 @@
 
 /**
  * @test
+ * @run main/othervm LdapTimeoutTest
  * @bug 7094377 8000487 6176036 7056489
  * @summary Timeout tests for ldap
  */
 
+import com.sun.jndi.ldap.Connection;
+
 import java.net.Socket;
 import java.net.ServerSocket;
 import java.net.SocketTimeoutException;
@@ -38,11 +41,12 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 public class LdapTimeoutTest {
-    private static final ScheduledExecutorService pool =
-        Executors.newScheduledThreadPool(1);
+
     static volatile int passed = 0, failed = 0;
     static void pass() {passed++;}
     static void fail() {failed++; Thread.dumpStack();}
@@ -75,7 +79,6 @@
             new LdapTimeoutTest().simpleAuthConnectTest(env);
         } finally {
             s.interrupt();
-            LdapTimeoutTest.pool.shutdown();
         }
 
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
@@ -85,7 +88,6 @@
     void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
         InitialContext ctx = null;
         if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -107,13 +109,12 @@
                 pass();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
     void simpleAuthConnectTest(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -123,7 +124,7 @@
         } catch (NamingException e) {
             long end = System.nanoTime();
             if (e.getCause() instanceof SocketTimeoutException) {
-                if (TimeUnit.NANOSECONDS.toMillis(end - start) < 2900) {
+                if (NANOSECONDS.toMillis(end - start) < 2_900) {
                     pass();
                 } else {
                     System.err.println("Fail: Waited too long");
@@ -136,14 +137,13 @@
                 fail();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
     void deadServerNoTimeout(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(30000);
-        long start = System.nanoTime();
+        long start = System.currentTimeMillis();
         try {
             ctx = new InitialDirContext(env);
             SearchControls scl = new SearchControls();
@@ -153,21 +153,22 @@
             // shouldn't reach here
             fail();
         } catch (NamingException e) {
-            long end = System.nanoTime();
-            if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
-                System.err.println("fail: timeout should be at least 15 seconds, actual time: "
-                                   + TimeUnit.NANOSECONDS.toMillis(end - start));
+            long elapsed = System.currentTimeMillis() - start;
+            if (elapsed < Connection.DEFAULT_READ_TIMEOUT_MILLIS) {
+                System.err.printf("fail: timeout should be at least %s ms, " +
+                                "actual time is %s ms%n",
+                        Connection.DEFAULT_READ_TIMEOUT_MILLIS, elapsed);
+                e.printStackTrace();
                 fail();
             } else {
                 pass();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
-    boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
-        killer.cancel(true);
+    boolean shutItDown(InitialContext ctx) {
         try {
             if (ctx != null) ctx.close();
             return true;
@@ -176,17 +177,6 @@
         }
     }
 
-    ScheduledFuture killSwitch(int ms) {
-        final Thread current = Thread.currentThread();
-        return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
-            public Void call() throws Exception {
-                System.err.println("Fail: killSwitch()");
-                System.exit(0);
-                return null;
-            }
-        }, ms, TimeUnit.MILLISECONDS);
-    }
-
     static class Server extends Thread {
         final ServerSocket serverSock;
 
diff --git a/test/com/sun/security/sasl/ntlm/NTLMTest.java b/test/com/sun/security/sasl/ntlm/NTLMTest.java
index 64f5eae..46d2f04 100644
--- a/test/com/sun/security/sasl/ntlm/NTLMTest.java
+++ b/test/com/sun/security/sasl/ntlm/NTLMTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6911951
+ * @bug 6911951 7150092
  * @summary NTLM should be a supported Java SASL mechanism
  */
 import java.io.IOException;
@@ -59,7 +59,6 @@
 
         checkAuthOnly();
         checkClientNameOverride();
-        checkServerDomainOverride();
         checkClientDomainOverride();
         checkVersions();
         checkClientHostname();
@@ -116,15 +115,12 @@
         Map<String,Object> ps = new HashMap<>();
         ps.put("com.sun.security.sasl.ntlm.version", vs);
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, pc,
+                new String[]{MECH}, USER1, PROTOCOL, REALM, pc,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
+                            if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
                         }
@@ -159,15 +155,12 @@
         Map<String,Object> pc = new HashMap<>();
         pc.put("com.sun.security.sasl.ntlm.hostname", "this.is.com");
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, pc,
+                new String[]{MECH}, USER1, PROTOCOL, REALM, pc,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
+                            if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
                         }
@@ -212,12 +205,8 @@
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if(cb instanceof RealmCallback) {
-                                RealmCallback dcb = (RealmCallback)cb;
-                                dcb.setText("THIRDDOMAIN");
+                            if (cb instanceof RealmCallback) {
+                                ((RealmCallback)cb).setText(REALM);
                             } else if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
@@ -255,13 +244,13 @@
      */
     private static void checkClientNameOverride() throws Exception {
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, null, PROTOCOL, null, null,
+                new String[]{MECH}, "someone", PROTOCOL, REALM, null,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
                             if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
+                                NameCallback ncb = (NameCallback) cb;
                                 ncb.setName(USER1);
                             } else if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
@@ -270,54 +259,7 @@
                     }
                 });
 
-        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, REALM, null,
-                new CallbackHandler() {
-                    public void handle(Callback[] callbacks)
-                            throws IOException, UnsupportedCallbackException {
-                        String domain = null, name = null;
-                        PasswordCallback pcb = null;
-                        for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                name = ((NameCallback)cb).getDefaultName();
-                            } else if (cb instanceof RealmCallback) {
-                                domain = ((RealmCallback)cb).getDefaultText();
-                            } else if (cb instanceof PasswordCallback) {
-                                pcb = (PasswordCallback)cb;
-                            }
-                        }
-                        if (pcb != null) {
-                            pcb.setPassword(getPass(domain, name));
-                        }
-                    }
-                });
-
-        handshake(clnt, srv);
-    }
-
-    /**
-     * server side domain provided in props.
-     * @throws Exception
-     */
-    private static void checkServerDomainOverride() throws Exception {
-        SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, null,
-                new CallbackHandler() {
-                    public void handle(Callback[] callbacks)
-                            throws IOException, UnsupportedCallbackException {
-                        for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
-                                ((PasswordCallback)cb).setPassword(PASS1);
-                            }
-                        }
-                    }
-                });
-
-        Map<String,Object> ps = new HashMap<>();
-        ps.put("com.sun.security.sasl.ntlm.domain", REALM);
-        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, null, ps,
+        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, "FAKE", null,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
diff --git a/test/com/sun/tools/attach/SimpleProvider.java b/test/com/sun/tools/attach/SimpleProvider.java
index 2a380f5..54f3dad 100644
--- a/test/com/sun/tools/attach/SimpleProvider.java
+++ b/test/com/sun/tools/attach/SimpleProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,4 +100,12 @@
 
     public void dataDumpRequest() throws IOException {
     }
+
+    public String startLocalManagementAgent() {
+        return null;
+    }
+
+    public void startManagementAgent(Properties agentProperties) {
+    }
+
 }
diff --git a/test/com/sun/tools/attach/StartManagementAgent.java b/test/com/sun/tools/attach/StartManagementAgent.java
new file mode 100644
index 0000000..16e701e
--- /dev/null
+++ b/test/com/sun/tools/attach/StartManagementAgent.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.attach.AttachOperationFailedException;
+import com.sun.tools.attach.VirtualMachine;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Properties;
+import java.util.HashMap;
+
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+
+import jdk.testlibrary.ProcessThread;
+import jdk.testlibrary.Utils;
+
+/*
+ * @test
+ * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
+ * @library /lib/testlibrary
+ * @run build Application Shutdown SimpleProvider jdk.testlibrary.*
+ * @run main StartManagementAgent
+ */
+
+/*
+ * This test is not meant to test all possible configuration parameters to
+ * the JMX agent, there are other tests for that. This test makes sure it is
+ * possible to start the agent via attach.
+ */
+public class StartManagementAgent {
+    public static void main(String[] args) throws Throwable {
+        final String pidFile = "StartManagementAgent.Application.pid";
+        ProcessThread processThread = null;
+        RunnerUtil.ProcessInfo info = null;
+        try {
+            processThread = RunnerUtil.startApplication(pidFile);
+            info = RunnerUtil.readProcessInfo(pidFile);
+            runTests(info.pid);
+        } catch (Throwable t) {
+            System.out.println("StartManagementAgent got unexpected exception: " + t);
+            t.printStackTrace();
+            throw t;
+        } finally {
+            // Make sure the Application process is stopped.
+            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+        }
+    }
+
+    private static void basicTests(VirtualMachine vm) throws Exception {
+
+        // Try calling with null argument
+        boolean exception = false;
+        try {
+            vm.startManagementAgent(null);
+        } catch (NullPointerException e) {
+            exception = true;
+        }
+        if (!exception) {
+            throw new Exception("startManagementAgent(null) should throw NPE");
+        }
+
+        // Try calling with a property value with a space in it
+        Properties p = new Properties();
+        File f = new File("file with space");
+        try (FileWriter fw = new FileWriter(f)) {
+            fw.write("com.sun.management.jmxremote.port=apa");
+        }
+        p.put("com.sun.management.config.file", f.getAbsolutePath());
+        try {
+            vm.startManagementAgent(p);
+        } catch(AttachOperationFailedException ex) {
+            // We expect parsing of "apa" above to fail, but if the file path
+            // can't be read we get a different exception message
+            if (!ex.getMessage().contains("java.lang.NumberFormatException")) {
+                throw ex;
+            }
+        }
+    }
+
+    private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
+        "com.sun.management.jmxremote.localConnectorAddress";
+
+    private static final int MAX_RETRIES = 10;
+
+    public static void runTests(int pid) throws Exception {
+        VirtualMachine vm = VirtualMachine.attach(""+pid);
+        try {
+
+            basicTests(vm);
+
+            testLocalAgent(vm);
+
+            // we retry the remote case several times in case the error
+            // was caused by a port conflict
+            int i = 0;
+            boolean success = false;
+            do {
+                try {
+                    System.err.println("Trying remote agent. Try #" + i);
+                    testRemoteAgent(vm);
+                    success = true;
+                } catch(Exception ex) {
+                    System.err.println("testRemoteAgent failed with exception:");
+                    ex.printStackTrace();
+                    System.err.println("Retrying.");
+                }
+                i++;
+            } while(!success && i < MAX_RETRIES);
+            if (!success) {
+                throw new Exception("testRemoteAgent failed after " + MAX_RETRIES + " tries");
+            }
+        } finally {
+            vm.detach();
+        }
+    }
+
+    public static void testLocalAgent(VirtualMachine vm) throws Exception {
+        Properties agentProps = vm.getAgentProperties();
+        String address = (String) agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+        if (address != null) {
+            throw new Exception("Local management agent already started");
+        }
+
+        String result = vm.startLocalManagementAgent();
+
+        // try to parse the return value as a JMXServiceURL
+        new JMXServiceURL(result);
+
+        agentProps = vm.getAgentProperties();
+        address = (String) agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+        if (address == null) {
+            throw new Exception("Local management agent could not be started");
+        }
+    }
+
+    public static void testRemoteAgent(VirtualMachine vm) throws Exception {
+        int port = Utils.getFreePort();
+
+        // try to connect - should fail
+        tryConnect(port, false);
+
+        // start agent
+        System.out.println("Starting agent on port: " + port);
+        Properties mgmtProps = new Properties();
+        mgmtProps.put("com.sun.management.jmxremote.port", port);
+        mgmtProps.put("com.sun.management.jmxremote.authenticate", "false");
+        mgmtProps.put("com.sun.management.jmxremote.ssl", "false");
+        vm.startManagementAgent(mgmtProps);
+
+        // try to connect - should work
+        tryConnect(port, true);
+
+        // try to start again - should fail
+        boolean exception = false;
+        try {
+            vm.startManagementAgent(mgmtProps);
+        } catch(AttachOperationFailedException ex) {
+            // expected
+            exception = true;
+        }
+        if (!exception) {
+            throw new Exception("Expected the second call to vm.startManagementAgent() to fail");
+        }
+    }
+
+    private static void tryConnect(int port, boolean shouldSucceed) throws Exception {
+        String jmxUrlStr =
+            String.format(
+                "service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi",
+                port);
+        JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
+        HashMap<String, ?> env = new HashMap<>();
+
+        boolean succeeded;
+        try {
+            JMXConnector c = JMXConnectorFactory.connect(url, env);
+            c.getMBeanServerConnection();
+            succeeded = true;
+        } catch(Exception ex) {
+            succeeded = false;
+        }
+        if (succeeded && !shouldSucceed) {
+            throw new Exception("Could connect to agent, but should not have been possible");
+        }
+        if (!succeeded && shouldSucceed) {
+            throw new Exception("Could not connect to agent");
+        }
+    }
+}
diff --git a/test/java/awt/Container/ContainerAIOOBE/ContainerAIOOBE.java b/test/java/awt/Container/ContainerAIOOBE/ContainerAIOOBE.java
new file mode 100644
index 0000000..677188a
--- /dev/null
+++ b/test/java/awt/Container/ContainerAIOOBE/ContainerAIOOBE.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Container;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * @test
+ * @bug 8059590
+ * @summary ArrayIndexOutOfBoundsException occurs when Container with overridden getComponents() is deserialized.
+ * @author Alexey Ivanov
+ * @run main ContainerAIOOBE
+ */
+public class ContainerAIOOBE {
+
+    public static void main(final String[] args) throws Exception {
+        ZContainer z = new ZContainer();
+        z.add(new Button());
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(z);
+        oos.flush();
+        oos.close();
+
+        byte[] array = baos.toByteArray();
+        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(array));
+
+        // Reading the object must not throw ArrayIndexOutOfBoundsException
+        ZContainer zz = (ZContainer) ois.readObject();
+
+        if (zz.getComponentCount() != 1) {
+            throw new Exception("deserialized object must have 1 component");
+        }
+        if (!(zz.getComponent(0) instanceof Button)) {
+            throw new Exception("deserialized object must contain Button component");
+        }
+        if (zz.getComponents().length != 0) {
+            throw new Exception("deserialized object returns non-empty array");
+        }
+        System.out.println("Test passed");
+    }
+
+    static class ZContainer extends Container {
+        public Component[] getComponents() {
+            return new Component[0];
+        }
+    }
+}
diff --git a/test/java/awt/Focus/8044614/TestApplet.java b/test/java/awt/Focus/8044614/TestApplet.java
new file mode 100644
index 0000000..fbc6fbc
--- /dev/null
+++ b/test/java/awt/Focus/8044614/TestApplet.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.applet.Applet;
+import java.awt.TextField;
+
+public class TestApplet extends Applet {
+    TextField textField = null;
+
+    public void init() {
+        textField = new TextField(25);
+        add(textField);
+    }
+}
diff --git a/test/java/awt/Focus/8044614/applet1.html b/test/java/awt/Focus/8044614/applet1.html
new file mode 100644
index 0000000..5e7e124
--- /dev/null
+++ b/test/java/awt/Focus/8044614/applet1.html
@@ -0,0 +1,37 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>First Applet</title>
+</head>
+  <body>
+    <applet 
+      code="TestApplet.class"
+      width="400" 
+      height="200"/>
+    </applet>
+  </body>
+</html>
diff --git a/test/java/awt/Focus/8044614/applet2.html b/test/java/awt/Focus/8044614/applet2.html
new file mode 100644
index 0000000..3541405
--- /dev/null
+++ b/test/java/awt/Focus/8044614/applet2.html
@@ -0,0 +1,37 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Second Applet</title>
+</head>
+  <body>
+    <applet 
+      code="TestApplet.class"
+      width="400" 
+      height="200"/>
+    </applet>
+  </body>
+</html>
diff --git a/test/java/awt/Focus/8044614/bug8044614.html b/test/java/awt/Focus/8044614/bug8044614.html
new file mode 100644
index 0000000..c07382f
--- /dev/null
+++ b/test/java/awt/Focus/8044614/bug8044614.html
@@ -0,0 +1,36 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<head>
+<title>bug8044614</title>
+</head>
+<body>
+
+<h1>bug8044614</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="bug8044614.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/Focus/8044614/bug8044614.java b/test/java/awt/Focus/8044614/bug8044614.java
new file mode 100644
index 0000000..9ed3921
--- /dev/null
+++ b/test/java/awt/Focus/8044614/bug8044614.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044614
+ * @summary Tests focus transfer between applets in different browser windows
+ * @author Dmitry Markov
+ * @library ../../regtesthelpers
+ * @build Sysout
+ * @run applet/manual=yesno bug8044614.html
+ */
+
+import javax.swing.JApplet;
+
+import test.java.awt.regtesthelpers.Sysout;
+
+public class bug8044614 extends JApplet {
+    public void init() {
+        String[] instructions = {
+            "(1) Go to the test directory test/java/awt/Focus/8044614",
+            "(2) Compile source file: javac TestApplet.java",
+            "(3) Open the \"main.html\" file in the browser",
+            "(4) Click the \"Start First Applet\" link to open the first applet window",
+            "(5) Wait for the applet to start (press \"Run\" to any security alerts that appears)",
+            "(6) Enter \"Hello\" to the text field",
+            "(7) Click the \"Start Second Applet)\" link to open the second applet window",
+            "(8) Wait for the applet to start (press \"Run\" to any security alerts that appears)",
+            "(9) Enter \"World\" to the text field",
+            "(10) Go back to the first applet and make sure you can enter some text to the text field"
+        };
+
+        Sysout.createDialogWithInstructions(instructions);
+    }
+}
+
diff --git a/test/java/awt/Focus/8044614/main.html b/test/java/awt/Focus/8044614/main.html
new file mode 100644
index 0000000..d7c3033
--- /dev/null
+++ b/test/java/awt/Focus/8044614/main.html
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Applet Focus Bug main window</title>
+  <script language="JavaScript">
+    function openWindow(strURL, strWindowName, strWindowFeatures) {
+      var win = window.open(strURL, strWindowName, strWindowFeatures);
+    }
+  </script>
+
+</head>
+  <body>
+    <table>
+      <tr>
+        <td><a href="javascript:openWindow('applet1.html', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=400, top=0, left=0, hide=no')">Start First Applet</a></td>
+      </tr>
+      <tr>
+        <td><a href="javascript:openWindow('applet2.html', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=400, top=0, left=350, hide=no')">Start Second Applet</a></td>
+      </tr>
+    </table>
+  </body>
+</html>
diff --git a/test/java/awt/Focus/SortingFPT/JDK8048887.java b/test/java/awt/Focus/SortingFPT/JDK8048887.java
new file mode 100644
index 0000000..0128706
--- /dev/null
+++ b/test/java/awt/Focus/SortingFPT/JDK8048887.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug       8048887
+  @summary   Tests SortingFTP for an exception caused by the tim-sort algo.
+  @author    anton.tarasov: area=awt.focus
+  @run       main JDK8048887
+*/
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import java.awt.Dimension;
+import java.awt.Color;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class JDK8048887 {
+
+    static volatile boolean passed = true;
+
+    public static void main(String[] args) {
+        JDK8048887 app = new JDK8048887();
+        app.start();
+    }
+
+    public void start() {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        SwingUtilities.invokeLater(() -> {
+                // Catch the original exception which sounds like:
+                // java.lang.IllegalArgumentException: Comparison method violates its general contract!
+                Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+                        public void uncaughtException(Thread t, Throwable e) {
+                            e.printStackTrace();
+                            if (e instanceof IllegalArgumentException) {
+                                passed = false;
+                                latch.countDown();
+                            }
+                        }
+                    });
+
+                TestDialog d = new TestDialog();
+                // It's expected that the dialog is focused on start.
+                // The listener is called after the FTP completes processing and the bug is reproduced or not.
+                d.addWindowFocusListener(new WindowAdapter() {
+                        public void windowGainedFocus(WindowEvent e) {
+                            latch.countDown();
+                        }
+                });
+                d.setVisible(true);
+        });
+
+        try {
+            latch.await(5, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        if (passed)
+            System.out.println("Test passed.");
+        else
+            throw new RuntimeException("Test failed!");
+    }
+}
+
+class TestDialog extends JFrame {
+
+    // The layout of the components reproduces the transitivity issue
+    // with SortingFocusTraversalPolicy relying on the tim-sort algo.
+
+    private static int[] Xs = new int[] {71, 23, 62, 4, 79, 39, 34, 9, 84, 58, 30, 34, 38, 15, 69, 10, 44, 95, 70, 54,
+    44, 62, 77, 64, 70, 83, 31, 48, 96, 54, 40, 3, 60, 58, 3, 20, 94, 54, 26, 19, 48, 47, 12, 70, 86, 43, 71, 97, 19,
+    69, 90, 22, 43, 76, 10, 60, 29, 49, 9, 9, 15, 73, 85, 80, 81, 35, 87, 43, 17, 57, 38, 44, 29, 86, 96, 15, 57, 26,
+    27, 78, 26, 87, 43, 6, 4, 16, 57, 99, 32, 86, 96, 5, 50, 69, 12, 4, 36, 84, 71, 60, 22, 46, 11, 44, 87, 3, 23, 14,
+    43, 25, 32, 44, 11, 18, 77, 2, 51, 87, 88, 53, 69, 37, 14, 10, 25, 73, 39, 33, 91, 51, 96, 9, 74, 66, 70, 42, 72,
+    7, 82, 40, 91, 33, 83, 54, 33, 50, 83, 1, 81, 32, 66, 11, 75, 56, 53, 45, 1, 69, 46, 31, 79, 58, 12, 20, 92, 49,
+    50, 90, 33, 8, 43, 93, 72, 78, 9, 56, 84, 60, 30, 39, 33, 88, 84, 56, 49, 47, 4, 90, 57, 6, 23, 96, 37, 88, 22, 79,
+    35, 80, 45, 55};
+
+    public TestDialog() {
+        JPanel panel = new JPanel(new GridBagLayout());
+        GridBagConstraints gbc = new GridBagConstraints();
+        for (int i=0; i < Xs.length; i++) {
+            gbc.gridx = Xs[i];
+            gbc.gridy = 100 - gbc.gridx;
+            panel.add(new MyComponent(), gbc);
+        }
+        getRootPane().getContentPane().add(panel);
+        pack();
+    }
+
+    public static class MyComponent extends JPanel {
+        private final static Dimension SIZE = new Dimension(1,1);
+
+        public MyComponent() {
+            setBackground(Color.BLACK);
+            setOpaque(true);
+        }
+
+        @Override
+        public Dimension getPreferredSize() {
+            return SIZE;
+        }
+    }
+}
diff --git a/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html
new file mode 100644
index 0000000..41944bc
--- /dev/null
+++ b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html
@@ -0,0 +1,21 @@
+<html>
+<!--  
+  @test
+  @bug 4051487 4145670
+  @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
+           while it is being created does not crash the VM.
+  @author dpm area=Threads
+  @run applet/timeout=7200 DisposeStressTest.html
+  -->
+<head>
+<title>DisposeStressTest</title>
+</head>
+<body>
+
+<h1>DisposeStressTest<br>Bug ID: 4051487, 4145670</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="DisposeStressTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java
new file mode 100644
index 0000000..7e13bc3
--- /dev/null
+++ b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  test
+  @bug 4051487 4145670 8062021
+  @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
+           while it is being created does not crash the VM.
+  @author dpm area=Threads
+  @run applet/timeout=7200 DisposeStressTest.html
+*/
+
+// Note there is no @ in front of test above.  This is so that the
+//  harness will not mistake this file as a test file.  It should
+//  only see the html file as a test file. (the harness runs all
+//  valid test files, so it would run this test twice if this file
+//  were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag.  Here, you
+//  should put which functional area the test falls in.  See the
+//  AWT-core home page -> test areas and/or -> AWT team  for a list of
+//  areas.
+// Note also the 'DisposeStressTest.html' in the run tag.  This should
+//  be changed to the name of the test.
+
+
+/**
+ * DisposeStressTest.java
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors.  (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems).  Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class DisposeStressTest extends Applet
+ {
+   //Declare things used in the test, like buttons and labels here
+
+   public void init()
+    {
+      //Create instructions for the user here, as well as set up
+      // the environment -- set the layout manager, add buttons,
+      // etc.
+
+      this.setLayout (new BorderLayout ());
+
+      String[] instructions =
+       {
+         "This is an AUTOMATIC test",
+         "simply wait until it is done"
+       };
+      Sysout.createDialog( );
+      Sysout.printInstructions( instructions );
+
+    }//End  init()
+
+   public void start ()
+    {
+        for (int i = 0; i < 1000; i++) {
+            Frame f = new Frame();
+            f.setBounds(10, 10, 10, 10);
+            f.show();
+            f.dispose();
+
+            Frame f2 = new Frame();
+            f2.setBounds(10, 10, 100, 100);
+            MenuBar bar = new MenuBar();
+            Menu menu = new Menu();
+            menu.add(new MenuItem("foo"));
+            bar.add(menu);
+            f2.setMenuBar(bar);
+            f2.show();
+            f2.dispose();
+        }
+    }// start()
+
+ }// class DisposeStressTest
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+ {
+   private static TestDialog dialog;
+
+   public static void createDialogWithInstructions( String[] instructions )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      dialog.printInstructions( instructions );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+   public static void createDialog( )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      String[] defInstr = { "Instructions will appear here. ", "" } ;
+      dialog.printInstructions( defInstr );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+
+   public static void printInstructions( String[] instructions )
+    {
+      dialog.printInstructions( instructions );
+    }
+
+
+   public static void println( String messageIn )
+    {
+      dialog.displayMessage( messageIn );
+    }
+
+ }// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+ {
+
+   TextArea instructionsText;
+   TextArea messageText;
+   int maxStringLength = 80;
+
+   //DO NOT call this directly, go through Sysout
+   public TestDialog( Frame frame, String name )
+    {
+      super( frame, name );
+      int scrollBoth = TextArea.SCROLLBARS_BOTH;
+      instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+      add( "North", instructionsText );
+
+      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+      add("South", messageText);
+
+      pack();
+
+      show();
+    }// TestDialog()
+
+   //DO NOT call this directly, go through Sysout
+   public void printInstructions( String[] instructions )
+    {
+      //Clear out any current instructions
+      instructionsText.setText( "" );
+
+      //Go down array of instruction strings
+
+      String printStr, remainingStr;
+      for( int i=0; i < instructions.length; i++ )
+       {
+         //chop up each into pieces maxSringLength long
+         remainingStr = instructions[ i ];
+         while( remainingStr.length() > 0 )
+          {
+            //if longer than max then chop off first max chars to print
+            if( remainingStr.length() >= maxStringLength )
+             {
+               //Try to chop on a word boundary
+               int posOfSpace = remainingStr.
+                  lastIndexOf( ' ', maxStringLength - 1 );
+
+               if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+               printStr = remainingStr.substring( 0, posOfSpace + 1 );
+               remainingStr = remainingStr.substring( posOfSpace + 1 );
+             }
+            //else just print
+            else
+             {
+               printStr = remainingStr;
+               remainingStr = "";
+             }
+
+            instructionsText.append( printStr + "\n" );
+
+          }// while
+
+       }// for
+
+    }//printInstructions()
+
+   //DO NOT call this directly, go through Sysout
+   public void displayMessage( String messageIn )
+    {
+      messageText.append( messageIn + "\n" );
+    }
+
+ }// TestDialog  class
diff --git a/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java b/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java
new file mode 100644
index 0000000..de8a900
--- /dev/null
+++ b/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043508
+ * @summary Drawing a very long string crashes VM
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class DrawStringCrash {
+
+    public static void main(String[] args) {
+        StringBuffer sb = new StringBuffer();
+        String s = "abcdefghijklmnopqrstuzwxyz";
+        for (int x = 0; x < 100000 ; x++) {
+           sb.append(s);
+        }
+        // Now have a string which uses approx 5Mb memory
+        // Loop again drawing doubling each time until
+        // we reach 8 billion chars or get OOME which means we can't
+        // go any further.
+        // Often there is no crash because Java OOM happens
+        // long before native heap runs out.
+        long maxLen = 8L * 1024 * 1024 * 1024;
+        int len = sb.length();
+
+        BufferedImage bi =
+            new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = bi.createGraphics();
+        while (len < maxLen) {
+            try {
+                g2d.drawString(sb.toString(), 20, 20);
+            } catch (OutOfMemoryError e) {
+                return;
+            }
+            sb.append(sb);
+            len *= 2;
+        }
+        return;
+    }
+}
diff --git a/test/java/awt/Graphics2D/WhiteTextColorTest.java b/test/java/awt/Graphics2D/WhiteTextColorTest.java
new file mode 100644
index 0000000..8c2ddf4
--- /dev/null
+++ b/test/java/awt/Graphics2D/WhiteTextColorTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import javax.swing.*;
+
+/**
+ * @test
+ * @bug 8056009
+ * @summary tests whether Graphics.setColor-calls with Color.white are ignored directly
+ *          after pipeline initialization for a certain set of operations.
+ * @author ceisserer
+ */
+public class WhiteTextColorTest extends Frame {
+    public static volatile boolean success = false;
+
+    public WhiteTextColorTest() {
+        Image dstImg = getGraphicsConfiguration()
+                .createCompatibleVolatileImage(30, 20);
+        Graphics g = dstImg.getGraphics();
+
+        g.setColor(Color.BLACK);
+        g.fillRect(0, 0, dstImg.getWidth(null), dstImg.getHeight(null));
+        g.setColor(Color.WHITE);
+        g.drawString("Test", 0, 15);
+
+        BufferedImage readBackImg = new BufferedImage(dstImg.getWidth(null),
+                dstImg.getHeight(null), BufferedImage.TYPE_INT_RGB);
+        readBackImg.getGraphics().drawImage(dstImg, 0, 0, null);
+
+        for (int x = 0; x < readBackImg.getWidth(); x++) {
+            for (int y = 0; y < readBackImg.getHeight(); y++) {
+                int pixel = readBackImg.getRGB(x, y);
+
+                // In case a single white pixel is found, the
+                // setColor(Color.WHITE)
+                // call before was not ignored and the bug is not present
+                if (pixel == 0xFFFFFFFF) {
+                    return;
+                }
+            }
+        }
+
+        throw new RuntimeException("Test Failed");
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                new WhiteTextColorTest();
+            }
+        });
+    }
+}
+
diff --git a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
new file mode 100644
index 0000000..a13cd81
--- /dev/null
+++ b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Dialog;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.SplashScreen;
+import java.awt.Window;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import javax.imageio.ImageIO;
+import sun.java2d.SunGraphics2D;
+
+/**
+ * @test
+ * @bug 8043869
+ * @author Alexander Scherbatiy
+ * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
+ * support
+ * @run main MultiResolutionSplashTest GENERATE_IMAGES
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
+ * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
+ * @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ */
+public class MultiResolutionSplashTest {
+
+    private static final int IMAGE_WIDTH = 300;
+    private static final int IMAGE_HEIGHT = 200;
+
+    private static final ImageInfo[] tests = {
+        new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN),
+        new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK),
+        new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED)
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        String test = args[0];
+
+        switch (test) {
+            case "GENERATE_IMAGES":
+                generateImages();
+                break;
+            case "TEST_SPLASH":
+                int index = Integer.parseInt(args[1]);
+                testSplash(tests[index]);
+                break;
+            default:
+                throw new RuntimeException("Unknown test: " + test);
+        }
+    }
+
+    static void testSplash(ImageInfo test) throws Exception {
+        SplashScreen splashScreen = SplashScreen.getSplashScreen();
+
+        if (splashScreen == null) {
+            throw new RuntimeException("Splash screen is not shown!");
+        }
+
+        Graphics2D g = splashScreen.createGraphics();
+        Rectangle splashBounds = splashScreen.getBounds();
+        int screenX = (int) splashBounds.getCenterX();
+        int screenY = (int) splashBounds.getCenterY();
+
+        Robot robot = new Robot();
+        Color splashScreenColor = robot.getPixelColor(screenX, screenY);
+
+        float scaleFactor = getScaleFactor();
+        Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
+
+        if (!testColor.equals(splashScreenColor)) {
+            throw new RuntimeException(
+                    "Image with wrong resolution is used for splash screen!");
+        }
+    }
+
+    static float getScaleFactor() {
+
+        final Dialog dialog = new Dialog((Window) null);
+        dialog.setSize(100, 100);
+        dialog.setModal(true);
+        final float[] scaleFactors = new float[1];
+        Panel panel = new Panel() {
+
+            @Override
+            public void paint(Graphics g) {
+                float scaleFactor = 1;
+                if (g instanceof SunGraphics2D) {
+                    scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
+                }
+                scaleFactors[0] = scaleFactor;
+                dialog.setVisible(false);
+            }
+        };
+
+        dialog.add(panel);
+        dialog.setVisible(true);
+        dialog.dispose();
+
+        return scaleFactors[0];
+    }
+
+    static void generateImages() throws Exception {
+        for (ImageInfo test : tests) {
+            generateImage(test.name1x, test.color1x, 1);
+            generateImage(test.name2x, test.color2x, 2);
+        }
+    }
+
+    static void generateImage(String name, Color color, int scale) throws Exception {
+        File file = new File(name);
+        if (file.exists()) {
+            return;
+        }
+        BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.getGraphics();
+        g.setColor(color);
+        g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+        ImageIO.write(image, "png", file);
+    }
+
+    static class ImageInfo {
+
+        final String name1x;
+        final String name2x;
+        final Color color1x;
+        final Color color2x;
+
+        public ImageInfo(String name1x, String name2x, Color color1x, Color color2x) {
+            this.name1x = name1x;
+            this.name2x = name2x;
+            this.color1x = color1x;
+            this.color2x = color2x;
+        }
+    }
+}
diff --git a/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java b/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java
new file mode 100644
index 0000000..ed76fa8
--- /dev/null
+++ b/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Window;
+
+/**
+ * @test
+ * @bug 8064468
+ * @author Alexander Scherbatiy
+ * @summary ownedWindowList access requires synchronization in
+ *     Window.setAlwaysOnTop() method
+ * @run main SyncAlwaysOnTopFieldTest
+ */
+public class SyncAlwaysOnTopFieldTest {
+
+    private static final int WINDOWS_COUNT = 200;
+    private static final int STEPS_COUNT = 20;
+
+    public static void main(String[] args) throws Exception {
+        final Window rootWindow = createWindow(null);
+
+        new Thread(() -> {
+            for (int i = 0; i < WINDOWS_COUNT; i++) {
+                createWindow(rootWindow);
+            }
+        }).start();
+
+        boolean alwaysOnTop = true;
+        for (int i = 0; i < STEPS_COUNT; i++) {
+            Thread.sleep(10);
+            rootWindow.setAlwaysOnTop(alwaysOnTop);
+            alwaysOnTop = !alwaysOnTop;
+        }
+    }
+
+    private static Window createWindow(Window parent) {
+        Window window = new Window(parent);
+        window.setSize(200, 200);
+        window.setVisible(true);
+        return window;
+    }
+}
\ No newline at end of file
diff --git a/test/java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java b/test/java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java
new file mode 100644
index 0000000..2c07f31
--- /dev/null
+++ b/test/java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.event.AWTEventListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+/*
+ * @test
+ * @bug 8046495
+ * @summary Verifies that mouse/key events has always increasing 'when' timestamps
+ * @author Anton Nashatyrev
+ * @run main EventWhenTest
+ */
+public class EventWhenTest {
+
+    private static volatile int eventsCount = 0;
+    private static volatile boolean failed = false;
+
+    static {
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+            long lastWhen = 0;
+
+            @Override
+            public void eventDispatched(AWTEvent event) {
+                long curWhen;
+                if (event instanceof KeyEvent) {
+                    curWhen = ((KeyEvent) event).getWhen();
+                } else if (event instanceof MouseEvent) {
+                    curWhen = ((MouseEvent) event).getWhen();
+                } else {
+                    return;
+                }
+
+                eventsCount++;
+
+                if (curWhen < lastWhen) {
+                    System.err.println("FAILED: " + curWhen + " < " + lastWhen +
+                        " for " + event);
+                    failed = true;
+                } else {
+                    lastWhen = curWhen;
+                }
+            }
+        }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Frame frame = new Frame();
+
+        try {
+            Button b = new Button("Button");
+            frame.setBounds(300, 300, 300, 300);
+            frame.add(b);
+            frame.setVisible(true);
+            toolkit.realSync();
+
+            Robot robot = new Robot();
+            robot.mouseMove((int)frame.getLocationOnScreen().getX() + 150,
+                    (int)frame.getLocationOnScreen().getY() + 150);
+
+            eventsCount = 0;
+            System.out.println("Clicking mouse...");
+            for (int i = 0; i < 300 && !failed; i++) {
+                robot.mousePress(InputEvent.BUTTON1_MASK);
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+                Thread.sleep(10);
+                b.setLabel("Click: " + i);
+            }
+
+            if (eventsCount == 0) {
+                throw new RuntimeException("No events were received");
+            }
+
+            if (failed) {
+                throw new RuntimeException("Test failed.");
+            }
+            System.out.println("Clicking mouse done: " + eventsCount + " events.");
+
+            b.requestFocusInWindow();
+            toolkit.realSync();
+
+            eventsCount = 0;
+            System.out.println("Typing a key...");
+            for (int i = 0; i < 300 && !failed; i++) {
+                robot.keyPress(KeyEvent.VK_A);
+                robot.keyRelease(KeyEvent.VK_A);
+                Thread.sleep(10);
+                b.setLabel("Type: " + i);
+            }
+            System.out.println("Key typing done: " + eventsCount + " events.");
+
+            if (eventsCount == 0) {
+                throw new RuntimeException("No events were received");
+            }
+
+            if (failed) {
+                throw new RuntimeException("Test failed.");
+            }
+
+            System.out.println("Success!");
+        } finally {
+            frame.dispose();
+        }
+    }
+}
diff --git a/test/java/awt/image/DrawImage/DrawImageCoordsTest.java b/test/java/awt/image/DrawImage/DrawImageCoordsTest.java
new file mode 100644
index 0000000..36d4185
--- /dev/null
+++ b/test/java/awt/image/DrawImage/DrawImageCoordsTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8028539
+ * @summary Test that drawing a scaled image terminates.
+ * @run main/othervm/timeout=60 DrawImageCoordsTest
+*/
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+
+public class DrawImageCoordsTest {
+
+    public static void main(String[] args) {
+
+        /* Create an image to draw, filled in solid red. */
+        BufferedImage srcImg =
+             new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+        Graphics srcG = srcImg.createGraphics();
+        srcG.setColor(Color.red);
+        int w = srcImg.getWidth(null);
+        int h = srcImg.getHeight(null);
+        srcG.fillRect(0, 0, w, h);
+
+        /* Create a destination image */
+        BufferedImage dstImage =
+           new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+        Graphics2D dstG = dstImage.createGraphics();
+        /* draw image under a scaling transform that overflows int */
+        AffineTransform tx = new AffineTransform(0.5, 0, 0, 0.5,
+                                                  0, 5.8658460197478485E9);
+        dstG.setTransform(tx);
+        dstG.drawImage(srcImg, 0, 0, null );
+        /* draw image under the same overflowing transform, cancelling
+         * out the 0.5 scale on the graphics
+         */
+        dstG.drawImage(srcImg, 0, 0, 2*w, 2*h, null);
+        if (Color.red.getRGB() == dstImage.getRGB(w/2, h/2)) {
+             throw new RuntimeException("Unexpected color: clipping failed.");
+        }
+        System.out.println("Test Thread Completed");
+    }
+}
diff --git a/test/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java b/test/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java
new file mode 100644
index 0000000..88d4e43
--- /dev/null
+++ b/test/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8061392
+ * @summary Test no NPE when printing transparency with null clip.
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import java.awt.print.*;
+
+public class NullClipARGB implements Printable {
+
+    public static void main( String[] args ) {
+
+        try {
+            PrinterJob pj = PrinterJob.getPrinterJob();
+            pj.setPrintable(new NullClipARGB());
+            pj.print();
+            } catch (Exception ex) {
+             throw new RuntimeException(ex);
+        }
+    }
+
+    public int print(Graphics g, PageFormat pf, int pageIndex)
+               throws PrinterException{
+
+        if (pageIndex != 0) {
+            return NO_SUCH_PAGE;
+        }
+        Graphics2D g2 = (Graphics2D)g;
+        System.out.println("original clip="+g2.getClip());
+        g2.translate(pf.getImageableX(), pf.getImageableY());
+        g2.rotate(0.2);
+        g2.setClip(null);
+        g2.setColor( Color.BLACK );
+        g2.drawString("This text should be visible through the image", 0, 20);
+        BufferedImage bi = new BufferedImage(100, 100,
+                                              BufferedImage.TYPE_INT_ARGB );
+        Graphics ig = bi.createGraphics();
+        ig.setColor( new Color( 192, 192, 192, 80 ) );
+        ig.fillRect( 0, 0, 100, 100 );
+        ig.setColor( Color.BLACK );
+        ig.drawRect( 0, 0, 99, 99 );
+        ig.dispose();
+        g2.drawImage(bi, 10, 0, 90, 90, null );
+        g2.translate(100, 100);
+        g2.drawString("This text should also be visible through the image", 0, 20);
+        g2.drawImage(bi, 10, 0, 90, 90, null );
+        return PAGE_EXISTS;
+    }
+}
diff --git a/test/java/io/SequenceInputStream/LotsOfStreams.java b/test/java/io/SequenceInputStream/LotsOfStreams.java
new file mode 100644
index 0000000..3ad0d27
--- /dev/null
+++ b/test/java/io/SequenceInputStream/LotsOfStreams.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 7011804
+ * @summary SequenceInputStream#read() was implemented recursivly,
+ *          which may cause stack overflow
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.util.Enumeration;
+
+public class LotsOfStreams {
+
+    static final int MAX_SUBSTREAMS = 32000;
+
+    public static void main(String[] argv) throws Exception {
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            stream.read();
+        }
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            byte[] b = new byte[1];
+            stream.read(b, 0, 1);
+        }
+    }
+
+    static class LOSEnumeration
+            implements Enumeration<InputStream> {
+
+        private static InputStream inputStream =
+                new ByteArrayInputStream(new byte[0]);
+        private int left = MAX_SUBSTREAMS;
+
+        public boolean hasMoreElements() {
+            return (left > 0);
+        }
+        public InputStream nextElement() {
+            left--;
+            return inputStream;
+        }
+    }
+}
diff --git a/test/java/lang/ProcessBuilder/Basic.java b/test/java/lang/ProcessBuilder/Basic.java
index 3aa96a9..b86509d 100644
--- a/test/java/lang/ProcessBuilder/Basic.java
+++ b/test/java/lang/ProcessBuilder/Basic.java
@@ -2246,9 +2246,9 @@
                 fail("Test failed: Process exited prematurely");
             }
             long end = System.nanoTime();
-            // give waitFor(timeout) a wide berth (100ms)
+            // give waitFor(timeout) a wide berth (200ms)
             // Old AIX machines my need a little longer.
-            if ((end - start) > 100000000L * (AIX.is() ? 4 : 1))
+            if ((end - start) > 200000000L * (AIX.is() ? 2 : 1))
                 fail("Test failed: waitFor took too long (" + (end - start) + "ns)");
 
             p.destroy();
diff --git a/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh b/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh
index 2b33a03..a8cfa51 100644
--- a/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh
+++ b/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh
@@ -36,9 +36,12 @@
   exit 1
 fi
 
+if [ "x${COMPILEJAVA}" = "x" ]; then
+  COMPILEJAVA="${TESTJAVA}"
+fi
 
 JAVA="${TESTJAVA}/bin/java"
-JAVAC="${TESTJAVA}/bin/javac"
+JAVAC="${COMPILEJAVA}/bin/javac"
 
 cp -f ${TESTSRC}/InheritIO.java .
 
diff --git a/test/java/lang/ProcessBuilder/SecurityManagerClinit.java b/test/java/lang/ProcessBuilder/SecurityManagerClinit.java
index dff6174..a72cdbe 100644
--- a/test/java/lang/ProcessBuilder/SecurityManagerClinit.java
+++ b/test/java/lang/ProcessBuilder/SecurityManagerClinit.java
@@ -54,9 +54,6 @@
             System.getProperty("java.home") +
             File.separator + "bin" + File.separator + "java";
 
-        // A funky contrived security setup, just for bug repro purposes.
-        java.security.Security.setProperty("package.access", "java.util");
-
         final Policy policy =
             new Policy
             (new FilePermission("<<ALL FILES>>", "execute"),
diff --git a/test/java/lang/instrument/NMTHelper.java b/test/java/lang/instrument/NMTHelper.java
index ad08fdb..ee5d1e1 100644
--- a/test/java/lang/instrument/NMTHelper.java
+++ b/test/java/lang/instrument/NMTHelper.java
@@ -21,8 +21,12 @@
  * questions.
  */
 
+import java.io.File;
+import java.io.FileWriter;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.Arrays;
+import java.util.stream.Collectors;
 import sun.management.ManagementFactoryHelper;
 import com.sun.management.DiagnosticCommandMBean;
 
@@ -32,8 +36,8 @@
         executeDcmd("vmNativeMemory", "baseline");
     }
 
-    // Total:  reserved=3484685KB  +293KB, committed=266629KB +293KB
-    private static Pattern totalLine = Pattern.compile("^Total:  reserved=\\d+KB  .*KB, committed=\\d+KB (.*)KB$");
+    // Total: reserved=3484685KB +293KB, committed=266629KB +293KB
+    private static Pattern totalLine = Pattern.compile("^Total: reserved=\\d+KB .*KB, committed=\\d+KB (.*)KB$");
 
     public static long committedDiff() throws Exception {
         String res = (String) executeDcmd("vmNativeMemory", "detail.diff");
@@ -53,14 +57,14 @@
         Object[] dcmdArgs = {args};
         String[] signature = {String[].class.getName()};
 
-        try {
-            System.out.print("> " + cmd + " ");
-            for (String s : args) {
-                System.out.print(s + " ");
-            }
-            System.out.println(":");
+        String cmdString = cmd + " " +
+            Arrays.stream(args).collect(Collectors.joining(" "));
+        File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
+        System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
+        try (FileWriter fw = new FileWriter(f)) {
+            fw.write("> " + cmdString + ":");
             String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
-            System.out.println(result);
+            fw.write(result);
             return result;
         } catch(Exception ex) {
             ex.printStackTrace();
diff --git a/test/java/lang/instrument/RedefineBigClass.sh b/test/java/lang/instrument/RedefineBigClass.sh
index 82cfd4c..e5c84e7 100644
--- a/test/java/lang/instrument/RedefineBigClass.sh
+++ b/test/java/lang/instrument/RedefineBigClass.sh
@@ -27,7 +27,7 @@
 # @author Daniel D. Daugherty
 #
 # @run shell MakeJAR3.sh RedefineBigClassAgent 'Can-Redefine-Classes: true'
-# @run build BigClass RedefineBigClassApp
+# @run build BigClass RedefineBigClassApp NMTHelper
 # @run shell/timeout=600 RedefineBigClass.sh
 #
 
diff --git a/test/java/lang/instrument/RetransformBigClass.sh b/test/java/lang/instrument/RetransformBigClass.sh
index 22065b6..332dd32 100644
--- a/test/java/lang/instrument/RetransformBigClass.sh
+++ b/test/java/lang/instrument/RetransformBigClass.sh
@@ -27,7 +27,7 @@
 # @author Daniel D. Daugherty
 #
 # @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
-# @run build BigClass RetransformBigClassApp
+# @run build BigClass RetransformBigClassApp NMTHelper
 # @run shell/timeout=600 RetransformBigClass.sh
 #
 
diff --git a/test/java/lang/invoke/ExplicitCastArgumentsTest.java b/test/java/lang/invoke/ExplicitCastArgumentsTest.java
new file mode 100644
index 0000000..06f7a64
--- /dev/null
+++ b/test/java/lang/invoke/ExplicitCastArgumentsTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+import sun.invoke.util.Wrapper;
+
+/* @test
+ * @summary unit tests for MethodHandles.explicitCastArguments()
+ *
+ * @run main/bootclasspath java.lang.invoke.ExplicitCastArgumentsTest
+ */
+public class ExplicitCastArgumentsTest {
+    private static final boolean VERBOSE = Boolean.getBoolean("verbose");
+
+    public static void main(String[] args) throws Throwable {
+        for (Wrapper from : Wrapper.values()) {
+            for (Wrapper to : Wrapper.values()) {
+                if (from == Wrapper.VOID || to == Wrapper.VOID) continue;
+                testRef2Prim (from, to);
+            }
+        }
+        System.out.println("TEST PASSED");
+    }
+
+    public static void testRef2Prim(Wrapper from, Wrapper to) throws Throwable {
+        // MHs.eCA javadoc:
+        //    If T0 is a reference and T1 a primitive, and if the reference is null at runtime, a zero value is introduced.
+        test(from.wrapperType(), to.primitiveType(),        null, false);
+    }
+
+    public static void test(Class<?> from, Class<?> to, Object param, boolean failureExpected) throws Throwable {
+        if (VERBOSE) System.out.printf("%-10s => %-10s: %5s: ", from.getSimpleName(), to.getSimpleName(), param);
+
+        MethodHandle original = MethodHandles.identity(from);
+        MethodType newType = original.type().changeReturnType(to);
+
+        try {
+            MethodHandle target = MethodHandles.explicitCastArguments(original, newType);
+            Object result = target.invokeWithArguments(param);
+
+            if (VERBOSE) {
+                String resultStr;
+                if (result != null) {
+                    resultStr = String.format("%10s (%10s)", "'"+result+"'", result.getClass().getSimpleName());
+                } else {
+                    resultStr = String.format("%10s", result);
+                }
+                System.out.println(resultStr);
+            }
+
+            if (failureExpected) {
+                String msg = String.format("No exception thrown: %s => %s; parameter: %s", from, to, param);
+                throw new AssertionError(msg);
+            }
+        } catch (AssertionError e) {
+            throw e; // report test failure
+        } catch (Throwable e) {
+            if (VERBOSE) System.out.printf("%s: %s\n", e.getClass(), e.getMessage());
+            if (!failureExpected) {
+                String msg = String.format("Unexpected exception was thrown: %s => %s; parameter: %s", from, to, param);
+                throw new AssertionError(msg, e);
+            }
+        }
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/LFCachingTestCase.java b/test/java/lang/invoke/LFCaching/LFCachingTestCase.java
new file mode 100644
index 0000000..30ba39a
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/LFCachingTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.invoke.MethodHandle;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Abstract class for lambda forms caching testing.
+ *
+ * @author kshefov
+ */
+public abstract class LFCachingTestCase extends LambdaFormTestCase {
+
+    /**
+     * Constructor for lambda forms caching test case.
+     *
+     * @param testMethod A method from {@code j.l.i.MethodHandles} class that
+     * returns a {@code j.l.i.MethodHandle} instance.
+     */
+    protected LFCachingTestCase(TestMethods testMethod) {
+        super(testMethod);
+    }
+
+    /**
+     * Checks that the lambda forms of the two adapter method handles adapter1
+     * and adapter2 are the same.
+     *
+     * @param adapter1 First method handle.
+     * @param adapter2 Second method handle.
+     */
+    public void checkLFCaching(MethodHandle adapter1, MethodHandle adapter2) {
+        try {
+
+            if (!adapter1.type().equals(adapter2.type())) {
+                throw new Error("TESTBUG: Types of the two method handles are not the same");
+            }
+
+            Object lambdaForm0 = LambdaFormTestCase.INTERNAL_FORM.invoke(adapter1);
+            Object lambdaForm1 = LambdaFormTestCase.INTERNAL_FORM.invoke(adapter2);
+
+            if (lambdaForm0 == null || lambdaForm1 == null) {
+                throw new Error("Unexpected error: One or both lambda forms of the method handles are null");
+            }
+
+            if (lambdaForm0 != lambdaForm1) {
+                System.err.println("Lambda form 0 toString is:");
+                System.err.println(lambdaForm0);
+                System.err.println("Lambda form 1 toString is:");
+                System.err.println(lambdaForm1);
+                throw new AssertionError("Error: Lambda forms of the two method handles"
+                        + " are not the same. LF cahing does not work");
+            }
+        } catch (IllegalAccessException | IllegalArgumentException |
+                SecurityException | InvocationTargetException ex) {
+            throw new Error("Unexpected exception: ", ex);
+        }
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
new file mode 100644
index 0000000..3b9ed4d
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test LFGarbageCollectedTest
+ * @bug 8046703
+ * @summary Test verifies that lambda forms are garbage collected
+ * @author kshefov
+ * @ignore 8057020
+ * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @build TestMethods
+ * @build LambdaFormTestCase
+ * @build LFGarbageCollectedTest
+ * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 LFGarbageCollectedTest
+ */
+
+import java.lang.invoke.MethodHandle;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.reflect.InvocationTargetException;
+import java.util.EnumSet;
+import java.util.Map;
+
+/**
+ * Lambda forms garbage collection test class.
+ */
+public final class LFGarbageCollectedTest extends LambdaFormTestCase {
+
+    /**
+     * Constructor for a lambda forms garbage collection test case.
+     *
+     * @param testMethod A method from {@code j.l.i.MethodHandles} class that
+     * returns a {@code j.l.i.MethodHandle} instance.
+     */
+    public LFGarbageCollectedTest(TestMethods testMethod) {
+        super(testMethod);
+    }
+
+    @Override
+    public void doTest() {
+        try {
+            Map<String, Object> data = getTestMethod().getTestCaseData();
+            MethodHandle adapter;
+            try {
+                adapter = getTestMethod().getTestCaseMH(data, TestMethods.Kind.ONE);
+            } catch (NoSuchMethodException ex) {
+                throw new Error("Unexpected exception: ", ex);
+            }
+            Object lambdaForm = LambdaFormTestCase.INTERNAL_FORM.invoke(adapter);
+            if (lambdaForm == null) {
+                throw new Error("Unexpected error: Lambda form of the method handle is null");
+            }
+            ReferenceQueue rq = new ReferenceQueue();
+            PhantomReference ph = new PhantomReference(lambdaForm, rq);
+            lambdaForm = null;
+            data = null;
+            adapter = null;
+            for (int i = 0; i < 1000 && !ph.isEnqueued(); i++) {
+                System.gc();
+            }
+            if (!ph.isEnqueued()) {
+                throw new AssertionError("Error: Lambda form is not garbage collected");
+            }
+        } catch (IllegalAccessException | IllegalArgumentException |
+                InvocationTargetException ex) {
+            throw new Error("Unexpected exception: ", ex);
+        }
+    }
+
+    /**
+     * Main routine for lambda forms garbage collection test.
+     *
+     * @param args Accepts no arguments.
+     */
+    public static void main(String[] args) {
+        // The "identity", "constant", "arrayElementGetter" and "arrayElementSetter"
+        // methods should be removed from this test,
+        // because their lambda forms are stored in a static field and are not GC'ed.
+        // There can be only a finite number of such LFs for each method,
+        // so no memory leak happens.
+        EnumSet<TestMethods> testMethods = EnumSet.complementOf(EnumSet.of(
+                TestMethods.IDENTITY,
+                TestMethods.CONSTANT,
+                TestMethods.ARRAY_ELEMENT_GETTER,
+                TestMethods.ARRAY_ELEMENT_SETTER));
+        LambdaFormTestCase.runTests(LFGarbageCollectedTest::new, testMethods);
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
new file mode 100644
index 0000000..a416472
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test LFMultiThreadCachingTest
+ * @bug 8046703
+ * @summary Test verifies that lambda forms are cached when run with multiple threads
+ * @author kshefov
+ * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @build TestMethods
+ * @build LambdaFormTestCase
+ * @build LFCachingTestCase
+ * @build LFMultiThreadCachingTest
+ * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFMultiThreadCachingTest
+ */
+
+import java.lang.invoke.MethodHandle;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+
+/**
+ * Multiple threaded lambda forms caching test class.
+ */
+public final class LFMultiThreadCachingTest extends LFCachingTestCase {
+    private static final TestMethods.Kind[] KINDS;
+    static {
+        EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
+        KINDS = set.toArray(new TestMethods.Kind[set.size()]);
+        if (KINDS.length < 2) {
+            throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");
+        }
+    }
+    private static final int CORES = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
+
+    /**
+     * Constructor a for multiple threaded lambda forms caching test case.
+     *
+     * @param testMethod A method from {@code j.l.i.MethodHandles} class that
+     * returns a {@code j.l.i.MethodHandle} instance.
+     */
+    public LFMultiThreadCachingTest(TestMethods testMethod) {
+        super(testMethod);
+    }
+
+    @Override
+    public void doTest() {
+        Map<String, Object> data = getTestMethod().getTestCaseData();
+        ConcurrentLinkedQueue<MethodHandle> adapters = new ConcurrentLinkedQueue<>();
+        CyclicBarrier begin = new CyclicBarrier(CORES);
+        CountDownLatch end = new CountDownLatch(CORES);
+        for (int i = 0; i < CORES; ++i) {
+            TestMethods.Kind kind = KINDS[i % KINDS.length];
+            new Thread(() -> {
+                try {
+                    begin.await();
+                    adapters.add(getTestMethod().getTestCaseMH(data, kind));
+                } catch (InterruptedException | BrokenBarrierException | IllegalAccessException | NoSuchMethodException ex) {
+                    throw new Error("Unexpected exception: ", ex);
+                } finally {
+                    end.countDown();
+                }
+            }).start();
+        }
+        try {
+            end.await();
+        } catch (InterruptedException ex) {
+            throw new Error("Unexpected exception: ", ex);
+        }
+        if (adapters.size() < CORES) {
+            throw new Error("adapters size[" + adapters.size() + "] is less than " + CORES);
+        }
+        MethodHandle prev = adapters.poll();
+        for (MethodHandle current : adapters) {
+            checkLFCaching(prev, current);
+            prev = current;
+        }
+    }
+
+    /**
+     * Main routine for multiple threaded lambda forms caching test.
+     *
+     * @param args Accepts no arguments.
+     */
+    public static void main(String[] args) {
+        LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
new file mode 100644
index 0000000..21221aa
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test LFSingleThreadCachingTest
+ * @bug 8046703
+ * @summary Test verifies that lambda forms are cached when run with single thread
+ * @author kshefov
+ * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @build TestMethods
+ * @build LambdaFormTestCase
+ * @build LFCachingTestCase
+ * @build LFSingleThreadCachingTest
+ * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFSingleThreadCachingTest
+ */
+
+import java.lang.invoke.MethodHandle;
+import java.util.EnumSet;
+import java.util.Map;
+
+/**
+ * Single threaded lambda forms caching test class.
+ */
+public final class LFSingleThreadCachingTest extends LFCachingTestCase {
+
+    /**
+     * Constructor for a single threaded lambda forms caching test case.
+     *
+     * @param testMethod A method from {@code j.l.i.MethodHandles} class that
+     * returns a {@code j.l.i.MethodHandle} instance.
+     */
+    public LFSingleThreadCachingTest(TestMethods testMethod) {
+        super(testMethod);
+    }
+
+    @Override
+    public void doTest() {
+        MethodHandle adapter1;
+        MethodHandle adapter2;
+        Map<String, Object> data = getTestMethod().getTestCaseData();
+        try {
+            adapter1 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.ONE);
+            adapter2 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.TWO);
+        } catch (NoSuchMethodException | IllegalAccessException ex) {
+            throw new Error("Unexpected exception: ", ex);
+        }
+        checkLFCaching(adapter1, adapter2);
+    }
+
+    /**
+     * Main routine for single threaded lambda forms caching test.
+     *
+     * @param args Accepts no arguments.
+     */
+    public static void main(String[] args) {
+        LambdaFormTestCase.runTests(LFSingleThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
new file mode 100644
index 0000000..c867898
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.oracle.testlibrary.jsr292.Helper;
+import com.sun.management.HotSpotDiagnosticMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.function.Function;
+
+/**
+ * Lambda forms caching test case class. Contains all necessary test routines to
+ * test lambda forms caching in method handles returned by methods of
+ * MethodHandles class.
+ *
+ * @author kshefov
+ */
+public abstract class LambdaFormTestCase {
+
+    private final static String METHOD_HANDLE_CLASS_NAME = "java.lang.invoke.MethodHandle";
+    private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
+    private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
+            = 45 / (128.0 * 1024 * 1024);
+
+    /**
+     * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
+     * used to get a lambda form from a method handle.
+     */
+    protected final static Method INTERNAL_FORM;
+
+    static {
+        try {
+            Class mhClass = Class.forName(METHOD_HANDLE_CLASS_NAME);
+            INTERNAL_FORM = mhClass.getDeclaredMethod(INTERNAL_FORM_METHOD_NAME);
+            INTERNAL_FORM.setAccessible(true);
+        } catch (Exception ex) {
+            throw new Error("Unexpected exception: ", ex);
+        }
+    }
+
+    private final TestMethods testMethod;
+
+    /**
+     * Test case constructor. Generates test cases with random method types for
+     * given methods form {@code j.l.i.MethodHandles} class.
+     *
+     * @param testMethod A method from {@code j.l.i.MethodHandles} class which
+     * returns a {@code j.l.i.MethodHandle}.
+     */
+    protected LambdaFormTestCase(TestMethods testMethod) {
+        this.testMethod = testMethod;
+    }
+
+    public TestMethods getTestMethod() {
+        return testMethod;
+    }
+
+    /**
+     * Routine that executes a test case.
+     */
+    public abstract void doTest();
+
+    /**
+     * Runs a number of test cases defined by the size of testCases list.
+     *
+     * @param ctor constructor of LambdaFormCachingTest or its child classes
+     * object.
+     * @param testMethods list of test methods
+     */
+    public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
+        boolean passed = true;
+        int testCounter = 0;
+        int failCounter = 0;
+        long testCaseNum = testMethods.size();
+        long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
+        System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n",
+                iterations, iterations * testCaseNum);
+        HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
+        long codeCacheSize = Long.parseLong(
+                hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue());
+        System.out.printf("Code Cache Size is %d bytes%n", codeCacheSize);
+        long iterationsByCodeCacheSize = (long) (codeCacheSize
+                * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
+        System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n",
+                iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum);
+        if (iterations > iterationsByCodeCacheSize) {
+            iterations = iterationsByCodeCacheSize;
+        }
+        System.out.printf("Number of iterations is set to %d (%d cases)%n",
+                iterations, iterations * testCaseNum);
+        System.out.flush();
+        for (long i = 0; i < iterations; i++) {
+            System.err.println(String.format("Iteration %d:", i));
+            for (TestMethods testMethod : testMethods) {
+                LambdaFormTestCase testCase = ctor.apply(testMethod);
+                try {
+                    System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
+                            testCase.getTestMethod().name);
+                    testCase.doTest();
+                    System.err.println("PASSED");
+                } catch (Throwable t) {
+                    t.printStackTrace();
+                    System.err.println("FAILED");
+                    passed = false;
+                    failCounter++;
+                }
+                testCounter++;
+            }
+        }
+        if (!passed) {
+            throw new Error(String.format("%d of %d test cases FAILED! %n"
+                    + "Rerun the test with the same \"-Dseed=\" option as in the log file!",
+                    failCounter, testCounter));
+        } else {
+            System.err.println(String.format("All %d test cases PASSED!", testCounter));
+        }
+    }
+}
diff --git a/test/java/lang/invoke/LFCaching/TestMethods.java b/test/java/lang/invoke/LFCaching/TestMethods.java
new file mode 100644
index 0000000..8753073
--- /dev/null
+++ b/test/java/lang/invoke/LFCaching/TestMethods.java
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.oracle.testlibrary.jsr292.Helper;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Enumeration containing information about methods from
+ * {@code j.l.i.MethodHandles} class that are used for testing lambda forms
+ * caching.
+ *
+ * @author kshefov
+ */
+public enum TestMethods {
+
+    FOLD_ARGUMENTS("foldArguments") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+                    data.put("modifierMHArgNum", modifierMHArgNum);
+                    Class<?> combinerReturnType;
+                    if (realArity == 0) {
+                        combinerReturnType = void.class;
+                    } else {
+                        combinerReturnType = Helper.RNG.nextBoolean() ? void.class : mtTarget.parameterType(0);
+                    }
+                    data.put("combinerReturnType", combinerReturnType);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> combinerReturnType = (Class) data.get("combinerReturnType");
+                    int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    Class<?> rType = mtTarget.returnType();
+                    int combListStart = (combinerReturnType == void.class) ? 0 : 1;
+                    if (modifierMHArgNum < combListStart) {
+                        modifierMHArgNum = combListStart;
+                    }
+                    MethodHandle combiner = TestMethods.methodHandleGenerator(combinerReturnType,
+                            mtTarget.parameterList().subList(combListStart,
+                                    modifierMHArgNum), kind);
+                    return MethodHandles.foldArguments(target, combiner);
+                }
+            },
+    DROP_ARGUMENTS("dropArguments") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int dropArgsPos = Helper.RNG.nextInt(realArity + 1);
+                    data.put("dropArgsPos", dropArgsPos);
+                    MethodType mtDropArgs = TestMethods.randomMethodTypeGenerator(
+                            Helper.RNG.nextInt(super.maxArity - realArity));
+                    data.put("mtDropArgs", mtDropArgs);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtDropArgs = (MethodType) data.get("mtDropArgs");
+                    int dropArgsPos = (int) data.get("dropArgsPos");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    int mtTgtSlotsCount = TestMethods.argSlotsCount(mtTarget);
+                    int mtDASlotsCount = TestMethods.argSlotsCount(mtDropArgs);
+                    List<Class<?>> fakeParList;
+                    if (mtTgtSlotsCount + mtDASlotsCount > super.maxArity - 1) {
+                        fakeParList = TestMethods.reduceArgListToSlotsCount(mtDropArgs.parameterList(),
+                                super.maxArity - mtTgtSlotsCount - 1);
+                    } else {
+                        fakeParList = mtDropArgs.parameterList();
+                    }
+                    return MethodHandles.dropArguments(target, dropArgsPos, fakeParList);
+                }
+            },
+    EXPLICIT_CAST_ARGUMENTS("explicitCastArguments", Helper.MAX_ARITY / 2) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    MethodType mtExcplCastArgs = TestMethods.randomMethodTypeGenerator(realArity);
+                    if (mtTarget.returnType() == void.class) {
+                        mtExcplCastArgs = MethodType.methodType(void.class,
+                                mtExcplCastArgs.parameterArray());
+                    }
+                    if (mtExcplCastArgs.returnType() == void.class) {
+                        mtExcplCastArgs = MethodType.methodType(mtTarget.returnType(),
+                                mtExcplCastArgs.parameterArray());
+                    }
+                    data.put("mtExcplCastArgs", mtExcplCastArgs);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtExcplCastArgs = (MethodType) data.get("mtExcplCastArgs");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    return MethodHandles.explicitCastArguments(target, mtExcplCastArgs);
+                }
+            },
+    FILTER_ARGUMENTS("filterArguments", Helper.MAX_ARITY / 2) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+                    data.put("filterArgsPos", filterArgsPos);
+                    int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+                    data.put("filtersArgsArrayLength", filtersArgsArrayLength);
+                    MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+                    data.put("mtFilter", mtFilter);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtFilter = (MethodType) data.get("mtFilter");
+                    int filterArgsPos = (int) data.get("filterArgsPos");
+                    int filtersArgsArrayLength = (int) data.get("filtersArgsArrayLength");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    MethodHandle[] filters = new MethodHandle[filtersArgsArrayLength];
+                    for (int i = 0; i < filtersArgsArrayLength; i++) {
+                        filters[i] = TestMethods.filterGenerator(mtFilter.parameterType(i),
+                                mtTarget.parameterType(filterArgsPos + i), kind);
+                    }
+                    return MethodHandles.filterArguments(target, filterArgsPos, filters);
+                }
+            },
+    FILTER_RETURN_VALUE("filterReturnValue") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+                    int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+                    MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+                    data.put("mtFilter", mtFilter);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtFilter = (MethodType) data.get("mtFilter");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    MethodHandle filter = TestMethods.filterGenerator(mtTarget.returnType(),
+                            mtFilter.returnType(), kind);
+                    return MethodHandles.filterReturnValue(target, filter);
+                }
+            },
+    INSERT_ARGUMENTS("insertArguments") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int insertArgsPos = Helper.RNG.nextInt(realArity + 1);
+                    data.put("insertArgsPos", insertArgsPos);
+                    int insertArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - insertArgsPos);
+                    MethodType mtInsertArgs = MethodType.methodType(void.class, mtTarget.parameterList()
+                            .subList(insertArgsPos, insertArgsPos + insertArgsArrayLength));
+                    data.put("mtInsertArgs", mtInsertArgs);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtInsertArgs = (MethodType) data.get("mtInsertArgs");
+                    int insertArgsPos = (int) data.get("insertArgsPos");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    Object[] insertList = Helper.randomArgs(mtInsertArgs.parameterList());
+                    return MethodHandles.insertArguments(target, insertArgsPos, insertList);
+                }
+            },
+    PERMUTE_ARGUMENTS("permuteArguments", Helper.MAX_ARITY / 2) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int[] permuteArgsReorderArray = new int[realArity];
+                    int mtPermuteArgsNum = Helper.RNG.nextInt(Helper.MAX_ARITY);
+                    mtPermuteArgsNum = mtPermuteArgsNum == 0 ? 1 : mtPermuteArgsNum;
+                    MethodType mtPermuteArgs = TestMethods.randomMethodTypeGenerator(mtPermuteArgsNum);
+                    mtTarget = mtTarget.changeReturnType(mtPermuteArgs.returnType());
+                    for (int i = 0; i < realArity; i++) {
+                        int mtPermuteArgsParNum = Helper.RNG.nextInt(mtPermuteArgs.parameterCount());
+                        permuteArgsReorderArray[i] = mtPermuteArgsParNum;
+                        mtTarget = mtTarget.changeParameterType(
+                                i, mtPermuteArgs.parameterType(mtPermuteArgsParNum));
+                    }
+                    data.put("mtTarget", mtTarget);
+                    data.put("permuteArgsReorderArray", permuteArgsReorderArray);
+                    data.put("mtPermuteArgs", mtPermuteArgs);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    MethodType mtPermuteArgs = (MethodType) data.get("mtPermuteArgs");
+                    int[] permuteArgsReorderArray = (int[]) data.get("permuteArgsReorderArray");
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), kind);
+                    return MethodHandles.permuteArguments(target, mtPermuteArgs, permuteArgsReorderArray);
+                }
+            },
+    THROW_EXCEPTION("throwException") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> rType = mtTarget.returnType();
+                    return MethodHandles.throwException(rType, Exception.class
+                    );
+                }
+            },
+    GUARD_WITH_TEST("guardWithTest") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+                    data.put("modifierMHArgNum", modifierMHArgNum);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+                    TestMethods.Kind targetKind;
+                    TestMethods.Kind fallbackKind;
+                    if (kind.equals(TestMethods.Kind.ONE)) {
+                        targetKind = TestMethods.Kind.ONE;
+                        fallbackKind = TestMethods.Kind.TWO;
+                    } else {
+                        targetKind = TestMethods.Kind.TWO;
+                        fallbackKind = TestMethods.Kind.ONE;
+                    }
+                    MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), targetKind);
+                    MethodHandle fallback = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                            mtTarget.parameterList(), fallbackKind);
+                    MethodHandle test = TestMethods.methodHandleGenerator(boolean.class,
+                            mtTarget.parameterList().subList(0, modifierMHArgNum), kind);
+                    return MethodHandles.guardWithTest(test, target, fallback);
+                }
+            },
+    CATCH_EXCEPTION("catchException") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+                    data.put("modifierMHArgNum", modifierMHArgNum);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+                    MethodHandle target;
+                    if (kind.equals(TestMethods.Kind.ONE)) {
+                        target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                                mtTarget.parameterList(), TestMethods.Kind.ONE);
+                    } else {
+                        target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+                                mtTarget.parameterList(), TestMethods.Kind.EXCEPT);
+                    }
+                    List<Class<?>> handlerParamList = new ArrayList<>(mtTarget.parameterCount() + 1);
+                    handlerParamList.add(Exception.class);
+                    handlerParamList.addAll(mtTarget.parameterList().subList(0, modifierMHArgNum));
+                    MethodHandle handler = TestMethods.methodHandleGenerator(
+                            mtTarget.returnType(), handlerParamList, TestMethods.Kind.TWO);
+                    return MethodHandles.catchException(target, Exception.class, handler);
+                }
+            },
+    INVOKER("invoker", Helper.MAX_ARITY - 1) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    return MethodHandles.invoker(mtTarget);
+                }
+            },
+    EXACT_INVOKER("exactInvoker", Helper.MAX_ARITY - 1) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    return MethodHandles.exactInvoker(mtTarget);
+                }
+            },
+    SPREAD_INVOKER("spreadInvoker", Helper.MAX_ARITY - 1) {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    // Arity after reducing because of long and double take 2 slots.
+                    int realArity = mtTarget.parameterCount();
+                    int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+                    data.put("modifierMHArgNum", modifierMHArgNum);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+                    return MethodHandles.spreadInvoker(mtTarget, modifierMHArgNum);
+                }
+            },
+    ARRAY_ELEMENT_GETTER("arrayElementGetter") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> rType = mtTarget.returnType();
+                    if (rType == void.class) {
+                        rType = Object.class;
+                    }
+                    return MethodHandles.arrayElementGetter(Array.newInstance(rType, 2).getClass());
+                }
+            },
+    ARRAY_ELEMENT_SETTER("arrayElementSetter") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> rType = mtTarget.returnType();
+                    if (rType == void.class) {
+                        rType = Object.class;
+                    }
+                    return MethodHandles.arrayElementSetter(Array.newInstance(rType, 2).getClass());
+                }
+            },
+    CONSTANT("constant") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> rType = mtTarget.returnType();
+                    if (rType == void.class) {
+                        rType = Object.class;
+                    }
+                    if (rType.equals(boolean.class)) {
+                        // There should be the same return values because for default values there are special "zero" forms
+                        return MethodHandles.constant(rType, true);
+                    } else {
+                        return MethodHandles.constant(rType, kind.getValue(rType));
+                    }
+                }
+            },
+    IDENTITY("identity") {
+                @Override
+                public Map<String, Object> getTestCaseData() {
+                    Map<String, Object> data = new HashMap<>();
+                    int desiredArity = Helper.RNG.nextInt(super.maxArity);
+                    MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+                    data.put("mtTarget", mtTarget);
+                    return data;
+                }
+
+                @Override
+                protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+                    MethodType mtTarget = (MethodType) data.get("mtTarget");
+                    Class<?> rType = mtTarget.returnType();
+                    if (rType == void.class) {
+                        rType = Object.class;
+                    }
+                    return MethodHandles.identity(rType);
+                }
+            };
+
+    /**
+     * Test method's name.
+     */
+    public final String name;
+
+    private final int maxArity;
+
+    private TestMethods(String name, int maxArity) {
+        this.name = name;
+        this.maxArity = maxArity;
+    }
+
+    private TestMethods(String name) {
+        this(name, Helper.MAX_ARITY);
+    }
+
+    protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+        throw new UnsupportedOperationException("TESTBUG: getMH method is not implemented for test method " + this);
+    }
+
+    /**
+     * Creates an adapter method handle depending on a test method from
+     * MethodHandles class. Adapter is what is returned by the test method. This
+     * method is able to create two kinds of adapters, their type will be the
+     * same, but return values are different.
+     *
+     * @param data a Map containing data to create a method handle, can be
+     * obtained by {@link #getTestCaseData} method
+     * @param kind defines whether adapter ONE or adapter TWO will be
+     * initialized. Should be equal to TestMethods.Kind.ONE or
+     * TestMethods.Kind.TWO
+     * @return Method handle adapter that behaves according to
+     * TestMethods.Kind.ONE or TestMethods.Kind.TWO
+     * @throws java.lang.NoSuchMethodException
+     * @throws java.lang.IllegalAccessException
+     */
+    public MethodHandle getTestCaseMH(Map<String, Object> data, TestMethods.Kind kind)
+            throws NoSuchMethodException, IllegalAccessException {
+        if (data == null) {
+            throw new Error(String.format("TESTBUG: Data for test method %s is not prepared",
+                    this.name));
+        }
+        if (!kind.equals(TestMethods.Kind.ONE) && !kind.equals(TestMethods.Kind.TWO)) {
+            throw new IllegalArgumentException("TESTBUG: Wrong \"kind\" (" + kind
+                    + ") arg to getTestCaseMH function."
+                    + " Should be Kind.ONE or Kind.TWO");
+        }
+        return getMH(data, kind);
+    }
+
+    /**
+     * Returns a data Map needed for {@link #getTestCaseMH} method.
+     *
+     * @return data Map needed for {@link #getTestCaseMH} method
+     */
+    public Map<String, Object> getTestCaseData() {
+        throw new UnsupportedOperationException(
+                "TESTBUG: getTestCaseData method is not implemented for test method " + this);
+    }
+
+    /**
+     * Enumeration used in methodHandleGenerator to define whether a MH returned
+     * by this method returns "2" in different type representations, "4", or
+     * throw an Exception.
+     */
+    public static enum Kind {
+
+        ONE(2),
+        TWO(4),
+        EXCEPT(0);
+
+        private final int value;
+
+        private Object getValue(Class<?> cl) {
+            return Helper.castToWrapper(value, cl);
+        }
+
+        private MethodHandle getBasicMH(Class<?> rType) throws NoSuchMethodException, IllegalAccessException {
+            MethodHandle result = null;
+            switch (this) {
+                case ONE:
+                case TWO:
+                    if (rType.equals(void.class)) {
+                        result = MethodHandles.lookup().findVirtual(Kind.class, "returnVoid", MethodType.methodType(void.class));
+                        result = MethodHandles.insertArguments(result, 0, this);
+                    } else {
+                        result = MethodHandles.constant(rType, getValue(rType));
+                    }
+                    break;
+                case EXCEPT:
+                    result = MethodHandles.throwException(rType, Exception.class);
+                    result = MethodHandles.insertArguments(result, 0, new Exception());
+                    break;
+            }
+            return result;
+        }
+
+        private void returnVoid() {
+        }
+
+        private Kind(int value) {
+            this.value = value;
+        }
+    }
+
+    /**
+     * Routine used to obtain a randomly generated method type.
+     *
+     * @param arity Arity of returned method type.
+     * @return MethodType generated randomly.
+     */
+    private static MethodType randomMethodTypeGenerator(int arity) {
+        final Class<?>[] CLASSES = {
+            Object.class,
+            int.class,
+            boolean.class,
+            byte.class,
+            short.class,
+            char.class,
+            long.class,
+            float.class,
+            double.class
+        };
+        if (arity > Helper.MAX_ARITY) {
+            throw new IllegalArgumentException(
+                    String.format("Arity should not exceed %d!", Helper.MAX_ARITY));
+        }
+        List<Class<?>> list = Helper.randomClasses(CLASSES, arity);
+        list = Helper.getParams(list, false, arity);
+        int i = Helper.RNG.nextInt(CLASSES.length + 1);
+        Class<?> rtype = i == CLASSES.length ? void.class : CLASSES[i];
+        return MethodType.methodType(rtype, list);
+    }
+
+    /**
+     * Routine used to obtain a method handles of a given type an kind (return
+     * value).
+     *
+     * @param returnType Type of MH return value.
+     * @param argTypes Types of MH args.
+     * @param kind Defines whether the obtained MH returns "1" or "2".
+     * @return Method handle of the given type.
+     * @throws NoSuchMethodException
+     * @throws IllegalAccessException
+     */
+    private static MethodHandle methodHandleGenerator(Class<?> returnType,
+            List<Class<?>> argTypes, TestMethods.Kind kind)
+            throws NoSuchMethodException, IllegalAccessException {
+        MethodHandle result;
+        result = kind.getBasicMH(returnType);
+        return Helper.addTrailingArgs(result, argTypes.size(), argTypes);
+    }
+
+    /**
+     * Routine that generates filter method handles to test
+     * MethodHandles.filterArguments method.
+     *
+     * @param inputType Filter's argument type.
+     * @param returnType Filter's return type.
+     * @param kind Filter's return value definer.
+     * @return A filter method handle, that takes one argument.
+     * @throws NoSuchMethodException
+     * @throws IllegalAccessException
+     */
+    private static MethodHandle filterGenerator(Class<?> inputType, Class<?> returnType,
+            TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
+        MethodHandle tmpMH = kind.getBasicMH(returnType);
+        if (inputType.equals(void.class)) {
+            return tmpMH;
+        }
+        ArrayList<Class<?>> inputTypeList = new ArrayList<>(1);
+        inputTypeList.add(inputType);
+        return Helper.addTrailingArgs(tmpMH, 1, inputTypeList);
+    }
+
+    private static int argSlotsCount(MethodType mt) {
+        int result = 0;
+        for (Class cl : mt.parameterArray()) {
+            if (cl.equals(long.class) || cl.equals(double.class)) {
+                result += 2;
+            } else {
+                result++;
+            }
+        }
+        return result;
+    }
+
+    private static List<Class<?>> reduceArgListToSlotsCount(List<Class<?>> list,
+            int desiredSlotCount) {
+        List<Class<?>> result = new ArrayList<>(desiredSlotCount);
+        int count = 0;
+        for (Class<?> cl : list) {
+            if (count >= desiredSlotCount) {
+                break;
+            }
+            if (cl.equals(long.class) || cl.equals(double.class)) {
+                count += 2;
+            } else {
+                count++;
+            }
+            result.add(cl);
+        }
+        return result;
+    }
+}
diff --git a/test/java/lang/invoke/LambdaFormTest.java b/test/java/lang/invoke/LambdaFormTest.java
new file mode 100644
index 0000000..f078189
--- /dev/null
+++ b/test/java/lang/invoke/LambdaFormTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.LambdaForm
+ * @run junit/othervm test.java.lang.invoke.LambdaFormTest
+ */
+package test.java.lang.invoke;
+
+import org.junit.Test;
+import java.lang.reflect.Method;
+import static org.junit.Assert.*;
+
+public class LambdaFormTest {
+    static final Method M_shortenSignature;
+    static {
+        try {
+            Class<?> impl = Class.forName("java.lang.invoke.LambdaForm", false, null);
+            Method m = impl.getDeclaredMethod("shortenSignature", String.class);
+            m.setAccessible(true);
+            M_shortenSignature = m;
+        } catch(Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public static String shortenSignature(String signature) throws ReflectiveOperationException {
+        return (String)M_shortenSignature.invoke(null, signature);
+    }
+
+    @Test
+    public void testShortenSignature() throws ReflectiveOperationException {
+        for (String s : new String[] {
+                // invariant strings:
+                "L", "LL", "ILL", "LIL", "LLI", "IILL", "ILIL", "ILLI",
+                // a few mappings:
+                "LLL=L3", "LLLL=L4", "LLLLLLLLLL=L10",
+                "IIIDDD=I3D3", "IDDD=ID3", "IIDDD=IID3", "IIID=I3D", "IIIDD=I3DD"
+            }) {
+            String s2 = s.substring(s.indexOf('=')+1);
+            String s1 = s.equals(s2) ? s : s.substring(0, s.length() - s2.length() - 1);
+            // mix the above cases with before and after reps of Z*
+            for (int k = -3; k <= 3; k++) {
+                String beg = (k < 0 ? "ZZZZ".substring(-k) : "");
+                String end = (k > 0 ? "ZZZZ".substring(+k) : "");
+                String ks1 = beg+s1+end;
+                String ks2 = shortenSignature(beg)+s2+shortenSignature(end);
+                String ks3 = shortenSignature(ks1);
+                assertEquals(ks2, ks3);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws ReflectiveOperationException {
+        LambdaFormTest test = new LambdaFormTest();
+        test.testShortenSignature();
+    }
+}
diff --git a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
index 38baeae..7202f2f 100644
--- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
+++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
@@ -43,6 +43,7 @@
 public class CatchExceptionTest {
     private static final List<Class<?>> ARGS_CLASSES;
     protected static final int MAX_ARITY = Helper.MAX_ARITY - 1;
+
     static {
         Class<?> classes[] = {
                 Object.class,
@@ -53,11 +54,8 @@
                 double[].class,
                 String.class,
         };
-        List<Class<?>> list = new ArrayList<>(MAX_ARITY);
-        for (int i = 0; i < MAX_ARITY; ++i) {
-            list.add(classes[Helper.RNG.nextInt(classes.length)]);
-        }
-        ARGS_CLASSES = Collections.unmodifiableList(list);
+        ARGS_CLASSES = Collections.unmodifiableList(
+                Helper.randomClasses(classes, MAX_ARITY));
     }
 
     private final TestCase testCase;
@@ -67,7 +65,6 @@
     private int dropped;
     private MethodHandle thrower;
 
-
     public CatchExceptionTest(TestCase testCase, final boolean isVararg, final int argsCount,
             final int catchDrops) {
         this.testCase = testCase;
@@ -108,37 +105,7 @@
     }
 
     private List<Class<?>> getThrowerParams(boolean isVararg, int argsCount) {
-        boolean unmodifiable = true;
-        List<Class<?>> classes;
-        classes = ARGS_CLASSES.subList(0,
-                Math.min(argsCount, (MAX_ARITY / 2) - 1));
-        int extra = 0;
-        if (argsCount >= MAX_ARITY / 2) {
-            classes = new ArrayList<>(classes);
-            unmodifiable = false;
-            extra = (int) classes.stream().filter(Helper::isDoubleCost).count();
-            int i = classes.size();
-            while (classes.size() + extra < argsCount) {
-                Class<?> aClass = ARGS_CLASSES.get(i);
-                if (Helper.isDoubleCost(aClass)) {
-                    ++extra;
-                    if (classes.size() + extra >= argsCount) {
-                        break;
-                    }
-                }
-                classes.add(aClass);
-            }
-        }
-        if (isVararg && classes.size() > 0) {
-            if (unmodifiable) {
-                classes = new ArrayList<>(classes);
-            }
-            int last = classes.size() - 1;
-            Class<?> aClass = classes.get(classes.size() - 1);
-            aClass = Array.newInstance(aClass, 2).getClass();
-            classes.set(last, aClass);
-        }
-        return classes;
+        return Helper.getParams(ARGS_CLASSES, isVararg, argsCount);
     }
 
 
diff --git a/test/java/lang/invoke/MethodHandlesTest.java b/test/java/lang/invoke/MethodHandlesTest.java
index d607e06..993eaef 100644
--- a/test/java/lang/invoke/MethodHandlesTest.java
+++ b/test/java/lang/invoke/MethodHandlesTest.java
@@ -2160,15 +2160,23 @@
                     else
                         type = type.changeParameterType(j, argType);
                     if (done.add(type))
-                        testInvokers(type);
+                        testInvokersWithCatch(type);
                     MethodType vtype = type.changeReturnType(void.class);
                     if (done.add(vtype))
-                        testInvokers(vtype);
+                        testInvokersWithCatch(vtype);
                 }
             }
         }
     }
 
+    public void testInvokersWithCatch(MethodType type) throws Throwable {
+        try {
+            testInvokers(type);
+        } catch (Throwable ex) {
+            System.out.println("*** testInvokers on "+type+" => ");
+            ex.printStackTrace(System.out);
+        }
+    }
     public void testInvokers(MethodType type) throws Throwable {
         if (verbosity >= 3)
             System.out.println("test invokers for "+type);
diff --git a/test/java/lang/invoke/VarargsArrayTest.java b/test/java/lang/invoke/VarargsArrayTest.java
new file mode 100644
index 0000000..91bf364
--- /dev/null
+++ b/test/java/lang/invoke/VarargsArrayTest.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+import sun.invoke.util.Wrapper;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/* @test
+ * @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int),
+ *          MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int)
+ *
+ * @run main/bootclasspath java.lang.invoke.VarargsArrayTest
+ * @run main/bootclasspath -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250
+ *                         java.lang.invoke.VarargsArrayTest
+ */
+
+/* This might take a while and burn lots of metadata:
+ * @run main/bootclasspath -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.EXHAUSTIVE=true java.lang.invoke.VarargsArrayTest
+ */
+public class VarargsArrayTest {
+    private static final Class<?> CLASS = VarargsArrayTest.class;
+    private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 40);
+    private static final int START_ARITY = Integer.getInteger(CLASS.getSimpleName()+".START_ARITY", 0);
+    private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE");
+
+    public static void main(String[] args) throws Throwable {
+        testVarargsArray();
+        testVarargsReferenceArray();
+        testVarargsPrimitiveArray();
+    }
+
+    public static void testVarargsArray() throws Throwable {
+        final int MIN = START_ARITY;
+        final int MAX = MAX_ARITY-2;  // 253+1 would cause parameter overflow with 'this' added
+        for (int nargs = MIN; nargs <= MAX; nargs = nextArgCount(nargs, 17, MAX)) {
+            MethodHandle target = MethodHandleImpl.varargsArray(nargs);
+            Object[] args = new Object[nargs];
+            for (int i = 0; i < nargs; i++)
+                args[i] = "#"+i;
+            Object res = target.invokeWithArguments(args);
+            assertArrayEquals(args, (Object[])res);
+        }
+    }
+
+    public static void testVarargsReferenceArray() throws Throwable {
+        testTypedVarargsArray(Object[].class);
+        testTypedVarargsArray(String[].class);
+        testTypedVarargsArray(Number[].class);
+    }
+
+    public static void testVarargsPrimitiveArray() throws Throwable {
+        testTypedVarargsArray(int[].class);
+        testTypedVarargsArray(long[].class);
+        testTypedVarargsArray(byte[].class);
+        testTypedVarargsArray(boolean[].class);
+        testTypedVarargsArray(short[].class);
+        testTypedVarargsArray(char[].class);
+        testTypedVarargsArray(float[].class);
+        testTypedVarargsArray(double[].class);
+    }
+
+    private static int nextArgCount(int nargs, int density, int MAX) {
+        if (EXHAUSTIVE)  return nargs + 1;
+        if (nargs >= MAX)  return Integer.MAX_VALUE;
+        int BOT = 20, TOP = MAX-5;
+        if (density < 10) { BOT = 10; MAX = TOP-2; }
+        if (nargs <= BOT || nargs >= TOP) {
+            ++nargs;
+        } else {
+            int bump = Math.max(1, 100 / density);
+            nargs += bump;
+            if (nargs > TOP)  nargs = TOP;
+        }
+        return nargs;
+    }
+
+    private static void testTypedVarargsArray(Class<?> arrayType) throws Throwable {
+        Class<?> elemType = arrayType.getComponentType();
+        int MIN = START_ARITY;
+        int MAX = MAX_ARITY-2;  // 253+1 would cause parameter overflow with 'this' added
+        int density = 3;
+        if (elemType == int.class || elemType == long.class)  density = 7;
+        if (elemType == long.class || elemType == double.class) { MAX /= 2; MIN /= 2; }
+        for (int nargs = MIN; nargs <= MAX; nargs = nextArgCount(nargs, density, MAX)) {
+            Object[] args = makeTestArray(elemType, nargs);
+            MethodHandle varargsArray = MethodHandleImpl.varargsArray(arrayType, nargs);
+            MethodType vaType = varargsArray.type();
+            assertEquals(arrayType, vaType.returnType());
+            if (nargs != 0) {
+                assertEquals(elemType, vaType.parameterType(0));
+                assertEquals(elemType, vaType.parameterType(vaType.parameterCount()-1));
+            }
+            assertEquals(MethodType.methodType(arrayType, Collections.<Class<?>>nCopies(nargs, elemType)),
+                         vaType);
+            Object res = varargsArray.invokeWithArguments(args);
+            assertEquals(res.getClass(), arrayType);
+            String resString = toArrayString(res);
+            assertEquals(Arrays.toString(args), resString);
+
+            MethodHandle spreader = varargsArray.asSpreader(arrayType, nargs);
+            MethodType stype = spreader.type();
+            assert(stype == MethodType.methodType(arrayType, arrayType));
+            if (nargs <= 5) {
+                // invoke target as a spreader also:
+                @SuppressWarnings("cast")
+                Object res2 = spreader.invokeWithArguments((Object)res);
+                String res2String = toArrayString(res2);
+                assertEquals(Arrays.toString(args), res2String);
+                // invoke the spreader on a generic Object[] array; check for error
+                try {
+                    Object res3 = spreader.invokeWithArguments((Object)args);
+                    String res3String = toArrayString(res3);
+                    assertTrue(arrayType.getName(), arrayType.isAssignableFrom(Object[].class));
+                    assertEquals(Arrays.toString(args), res3String);
+                } catch (ClassCastException ex) {
+                    assertFalse(arrayType.getName(), arrayType.isAssignableFrom(Object[].class));
+                }
+            }
+            if (nargs == 0) {
+                // invoke spreader on null arglist
+                Object res3 = spreader.invokeWithArguments((Object)null);
+                String res3String = toArrayString(res3);
+                assertEquals(Arrays.toString(args), res3String);
+            }
+        }
+    }
+
+    private static Object[] makeTestArray(Class<?> elemType, int len) {
+        Wrapper elem = null;
+        if (elemType.isPrimitive())
+            elem = Wrapper.forPrimitiveType(elemType);
+        else if (Wrapper.isWrapperType(elemType))
+            elem = Wrapper.forWrapperType(elemType);
+        Object[] args = new Object[len];
+        for (int i = 0; i < len; i++) {
+            Object arg = i * 100;
+            if (elem == null) {
+                if (elemType == String.class)
+                    arg = "#"+arg;
+                arg = elemType.cast(arg);  // just to make sure
+            } else {
+                switch (elem) {
+                    case BOOLEAN: arg = (i % 3 == 0);           break;
+                    case CHAR:    arg = 'a' + i;                break;
+                    case LONG:    arg = (long)i * 1000_000_000; break;
+                    case FLOAT:   arg = (float)i / 100;         break;
+                    case DOUBLE:  arg = (double)i / 1000_000;   break;
+                }
+                arg = elem.cast(arg, elemType);
+            }
+            args[i] = arg;
+        }
+        return args;
+    }
+
+    private static String toArrayString(Object a) {
+        if (a == null)  return "null";
+        Class<?> elemType = a.getClass().getComponentType();
+        if (elemType == null)  return a.toString();
+        if (elemType.isPrimitive()) {
+            switch (Wrapper.forPrimitiveType(elemType)) {
+                case INT:      return Arrays.toString((int[])a);
+                case BYTE:     return Arrays.toString((byte[])a);
+                case BOOLEAN:  return Arrays.toString((boolean[])a);
+                case SHORT:    return Arrays.toString((short[])a);
+                case CHAR:     return Arrays.toString((char[])a);
+                case FLOAT:    return Arrays.toString((float[])a);
+                case LONG:     return Arrays.toString((long[])a);
+                case DOUBLE:   return Arrays.toString((double[])a);
+            }
+        }
+        return Arrays.toString((Object[])a);
+    }
+
+    public static void assertArrayEquals(Object[] arr1, Object[] arr2) {
+        if (arr1 == null && arr2 == null)  return;
+        if (arr1 != null && arr2 != null && arr1.length == arr2.length) {
+            for (int i = 0; i < arr1.length; i++) {
+                assertEquals(arr1[i], arr2[i]);
+            }
+            return;
+        }
+        throw new AssertionError(Arrays.deepToString(arr1) + " != " + Arrays.deepToString(arr2));
+    }
+
+    public static void assertEquals(Object o1, Object o2) {
+        if (o1 == null && o2 == null)    return;
+        if (o1 != null && o1.equals(o2)) return;
+        throw new AssertionError(o1 + " != " + o2);
+    }
+
+    public static void assertTrue(String msg, boolean b) {
+        if (!b) {
+            throw new AssertionError(msg);
+        }
+    }
+
+    public static void assertFalse(String msg, boolean b) {
+        assertTrue(msg, !b);
+    }
+}
diff --git a/test/java/lang/ref/EarlyTimeout.java b/test/java/lang/ref/EarlyTimeout.java
new file mode 100644
index 0000000..d103725
--- /dev/null
+++ b/test/java/lang/ref/EarlyTimeout.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 6853696
+ * @summary ReferenceQueue#remove(timeout) should not return null before
+ *          timeout is elapsed
+ */
+
+import java.lang.InterruptedException;
+import java.lang.System;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.concurrent.CountDownLatch;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+/**
+ * In order to demonstrate the issue we make several threads (two appears to be sufficient)
+ * to block in ReferenceQueue#remove(timeout) at the same time.
+ * Then, we force a reference to be enqueued by setting its referent to null and calling System.gc().
+ * One of the threads gets the reference returned from the remove().
+ * The other threads get null:
+ * 1) with bug:  this may happen before the specified timeout is elapsed,
+ * 2) without bug:  this can only happen after the timeout is fully elapsed.
+ */
+
+public class EarlyTimeout extends Thread {
+
+    static final int THREADS_COUNT = 2;
+    static final int TIMEOUT = 1000;
+
+    static Object referent = new Object();
+    static final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
+    static final WeakReference<Object> weakReference = new WeakReference<Object>(referent, queue);
+    static final CountDownLatch startedSignal = new CountDownLatch(THREADS_COUNT);
+
+    long actual;
+    Reference<?> reference;
+
+    public static void main(String[] args) throws Exception {
+        EarlyTimeout[] threads = new EarlyTimeout[THREADS_COUNT];
+        for (int i = 0; i < THREADS_COUNT; ++i) {
+            threads[i] = new EarlyTimeout();
+            threads[i].start();
+        }
+        // The main thread waits until the threads has started and give it a chance
+        // for the threads to block on the queue.remove(TIMEOUT) call
+        startedSignal.await();
+        Thread.sleep(TIMEOUT / 2);
+        referent = null;
+        System.gc();
+        for (EarlyTimeout thread : threads) {
+            thread.join();
+        }
+        if (weakReference.get() != null) {
+            throw new RuntimeException("weakReference was not cleared");
+        }
+        int nonNullRefCount = 0;
+        for (EarlyTimeout thread : threads) {
+            if (thread.reference == null && thread.actual < TIMEOUT) {
+                throw new RuntimeException("elapsed time " + thread.actual
+                        + " is less than timeout " + TIMEOUT);
+            }
+            if (thread.reference != null && thread.reference == weakReference) {
+                nonNullRefCount++;
+            }
+        }
+        if (nonNullRefCount > 1) {
+            throw new RuntimeException("more than one references were removed from queue");
+        }
+    }
+
+    public void run() {
+        try {
+            startedSignal.countDown();
+            long start = System.nanoTime();
+            reference = queue.remove(TIMEOUT);
+            actual = NANOSECONDS.toMillis(System.nanoTime() - start);
+        } catch (InterruptedException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
diff --git a/test/java/lang/reflect/annotationSharing/AnnotationSharing.java b/test/java/lang/reflect/annotationSharing/AnnotationSharing.java
new file mode 100644
index 0000000..4606b96
--- /dev/null
+++ b/test/java/lang/reflect/annotationSharing/AnnotationSharing.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8054987
+ * @summary Test sharing of annotations between Executable/Field instances.
+ *          Sharing should not be noticeable when performing mutating
+ *          operations.
+ * @run testng AnnotationSharing
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+import org.testng.annotations.Test;
+
+public class AnnotationSharing {
+    public static void main(String ... args) throws Exception {
+    }
+
+    @Test
+    public void testMethodSharing() throws Exception {
+        Method[] m1 = AnnotationSharing.class.getMethods();
+        Method[] m2 = AnnotationSharing.class.getMethods();
+        validateSharingSafelyObservable(m1, m2);
+    }
+
+    @Test
+    public void testDeclaredMethodSharing() throws Exception {
+        Method[] m3 = AnnotationSharing.class.getDeclaredMethods();
+        Method[] m4 = AnnotationSharing.class.getDeclaredMethods();
+        validateSharingSafelyObservable(m3, m4);
+    }
+
+    @Test
+    public void testFieldSharing() throws Exception {
+        Field[] f1 = AnnotationSharing.class.getFields();
+        Field[] f2 = AnnotationSharing.class.getFields();
+        validateSharingSafelyObservable(f1, f2);
+    }
+
+    @Test
+    public void testDeclaredFieldsSharing() throws Exception {
+        Field[] f3 = AnnotationSharing.class.getDeclaredFields();
+        Field[] f4 = AnnotationSharing.class.getDeclaredFields();
+        validateSharingSafelyObservable(f3, f4);
+    }
+
+    @Test
+    public void testMethodSharingOccurs() throws Exception {
+        Method mm1 = AnnotationSharing.class.getDeclaredMethod("m", (Class<?>[])null);
+        Method mm2 = AnnotationSharing.class.getDeclaredMethod("m", (Class<?>[])null);
+        validateAnnotationSharing(mm1, mm2);
+    }
+
+    @Test
+    public void testMethodSharingIsSafe() throws Exception {
+        Method mm1 = AnnotationSharing.class.getDeclaredMethod("m", (Class<?>[])null);
+        Method mm2 = AnnotationSharing.class.getDeclaredMethod("m", (Class<?>[])null);
+        validateAnnotationSharingIsSafe(mm1, mm2);
+        validateArrayValues(mm1.getAnnotation(Baz.class), mm2.getAnnotation(Baz.class));
+    }
+
+    @Test
+    public void testFieldSharingOccurs() throws Exception {
+        Field ff1 = AnnotationSharing.class.getDeclaredField("f");
+        Field ff2 = AnnotationSharing.class.getDeclaredField("f");
+        validateAnnotationSharing(ff1, ff2);
+    }
+
+    @Test
+    public void testFieldSharingIsSafe() throws Exception {
+        Field ff1 = AnnotationSharing.class.getDeclaredField("f");
+        Field ff2 = AnnotationSharing.class.getDeclaredField("f");
+        validateAnnotationSharingIsSafe(ff1, ff2);
+        validateArrayValues(ff1.getAnnotation(Baz.class), ff2.getAnnotation(Baz.class));
+    }
+
+    // Validate that AccessibleObject instances are not shared
+    private static void validateSharingSafelyObservable(AccessibleObject[] m1, AccessibleObject[] m2)
+            throws Exception {
+
+        // Validate that setAccessible works
+        for (AccessibleObject m : m1)
+            m.setAccessible(false);
+
+        for (AccessibleObject m : m2)
+            m.setAccessible(true);
+
+        for (AccessibleObject m : m1)
+            if (m.isAccessible())
+                throw new RuntimeException(m + " should not be accessible");
+
+        for (AccessibleObject m : m2)
+            if (!m.isAccessible())
+                throw new RuntimeException(m + " should be accessible");
+
+        // Validate that methods are still equal()
+        for (int i = 0; i < m1.length; i++)
+            if (!m1[i].equals(m2[i]))
+                throw new RuntimeException(m1[i] + " and " + m2[i] + " should be equal()");
+
+        // Validate that the arrays aren't shared
+        for (int i = 0; i < m1.length; i++)
+            m1[i] = null;
+
+        for (int i = 0; i < m2.length; i++)
+            if (m2[i] == null)
+                throw new RuntimeException("Detected sharing of AccessibleObject arrays");
+    }
+
+    // Validate that annotations are shared
+    private static void validateAnnotationSharing(AccessibleObject m1, AccessibleObject m2) {
+        Bar b1 = m1.getAnnotation(Bar.class);
+        Bar b2 = m2.getAnnotation(Bar.class);
+
+        if (b1 != b2)
+            throw new RuntimeException(b1 + " and " + b2 + " should be ==");
+
+    }
+
+    // Validate that Method instances representing the annotation elements
+    // behave as intended
+    private static void validateAnnotationSharingIsSafe(AccessibleObject m1, AccessibleObject m2)
+            throws Exception {
+        Bar b1 = m1.getAnnotation(Bar.class);
+        Bar b2 = m2.getAnnotation(Bar.class);
+
+        Method mm1 = b1.annotationType().getMethod("value", (Class<?>[]) null);
+        Method mm2 = b2.annotationType().getMethod("value", (Class<?>[]) null);
+        inner(mm1, mm2);
+
+        mm1 = b1.getClass().getMethod("value", (Class<?>[]) null);
+        mm2 = b2.getClass().getMethod("value", (Class<?>[]) null);
+        inner(mm1, mm2);
+
+    }
+    private static void inner(Method mm1, Method mm2)
+            throws Exception {
+        if (!mm1.equals(mm2))
+            throw new RuntimeException(mm1 + " and " + mm2 + " should be equal()");
+
+        mm1.setAccessible(false);
+        mm2.setAccessible(true);
+
+        if (mm1.isAccessible())
+            throw new RuntimeException(mm1 + " should not be accessible");
+
+        if (!mm2.isAccessible())
+            throw new RuntimeException(mm2 + " should be accessible");
+    }
+
+    // Validate that array element values are not shared
+    private static void validateArrayValues(Baz a, Baz b) {
+        String[] s1 = a.value();
+        String[] s2 = b.value();
+
+        s1[0] = "22";
+
+        if (!s2[0].equals("1"))
+            throw new RuntimeException("Mutation of array elements should not be detectable");
+    }
+
+    @Foo @Bar("val") @Baz({"1", "2"})
+    public void m() {
+        return ;
+    }
+
+    @Foo @Bar("someValue") @Baz({"1", "22", "33"})
+    public Object f = new Object();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Foo {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Bar {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Baz {
+    String [] value();
+}
diff --git a/test/java/math/BigDecimal/ZeroScalingTests.java b/test/java/math/BigDecimal/ZeroScalingTests.java
index 3ebd47a..05a5915 100644
--- a/test/java/math/BigDecimal/ZeroScalingTests.java
+++ b/test/java/math/BigDecimal/ZeroScalingTests.java
@@ -23,8 +23,10 @@
 
 /*
  * @test
- * @bug 4902952 4905407 4916149
- * @summary Tests that the scale of zero is propagated properly and has the proper effect.
+ * @bug 4902952 4905407 4916149 8057793
+ * @summary Tests that the scale of zero is propagated properly and has the
+ * proper effect and that setting the scale to zero does not mutate the
+ * BigDecimal.
  * @author Joseph D. Darcy
  */
 
@@ -445,6 +447,16 @@
         return failures;
     }
 
+    static int setScaleDoesNotMutateTest() {
+        BigDecimal total = new BigDecimal("258815507198903607775511093103396443816569106750031264155319238473795838680758514810110764742309284477206138527975952150289602995045050194333030191178778772026538699925775139201970526695485362661420908248887297829319881475178467494779683293036572059595504702727301324759997409522995072582369210284334718757260859794972695026582432867589093687280300148141501712013226636373167978223780290547640482160818746599330924736802844173226042389174403401903999447463440670236056324929325189403433689"
+                + ".426167432065785331444814035799717606745777287606858873045971898862329763544687891847664736523584843544347118836628373041412918374550458884706686730726101338872517021688769782894793734049819222924171842793485919753186993388451909096042127903835765393729547730953942175461146061715108701615615142134282261293656760570061554783195726716403304101469782303957325142638493327692352838806741611887655695029948975509680496573999174402058593454203190963443179532640446352828089016874853634851387762579319853267317320515941105912189838719919259277721994880193541634872882180184303434360412344059435559680494807415573269199203376126242271766939666939316648575065702750502798973418978204972336924254702551350654650573582614211506856383897692911422458286912085339575875324832979140870119455620532272318122103640233069115700020760625493816902806241630788230268031695140687964931377988962507263990468276009750998066442971308866347136022907166625330623130307555914930120150437900510530537258665172619821272937026713977709974434967165159545592482710663639966781678268622620229577009317698254134914742098420792313931843709810905414336383757407675429663714210967924767434203021205270369316797752411974617662200898086335322218191674846795163102021505555508444216708745911194321674887527227200297039471799580744303346354057273540730643842091810899490590914195225087593013834388801018488174855060306804024894292757613618190472234110859436472645203753139820658279559340251226992556744343475086923568365637919479462424794554522865559888240039662899509652221329892034706445253487898044421278283079233226845124525434586324657471286953226255430662125870993375281512713207125720748163498642795960457639954616530163959004770092547297392499137383176609646505351001304840762905826237024982330597805063521162285806541220110524989649256399233792799406995068469271941269511818994954109392839548141262324660472253632382325038836831429045617036015122388070240133760858500132713255407855625837956886349324981003917084922808187223285051144454915441134217743066575863563572152133978905444998209075763950909784148142018992367290485890072303179512881131769414783097454103103347826517701720263541869335631166977965013552647906729408522950996105479525445916501155305220090853891226367184989434453290788068397817927893708837722255115237672194162924260945492012622891770365546831236789867922136747819364833843397165107825773447549885351449899330007200651144003961228091210630807333236718793283427788965479074476288255387824982443633190938302785760754436525586544523339170400053128503337395428393881357669568532722167493096151221381017320147344991331421789379785964440840684363041795410525097564979585773948558651896834067324427900848255265001498890329859444233861478388742393060996236783742654761350763876989363052609107226398858310051497856931093693697981165801539060516895227818925342535261227134364063673285588256280386915163875872231395348293505967057794409379709079685798908660258077792158532257603211711587587586356431658240229896344639704");
+        if (total.setScale(0, RoundingMode.DOWN).equals(total.setScale(0, RoundingMode.DOWN))) {
+            return 0;
+        } else {
+            return 1;
+        }
+    }
+
     public static void main(String argv[]) {
         int failures = 0;
 
@@ -455,6 +467,7 @@
         failures += setScaleTests();
         failures += toEngineeringStringTests();
         failures += ulpTests();
+        failures += setScaleDoesNotMutateTest();
 
         if (failures > 0 ) {
             throw new RuntimeException("Incurred " + failures + " failures" +
diff --git a/test/java/math/BigInteger/BigIntegerTest.java b/test/java/math/BigInteger/BigIntegerTest.java
index 8d7ad25..c8d6326 100644
--- a/test/java/math/BigInteger/BigIntegerTest.java
+++ b/test/java/math/BigInteger/BigIntegerTest.java
@@ -71,6 +71,7 @@
     static final int BITS_TOOM_COOK_SQUARE = 6912;
     static final int BITS_SCHOENHAGE_BASE = 640;
     static final int BITS_BURNIKEL_ZIEGLER = 2560;
+    static final int BITS_BURNIKEL_ZIEGLER_OFFSET = 1280;
 
     static final int ORDER_SMALL = 60;
     static final int ORDER_MEDIUM = 100;
@@ -288,19 +289,19 @@
      * where {@code abs(u) > abs(v)} and {@code a > b && b > 0}, then if
      * {@code w/z = q1*z + r1} and {@code u/v = q2*v + r2}, then
      * {@code q1 = q2*pow(2,a-b)} and {@code r1 = r2*pow(2,b)}.  The test
-     * ensures that {@code v} is just under the B-Z threshold and that {@code w}
-     * and {@code z} are both over the threshold.  This implies that {@code u/v}
-     * uses the standard division algorithm and {@code w/z} uses the B-Z
-     * algorithm.  The results of the two algorithms are then compared using the
-     * observation described in the foregoing and if they are not equal a
-     * failure is logged.
+     * ensures that {@code v} is just under the B-Z threshold, that {@code z} is
+     * over the threshold and {@code w} is much larger than {@code z}. This
+     * implies that {@code u/v} uses the standard division algorithm and
+     * {@code w/z} uses the B-Z algorithm.  The results of the two algorithms
+     * are then compared using the observation described in the foregoing and
+     * if they are not equal a failure is logged.
      */
     public static void divideLarge() {
         int failCount = 0;
 
-        BigInteger base = BigInteger.ONE.shiftLeft(BITS_BURNIKEL_ZIEGLER - 33);
+        BigInteger base = BigInteger.ONE.shiftLeft(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 33);
         for (int i=0; i<SIZE; i++) {
-            BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER - 34, rnd);
+            BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 34, rnd);
             BigInteger v = base.add(addend);
 
             BigInteger u = v.multiply(BigInteger.valueOf(2 + rnd.nextInt(Short.MAX_VALUE - 1)));
@@ -312,14 +313,14 @@
                 v = v.negate();
             }
 
-            int a = 17 + rnd.nextInt(16);
+            int a = BITS_BURNIKEL_ZIEGLER_OFFSET + rnd.nextInt(16);
             int b = 1 + rnd.nextInt(16);
-            BigInteger w = u.multiply(BigInteger.valueOf(1L << a));
-            BigInteger z = v.multiply(BigInteger.valueOf(1L << b));
+            BigInteger w = u.multiply(BigInteger.ONE.shiftLeft(a));
+            BigInteger z = v.multiply(BigInteger.ONE.shiftLeft(b));
 
             BigInteger[] divideResult = u.divideAndRemainder(v);
-            divideResult[0] = divideResult[0].multiply(BigInteger.valueOf(1L << (a - b)));
-            divideResult[1] = divideResult[1].multiply(BigInteger.valueOf(1L << b));
+            divideResult[0] = divideResult[0].multiply(BigInteger.ONE.shiftLeft(a - b));
+            divideResult[1] = divideResult[1].multiply(BigInteger.ONE.shiftLeft(b));
             BigInteger[] bzResult = w.divideAndRemainder(z);
 
             if (divideResult[0].compareTo(bzResult[0]) != 0 ||
diff --git a/test/java/net/InetAddress/IPv4Formats.java b/test/java/net/InetAddress/IPv4Formats.java
index 7c6dc86..e626043 100644
--- a/test/java/net/InetAddress/IPv4Formats.java
+++ b/test/java/net/InetAddress/IPv4Formats.java
@@ -27,6 +27,7 @@
  * @summary InetAddress.getByName behaves differently on windows
  */
 import java.net.*;
+import java.util.UUID;
 
 public class IPv4Formats {
     public static void main(String[] args) {
@@ -36,7 +37,7 @@
             {"126.1", "126.0.0.1"},
             {"128.50.65534", "128.50.255.254"},
             {"192.168.1.2", "192.168.1.2"},
-            {"hello.foo.bar", null},
+            {"invalidhost.invalid", null},
             {"1024.1.2.3", null},
             {"128.14.66000", null }
         };
diff --git a/test/java/net/NetworkInterface/Test.java b/test/java/net/NetworkInterface/Test.java
index 66ecbed..56325fd 100644
--- a/test/java/net/NetworkInterface/Test.java
+++ b/test/java/net/NetworkInterface/Test.java
@@ -22,7 +22,9 @@
  */
 
 /* @test
- * @bug 4405354 6594296
+ * @bug 4405354 6594296 8058216
+ * @run main Test
+ * @run main/othervm -Djava.net.preferIPv4Stack=true Test
  * @summary Basic tests for NetworkInterface
  */
 import java.net.NetworkInterface;
diff --git a/test/java/net/ResponseCache/Test2.java b/test/java/net/ResponseCache/Test2.java
new file mode 100644
index 0000000..6c6f15c
--- /dev/null
+++ b/test/java/net/ResponseCache/Test2.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8042622
+ * @summary Check for CRL results in IllegalArgumentException "white space not allowed"
+ * @run main/othervm Test2
+ */
+
+import com.sun.net.httpserver.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import javax.security.auth.callback.*;
+import javax.net.ssl.*;
+
+public class Test2 {
+
+    static volatile boolean failed = false;
+
+    static class Cache extends ResponseCache {
+        public CacheResponse get(URI uri, String method, Map<String,List<String>> headers) {
+            Set<String> keys = headers.keySet();
+            for (String key : keys) {
+                if (key.indexOf(' ') != -1 || key.indexOf('\t') != -1
+                        || key.indexOf(':') != -1)
+                {
+                    failed = true;
+                }
+            }
+            return null;
+        }
+
+        public CacheRequest put(URI uri, URLConnection c) throws IOException {
+            return null;
+        }
+    }
+
+    static int port;
+
+    static String urlstring, redirstring;
+
+    public static void main (String[] args) throws Exception {
+        Handler handler = new Handler();
+        InetSocketAddress addr = new InetSocketAddress (0);
+        HttpServer server = HttpServer.create (addr, 0);
+        port = server.getAddress().getPort();
+        HttpContext ctx = server.createContext ("/test", handler);
+        System.out.println ("Server: " + server.getAddress().getPort());
+        ResponseCache.setDefault(new Cache());
+
+        ExecutorService executor = Executors.newCachedThreadPool();
+        server.setExecutor (executor);
+        server.start ();
+
+        urlstring = "http://127.0.0.1:" + Integer.toString(port)+"/test/foo";
+        redirstring = urlstring + "/redirect/bar";
+
+        URL url = new URL (urlstring);
+        HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
+        urlc.addRequestProperty("X-Foo", "bar");
+        urlc.setInstanceFollowRedirects(true);
+        System.out.println(urlc.getResponseCode());
+        InputStream i = urlc.getInputStream();
+        int count=0;
+        for (int c=i.read(); c!=-1; c=i.read()) {
+            //System.out.write(c);
+            count++;
+        }
+        System.out.println("Read " + count);
+        System.out.println("FINISHED");
+        server.stop(0);
+        executor.shutdownNow();
+        if (failed) {
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    public static boolean error = false;
+    public static int count = 0;
+
+    static class Handler implements HttpHandler {
+        int invocation = 0;
+        public void handle (HttpExchange t)
+            throws IOException
+        {
+            InputStream is = t.getRequestBody();
+            Headers map = t.getRequestHeaders();
+            Headers rmap = t.getResponseHeaders();
+            invocation ++;
+            if (invocation == 1) {
+                rmap.add("Location", redirstring);
+                while (is.read () != -1) ;
+                is.close();
+                System.out.println ("sending response");
+                t.sendResponseHeaders (301, 0);
+            } else {
+                byte[] buf = "Hello world".getBytes();
+                t.sendResponseHeaders (200, buf.length);
+                OutputStream os = t.getResponseBody();
+                try {
+                        os.write(buf);
+                } catch (IOException e) {
+                        System.out.println ("EX 1 " + e);
+                }
+            }
+            System.out.println ("Closing");
+            t.close();
+        }
+    }
+}
diff --git a/test/java/nio/channels/FileChannel/BlockDeviceSize.java b/test/java/nio/channels/FileChannel/BlockDeviceSize.java
new file mode 100644
index 0000000..aafe419
--- /dev/null
+++ b/test/java/nio/channels/FileChannel/BlockDeviceSize.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8054029
+ * @summary Block devices should not report size=0 on Linux
+ */
+
+import java.io.RandomAccessFile;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.channels.FileChannel;
+import java.nio.file.AccessDeniedException;
+import java.nio.file.NoSuchFileException;
+import static java.nio.file.StandardOpenOption.*;
+
+
+public class BlockDeviceSize {
+    private static final String BLK_FNAME = "/dev/sda1";
+    private static final Path BLK_PATH = Paths.get(BLK_FNAME);
+
+    public static void main(String[] args) throws Throwable {
+        try (FileChannel ch = FileChannel.open(BLK_PATH, READ);
+             RandomAccessFile file = new RandomAccessFile(BLK_FNAME, "r")) {
+
+            long size1 = ch.size();
+            long size2 = file.length();
+            if (size1 != size2) {
+                throw new RuntimeException("size differs when retrieved" +
+                        " in different ways: " + size1 + " != " + size2);
+            }
+            System.out.println("OK");
+
+        } catch (NoSuchFileException nsfe) {
+            System.err.println("File " + BLK_FNAME + " not found." +
+                    " Skipping test");
+        } catch (AccessDeniedException ade) {
+            System.err.println("Access to " + BLK_FNAME + " is denied." +
+                    " Run test as root.");
+        }
+    }
+}
diff --git a/test/java/nio/file/WatchService/Basic.java b/test/java/nio/file/WatchService/Basic.java
index 00965e8..f31a2f5 100644
--- a/test/java/nio/file/WatchService/Basic.java
+++ b/test/java/nio/file/WatchService/Basic.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 6838333 7017446
+ * @bug 4313887 6838333 7017446 8011537 8042470
  * @summary Unit test for java.nio.file.WatchService
  * @library ..
  * @run main Basic
@@ -295,24 +295,31 @@
             // IllegalArgumentException
             System.out.println("IllegalArgumentException tests...");
             try {
-                dir.register(watcher, new WatchEvent.Kind<?>[]{ } );
+                dir.register(watcher /*empty event list*/);
                 throw new RuntimeException("IllegalArgumentException not thrown");
             } catch (IllegalArgumentException x) {
             }
             try {
                 // OVERFLOW is ignored so this is equivalent to the empty set
-                dir.register(watcher, new WatchEvent.Kind<?>[]{ OVERFLOW });
+                dir.register(watcher, OVERFLOW);
+                throw new RuntimeException("IllegalArgumentException not thrown");
+            } catch (IllegalArgumentException x) {
+            }
+            try {
+                // OVERFLOW is ignored even if specified multiple times
+                dir.register(watcher, OVERFLOW, OVERFLOW);
                 throw new RuntimeException("IllegalArgumentException not thrown");
             } catch (IllegalArgumentException x) {
             }
 
             // UnsupportedOperationException
             try {
-                dir.register(watcher, new WatchEvent.Kind<?>[]{
+                dir.register(watcher,
                              new WatchEvent.Kind<Object>() {
                                 @Override public String name() { return "custom"; }
                                 @Override public Class<Object> type() { return Object.class; }
-                             }});
+                             });
+                throw new RuntimeException("UnsupportedOperationException not thrown");
             } catch (UnsupportedOperationException x) {
             }
             try {
@@ -328,7 +335,7 @@
             // NullPointerException
             System.out.println("NullPointerException tests...");
             try {
-                dir.register(null, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
+                dir.register(null, ENTRY_CREATE);
                 throw new RuntimeException("NullPointerException not thrown");
             } catch (NullPointerException x) {
             }
@@ -380,7 +387,7 @@
 
         try {
             dir.register(watcher, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
-             throw new RuntimeException("ClosedWatchServiceException not thrown");
+            throw new RuntimeException("ClosedWatchServiceException not thrown");
         } catch (ClosedWatchServiceException  x) {
         }
 
@@ -468,6 +475,28 @@
         }
     }
 
+    /**
+     * Test that thread interruped status is preserved upon a call
+     * to register()
+     */
+    static void testThreadInterrupt(Path dir) throws IOException {
+        System.out.println("-- Thread interrupted status test --");
+
+        FileSystem fs = FileSystems.getDefault();
+        Thread curr = Thread.currentThread();
+        try (WatchService watcher = fs.newWatchService()) {
+            System.out.println("interrupting current thread");
+            curr.interrupt();
+            dir.register(watcher, ENTRY_CREATE);
+            if (!curr.isInterrupted())
+                throw new RuntimeException("thread should remain interrupted");
+            System.out.println("current thread is still interrupted");
+            System.out.println("OKAY");
+        } finally {
+            curr.interrupted();
+        }
+    }
+
     public static void main(String[] args) throws IOException {
         Path dir = TestUtil.createTemporaryDirectory();
         try {
@@ -478,6 +507,7 @@
             testWakeup(dir);
             testExceptions(dir);
             testTwoWatchers(dir);
+            testThreadInterrupt(dir);
 
         } finally {
             TestUtil.removeAll(dir);
diff --git a/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java b/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java
index 26db324..dab36fc 100644
--- a/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java
+++ b/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,27 +23,548 @@
 
 /**
  * @test
- * @bug 4776466
+ * @bug 4776466 8032573
  * @summary check that CertificateFactory rejects invalid encoded X.509 certs
  */
 
 import java.io.*;
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+import javax.security.auth.x500.X500Principal;
+import java.security.GeneralSecurityException;
 import java.security.cert.*;
 
 public class DetectInvalidEncoding {
 
+    // Originally found in the test file:
+    // java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem
+    // The first character of the PEM encoding has been changed from "M" to
+    // "X" to force a failure during decoding.
+    private static final String INVALID_CERT =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "XIICJjCCAdCgAwIBAgIBITANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCVVMx\n" +
+        "EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xFTAT\n" +
+        "BgNVBAoTDEJFQSBXZWJMb2dpYzERMA8GA1UECxMIU2VjdXJpdHkxIzAhBgNVBAMT\n" +
+        "GkRlbW8gQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9zdXBw\n" +
+        "b3J0QGJlYS5jb20wHhcNMDAwNTMwMjEzODAxWhcNMDQwNTEzMjEzODAxWjCBjDEL\n" +
+        "MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\n" +
+        "cmFuY2lzY28xFTATBgNVBAoTDEJFQSBXZWJMb2dpYzEZMBcGA1UEAxMQd2VibG9n\n" +
+        "aWMuYmVhLmNvbTEeMBwGCSqGSIb3DQEJARYPc3VwcG9ydEBiZWEuY29tMFwwDQYJ\n" +
+        "KoZIhvcNAQEBBQADSwAwSAJBALdsXEHqKHgs6zj0hU5sXMAUHzoT8kgWXmNkKHXH\n" +
+        "79qbPh6EfdlriW9G/AbRF/pKrCQu7hhllAxREbqTuSlf2EMCAwEAATANBgkqhkiG\n" +
+        "9w0BAQQFAANBACgmqflL5m5LNeJGpWx9aIoABCiuDcpw1fFyegsqGX7CBhffcruS\n" +
+        "1p8h5vkHVbMu1frD1UgGnPlOO/K7Ig/KrsU=\n" +
+        "-----END CERTIFICATE-----";
+
+    // Created with keytool:
+    // keytool -genkeypair -keyalg rsa -keysize 2048 -keystore <KS_FILE>
+    //      -alias root -sigalg SHA256withRSA -dname "CN=Root, O=SomeCompany"
+    //      -validity 730 -ext bc:critical=ca:true
+    //      -ext ku:critical=keyCertSign,cRLSign
+    private static final String SINGLE_ROOT_CERT =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIDCjCCAfKgAwIBAgIEDUiw+DANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
+        "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMTI5MjZaFw0xNjA4\n" +
+        "MjcyMTI5MjZaMCUxFDASBgNVBAoTC1NvbWVDb21wYW55MQ0wCwYDVQQDEwRSb290\n" +
+        "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0VFecSNdH6CJhPOSG127\n" +
+        "tuvld4y7GGJ0kQf3Q0b8qgprsXAmn0/bQR+YX7PfS408cFW+q2SWXeY2kC/3chvi\n" +
+        "2syMsGdUJrDzuMbYsbvKPKyuJ2GJskX3mSbLMJj5Tzhg4qmwbzDTFIJ51yGa1Wmh\n" +
+        "i2+4PhltqT0TohvSVJlBrOWNhmvwv5UWsF4e2i04rebDZQoWkmD3MpImZXF/HYre\n" +
+        "9P8NP97vN0xZmh5PySHy2ILXN3ZhTn3tq0YxNSQTaMUfhgoyzWFvZKAnm/tZIh/1\n" +
+        "oswwEQPIZJ25AUTm9r3YPQXl1hsNdLU0asEVYRsgzGSTX5gCuUY+KzhStzisOcUY\n" +
+        "uQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" +
+        "HQ4EFgQUz1FBNixG/KCgcn6FOWzxP1hujG0wDQYJKoZIhvcNAQELBQADggEBAL60\n" +
+        "ZaNc6eIMbKntGVE/pdxxyKwPdDyAAeEevX23KRWoLbQjHXo5jrfDPhI5k45ztlyU\n" +
+        "+tIQbc81LlCl88I4dIx0fvEbxjNaAYhFNXwwSQBs2CuEAdRK8hodXbRcEeI+G10F\n" +
+        "ARIVs2C7JNm/RhxskCWgj6tFIOGaTZ9gHyvlQUEM18sr5fXZlXTqspZCmz3t5XPi\n" +
+        "5/wYLv6vk7k3G8WzMHbBE0bYI+61cCc8rbMHldtymbwSwiqfKC9y7oPEfRCbzVUe\n" +
+        "fgrKcOyVWDuw0y0hhsQL/oONjPp4uK/bl9B7T84t4+ihxdocWKx6eyhFvOvZH9t2\n" +
+        "kUylb9yBUYStwGExMHg=\n" +
+        "-----END CERTIFICATE-----";
+
+    // Created with keytool:
+    // keytool -genkeypair -keyalg rsa -keysize 2048 -keystore <KS_FILE>
+    //      -alias root -sigalg SHA256withRSA
+    //      -dname "CN=Intermed, O=SomeCompany" -validity 730
+    //      -ext bc:critical=ca:true -ext ku:critical=keyCertSign,cRLSign
+    // keytool -certreq -keystore <KS_FILE> -sigalg SHA256withRSA
+    //      -alias intermed -dname "CN=Intermed, O=SomeCompany"
+    // keytool -gencert -keystore <KS_FILE> -alias intermed
+    //      -sigalg SHA256withRSA -validity 730
+    //      -ext bc:critical=ca:true -ext ku:critical=keyCertSign,cRLSign
+    private static final String INTERMED_CA_CERT =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIDLzCCAhegAwIBAgIEIIgOyDANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
+        "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjUyNDJaFw0xNjA4\n" +
+        "MDcyMjUyNDJaMCkxFDASBgNVBAoTC1NvbWVDb21wYW55MREwDwYDVQQDEwhJbnRl\n" +
+        "cm1lZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJEecvTWla8kdWx+\n" +
+        "HHu5ryfBpJ95I7V4MEajnmzJVZcwvKhDjlDgABDMuVwFEUUSyeOdbWJF3DLKnyMD\n" +
+        "KTx6/58kuVak3NX2TJ8cmmIlKf1upFbdrEtjYViSnNrApprfO8B3ORdBbO6QDYza\n" +
+        "IkAWdI5GllFnVkb4yhMUBg3zfhglF+bl3D3lVRlp9bCrUZoNRs+mZjhVbcMn22ej\n" +
+        "TfG5Y3VpNM4SN8dFIxPQLLk/aao+cmWEQdbQ0R6ydemRukqrw170olSVLeoGGala\n" +
+        "3D4oJckde8EgNPcghcsdQ6tpGhkpFhmoyzEsuToR7Gq9UT5V2kkqJneiKXqQg4wz\n" +
+        "vMAlUGECAwEAAaNjMGEwHwYDVR0jBBgwFoAUOw+92bevFoJz96pR1DrAkPPUKb0w\n" +
+        "DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLbnErBs\n" +
+        "q/Mhci5XElfjjLZp3GRyMA0GCSqGSIb3DQEBCwUAA4IBAQAq8y2DpkSV31IXZ1vr\n" +
+        "/Ye+Nj/2NvBydFeHVRGMAN1LJv6/Q42TCSXbr6cDQ4NWQUtPm90yZBYJSznkbShx\n" +
+        "HOJEE6R8PRJvoUtMm7fJrNtkybTt6jX4j50Lw8gdYB/rgZb4z8ZQZVEo/0zpW4HV\n" +
+        "Gs+q4z8TkdmLR18hl39sUEsxt99AOBk8NtKKVNfBWq9b0QDhRkXfmqhyeXdDsHOV\n" +
+        "8ksulsa7hseheHhdjziEOpQugh8qzSea2kFPrLB53VjWfa4qDzEPaNhahho9piCu\n" +
+        "82XDnOrcEk9KyHWM7sa7vtK7++W+0MXD/p9nkZ6NHrJXweLriU0DXO6ZY3mzNKJK\n" +
+        "435M\n" +
+        "-----END CERTIFICATE-----";
+
+    // Subordinate cert created using keytool, both certs exported to
+    // files individually, then use openssl to place in a PKCS#7:
+    // openssl crl2pkcs7 -nocrl -certfile <INTERMED-CERT-PEM>
+    //      -certfile <ROOT-CERT-PEM> -out <P7-DEST-PEM-FILE>
+    private static final String PKCS7_INTERMED_ROOT_CERTS =
+        "-----BEGIN PKCS7-----\n" +
+        "MIIGbgYJKoZIhvcNAQcCoIIGXzCCBlsCAQExADALBgkqhkiG9w0BBwGgggZBMIID\n" +
+        "LzCCAhegAwIBAgIEIIgOyDANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtTb21l\n" +
+        "Q29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjUyNDJaFw0xNjA4MDcy\n" +
+        "MjUyNDJaMCkxFDASBgNVBAoTC1NvbWVDb21wYW55MREwDwYDVQQDEwhJbnRlcm1l\n" +
+        "ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJEecvTWla8kdWx+HHu5\n" +
+        "ryfBpJ95I7V4MEajnmzJVZcwvKhDjlDgABDMuVwFEUUSyeOdbWJF3DLKnyMDKTx6\n" +
+        "/58kuVak3NX2TJ8cmmIlKf1upFbdrEtjYViSnNrApprfO8B3ORdBbO6QDYzaIkAW\n" +
+        "dI5GllFnVkb4yhMUBg3zfhglF+bl3D3lVRlp9bCrUZoNRs+mZjhVbcMn22ejTfG5\n" +
+        "Y3VpNM4SN8dFIxPQLLk/aao+cmWEQdbQ0R6ydemRukqrw170olSVLeoGGala3D4o\n" +
+        "Jckde8EgNPcghcsdQ6tpGhkpFhmoyzEsuToR7Gq9UT5V2kkqJneiKXqQg4wzvMAl\n" +
+        "UGECAwEAAaNjMGEwHwYDVR0jBBgwFoAUOw+92bevFoJz96pR1DrAkPPUKb0wDwYD\n" +
+        "VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLbnErBsq/Mh\n" +
+        "ci5XElfjjLZp3GRyMA0GCSqGSIb3DQEBCwUAA4IBAQAq8y2DpkSV31IXZ1vr/Ye+\n" +
+        "Nj/2NvBydFeHVRGMAN1LJv6/Q42TCSXbr6cDQ4NWQUtPm90yZBYJSznkbShxHOJE\n" +
+        "E6R8PRJvoUtMm7fJrNtkybTt6jX4j50Lw8gdYB/rgZb4z8ZQZVEo/0zpW4HVGs+q\n" +
+        "4z8TkdmLR18hl39sUEsxt99AOBk8NtKKVNfBWq9b0QDhRkXfmqhyeXdDsHOV8ksu\n" +
+        "lsa7hseheHhdjziEOpQugh8qzSea2kFPrLB53VjWfa4qDzEPaNhahho9piCu82XD\n" +
+        "nOrcEk9KyHWM7sa7vtK7++W+0MXD/p9nkZ6NHrJXweLriU0DXO6ZY3mzNKJK435M\n" +
+        "MIIDCjCCAfKgAwIBAgIEdffjKTANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
+        "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjQ2MzZaFw0xNjA4\n" +
+        "MjcyMjQ2MzZaMCUxFDASBgNVBAoTC1NvbWVDb21wYW55MQ0wCwYDVQQDEwRSb290\n" +
+        "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhnXc8Avv54Gk2xjVa2yA\n" +
+        "lBL/Cug1nyvKl5wqmN+foT6cMOX6bneCkJOJ4lSbch3gvl4ctlX/9hm3pB/+HhSr\n" +
+        "em2NcLQrLEq8l9Ar4RnqfoXQR4Uy+4P6wj9OcVV7e/v/+ZPnStOoEAtb5nAwsR2b\n" +
+        "hOC/tIFNwflrsmsmtMSoOiNftpYLFF4eOAdpDrXYMrqNu6ZxZsOQ7WZl4SsVOx1N\n" +
+        "/IINXwBLyoHJDzLZ0iJEV0O6mh846s0n6QXeK1P5d0uLcoZaZ1k8Q4sRcdoLA6rS\n" +
+        "e1WffipBFMvIuoDIigkHZIKVYRLG828rO+PFnRah0ybybkVsN6s3oLxfhswZDvut\n" +
+        "OwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" +
+        "HQ4EFgQUOw+92bevFoJz96pR1DrAkPPUKb0wDQYJKoZIhvcNAQELBQADggEBACBN\n" +
+        "wEaV70FKKBINHtNwesd7TB6fgSaVgDZOO08aseHbXnm7AUhtDV3P5rQR2AsKtbg4\n" +
+        "COhlKw2/Ki18D4DfdCccFKFTRZBjqj2PxNmn6C68l1/bT4PuUXuM7rW++53RcOA7\n" +
+        "TbgLuzA25kSz7XinRvR8L4VwHtppu5tSYEthMIMgLZLGGV9r7kBfpY8lXdxQM8vb\n" +
+        "xZUIysasvVtVUFPOTV6g2dfn8QCoqLOmxyzTLdXe4M6acP6f7lmhgr3LMqDtB6K9\n" +
+        "pN+OImr77zNdZ+jTB+5e9a8gAvc5ZfG7Nk5RfwUatYTAFZ6Uggy2cKmIRpXCia18\n" +
+        "If78mc7goS1+lHkGCs2hADEA\n" +
+        "-----END PKCS7-----";
+
+    // Empty PKCS#7 in DER form can be created with openssl:
+    // openssl crl2pkcs7 -nocrl -outform DER
+    private static final byte[] PKCS7_BER_EMPTY = {
+          48,   39,    6,    9,   42, -122,   72, -122,
+          -9,   13,    1,    7,    2,  -96,   26,   48,
+          24,    2,    1,    1,   49,    0,   48,   11,
+           6,    9,   42, -122,   72, -122,   -9,   13,
+           1,    7,    1,  -96,    0,  -95,    0,   49,
+           0
+    };
+
+    private static final String JTEST_ROOT_CRL =
+        "-----BEGIN X509 CRL-----\n" +
+        "MIICoTCBigIBATANBgkqhkiG9w0BAQsFADA1MQ4wDAYDVQQKEwVKVGVzdDELMAkG\n" +
+        "A1UECxMCSVQxFjAUBgNVBAMTDUpUZXN0IFJvb3QgQ0EXDTE0MDkwNDE4NDIyMVqg\n" +
+        "MDAuMB8GA1UdIwQYMBaAFO6bllCV6kctH77MfqAtefNeRdsmMAsGA1UdFAQEAgIA\n" +
+        "jjANBgkqhkiG9w0BAQsFAAOCAgEAmp8ihtiRthknDC+VzehmlQw5u8MftMZYQYk5\n" +
+        "EI04SwyzY9JTL8QHb4u7fXjnZAyN89aYPypI5OSyDsyyGP/JDNsBt2Um/fl0aaCl\n" +
+        "Z4Np6x+dB9+oIU1XY7y2+uyQUC5MHivQ5ddbGPoAvK/msbugTGAjHvZpM+l0okiV\n" +
+        "3SofDrii5BSosFEkXfkf2oG9ZLO3YamsFMEZaOj/eWDyGhTyJMGsq2/8NeTF21Tp\n" +
+        "YkeDcTHqR5KHoYXjOIaS7NjmErm+uDpKH9Lq+JUcYrbUhmjnq5z04EsPF2F2L7Vb\n" +
+        "THI+awQAUQit16lXGuz7fFRZi2vPyiaRP5n2QT5D+ac1dAs+oWLDJw6Tf2v9KVTe\n" +
+        "OmW62yd6zQqCwBg+n57UcNu3sv/Sq3t7iRuN0AmWlIhu659POPQv7Np6bEo6dIpp\n" +
+        "u7Ze6D2KPtM177ETHYlCx2a3g9VEZYKrVhQ2749St0Cp5szVq691jFZAWYOzcfEO\n" +
+        "XfK1y25pmlBjvhNIIVRlU+T5rjNb8GaleYKVYnKOcv700K32QxFzcPf7nbNKwW99\n" +
+        "tcaNHFNP+LW/XP8I3CJ8toXLLcOITKVwMA+0GlO5eL7eX5POc+vE9+7IzGuybmU4\n" +
+        "uslxoLdJ0NSZWpYmf6a6qrJ67cj5i3706H+eBsWQcShfSYreh+TyWQaGk+fkEiUV\n" +
+        "iy4QdJ0=\n" +
+        "-----END X509 CRL-----";
+
+    private static final String JTEST_INTERMED_CRL =
+        "-----BEGIN X509 CRL-----\n" +
+        "MIICzzCBuAIBATANBgkqhkiG9w0BAQsFADA/MQ4wDAYDVQQKEwVKVGVzdDELMAkG\n" +
+        "A1UECxMCSVQxIDAeBgNVBAMTF0pUZXN0IEludGVybWVkaWF0ZSBDQSAxFw0xNDA5\n" +
+        "MDQyMjE2NTRaMCIwIAIBBhcNMTQwOTA0MjIxNjU0WjAMMAoGA1UdFQQDCgEFoDAw\n" +
+        "LjAfBgNVHSMEGDAWgBSvRdjbkSMJ3A7s5H6EWghQ+lkw/zALBgNVHRQEBAICAJsw\n" +
+        "DQYJKoZIhvcNAQELBQADggIBALJmikMwil8oywhenoO8o9xxCOIU0xrt3KdfiSXw\n" +
+        "8MtQXZHT9d1C6tlLAsYkWAfmfTvM2OU6wquFCLLsFmDZszbbCqmn4JhYBSKQMqlm\n" +
+        "IHnsiOFPvITW2FU08fWNLM+FtQzPnTFmx/CJo+wfGpq5tZMIbsccsCJ5uvZVAWGh\n" +
+        "0KbPmYcJG/O384+kzr/2H2IaoZoMMABec5c5FEF/tpp8jawzY+0VFyaVrumKWdan\n" +
+        "+3OvRQxT1wLxfNi2vdxB2rmNPo423qanXZAoVv260um3LYlmXBNK1jwQ9lp78jkT\n" +
+        "B7zMVa4hOUWVxdWc/LE6fUYgPsNqZd+hWy/PolIRp5TS21B5hkc5K87LT59GkexK\n" +
+        "vNVKQennOLGtH+Q7htK4UeY4Gm/W7UydOQ0k7hZzyfMDkCfLfNfK0l63qKwUku36\n" +
+        "UdeI1LXqulPEvb/d7rRAAM9p5Sm+RsECj2bcrZBMdIGXcSo26A5tzZpTEC79i4S1\n" +
+        "yxYIooeBnouUkDJ9+VBsJTSKY5fpU8JSkQPRyHKt+trGAkBt2Ka5MqrHtITzQ1vP\n" +
+        "5q4tNr45JGEXllH83NlBpWURfsdtkDHa3lxTD/pkrywOCyzz7wQ22D8Kul7EN8nT\n" +
+        "7LDbN+O3G9GHICxvWlJHp6HMsqGTuH1MIUR+5uZFOJa1S0IzorUIEieLncDUPgzO\n" +
+        "M4JA\n" +
+        "-----END X509 CRL-----";
+
+    // PKCS#7 CRL Set containing JTEST root and intermediate CRLs
+    private static final String PKCS7_CRL_SET =
+        "-----BEGIN PKCS7-----\n" +
+        "MIIFpQYJKoZIhvcNAQcCoIIFljCCBZICAQExADALBgkqhkiG9w0BBwGgAKGCBXgw\n" +
+        "ggKhMIGKAgEBMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNVBAoTBUpUZXN0MQswCQYD\n" +
+        "VQQLEwJJVDEWMBQGA1UEAxMNSlRlc3QgUm9vdCBDQRcNMTQwOTA0MTg0MjIxWqAw\n" +
+        "MC4wHwYDVR0jBBgwFoAU7puWUJXqRy0fvsx+oC15815F2yYwCwYDVR0UBAQCAgCO\n" +
+        "MA0GCSqGSIb3DQEBCwUAA4ICAQCanyKG2JG2GScML5XN6GaVDDm7wx+0xlhBiTkQ\n" +
+        "jThLDLNj0lMvxAdvi7t9eOdkDI3z1pg/Kkjk5LIOzLIY/8kM2wG3ZSb9+XRpoKVn\n" +
+        "g2nrH50H36ghTVdjvLb67JBQLkweK9Dl11sY+gC8r+axu6BMYCMe9mkz6XSiSJXd\n" +
+        "Kh8OuKLkFKiwUSRd+R/agb1ks7dhqawUwRlo6P95YPIaFPIkwayrb/w15MXbVOli\n" +
+        "R4NxMepHkoehheM4hpLs2OYSub64Okof0ur4lRxittSGaOernPTgSw8XYXYvtVtM\n" +
+        "cj5rBABRCK3XqVca7Pt8VFmLa8/KJpE/mfZBPkP5pzV0Cz6hYsMnDpN/a/0pVN46\n" +
+        "ZbrbJ3rNCoLAGD6fntRw27ey/9Kre3uJG43QCZaUiG7rn0849C/s2npsSjp0imm7\n" +
+        "tl7oPYo+0zXvsRMdiULHZreD1URlgqtWFDbvj1K3QKnmzNWrr3WMVkBZg7Nx8Q5d\n" +
+        "8rXLbmmaUGO+E0ghVGVT5PmuM1vwZqV5gpVico5y/vTQrfZDEXNw9/uds0rBb321\n" +
+        "xo0cU0/4tb9c/wjcIny2hcstw4hMpXAwD7QaU7l4vt5fk85z68T37sjMa7JuZTi6\n" +
+        "yXGgt0nQ1JlaliZ/prqqsnrtyPmLfvTof54GxZBxKF9Jit6H5PJZBoaT5+QSJRWL\n" +
+        "LhB0nTCCAs8wgbgCAQEwDQYJKoZIhvcNAQELBQAwPzEOMAwGA1UEChMFSlRlc3Qx\n" +
+        "CzAJBgNVBAsTAklUMSAwHgYDVQQDExdKVGVzdCBJbnRlcm1lZGlhdGUgQ0EgMRcN\n" +
+        "MTQwOTA0MjIxNjU0WjAiMCACAQYXDTE0MDkwNDIyMTY1NFowDDAKBgNVHRUEAwoB\n" +
+        "BaAwMC4wHwYDVR0jBBgwFoAUr0XY25EjCdwO7OR+hFoIUPpZMP8wCwYDVR0UBAQC\n" +
+        "AgCbMA0GCSqGSIb3DQEBCwUAA4ICAQCyZopDMIpfKMsIXp6DvKPccQjiFNMa7dyn\n" +
+        "X4kl8PDLUF2R0/XdQurZSwLGJFgH5n07zNjlOsKrhQiy7BZg2bM22wqpp+CYWAUi\n" +
+        "kDKpZiB57IjhT7yE1thVNPH1jSzPhbUMz50xZsfwiaPsHxqaubWTCG7HHLAiebr2\n" +
+        "VQFhodCmz5mHCRvzt/OPpM6/9h9iGqGaDDAAXnOXORRBf7aafI2sM2PtFRcmla7p\n" +
+        "ilnWp/tzr0UMU9cC8XzYtr3cQdq5jT6ONt6mp12QKFb9utLpty2JZlwTStY8EPZa\n" +
+        "e/I5Ewe8zFWuITlFlcXVnPyxOn1GID7DamXfoVsvz6JSEaeU0ttQeYZHOSvOy0+f\n" +
+        "RpHsSrzVSkHp5zixrR/kO4bSuFHmOBpv1u1MnTkNJO4Wc8nzA5Any3zXytJet6is\n" +
+        "FJLt+lHXiNS16rpTxL2/3e60QADPaeUpvkbBAo9m3K2QTHSBl3EqNugObc2aUxAu\n" +
+        "/YuEtcsWCKKHgZ6LlJAyfflQbCU0imOX6VPCUpED0chyrfraxgJAbdimuTKqx7SE\n" +
+        "80Nbz+auLTa+OSRhF5ZR/NzZQaVlEX7HbZAx2t5cUw/6ZK8sDgss8+8ENtg/Crpe\n" +
+        "xDfJ0+yw2zfjtxvRhyAsb1pSR6ehzLKhk7h9TCFEfubmRTiWtUtCM6K1CBIni53A\n" +
+        "1D4MzjOCQDEA\n" +
+        "-----END PKCS7-----";
+
     public static void main(String[] args) throws Exception {
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        File f = new File
-            (System.getProperty("test.src", "."), "invalidcert.pem");
-        InputStream inStream = new FileInputStream(f);
-        try {
-            X509Certificate cert =
-                (X509Certificate) cf.generateCertificate(inStream);
-        } catch (CertificateParsingException ce) {
-            return;
+        List<DecodeTest> validTests = new LinkedList<>();
+        List<DecodeTest> invalidTests = new LinkedList<>();
+
+        // Load up positive test cases (for sanity checks)
+        StringBuilder sb = new StringBuilder();
+
+        validTests.add(new GenMultiCertTest("Single, valid certificate",
+                    SINGLE_ROOT_CERT.getBytes(), null,
+                    new X500Principal("CN=Root, O=SomeCompany")));
+        validTests.add(new GenMultiCertTest("PEM-encoded PKCS#7 chain",
+                    PKCS7_INTERMED_ROOT_CERTS.getBytes(), null,
+                    new X500Principal("CN=Intermed, O=SomeCompany"),
+                    new X500Principal("CN=Root, O=SomeCompany")));
+        validTests.add(new GenMultiCertTest("Two PEM-encoded X509 certs",
+                    (INTERMED_CA_CERT + "\n" + SINGLE_ROOT_CERT).getBytes(),
+                    null,
+                    new X500Principal("CN=Intermed, O=SomeCompany"),
+                    new X500Principal("CN=Root, O=SomeCompany")));
+        validTests.add(new GenMultiCertTest("Empty data", new byte[0], null));
+
+        sb.append("Certificate 1: CN=Root, O=SomeCompany\n");
+        sb.append(SINGLE_ROOT_CERT).append("\n");
+        sb.append("Certificate 2: CN=Intermed, O=SomeCompany\n");
+        sb.append(INTERMED_CA_CERT).append("\n");
+        sb.append("Extra trailing data\n");
+        validTests.add(new GenMultiCertTest(
+                    "Two PEM-encoded certs with leading/trailing " +
+                    "text data around each.", sb.toString().getBytes(), null,
+                    new X500Principal("CN=Root, O=SomeCompany"),
+                    new X500Principal("CN=Intermed, O=SomeCompany")));
+        validTests.add(new GenMultiCertTest(
+                    "BER-encoded PKCS#7 with empty certificates segment",
+                    PKCS7_BER_EMPTY, null));
+        validTests.add(new GenMultiCRLTest(
+                    "CRL with leading and trailing text data",
+                    ("This is a CRL\n" + JTEST_ROOT_CRL +
+                     "\nSee? Told you so\n\n").getBytes(), null,
+                    new X500Principal("CN=JTest Root CA,OU=IT,O=JTest")));
+        validTests.add(new GenMultiCRLTest(
+                    "Two CRLs, one after the other with leading/trailing text",
+                    ("This is a CRL\n" + JTEST_ROOT_CRL +
+                     "\nAnd this is another CRL\n" + JTEST_INTERMED_CRL +
+                     "\nAnd this is trailing text\n").getBytes(), null,
+                    new X500Principal("CN=JTest Root CA,OU=IT,O=JTest"),
+                    new X500Principal(
+                        "CN=JTest Intermediate CA 1,OU=IT,O=JTest")));
+        validTests.add(new GenMultiCRLTest("Two CRLs in a PKCS#7 CRL set",
+                PKCS7_CRL_SET.getBytes(), null,
+                new X500Principal("CN=JTest Root CA,OU=IT,O=JTest"),
+                new X500Principal("CN=JTest Intermediate CA 1,OU=IT,O=JTest")));
+
+        // Load up all test cases where we expect failures
+        invalidTests.add(new GenSingleCertTest("Invalid PEM encoding",
+                    INVALID_CERT.getBytes(),
+                    new CertificateParsingException()));
+        invalidTests.add(new GenMultiCertTest("Invalid PEM encoding",
+                    INVALID_CERT.getBytes(),
+                    new CertificateParsingException()));
+        invalidTests.add(new GenMultiCertTest(
+                    "Two cert sequence, one valid and one invalid",
+                    (INTERMED_CA_CERT + "\n" + INVALID_CERT).getBytes(),
+                    new CertificateParsingException()));
+        invalidTests.add(new GenMultiCertTest("Non-certificate text",
+                    "This is not a certificate".getBytes(),
+                    new CertificateException()));
+        invalidTests.add(new GenMultiCertTest(
+                    "Non-certificate text with partial PEM header (4 hyphens)",
+                    "----This is not a valid x509 certificate".getBytes(),
+                    new CertificateException()));
+        invalidTests.add(new GenMultiCertTest(
+                    "Leading non-certificate text plus valid PEM header, " +
+                    "but not on new line",
+                    "This is not valid -----BEGIN CERTIFICATE-----".getBytes(),
+                    new CertificateException()));
+        byte[] emptyCString = {0};
+        invalidTests.add(new GenMultiCertTest("Empty C-style string",
+                    emptyCString, new CertificateException()));
+        invalidTests.add(new GenMultiCRLTest("Non-CRL text",
+                    "This is not a CRL".getBytes(), new CRLException()));
+        invalidTests.add(new GenMultiCRLTest("Valid headers, but not a CRL",
+                    INTERMED_CA_CERT.getBytes(), new CRLException()));
+
+        System.out.println("===== Valid Tests =====");
+        for (DecodeTest dt : validTests) {
+            dt.passTest();
         }
-        throw new Exception("CertificateFactory.generateCertificate() did not "
-            + "throw CertificateParsingException on invalid X.509 cert data");
+        System.out.print("\n");
+
+        System.out.println("===== Invalid Tests =====");
+        for (DecodeTest dt : invalidTests) {
+            dt.failTest();
+        }
+    }
+
+    public static abstract class DecodeTest {
+        protected String testName;
+        protected byte[] testData;
+        protected Throwable expectedException;
+        protected X500Principal[] principals;
+        protected CertificateFactory cf;
+
+        /**
+         * Construct a DecodeTest
+         *
+         * @param name The test name
+         * @param input A byte array consisting of the input for this test
+         * @param failType An exception whose class should match the expected
+         *        exception that will be thrown when this test is run
+         * @param princs Zero of more X500Principals which will be used
+         *        to compare the output in a success case.
+         */
+        DecodeTest(String name, byte[] input, Throwable failType,
+                X500Principal... princs) throws CertificateException {
+            testName = name;
+            testData = input.clone();
+            expectedException = failType;
+            principals = princs;
+            cf = CertificateFactory.getInstance("X.509");
+        }
+
+        public abstract void passTest() throws GeneralSecurityException;
+
+        public abstract void failTest() throws GeneralSecurityException;
+    }
+
+    public static class GenMultiCertTest extends DecodeTest {
+        public GenMultiCertTest(String name, byte[] input, Throwable failType,
+                X500Principal... princs) throws CertificateException {
+            super(name, input, failType, princs);
+        }
+
+        @Override
+        public void passTest() throws GeneralSecurityException {
+            Collection<? extends Certificate> certs;
+
+            System.out.println("generateCertificates(): " + testName);
+            certs = cf.generateCertificates(new ByteArrayInputStream(testData));
+
+            // Walk the certs Collection and do a comparison of subject names
+            int i = 0;
+            if (certs.size() == principals.length) {
+                for (Certificate crt : certs) {
+                    X509Certificate xc = (X509Certificate)crt;
+                    if (!xc.getSubjectX500Principal().equals(
+                                principals[i])) {
+                        throw new RuntimeException("Name mismatch: " +
+                                "cert: " + xc.getSubjectX500Principal() +
+                                ", expected: " + principals[i]);
+                    }
+                    i++;
+                }
+            } else {
+                throw new RuntimeException("Size mismatch: certs = " +
+                        certs.size() + ", expected = " +
+                        principals.length);
+            }
+        }
+
+        @Override
+        public void failTest() throws GeneralSecurityException {
+            Throwable caughtException = null;
+            Collection<? extends Certificate> certs = null;
+
+            System.out.println("generateCertificates(): " + testName);
+            if (expectedException == null) {
+                throw new RuntimeException("failTest requires non-null " +
+                        "expectedException");
+            }
+
+            try {
+                certs =
+                    cf.generateCertificates(new ByteArrayInputStream(testData));
+            } catch (CertificateException ce) {
+                caughtException = ce;
+            }
+
+            if (caughtException != null) {
+                // It has to be the right kind of exception though...
+                if (!caughtException.getClass().equals(
+                        expectedException.getClass())) {
+                    System.err.println("Unexpected exception thrown. " +
+                            "Received: " + caughtException + ", Expected: " +
+                            expectedException.getClass());
+                    throw new RuntimeException(caughtException);
+                }
+            } else {
+                // For a failure test, we'd expect some kind of exception
+                // to be thrown.
+                throw new RuntimeException("Failed to catch expected " +
+                        "exception " + expectedException.getClass());
+            }
+        }
+    }
+
+    public static class GenSingleCertTest extends DecodeTest {
+        public GenSingleCertTest(String name, byte[] input, Throwable failType,
+                X500Principal... princs) throws CertificateException {
+            super(name, input, failType, princs);
+        }
+
+        @Override
+        public void passTest() throws GeneralSecurityException {
+            X509Certificate cert;
+
+            System.out.println("generateCertificate(): " + testName);
+            cert = (X509Certificate)cf.generateCertificate(
+                    new ByteArrayInputStream(testData));
+
+            // Compare the cert's subject name against the expected value
+            // provided in the test.  If multiple X500Principals were provided
+            // just use the first one as the expected value.
+            if (!cert.getSubjectX500Principal().equals(principals[0])) {
+                throw new RuntimeException("Name mismatch: " +
+                        "cert: " + cert.getSubjectX500Principal() +
+                        ", expected: " + principals[0]);
+            }
+        }
+
+        @Override
+        public void failTest() throws GeneralSecurityException {
+            Throwable caughtException = null;
+            X509Certificate cert = null;
+            System.out.println("generateCertificate(): " + testName);
+
+            if (expectedException == null) {
+                throw new RuntimeException("failTest requires non-null " +
+                        "expectedException");
+            }
+
+            try {
+                cert = (X509Certificate)cf.generateCertificate(
+                        new ByteArrayInputStream(testData));
+            } catch (CertificateException e) {
+                caughtException = e;
+            }
+
+            if (caughtException != null) {
+                // It has to be the right kind of exception though...
+                if (!caughtException.getClass().equals(
+                        expectedException.getClass())) {
+                    System.err.println("Unexpected exception thrown. " +
+                            "Received: " + caughtException + ", Expected: " +
+                            expectedException.getClass());
+                    throw new RuntimeException(caughtException);
+                }
+            } else {
+                // For a failure test, we'd expect some kind of exception
+                // to be thrown.
+                throw new RuntimeException("Failed to catch expected " +
+                        "exception " + expectedException.getClass());
+            }
+        }
+    }
+
+    public static class GenMultiCRLTest extends DecodeTest {
+        public GenMultiCRLTest(String name, byte[] input, Throwable failType,
+                X500Principal... princs) throws CertificateException {
+            super(name, input, failType, princs);
+        }
+
+        @Override
+        public void passTest() throws GeneralSecurityException {
+            Collection<? extends CRL> crls;
+
+            System.out.println("generateCRLs(): " + testName);
+            crls = cf.generateCRLs(new ByteArrayInputStream(testData));
+
+            // Walk the crls Collection and do a comparison of issuer names
+            int i = 0;
+            if (crls.size() == principals.length) {
+                for (CRL revlist : crls) {
+                    X509CRL xc = (X509CRL)revlist;
+                    if (!xc.getIssuerX500Principal().equals(principals[i])) {
+                        throw new RuntimeException("Name mismatch: " +
+                                "CRL: " + xc.getIssuerX500Principal() +
+                                ", expected: " + principals[i]);
+                    }
+                    i++;
+                }
+            } else {
+                throw new RuntimeException("Size mismatch: crls = " +
+                        crls.size() + ", expected = " +
+                        principals.length);
+            }
+        }
+
+        @Override
+        public void failTest() throws GeneralSecurityException {
+            Throwable caughtException = null;
+            Collection<? extends CRL> crls = null;
+
+            System.out.println("generateCRLs(): " + testName);
+            if (expectedException == null) {
+                throw new RuntimeException("failTest requires non-null " +
+                        "expectedException");
+            }
+
+            try {
+                crls =
+                    cf.generateCRLs(new ByteArrayInputStream(testData));
+            } catch (CRLException e) {
+                caughtException = e;
+            }
+
+            if (caughtException != null) {
+                // It has to be the right kind of exception though...
+                if (!caughtException.getClass().equals(
+                        expectedException.getClass())) {
+                    System.err.println("Unexpected exception thrown. " +
+                            "Received: " + caughtException + ", Expected: " +
+                            expectedException.getClass());
+                    throw new RuntimeException(caughtException);
+                }
+            } else {
+                // For a failure test, we'd expect some kind of exception
+                // to be thrown.
+                throw new RuntimeException("Failed to catch expected " +
+                        "exception " + expectedException.getClass());
+            }
+        }
     }
 }
diff --git a/test/java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem b/test/java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem
deleted file mode 100644
index 214b0c7..0000000
--- a/test/java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem
+++ /dev/null
@@ -1,14 +0,0 @@
------BEGIN CERTIFICATE-----
-XIICJjCCAdCgAwIBAgIBITANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCVVMx
-EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xFTAT
-BgNVBAoTDEJFQSBXZWJMb2dpYzERMA8GA1UECxMIU2VjdXJpdHkxIzAhBgNVBAMT
-GkRlbW8gQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9zdXBw
-b3J0QGJlYS5jb20wHhcNMDAwNTMwMjEzODAxWhcNMDQwNTEzMjEzODAxWjCBjDEL
-MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
-cmFuY2lzY28xFTATBgNVBAoTDEJFQSBXZWJMb2dpYzEZMBcGA1UEAxMQd2VibG9n
-aWMuYmVhLmNvbTEeMBwGCSqGSIb3DQEJARYPc3VwcG9ydEBiZWEuY29tMFwwDQYJ
-KoZIhvcNAQEBBQADSwAwSAJBALdsXEHqKHgs6zj0hU5sXMAUHzoT8kgWXmNkKHXH
-79qbPh6EfdlriW9G/AbRF/pKrCQu7hhllAxREbqTuSlf2EMCAwEAATANBgkqhkiG
-9w0BAQQFAANBACgmqflL5m5LNeJGpWx9aIoABCiuDcpw1fFyegsqGX7CBhffcruS
-1p8h5vkHVbMu1frD1UgGnPlOO/K7Ig/KrsU=
------END CERTIFICATE-----
diff --git a/test/java/text/Format/DecimalFormat/TieRoundingTest.java b/test/java/text/Format/DecimalFormat/TieRoundingTest.java
index 16f4817..989f542 100644
--- a/test/java/text/Format/DecimalFormat/TieRoundingTest.java
+++ b/test/java/text/Format/DecimalFormat/TieRoundingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /* @test
  *
- * @bug 7131459
+ * @bug 7131459 8039915
  * @summary test various situations of NumberFormat rounding when close to tie
  * @author Olivier Lagneau
  * @run main TieRoundingTest
@@ -56,7 +56,7 @@
         if (!result.equals(expectedOutput)) {
             System.out.println();
             System.out.println("========================================");
-            System.out.println("***Error formatting double value from string : " +
+            System.out.println("***Failure : error formatting value from string : " +
                                inputDigits);
             System.out.println("NumberFormat pattern is  : " +
                                ((DecimalFormat ) nf).toPattern());
@@ -103,7 +103,7 @@
         if (!result.equals(expectedOutput)) {
             System.out.println();
             System.out.println("========================================");
-            System.out.println("***Error formatting double value from string : " +
+            System.out.println("***Failure : error formatting value from string : " +
                                inputDigits);
             System.out.println("NumberFormat pattern is  : " +
                                ((DecimalFormat ) nf).toPattern());
@@ -144,7 +144,7 @@
         if (!result.equals(expectedOutput)) {
             System.out.println();
             System.out.println("========================================");
-            System.out.println("***Error formatting number value from string : " +
+            System.out.println("***Failure : error formatting value from string : " +
                                inputDigits);
             System.out.println("NumberFormat pattern is  : " +
                                ((DecimalFormat ) nf).toPattern());
@@ -174,7 +174,7 @@
 
     public static void main(String[] args) {
 
-        // Only the 3 rounding modes below may be impacted by bug 7131459.
+        // The 3 HALF_* rounding modes are impacted by bugs 7131459, 8039915.
         // So we do not test the other rounding modes.
         RoundingMode[] roundingModes = {
             RoundingMode.HALF_DOWN,
@@ -183,10 +183,14 @@
         };
 
         // Precise the relative position of input value against its closest tie.
+        // The double values tested below for 3 and 5 fractional digits must follow
+        // this scheme (position toward tie).
         String[] tieRelativePositions = {
             "below", "exact", "above",
             "below", "exact", "above",
             "below", "exact", "above",
+            "below", "above", "above",
+            "below", "below", "above",
             "below", "exact", "above"
         };
 
@@ -196,9 +200,13 @@
         double[] values3FractDigits = {
             // unimpacting values close to tie, with less than 3 input fract digits
             1.115d, 1.125d, 1.135d,
-            // impacting close to tie values covering all 6 cases
+            // HALF_* impacting close to tie values covering all 6 tie cases
             0.3115d, 0.3125d, 0.3135d,
             0.6865d, 0.6875d, 0.6885d,
+            // specific HALF_UP close to tie values
+            0.3124d, 0.3126d, 0.3128d,
+            // specific HALF_DOWN close to tie values
+            0.6864d, 0.6865d, 0.6868d,
             // unimpacting values close to tie, with more than 3 input fract digits
             1.46885d, 2.46875d, 1.46865d
         };
@@ -207,6 +215,8 @@
             "1.115d", "1.125d", "1.135d",
             "0.3115d", "0.3125d", "0.3135d",
             "0.6865d", "0.6875d", "0.6885d",
+            "0.3124d", "0.3126d", "0.3128d",
+            "0.6864d", "0.6865d", "0.6868d",
             "1.46885d", "2.46875d", "1.46865d"
         };
 
@@ -214,16 +224,22 @@
             {"1.115", "1.125", "1.135",
              "0.311", "0.312", "0.314",
              "0.686", "0.687", "0.689",
+             "0.312", "0.313", "0.313",
+             "0.686", "0.686", "0.687",
              "1.469", "2.469", "1.469"
             },
             {"1.115", "1.125", "1.135",
              "0.311", "0.312", "0.314",
              "0.686", "0.688", "0.689",
+             "0.312", "0.313", "0.313",
+             "0.686", "0.686", "0.687",
              "1.469", "2.469", "1.469"
             },
             {"1.115", "1.125", "1.135",
              "0.311", "0.313", "0.314",
              "0.686", "0.688", "0.689",
+             "0.312", "0.313", "0.313",
+             "0.686", "0.686", "0.687",
              "1.469", "2.469", "1.469"
             },
         };
@@ -250,9 +266,13 @@
         double[] values5FractDigits = {
             // unimpacting values close to tie, with less than 5 input fract digits
             1.3135d, 1.3125d, 1.3115d,
-            // impacting values close to tie, covering all 6 cases
+            // HALF_* impacting values close to tie, covering all 6 cases
             1.328115d, 1.328125d, 1.328135d,
             1.796865d, 1.796875d, 1.796885d,
+            // specific HALF_UP close to tie values
+            1.328124d, 1.798876d, 1.796889d,
+            // specific HALF_DOWN close to tie values
+            1.328114d, 1.796865d, 1.328138d,
             // unimpacting values close to tie, with more than 5 input fract digits
             1.3281149999999d, 1.75390625d, 1.7968750000001d
         };
@@ -261,6 +281,8 @@
             "1.3135d", "1.3125d", "1.3115d",
             "1.328115d", "1.328125d", "1.328135d",
             "1.796865d", "1.796875d", "1.796885d",
+            "1.328124d", "1.798876d", "1.796889d",
+            "1.328114d", "1.796865d", "1.328138d",
             "1.3281149999999d", "1.75390625d", "1.7968750000001d"
         };
 
@@ -268,16 +290,22 @@
             {"1.3135", "1.3125", "1.3115",
              "1.32811", "1.32812", "1.32814",
              "1.79686", "1.79687", "1.79689",
+             "1.32812", "1.79888", "1.79689",
+             "1.32811", "1.79686", "1.32814",
              "1.32811", "1.75391", "1.79688"
             },
             {"1.3135", "1.3125", "1.3115",
              "1.32811", "1.32812", "1.32814",
              "1.79686", "1.79688", "1.79689",
+             "1.32812", "1.79888", "1.79689",
+             "1.32811", "1.79686", "1.32814",
              "1.32811", "1.75391", "1.79688"
             },
             {"1.3135", "1.3125", "1.3115",
              "1.32811", "1.32813", "1.32814",
              "1.79686", "1.79688", "1.79689",
+             "1.32812", "1.79888", "1.79689",
+             "1.32811", "1.79686", "1.32814",
              "1.32811", "1.75391", "1.79688"
             }
         };
diff --git a/test/java/util/BitSet/BSMethods.java b/test/java/util/BitSet/BSMethods.java
index c8f69e9..86d7499 100644
--- a/test/java/util/BitSet/BSMethods.java
+++ b/test/java/util/BitSet/BSMethods.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,10 @@
 
 /* @test
  * @bug 4098239 4107540 4080736 4261102 4274710 4305272
- *      4979017 4979028 4979031 5030267 6222207
+ *      4979017 4979028 4979031 5030267 6222207 8040806
  * @summary Test the operation of the methods of BitSet class
  * @author Mike McCloskey, Martin Buchholz
+ * @run main/othervm BSMethods
  */
 
 import java.util.*;
@@ -897,6 +898,21 @@
     private static void testToString() {
         check(new BitSet().toString().equals("{}"));
         check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}"));
+
+        final long MB = 1024*1024;
+        if (Runtime.getRuntime().maxMemory() >= 512*MB) {
+            // only run it if we have enough memory
+            try {
+                check(makeSet(Integer.MAX_VALUE-1).toString().equals(
+                        "{" + (Integer.MAX_VALUE-1) + "}"));
+                check(makeSet(Integer.MAX_VALUE).toString().equals(
+                        "{" + Integer.MAX_VALUE + "}"));
+                check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals(
+                        "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}"));
+            } catch (IndexOutOfBoundsException exc) {
+                fail("toString() with indices near MAX_VALUE");
+            }
+        }
     }
 
     private static void testLogicalIdentities() {
diff --git a/test/java/util/Collections/SyncSubMutexes.java b/test/java/util/Collections/SyncSubMutexes.java
new file mode 100644
index 0000000..05dbcc3
--- /dev/null
+++ b/test/java/util/Collections/SyncSubMutexes.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8048209
+ * @summary Check that Collections.synchronizedNavigableSet().tailSet() is using
+ * the same lock object as it's source.
+ * @run testng SyncSubMutexes
+ */
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.Set;
+import java.util.Arrays;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.assertSame;
+
+public class SyncSubMutexes {
+
+    @Test(dataProvider = "Collections")
+    public void testCollections(Collection<String> instance) {
+        // nothing to test, no subset methods
+    }
+
+    @Test(dataProvider = "Lists")
+    public void testLists(List<String> instance) {
+         assertSame(getSyncCollectionMutex(instance.subList(0, 1)), getSyncCollectionMutex(instance));
+    }
+
+    @Test(dataProvider = "Sets")
+    public void testSets(Set<String> instance) {
+        // nothing to test, no subset methods
+
+    }
+
+    @Test(dataProvider = "SortedSets")
+    public void testSortedSets(SortedSet<String> instance) {
+         assertSame(getSyncCollectionMutex(instance.headSet("Echo")), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.tailSet("Charlie")), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.subSet("Charlie", "Echo")), getSyncCollectionMutex(instance));
+
+    }
+
+    @Test(dataProvider = "NavigableSets")
+    public void testNavigableSets(NavigableSet<String> instance) {
+         assertSame(getSyncCollectionMutex(instance.descendingSet()), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.headSet("Echo")), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.headSet("Echo", true)), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.tailSet("Charlie")), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.tailSet("Charlie", true)), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.subSet("Charlie", "Echo")), getSyncCollectionMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.subSet("Charlie", true, "Echo", true)), getSyncCollectionMutex(instance));
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testMaps(Map<String, String> instance) {
+         assertSame(getSyncCollectionMutex(instance.entrySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.keySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.values()), getSyncMapMutex(instance));
+    }
+
+    @Test(dataProvider = "SortedMaps")
+    public void testSortedMaps(SortedMap<String, String> instance) {
+         assertSame(getSyncCollectionMutex(instance.entrySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.keySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.values()), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.headMap("Echo")), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.tailMap("Charlie")), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.subMap("Charlie", "Echo")), getSyncMapMutex(instance));
+    }
+
+    @Test(dataProvider = "NavigableMaps")
+    public void testNavigableMaps(NavigableMap<String, String> instance) {
+         assertSame(getSyncMapMutex(instance.descendingMap()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.entrySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.keySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.descendingKeySet()), getSyncMapMutex(instance));
+         assertSame(getSyncCollectionMutex(instance.values()), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.headMap("Echo")), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.headMap("Echo", true)), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.tailMap("Charlie")), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.tailMap("Charlie", true)), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.subMap("Charlie", true, "Echo", true)), getSyncMapMutex(instance));
+         assertSame(getSyncMapMutex(instance.subMap("Charlie", true, "Echo", true)), getSyncMapMutex(instance));
+    }
+
+    @DataProvider(name = "Collections", parallel = true)
+    public static Iterator<Object[]> collectionProvider() {
+        return makeCollections().iterator();
+    }
+
+    @DataProvider(name = "Lists", parallel = true)
+    public static Iterator<Object[]> listProvider() {
+        return makeLists().iterator();
+    }
+
+    @DataProvider(name = "Sets", parallel = true)
+    public static Iterator<Object[]> setProvider() {
+        return makeSets().iterator();
+    }
+
+    @DataProvider(name = "SortedSets", parallel = true)
+    public static Iterator<Object[]> sortedsetProvider() {
+        return makeSortedSets().iterator();
+    }
+
+    @DataProvider(name = "NavigableSets", parallel = true)
+    public static Iterator<Object[]> navigablesetProvider() {
+        return makeNavigableSets().iterator();
+    }
+
+    @DataProvider(name = "Maps", parallel = true)
+    public static Iterator<Object[]> mapProvider() {
+        return makeMaps().iterator();
+    }
+
+    @DataProvider(name = "SortedMaps", parallel = true)
+    public static Iterator<Object[]> sortedmapProvider() {
+        return makeSortedMaps().iterator();
+    }
+
+    @DataProvider(name = "NavigableMaps", parallel = true)
+    public static Iterator<Object[]> navigablemapProvider() {
+        return makeNavigableMaps().iterator();
+    }
+
+    private static final Collection<String> BASE_COLLECTION = Collections.unmodifiableCollection(
+            Arrays.asList("Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf")
+    );
+    private static final Map<String, String> BASE_MAP;
+
+    static {
+        Map<String, String> map = new HashMap<>();
+        for(String each : BASE_COLLECTION) {
+            map.put(each, "*" + each + "*");
+        }
+        BASE_MAP = Collections.unmodifiableMap(map);
+    }
+
+    public static Collection<Object[]> makeCollections() {
+        Collection<Object[]> instances = new ArrayList<>();
+        instances.add(new Object[] {Collections.synchronizedCollection(new ArrayList<>(BASE_COLLECTION))});
+        instances.addAll(makeLists());
+
+        return instances;
+    }
+
+    public static Collection<Object[]> makeLists() {
+        Collection<Object[]> instances = new ArrayList<>();
+        instances.add(new Object[] {Collections.synchronizedList(new ArrayList<>(BASE_COLLECTION))});
+        instances.add(new Object[] {Collections.synchronizedList(new ArrayList<>(BASE_COLLECTION)).subList(1, 2)});
+
+        return instances;
+    }
+
+     public static Collection<Object[]> makeSets() {
+        Collection<Object[]> instances = new ArrayList<>();
+
+        instances.add(new Object[] {Collections.synchronizedSet(new TreeSet<>(BASE_COLLECTION))});
+        instances.addAll(makeSortedSets());
+        return instances;
+     }
+
+    public static Collection<Object[]> makeSortedSets() {
+        Collection<Object[]> instances = new ArrayList<>();
+        instances.add(new Object[] {Collections.synchronizedSortedSet(new TreeSet<>(BASE_COLLECTION))});
+        instances.add(new Object[] {Collections.synchronizedSortedSet(new TreeSet<>(BASE_COLLECTION)).headSet("Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedSortedSet(new TreeSet<>(BASE_COLLECTION)).tailSet("Bravo")});
+        instances.add(new Object[] {Collections.synchronizedSortedSet(new TreeSet<>(BASE_COLLECTION)).subSet("Bravo", "Foxtrot")});
+        instances.addAll(makeNavigableSets());
+
+        return instances;
+     }
+
+    public static Collection<Object[]> makeNavigableSets() {
+        Collection<Object[]> instances = new ArrayList<>();
+
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION))});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).descendingSet().descendingSet()});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).headSet("Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).headSet("Foxtrot", true)});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).tailSet("Bravo")});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).tailSet("Bravo", true)});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).subSet("Bravo", "Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedNavigableSet(new TreeSet<>(BASE_COLLECTION)).subSet("Bravo", true, "Foxtrot", true)});
+
+        return instances;
+    }
+
+    public static Collection<Object[]> makeMaps() {
+        Collection<Object[]> instances = new ArrayList<>();
+
+        instances.add(new Object[] {Collections.synchronizedMap(new HashMap<>(BASE_MAP))});
+        instances.addAll(makeSortedMaps());
+
+        return instances;
+    }
+
+    public static Collection<Object[]> makeSortedMaps() {
+        Collection<Object[]> instances = new ArrayList<>();
+
+        instances.add(new Object[] {Collections.synchronizedSortedMap(new TreeMap<>(BASE_MAP))});
+        instances.add(new Object[] {Collections.synchronizedSortedMap(new TreeMap<>(BASE_MAP)).headMap("Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedSortedMap(new TreeMap<>(BASE_MAP)).tailMap("Bravo")});
+        instances.add(new Object[] {Collections.synchronizedSortedMap(new TreeMap<>(BASE_MAP)).subMap("Bravo", "Foxtrot")});
+        instances.addAll(makeNavigableMaps());
+
+        return instances;
+    }
+
+    public static Collection<Object[]> makeNavigableMaps() {
+        Collection<Object[]> instances = new ArrayList<>();
+
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP))});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP).descendingMap().descendingMap())});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).headMap("Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).headMap("Foxtrot", true)});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).tailMap("Bravo")});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).tailMap("Bravo", true)});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).subMap("Bravo", "Foxtrot")});
+        instances.add(new Object[] {Collections.synchronizedNavigableMap(new TreeMap<>(BASE_MAP)).subMap("Bravo", true, "Foxtrot", true)});
+
+        return instances;
+    }
+
+    private static Object getSyncCollectionMutex(Collection<?> from) {
+        try {
+            Class<?> synchronizedCollectionClazz = Class.forName("java.util.Collections$SynchronizedCollection");
+            Field f = synchronizedCollectionClazz.getDeclaredField("mutex");
+            f.setAccessible(true);
+            return f.get(from);
+        } catch ( ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
+            throw new RuntimeException("Unable to get mutex field.", e);
+        }
+    }
+
+    private static Object getSyncMapMutex(Map<?,?> from) {
+        try {
+            Class<?> synchronizedMapClazz = Class.forName("java.util.Collections$SynchronizedMap");
+            Field f = synchronizedMapClazz.getDeclaredField("mutex");
+            f.setAccessible(true);
+            return f.get(from);
+        } catch ( ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
+            throw new RuntimeException("Unable to get mutex field.", e);
+        }
+    }
+
+}
diff --git a/test/java/util/IdentityHashMap/Capacity.java b/test/java/util/IdentityHashMap/Capacity.java
new file mode 100644
index 0000000..3114e6c
--- /dev/null
+++ b/test/java/util/IdentityHashMap/Capacity.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Random;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 6904367
+ * @summary IdentityHashMap reallocates storage when inserting expected
+ *          number of elements
+ * @run testng Capacity
+ */
+
+@Test
+public class Capacity {
+    static final Field tableField;
+    static final Random random = new Random();
+    static final Object[][] sizesData;
+
+    @DataProvider(name="sizes", parallel = true)
+    public Object[][] sizesToTest() { return sizesData; }
+
+    static {
+        try {
+            tableField = IdentityHashMap.class.getDeclaredField("table");
+            tableField.setAccessible(true);
+        } catch (NoSuchFieldException e) {
+            throw new LinkageError("table", e);
+        }
+
+        ArrayList<Object[]> sizes = new ArrayList<>();
+        for (int size = 0; size < 200; size++)
+            sizes.add(new Object[] { size });
+
+        // some numbers known to demonstrate bug 6904367
+        for (int size : new int[] {682, 683, 1365, 2730, 2731, 5461})
+            sizes.add(new Object[] { size });
+
+        // a few more random sizes to try
+        for (int i = 0; i != 128; i++)
+            sizes.add(new Object[] { random.nextInt(5000) });
+
+        sizesData = sizes.toArray(new Object[0][]);
+    }
+
+    static int capacity(IdentityHashMap<?,?> map) {
+        try {
+            return ((Object[]) tableField.get(map)).length / 2;
+        } catch (Throwable t) {
+            throw new LinkageError("table", t);
+        }
+    }
+
+    static void assertCapacity(IdentityHashMap<?,?> map,
+                               int expectedCapacity) {
+        assertEquals(capacity(map), expectedCapacity);
+    }
+
+    static void growUsingPut(IdentityHashMap<Object,Object> map,
+                             int elementsToAdd) {
+        for (int i = 0; i < elementsToAdd; i++)
+            map.put(new Object(), new Object());
+    }
+
+    static void growUsingPutAll(IdentityHashMap<Object,Object> map,
+                                int elementsToAdd) {
+        IdentityHashMap<Object,Object> other = new IdentityHashMap<>();
+        growUsingPut(other, elementsToAdd);
+        map.putAll(other);
+    }
+
+    static void growUsingRepeatedPutAll(IdentityHashMap<Object,Object> map,
+                                        int elementsToAdd) {
+        for (int i = 0; i < elementsToAdd; i++)
+            map.putAll(Collections.singletonMap(new Object(),
+                                                new Object()));
+    }
+
+    /**
+     * Checks that expected number of items can be inserted into
+     * the map without resizing of the internal storage
+     */
+    @Test(dataProvider = "sizes")
+    public void canInsertExpectedItemsWithoutResizing(int size)
+        throws Throwable {
+        // First try growing using put()
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(size);
+        int initialCapacity = capacity(m);
+        growUsingPut(m, size);
+        assertCapacity(m, initialCapacity);
+
+        // Doubling from the expected size will cause exactly one
+        // resize, except near minimum capacity.
+        if (size > 1) {
+            growUsingPut(m, size);
+            assertCapacity(m, 2 * initialCapacity);
+        }
+
+        // Try again, growing with putAll()
+        m = new IdentityHashMap<>(size);
+        initialCapacity = capacity(m);
+        growUsingPutAll(m, size);
+        assertCapacity(m, initialCapacity);
+
+        // Doubling from the expected size will cause exactly one
+        // resize, except near minimum capacity.
+        if (size > 1) {
+            growUsingPutAll(m, size);
+            assertCapacity(m, 2 * initialCapacity);
+        }
+    }
+
+    /**
+     * Given the expected size, computes such a number N of items that
+     * inserting (N+1) items will trigger resizing of the internal storage
+     */
+    static int threshold(int size) throws Throwable {
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(size);
+        int initialCapacity = capacity(m);
+        while (capacity(m) == initialCapacity)
+            growUsingPut(m, 1);
+        return m.size() - 1;
+    }
+
+    /**
+     * Checks that inserting (threshold+1) item causes resizing
+     * of the internal storage
+     */
+    @Test(dataProvider = "sizes")
+    public void passingThresholdCausesResize(int size) throws Throwable {
+        final int threshold = threshold(size);
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(threshold);
+        int initialCapacity = capacity(m);
+
+        growUsingPut(m, threshold);
+        assertCapacity(m, initialCapacity);
+
+        growUsingPut(m, 1);
+        assertCapacity(m, 2 * initialCapacity);
+    }
+
+    /**
+     * Checks that 4 methods of requiring capacity lead to the same
+     * internal capacity, unless sized below default capacity.
+     */
+    @Test(dataProvider = "sizes")
+    public void differentGrowthPatternsResultInSameCapacity(int size)
+        throws Throwable {
+        if (size < 21)          // 21 is default maxExpectedSize
+            return;
+
+        IdentityHashMap<Object,Object> m;
+        m = new IdentityHashMap<Object,Object>(size);
+        int capacity1 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingPut(m, size);
+        int capacity2 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingPutAll(m, size);
+        int capacity3 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingRepeatedPutAll(m, size);
+        int capacity4 = capacity(m);
+
+        if (capacity1 != capacity2 ||
+            capacity2 != capacity3 ||
+            capacity3 != capacity4)
+            throw new AssertionError("Capacities not equal: "
+                                     + capacity1 + " "
+                                     + capacity2 + " "
+                                     + capacity3 + " "
+                                     + capacity4);
+    }
+
+    public void defaultExpectedMaxSizeIs21() {
+        assertCapacity(new IdentityHashMap<Long,Long>(), 32);
+        assertCapacity(new IdentityHashMap<Long,Long>(21), 32);
+    }
+
+    public void minimumCapacityIs4() {
+        assertCapacity(new IdentityHashMap<Long,Long>(0), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(1), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(2), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(3), 8);
+    }
+
+    @Test(enabled = false)
+    /** needs too much memory to run normally */
+    public void maximumCapacityIs2ToThe29() {
+        assertCapacity(new IdentityHashMap<Long,Long>(Integer.MAX_VALUE),
+                       1 << 29);
+    }
+}
diff --git a/test/java/util/logging/CheckZombieLockTest.java b/test/java/util/logging/CheckZombieLockTest.java
new file mode 100644
index 0000000..ab65a81
--- /dev/null
+++ b/test/java/util/logging/CheckZombieLockTest.java
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8048020
+ * @author  Daniel Fuchs
+ * @summary Regression on java.util.logging.FileHandler.
+ *     The fix is to avoid filling up the file system with zombie lock files.
+ *
+ * @run  main/othervm CheckZombieLockTest WRITABLE CLOSE CLEANUP
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ * @run  main/othervm CheckZombieLockTest WRITABLE
+ * @run  main/othervm CheckZombieLockTest CREATE_FIRST
+ * @run  main/othervm CheckZombieLockTest CREATE_NEXT
+ * @run  main/othervm CheckZombieLockTest CREATE_NEXT
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ * @run  main/othervm CheckZombieLockTest REUSE
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ */
+import java.io.File;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+public class CheckZombieLockTest {
+
+    private static final String WRITABLE_DIR = "writable-lockfile-dir";
+    private static volatile boolean supportsLocking = true;
+
+    static enum TestCase {
+        WRITABLE,  // just verifies that we can create a file in our 'writable-lockfile-dir'
+        CLOSE, // checks that closing a FileHandler removes its lock file
+        CREATE_FIRST, // verifies that 'writable-lockfile-dir' contains no lock, then creates a first FileHandler.
+        CREATE_NEXT, // verifies that 'writable-lockfile-dir' contains a single lock, then creates the next FileHandler
+        REUSE, // verifies that zombie lock files can be reused
+        CLEANUP // removes "writable-lockfile-dir"
+    };
+
+    public static void main(String... args) throws IOException {
+        // we'll base all file creation attempts on the system temp directory,
+        // %t
+        File writableDir = setup();
+        System.out.println("Writable dir is: " + writableDir.getAbsolutePath());
+        // we now have one writable directory to work with:
+        //    writableDir
+        if (args == null || args.length == 0) {
+            args = new String[] { "WRITABLE", "CLOSE", "CLEANUP" };
+        }
+        try {
+            runTests(writableDir, args);
+        } catch (RuntimeException | IOException | Error x) {
+            // some error occured: cleanup
+            delete(writableDir);
+            throw x;
+        }
+    }
+
+    /**
+     * @param writableDir in which log and lock file are created
+     * @throws SecurityException
+     * @throws RuntimeException
+     * @throws IOException
+     */
+    private static void runTests(File writableDir, String... args) throws SecurityException,
+            RuntimeException, IOException {
+        for (String arg : args) {
+            switch(TestCase.valueOf(arg)) {
+                // Test 1: makes sure we can create FileHandler in writable directory
+                case WRITABLE: checkWritable(writableDir); break;
+                // Test 2: verifies that FileHandler.close() cleans up its lock file
+                case CLOSE: testFileHandlerClose(writableDir); break;
+                // Test 3: creates the first file handler
+                case CREATE_FIRST: testFileHandlerCreate(writableDir, true); break;
+                // Test 4, 5, ... creates the next file handler
+                case CREATE_NEXT: testFileHandlerCreate(writableDir, false); break;
+                // Checks that zombie lock files are reused appropriatly
+                case REUSE: testFileHandlerReuse(writableDir); break;
+                // Removes the writableDir
+                case CLEANUP: delete(writableDir); break;
+                default: throw new RuntimeException("No such test case: " + arg);
+            }
+        }
+    }
+
+    /**
+     * @param writableDir in which log and lock file are created
+     * @throws SecurityException
+     * @throws RuntimeException
+     * @throws IOException
+     */
+    private static void checkWritable(File writableDir) throws SecurityException,
+            RuntimeException, IOException {
+        // Test 1: make sure we can create/delete files in the writable dir.
+        final File file = new File(writableDir, "test.txt");
+        if (!createFile(file, false)) {
+            throw new IOException("Can't create " + file + "\n\tUnable to run test");
+        } else {
+            delete(file);
+        }
+    }
+
+
+    private static FileHandler createFileHandler(File writableDir) throws SecurityException,
+            RuntimeException, IOException {
+        // Test 1: make sure we can create FileHandler in writable directory
+        try {
+            FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
+            handler.publish(new LogRecord(Level.INFO, handler.toString()));
+            handler.flush();
+            return handler;
+        } catch (IOException ex) {
+            throw new RuntimeException("Test failed: should have been able"
+                    + " to create FileHandler for " + "%t/" + WRITABLE_DIR
+                    + "/log.log in writable directory.", ex);
+        }
+    }
+
+    private static List<File> listLocks(File writableDir, boolean print)
+            throws IOException {
+        List<File> locks = new ArrayList<>();
+        for (File f : writableDir.listFiles()) {
+            if (print) {
+                System.out.println("Found file: " + f.getName());
+            }
+            if (f.getName().endsWith(".lck")) {
+                locks.add(f);
+            }
+        }
+        return locks;
+    }
+
+    private static void testFileHandlerClose(File writableDir) throws IOException {
+        File fakeLock = new File(writableDir, "log.log.lck");
+        if (!createFile(fakeLock, false)) {
+            throw new IOException("Can't create fake lock file: " + fakeLock);
+        }
+        try {
+            List<File> before = listLocks(writableDir, true);
+            System.out.println("before: " + before.size() + " locks found");
+            FileHandler handler = createFileHandler(writableDir);
+            System.out.println("handler created: " + handler);
+            List<File> after = listLocks(writableDir, true);
+            System.out.println("after creating handler: " + after.size() + " locks found");
+            handler.close();
+            System.out.println("handler closed: " + handler);
+            List<File> afterClose = listLocks(writableDir, true);
+            System.out.println("after closing handler: " + afterClose.size() + " locks found");
+            afterClose.removeAll(before);
+            if (!afterClose.isEmpty()) {
+                throw new RuntimeException("Zombie lock file detected: " + afterClose);
+            }
+        } finally {
+            if (fakeLock.canRead()) delete(fakeLock);
+        }
+        List<File> finalLocks = listLocks(writableDir, false);
+        System.out.println("After cleanup: " + finalLocks.size() + " locks found");
+    }
+
+
+    private static void testFileHandlerReuse(File writableDir) throws IOException {
+        List<File> before = listLocks(writableDir, true);
+        System.out.println("before: " + before.size() + " locks found");
+        try {
+            if (!before.isEmpty()) {
+                throw new RuntimeException("Expected no lock file! Found: " + before);
+            }
+        } finally {
+            before.stream().forEach(CheckZombieLockTest::delete);
+        }
+
+        FileHandler handler1 = createFileHandler(writableDir);
+        System.out.println("handler created: " + handler1);
+        List<File> after = listLocks(writableDir, true);
+        System.out.println("after creating handler: " + after.size() + " locks found");
+        if (after.size() != 1) {
+            throw new RuntimeException("Unexpected number of lock files found for "
+                    + handler1 + ": " + after);
+        }
+        final File lock = after.get(0);
+        after.clear();
+        handler1.close();
+        after = listLocks(writableDir, true);
+        System.out.println("after closing handler: " + after.size() + " locks found");
+        if (!after.isEmpty()) {
+            throw new RuntimeException("Unexpected number of lock files found for "
+                    + handler1 + ": " + after);
+        }
+        if (!createFile(lock, false)) {
+            throw new IOException("Can't create fake lock file: " + lock);
+        }
+        try {
+            before = listLocks(writableDir, true);
+            System.out.println("before: " + before.size() + " locks found");
+            if (before.size() != 1) {
+                throw new RuntimeException("Unexpected number of lock files found: "
+                        + before + " expected [" + lock + "].");
+            }
+            FileHandler handler2 = createFileHandler(writableDir);
+            System.out.println("handler created: " + handler2);
+            after = listLocks(writableDir, true);
+            System.out.println("after creating handler: " + after.size() + " locks found");
+            after.removeAll(before);
+            if (!after.isEmpty()) {
+                throw new RuntimeException("Unexpected lock file found: " + after
+                        + "\n\t" + lock + " should have been reused");
+            }
+            handler2.close();
+            System.out.println("handler closed: " + handler2);
+            List<File> afterClose = listLocks(writableDir, true);
+            System.out.println("after closing handler: " + afterClose.size() + " locks found");
+            if (!afterClose.isEmpty()) {
+                throw new RuntimeException("Zombie lock file detected: " + afterClose);
+            }
+
+            if (supportsLocking) {
+                FileChannel fc = FileChannel.open(Paths.get(lock.getAbsolutePath()),
+                    StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND,
+                    StandardOpenOption.WRITE);
+                try {
+                    if (fc.tryLock() != null) {
+                        System.out.println("locked: " + lock);
+                        handler2 = createFileHandler(writableDir);
+                        System.out.println("handler created: " + handler2);
+                        after = listLocks(writableDir, true);
+                        System.out.println("after creating handler: " + after.size()
+                                + " locks found");
+                        after.removeAll(before);
+                        if (after.size() != 1) {
+                            throw new RuntimeException("Unexpected lock files found: " + after
+                                + "\n\t" + lock + " should not have been reused");
+                        }
+                    } else {
+                        throw new RuntimeException("Failed to lock: " + lock);
+                    }
+                } finally {
+                    delete(lock);
+                }
+            }
+        } finally {
+            List<File> finalLocks = listLocks(writableDir, false);
+            System.out.println("end: " + finalLocks.size() + " locks found");
+            delete(writableDir);
+        }
+    }
+
+
+    private static void testFileHandlerCreate(File writableDir, boolean first)
+            throws IOException {
+        List<File> before = listLocks(writableDir, true);
+        System.out.println("before: " + before.size() + " locks found");
+        try {
+            if (first && !before.isEmpty()) {
+                throw new RuntimeException("Expected no lock file! Found: " + before);
+            } else if (!first && before.size() != 1) {
+                throw new RuntimeException("Expected a single lock file! Found: " + before);
+            }
+        } finally {
+            before.stream().forEach(CheckZombieLockTest::delete);
+        }
+        FileHandler handler = createFileHandler(writableDir);
+        System.out.println("handler created: " + handler);
+        List<File> after = listLocks(writableDir, true);
+        System.out.println("after creating handler: " + after.size() + " locks found");
+        if (after.size() != 1) {
+            throw new RuntimeException("Unexpected number of lock files found for "
+                    + handler + ": " + after);
+        }
+    }
+
+
+    /**
+     * Setup all the files and directories needed for the tests
+     *
+     * @return writable directory created that needs to be deleted when done
+     * @throws RuntimeException
+     */
+    private static File setup() throws RuntimeException {
+        // First do some setup in the temporary directory (using same logic as
+        // FileHandler for %t pattern)
+        String tmpDir = System.getProperty("java.io.tmpdir"); // i.e. %t
+        if (tmpDir == null) {
+            tmpDir = System.getProperty("user.home");
+        }
+        File tmpOrHomeDir = new File(tmpDir);
+        // Create a writable directory here (%t/writable-lockfile-dir)
+        File writableDir = new File(tmpOrHomeDir, WRITABLE_DIR);
+        if (!createFile(writableDir, true)) {
+            throw new RuntimeException("Test setup failed: unable to create"
+                    + " writable working directory "
+                    + writableDir.getAbsolutePath() );
+        }
+
+        // try to determine whether file locking is supported
+        final String uniqueFileName = UUID.randomUUID().toString()+".lck";
+        try {
+            FileChannel fc = FileChannel.open(Paths.get(writableDir.getAbsolutePath(),
+                    uniqueFileName),
+                    StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND,
+                    StandardOpenOption.DELETE_ON_CLOSE);
+            try {
+                fc.tryLock();
+            } catch(IOException x) {
+                supportsLocking = false;
+            } finally {
+                fc.close();
+            }
+        } catch (IOException t) {
+            // should not happen
+            System.err.println("Failed to create new file " + uniqueFileName +
+                    " in " + writableDir.getAbsolutePath());
+            throw new RuntimeException("Test setup failed: unable to run test", t);
+        }
+        return writableDir;
+    }
+
+    /**
+     * @param newFile
+     * @return true if file already exists or creation succeeded
+     */
+    private static boolean createFile(File newFile, boolean makeDirectory) {
+        if (newFile.exists()) {
+            return true;
+        }
+        if (makeDirectory) {
+            return newFile.mkdir();
+        } else {
+            try {
+                return newFile.createNewFile();
+            } catch (IOException ioex) {
+                ioex.printStackTrace();
+                return false;
+            }
+        }
+    }
+
+    /*
+     * Recursively delete all files starting at specified file
+     */
+    private static void delete(File f) {
+        if (f != null && f.isDirectory()) {
+            for (File c : f.listFiles())
+                delete(c);
+        }
+        if (!f.delete())
+            System.err.println(
+                    "WARNING: unable to delete/cleanup writable test directory: "
+                    + f );
+        }
+}
diff --git a/test/java/util/logging/FileHandlerPath.java b/test/java/util/logging/FileHandlerPath.java
new file mode 100644
index 0000000..9385909
--- /dev/null
+++ b/test/java/util/logging/FileHandlerPath.java
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import static java.nio.file.StandardOpenOption.CREATE_NEW;
+import static java.nio.file.StandardOpenOption.WRITE;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+import java.util.PropertyPermission;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.FileHandler;
+import java.util.logging.LogManager;
+import java.util.logging.LoggingPermission;
+
+/**
+ * @test
+ * @bug 8059269
+ * @summary tests that using a simple (non composite) pattern does not lead
+ *        to NPE when the lock file already exists.
+ * @run main/othervm FileHandlerPath UNSECURE
+ * @run main/othervm FileHandlerPath SECURE
+ * @author danielfuchs
+ */
+public class FileHandlerPath {
+
+    /**
+     * We will test the simple pattern in two configurations.
+     * UNSECURE: No security manager.
+     * SECURE: With the security manager present - and the required
+     *         permissions granted.
+     */
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run(Properties propertyFile) throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this, propertyFile);
+            test(this.name() + " " + propertyFile.getProperty("test.name"), propertyFile);
+        }
+    }
+
+
+    // Use a random name provided by UUID to avoid collision with other tests
+    final static String logFile = FileHandlerPath.class.getSimpleName() + "_"
+                + UUID.randomUUID().toString() + ".log";
+    final static String tmpLogFile;
+    final static String userDir = System.getProperty("user.dir");
+    final static String tmpDir = System.getProperty("java.io.tmpdir");
+    private static final List<Properties> properties;
+    static {
+        tmpLogFile = new File(tmpDir, logFile).toString();
+        Properties props1 = new Properties();
+        Properties props2 = new Properties();
+        props1.setProperty("test.name", "relative file");
+        props1.setProperty("test.file.name", logFile);
+        props1.setProperty(FileHandler.class.getName() + ".pattern", logFile);
+        props1.setProperty(FileHandler.class.getName() + ".count", "1");
+        props2.setProperty("test.name", "absoluste file");
+        props2.setProperty("test.file.name", tmpLogFile);
+        props2.setProperty(FileHandler.class.getName() + ".pattern", "%t/" + logFile);
+        props2.setProperty(FileHandler.class.getName() + ".count", "1");
+        properties = Collections.unmodifiableList(Arrays.asList(
+                    props1,
+                    props2));
+    }
+
+    public static void main(String... args) throws Exception {
+
+        if (args == null || args.length == 0) {
+            args = new String[] {
+                TestCase.UNSECURE.name(),
+                TestCase.SECURE.name(),
+            };
+        }
+
+        // Sanity checks
+
+        if (!Files.isWritable(Paths.get(userDir))) {
+            throw new RuntimeException(userDir +
+                    ": user.dir is not writable - can't run test.");
+        }
+        if (!Files.isWritable(Paths.get(tmpDir))) {
+            throw new RuntimeException(tmpDir +
+                    ": java.io.tmpdir is not writable - can't run test.");
+        }
+
+        File[] files = {
+            new File(logFile),
+            new File(tmpLogFile),
+            new File(logFile+".1"),
+            new File(tmpLogFile+".1"),
+            new File(logFile+".lck"),
+            new File(tmpLogFile+".lck"),
+            new File(logFile+".1.lck"),
+            new File(tmpLogFile+".1.lck")
+        };
+
+        for (File log : files) {
+            if (log.exists()) {
+                throw new Exception(log +": file already exists - can't run test.");
+            }
+        }
+
+        // Now start the real test
+
+        try {
+            for (String testName : args) {
+                for (Properties propertyFile : properties) {
+                    TestCase test = TestCase.valueOf(testName);
+                    test.run(propertyFile);
+                }
+            }
+        } finally {
+            // Cleanup...
+            Configure.doPrivileged(() -> {
+                for(File log : files) {
+                    try {
+                        final boolean isLockFile = log.getName().endsWith(".lck");
+                        // lock file should already be deleted, except if the
+                        // test failed in exception.
+                        // log file should all be present, except if the test
+                        // failed in exception.
+                        if (log.exists()) {
+                            if (!isLockFile) {
+                                System.out.println("deleting "+log.toString());
+                            } else {
+                                System.err.println("deleting lock file "+log.toString());
+                            }
+                            log.delete();
+                        } else {
+                            if (!isLockFile) {
+                                System.err.println(log.toString() + ": not found.");
+                            }
+                        }
+                    } catch (Throwable t) {
+                        // should not happen
+                        t.printStackTrace();
+                    }
+                }
+            });
+        }
+    }
+
+    static class Configure {
+        static Policy policy = null;
+        static final AtomicBoolean allowAll = new AtomicBoolean(false);
+        static void setUp(TestCase test, Properties propertyFile) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    new InternalError("No such testcase: " + test);
+            }
+            doPrivileged(() -> {
+                try {
+                    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+                    propertyFile.store(bytes, propertyFile.getProperty("test.name"));
+                    ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray());
+                    LogManager.getLogManager().readConfiguration(bais);
+                } catch (IOException ex) {
+                    throw new RuntimeException(ex);
+                }
+            });
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.set(false);
+            }
+        }
+    }
+
+    public static void test(String name, Properties props) throws Exception {
+        System.out.println("Testing: " + name);
+        String file = props.getProperty("test.file.name");
+        // create the lock files first - in order to take the path that
+        // used to trigger the NPE
+        Files.createFile(Paths.get(file + ".lck"));
+        Files.createFile(Paths.get(file + ".1.lck"));
+        final FileHandler f1 = new FileHandler();
+        final FileHandler f2 = new FileHandler();
+        f1.close();
+        f2.close();
+        System.out.println("Success for " + name);
+    }
+
+
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final AtomicBoolean allowAll;
+        public SimplePolicy(TestCase test, AtomicBoolean allowAll) {
+            this.allowAll = allowAll;
+            permissions = new Permissions();
+            permissions.add(new LoggingPermission("control", null)); // needed by new FileHandler()
+            permissions.add(new FilePermission("<<ALL FILES>>", "read")); // needed by new FileHandler()
+            permissions.add(new FilePermission(logFile, "write,delete")); // needed by new FileHandler()
+            permissions.add(new FilePermission(logFile+".lck", "write,delete")); // needed by FileHandler.close()
+            permissions.add(new FilePermission(logFile+".1", "write,delete")); // needed by new FileHandler()
+            permissions.add(new FilePermission(logFile+".1.lck", "write,delete")); // needed by FileHandler.close()
+            permissions.add(new FilePermission(tmpLogFile, "write,delete")); // needed by new FileHandler()
+            permissions.add(new FilePermission(tmpLogFile+".lck", "write,delete")); // needed by FileHandler.close()
+            permissions.add(new FilePermission(tmpLogFile+".1", "write,delete")); // needed by new FileHandler()
+            permissions.add(new FilePermission(tmpLogFile+".1.lck", "write,delete")); // needed by FileHandler.close()
+            permissions.add(new FilePermission(userDir, "write")); // needed by new FileHandler()
+            permissions.add(new FilePermission(tmpDir, "write")); // needed by new FileHandler()
+            permissions.add(new PropertyPermission("user.dir", "read"));
+            permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get()) return allPermissions.implies(permission);
+            return permissions.implies(permission);
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}
diff --git a/test/java/util/logging/LoggingDeadlock2.java b/test/java/util/logging/LoggingDeadlock2.java
index de328e7..c5b4e89 100644
--- a/test/java/util/logging/LoggingDeadlock2.java
+++ b/test/java/util/logging/LoggingDeadlock2.java
@@ -28,7 +28,7 @@
  * @author  Serguei Spitsyn / Hitachi / Martin Buchholz
  *
  * @build    LoggingDeadlock2
- * @run  main/timeout=15 LoggingDeadlock2
+ * @run  main LoggingDeadlock2
  *
  * There is a clear deadlock between LogManager.<clinit> and
  * Cleaner.run() methods.
diff --git a/test/java/util/logging/TestLoggerBundleSync.java b/test/java/util/logging/TestLoggerBundleSync.java
index 48933c9..7f5e514 100644
--- a/test/java/util/logging/TestLoggerBundleSync.java
+++ b/test/java/util/logging/TestLoggerBundleSync.java
@@ -58,6 +58,7 @@
  */
 public class TestLoggerBundleSync {
 
+    static final boolean VERBOSE = false;
     static volatile Exception thrown = null;
     static volatile boolean goOn = true;
 
@@ -65,6 +66,7 @@
     static final long TIME = 4 * 1000; // 4 sec.
     static final long STEP = 1 * 1000;  // message every 1 sec.
     static final int  LCOUNT = 50; // change bundle 50 times...
+    static final AtomicLong ignoreLogCount = new AtomicLong(0);
     static final AtomicLong setRBcount = new AtomicLong(0);
     static final AtomicLong setRBNameCount = new AtomicLong(0);
     static final AtomicLong getRBcount = new AtomicLong(0);
@@ -150,6 +152,7 @@
           long sSetRBNameCount  = setRBNameCount.get();
           long sCheckCount = checkCount.get();
           long sNextLong = nextLong.get();
+          long sIgnoreLogCount = ignoreLogCount.get();
           List<Thread> threads = new ArrayList<>();
           for (Class<? extends ResourceBundle> type : classes) {
               threads.add(new SetRB(type));
@@ -181,21 +184,58 @@
                   + " resource bundles set by " + classes.size() + " Thread(s),");
           System.out.println("\t " + (setRBNameCount.get() - sSetRBNameCount)
                   + " resource bundle names set by " + classes.size() + " Thread(s),");
+          System.out.println("\t " + (ignoreLogCount.get() - sIgnoreLogCount)
+                  + " log messages emitted by other GetRB threads were ignored"
+                  + " to ensure MT test consistency,");
           System.out.println("\t ThreadMXBean.findDeadlockedThreads called "
                   + (checkCount.get() -sCheckCount) + " times by 1 Thread.");
 
     }
 
     final static class GetRB extends Thread {
-        final static class MyHandler extends Handler {
+        final class MyHandler extends Handler {
             volatile ResourceBundle rb;
             volatile String rbName;
             volatile int count = 0;
             @Override
             public synchronized void publish(LogRecord record) {
-                count++;
-                rb = record.getResourceBundle();
-                rbName = record.getResourceBundleName();
+                Object[] params = record.getParameters();
+                // Each GetRB thread has its own handler, but since they
+                // log into the same logger, each handler may receive
+                // messages emitted by other threads.
+                // This means that GetRB#2.handler may receive a message
+                // emitted by GetRB#1 at a time where the resource bundle
+                // was still null.
+                // To avoid falling into this trap, the GetRB thread passes
+                // 'this' as argument to the messages it logs - which does
+                // allow us here to ignore messages that where not emitted
+                // by our own GetRB.this thread...
+                if (params.length == 1) {
+                    if (params[0] == GetRB.this) {
+                        // The message was emitted by our thread.
+                        count++;
+                        rb = record.getResourceBundle();
+                        rbName = record.getResourceBundleName();
+                    } else {
+                        // The message was emitted by another thread: just
+                        // ignore it, as it may have been emitted at a time
+                        // where the resource bundle was still null, and
+                        // processing it may overwrite the 'rb' and 'rbName'
+                        // recorded from the message emitted by our own thread.
+                        if (VERBOSE) {
+                            System.out.println("Ignoring message logged by " + params[0]);
+                        }
+                        ignoreLogCount.incrementAndGet();
+                    }
+                } else {
+                    ignoreLogCount.incrementAndGet();
+                    System.err.println("Unexpected message received");
+                }
+            }
+
+            void reset() {
+                rbName = null;
+                rb = null;
             }
 
             @Override
@@ -207,6 +247,7 @@
             }
         };
         final MyHandler handler = new MyHandler();
+
         @Override
         public void run() {
             try {
@@ -234,9 +275,10 @@
                                     + handler.getLevel());
                         }
                         final int countBefore = handler.count;
+                        handler.reset();
                         ll.setLevel(Level.FINEST);
                         ll.addHandler(handler);
-                        ll.fine("dummy");
+                        ll.log(Level.FINE, "dummy {0}", this);
                         ll.removeHandler(handler);
                         final int countAfter = handler.count;
                         if (countBefore == countAfter) {
diff --git a/test/javax/imageio/plugins/png/PngDitDepthTest.java b/test/javax/imageio/plugins/png/PngDitDepthTest.java
new file mode 100644
index 0000000..7317f87
--- /dev/null
+++ b/test/javax/imageio/plugins/png/PngDitDepthTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+* @test
+* @bug 4991647
+* @summary PNGMetadata.getAsTree() sets bitDepth to invalid value
+* @run main PngDitDepthTest
+*/
+
+import org.w3c.dom.Node;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.ImageWriter;
+import javax.imageio.metadata.IIOInvalidTreeException;
+import javax.imageio.metadata.IIOMetadata;
+import java.awt.image.ColorModel;
+import java.awt.image.SampleModel;
+import java.util.Iterator;
+
+public class PngDitDepthTest {
+
+    public static void main(String[] args) throws IIOInvalidTreeException {
+
+        // getting the writer for the png format
+        Iterator iter = ImageIO.getImageWritersByFormatName("png");
+        ImageWriter writer = (ImageWriter) iter.next();
+
+        // creating a color model
+        ColorModel colorModel = ColorModel.getRGBdefault();
+
+        // creating a sample model
+        SampleModel sampleModel = colorModel.createCompatibleSampleModel(640, 480);
+
+        // creating a default metadata object
+        IIOMetadata metaData = writer.getDefaultImageMetadata(new ImageTypeSpecifier(colorModel, sampleModel), null);
+        String formatName = metaData.getNativeMetadataFormatName();
+
+        // first call
+        Node metaDataNode = metaData.getAsTree(formatName);
+        try {
+            metaData.setFromTree(formatName, metaDataNode);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        // second call (bitdepht is already set to an invalid value)
+        metaDataNode = metaData.getAsTree(formatName);
+
+        metaData.setFromTree(formatName, metaDataNode);
+
+    }
+}
diff --git a/test/javax/management/MBeanServer/MBeanFallbackTest.java b/test/javax/management/MBeanServer/MBeanFallbackTest.java
index dcb5e18..5fe115f 100644
--- a/test/javax/management/MBeanServer/MBeanFallbackTest.java
+++ b/test/javax/management/MBeanServer/MBeanFallbackTest.java
@@ -35,7 +35,7 @@
  * @author Jaroslav Bachorik
  * @run clean MBeanFallbackTest
  * @run build MBeanFallbackTest
- * @run main MBeanFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MBeanFallbackTest
  */
 public class MBeanFallbackTest {
     private static interface PrivateMBean {
@@ -51,7 +51,6 @@
     private static int failures = 0;
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivate(PrivateMBean.class, new Private());
 
         if (failures == 0)
diff --git a/test/javax/management/ObjectName/SerialCompatTest.java b/test/javax/management/ObjectName/SerialCompatTest.java
index 50b6578..0c183b2 100644
--- a/test/javax/management/ObjectName/SerialCompatTest.java
+++ b/test/javax/management/ObjectName/SerialCompatTest.java
@@ -28,7 +28,7 @@
  * @author Eamonn McManus, Daniel Fuchs
  * @run clean SerialCompatTest
  * @run build SerialCompatTest
- * @run main/othervm SerialCompatTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true -Djmx.serial.form=1.0 SerialCompatTest
  */
 
 import java.io.*;
@@ -223,8 +223,6 @@
     }
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jmx.serial.form", "1.0");
-
         /* Check that we really are in jmx.serial.form=1.0 mode.
         The property is frozen the first time the ObjectName class
         is referenced so checking that it is set to the correct
diff --git a/test/javax/management/monitor/AttributeArbitraryDataTypeTest.java b/test/javax/management/monitor/AttributeArbitraryDataTypeTest.java
index deb4358..aa38606 100644
--- a/test/javax/management/monitor/AttributeArbitraryDataTypeTest.java
+++ b/test/javax/management/monitor/AttributeArbitraryDataTypeTest.java
@@ -58,9 +58,9 @@
 public class AttributeArbitraryDataTypeTest implements NotificationListener {
 
     // Flag to notify that a message has been received
-    private boolean counterMessageReceived = false;
-    private boolean gaugeMessageReceived = false;
-    private boolean stringMessageReceived = false;
+    private volatile boolean counterMessageReceived = false;
+    private volatile boolean gaugeMessageReceived = false;
+    private volatile boolean stringMessageReceived = false;
 
     // Match enum
     public enum Match { do_not_match_0,
@@ -195,21 +195,33 @@
                      " has reached or exceeded the threshold");
                 echo("\t\tDerived Gauge = " + n.getDerivedGauge());
                 echo("\t\tTrigger = " + n.getTrigger());
-                counterMessageReceived = true;
+
+                synchronized (this) {
+                    counterMessageReceived = true;
+                    notifyAll();
+                }
             } else if (type.equals(MonitorNotification.
                                    THRESHOLD_HIGH_VALUE_EXCEEDED)) {
                 echo("\t\t" + n.getObservedAttribute() +
                      " has reached or exceeded the high threshold");
                 echo("\t\tDerived Gauge = " + n.getDerivedGauge());
                 echo("\t\tTrigger = " + n.getTrigger());
-                gaugeMessageReceived = true;
+
+                synchronized (this) {
+                    gaugeMessageReceived = true;
+                    notifyAll();
+                }
             } else if (type.equals(MonitorNotification.
                                    STRING_TO_COMPARE_VALUE_MATCHED)) {
                 echo("\t\t" + n.getObservedAttribute() +
                      " matches the string-to-compare value");
                 echo("\t\tDerived Gauge = " + n.getDerivedGauge());
                 echo("\t\tTrigger = " + n.getTrigger());
-                stringMessageReceived = true;
+
+                synchronized (this) {
+                    stringMessageReceived = true;
+                    notifyAll();
+                }
             } else {
                 echo("\t\tSkipping notification of type: " + type);
             }
@@ -358,6 +370,17 @@
 
             // Check if notification was received
             //
+            synchronized (this) {
+                while (!counterMessageReceived) {
+                    try {
+                        wait();
+                    } catch (InterruptedException e) {
+                        System.err.println("Got unexpected exception: " + e);
+                        e.printStackTrace();
+                        break;
+                    }
+                }
+            }
             if (counterMessageReceived) {
                 echo("\tOK: CounterMonitor notification received");
             } else {
@@ -525,6 +548,17 @@
 
             // Check if notification was received
             //
+            synchronized (this) {
+                while (!gaugeMessageReceived) {
+                    try {
+                        wait();
+                    } catch (InterruptedException e) {
+                        System.err.println("Got unexpected exception: " + e);
+                        e.printStackTrace();
+                        break;
+                    }
+                }
+            }
             if (gaugeMessageReceived) {
                 echo("\tOK: GaugeMonitor notification received");
             } else {
@@ -680,6 +714,17 @@
 
             // Check if notification was received
             //
+            synchronized (this) {
+                while (!stringMessageReceived) {
+                    try {
+                        wait();
+                    } catch (InterruptedException e) {
+                        System.err.println("Got unexpected exception: " + e);
+                        e.printStackTrace();
+                        break;
+                    }
+                }
+            }
             if (stringMessageReceived) {
                 echo("\tOK: StringMonitor notification received");
             } else {
diff --git a/test/javax/management/monitor/CounterMonitorTest.java b/test/javax/management/monitor/CounterMonitorTest.java
index bf134c6..6c4ea10 100644
--- a/test/javax/management/monitor/CounterMonitorTest.java
+++ b/test/javax/management/monitor/CounterMonitorTest.java
@@ -43,9 +43,6 @@
     // modulus number
     private Number modulus = new Integer(7);
 
-    // offset number
-    private int offset = 0;
-
     // difference mode flag
     private boolean differenceModeFlag = true;
 
@@ -58,9 +55,6 @@
     // counter values
     private int[] values = new int[] {4, 6, 9, 11};
 
-    // time to wait for notification (in seconds)
-    private int timeout = 5;
-
     // flag to notify that a message has been received
     private volatile boolean messageReceived = false;
 
@@ -92,8 +86,9 @@
                 echo("\t\t" + n.getObservedAttribute() +
                      " has reached or exceeded the threshold");
                 echo("\t\tDerived Gauge = " + n.getDerivedGauge());
-                messageReceived = true;
+
                 synchronized (this) {
+                    messageReceived = true;
                     notifyAll();
                 }
             } else {
@@ -205,21 +200,16 @@
     }
 
     /*
-     * Wait until timeout reached
+     * Wait messageReceived to be true
      */
-    void doWait() {
-        for (int i = 0; i < timeout; i++) {
-            echo("\tdoWait: Waiting for " + timeout + " seconds. " +
-                 "i = " + i + ", messageReceived = " + messageReceived);
-            if (messageReceived) {
-                break;
-            }
+    synchronized void doWait() {
+        while (!messageReceived) {
             try {
-                synchronized (this) {
-                    wait(1000);
-                }
+                wait();
             } catch (InterruptedException e) {
-                // OK: Ignore...
+                System.err.println("Got unexpected exception: " + e);
+                e.printStackTrace();
+                break;
             }
         }
     }
diff --git a/test/javax/management/monitor/GaugeMonitorDeadlockTest.java b/test/javax/management/monitor/GaugeMonitorDeadlockTest.java
index b215705..c85c223 100644
--- a/test/javax/management/monitor/GaugeMonitorDeadlockTest.java
+++ b/test/javax/management/monitor/GaugeMonitorDeadlockTest.java
@@ -36,8 +36,9 @@
  */
 
 import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
 import java.util.concurrent.atomic.AtomicInteger;
-import javax.management.Attribute;
 import javax.management.JMX;
 import javax.management.MBeanServer;
 import javax.management.Notification;
@@ -47,10 +48,16 @@
 import javax.management.monitor.GaugeMonitorMBean;
 
 public class GaugeMonitorDeadlockTest {
+    private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY};
+    private static long checkingTime;
 
     public static void main(String[] args) throws Exception {
         if (args.length != 1)
             throw new Exception("Arg should be test number");
+        double factor = Double.parseDouble(System.getProperty("test.timeout.factor", "1.0"));
+        checkingTime = (long)factor*1000;
+        System.out.println("=== checkingTime = " + checkingTime + "ms");
+
         int testNo = Integer.parseInt(args[0]) - 1;
         TestCase test = testCases[testNo];
         System.out.println("Test: " + test.getDescription());
@@ -58,8 +65,6 @@
         System.out.println("Test passed");
     }
 
-    private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY};
-
     private static abstract class TestCase {
         TestCase(String description, When when) {
             this.description = description;
@@ -98,16 +103,29 @@
             monitorProxy.setNotifyLow(true);
             monitorProxy.start();
 
+            System.out.println("=== Waiting observedProxy.getGetCount() to be "
+                    + "changed, presumable deadlock if timeout?");
             final int initGetCount = observedProxy.getGetCount();
-            int getCount = initGetCount;
-            for (int i = 0; i < 2000; i++) { // 2000 * 10 = 20 seconds
-                getCount = observedProxy.getGetCount();
-                if (getCount != initGetCount)
-                    break;
-                Thread.sleep(10);
+            long checkedTime = System.currentTimeMillis();
+            long nowTime;
+            ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+            while (observedProxy.getGetCount() == initGetCount) {
+                Thread.sleep(100);
+
+                nowTime = System.currentTimeMillis();
+                if (nowTime - checkedTime >= checkingTime) {
+                    System.out.println("=== Checking deadlocked ...");
+                    if (threadMXBean.findDeadlockedThreads() != null) {
+                        for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
+                            System.out.println(info);
+                        }
+                        throw new Error("Found deadlocked threads: "
+                                + threadMXBean.findDeadlockedThreads().length);
+                    }
+                    checkedTime = System.currentTimeMillis();
+                }
             }
-            if (getCount <= initGetCount)
-                throw new Exception("Test failed: presumable deadlock");
+
             // This won't show up as a deadlock in CTRL-\ or in
             // ThreadMXBean.findDeadlockedThreads(), because they don't
             // see that thread A is waiting for thread B (B.join()), and
@@ -117,13 +135,13 @@
             // so if we want to test notify behaviour we can trigger by
             // exceeding the threshold.
             if (when == When.IN_NOTIFY) {
+                final Thread testedThread = new Thread(sensitiveThing);
                 final AtomicInteger notifCount = new AtomicInteger();
                 final NotificationListener listener = new NotificationListener() {
                     public void handleNotification(Notification n, Object h) {
-                        Thread t = new Thread(sensitiveThing);
-                        t.start();
+                        testedThread.start();
                         try {
-                            t.join();
+                            testedThread.join();
                         } catch (InterruptedException e) {
                             throw new RuntimeException(e);
                         }
@@ -132,12 +150,36 @@
                 };
                 mbs.addNotificationListener(monitorName, listener, null, null);
                 observedProxy.setThing(1000);
-                for (int i = 0; i < 2000 && notifCount.get() == 0; i++)
-                    Thread.sleep(10);
-                if (notifCount.get() == 0)
-                    throw new Exception("Test failed: presumable deadlock");
-            }
+                System.out.println("=== Waiting notifications, presumable "
+                        + "deadlock if timeout?");
+                long startTime = System.currentTimeMillis();
+                checkedTime = startTime;
+                while (notifCount.get() == 0) {
+                    Thread.sleep(100);
 
+                    nowTime = System.currentTimeMillis();
+                    if (nowTime - checkedTime >= checkingTime) {
+                        System.out.println("=== Checking the thread state ...");
+                        if (testedThread.isAlive()) {
+                            System.out.println("=== Waiting testedThread to die "
+                                    + "after " + (nowTime - startTime) + "ms");
+
+                            ThreadInfo tinfo = threadMXBean.getThreadInfo(testedThread.getId());
+                            if (Thread.State.BLOCKED.equals(tinfo.getThreadState())) {
+                                for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
+                                    System.out.println(info);
+                                }
+                            } else {
+                                System.out.println(tinfo);
+                            }
+                        } else {
+                            System.out.println("=== The testedThread is dead as wished, "
+                                    + "the test must be passed soon.");
+                        }
+                        checkedTime = System.currentTimeMillis();
+                    }
+                }
+            }
         }
 
         abstract void doSensitiveThing(GaugeMonitorMBean monitorProxy,
diff --git a/test/javax/management/monitor/NonComparableAttributeValueTest.java b/test/javax/management/monitor/NonComparableAttributeValueTest.java
index c9c153a..c382ec8 100644
--- a/test/javax/management/monitor/NonComparableAttributeValueTest.java
+++ b/test/javax/management/monitor/NonComparableAttributeValueTest.java
@@ -39,7 +39,7 @@
 public class NonComparableAttributeValueTest implements NotificationListener {
 
     // Flag to notify that a message has been received
-    private boolean messageReceived = false;
+    private volatile boolean messageReceived = false;
 
     // MBean class
     public class ObservedObject implements ObservedObjectMBean {
@@ -69,7 +69,11 @@
                 echo("\t\t" + n.getObservedAttribute() + " is null");
                 echo("\t\tDerived Gauge = " + n.getDerivedGauge());
                 echo("\t\tTrigger = " + n.getTrigger());
-                messageReceived = true;
+
+                synchronized (this) {
+                    messageReceived = true;
+                    notifyAll();
+                }
             } else {
                 echo("\t\tSkipping notification of type: " + type);
             }
@@ -134,12 +138,9 @@
             echo(">>> START the CounterMonitor");
             counterMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: CounterMonitor notification received");
             } else {
@@ -212,12 +213,9 @@
             echo(">>> START the GaugeMonitor");
             gaugeMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: GaugeMonitor notification received");
             } else {
@@ -289,12 +287,9 @@
             echo(">>> START the StringMonitor");
             stringMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: StringMonitor notification received");
             } else {
@@ -334,6 +329,21 @@
     }
 
     /*
+     * Wait messageReceived to be true
+     */
+    synchronized void doWait() {
+        while (!messageReceived) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+                System.err.println("Got unexpected exception: " + e);
+                e.printStackTrace();
+                break;
+            }
+        }
+    }
+
+    /*
      * Standalone entry point.
      *
      * Run the test and report to stdout.
diff --git a/test/javax/management/monitor/ReflectionExceptionTest.java b/test/javax/management/monitor/ReflectionExceptionTest.java
index db13caf..d4acde3 100644
--- a/test/javax/management/monitor/ReflectionExceptionTest.java
+++ b/test/javax/management/monitor/ReflectionExceptionTest.java
@@ -87,7 +87,11 @@
                 echo("\tObservedAttribute: " + mn.getObservedAttribute());
                 echo("\tDerivedGauge: " + mn.getDerivedGauge());
                 echo("\tTrigger: " + mn.getTrigger());
-                messageReceived = true;
+
+                synchronized (this) {
+                    messageReceived = true;
+                    notifyAll();
+                }
             }
         }
     }
@@ -135,12 +139,9 @@
             echo(">>> START the CounterMonitor");
             counterMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: CounterMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -203,12 +204,9 @@
             echo(">>> START the GaugeMonitor");
             gaugeMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -270,12 +268,9 @@
             echo(">>> START the StringMonitor");
             stringMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -349,8 +344,23 @@
         }
     }
 
+    /*
+     * Wait messageReceived to be true
+     */
+    synchronized void doWait() {
+        while (!messageReceived) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+                System.err.println("Got unexpected exception: " + e);
+                e.printStackTrace();
+                break;
+            }
+        }
+    }
+
     // Flag to notify that a message has been received
-    private boolean messageReceived = false;
+    private volatile boolean messageReceived = false;
 
     private MBeanServer server;
     private ObjectName obsObjName;
diff --git a/test/javax/management/monitor/RuntimeExceptionTest.java b/test/javax/management/monitor/RuntimeExceptionTest.java
index a10322a..53ee24d 100644
--- a/test/javax/management/monitor/RuntimeExceptionTest.java
+++ b/test/javax/management/monitor/RuntimeExceptionTest.java
@@ -86,7 +86,11 @@
                 echo("\tObservedAttribute: " + mn.getObservedAttribute());
                 echo("\tDerivedGauge: " + mn.getDerivedGauge());
                 echo("\tTrigger: " + mn.getTrigger());
-                messageReceived = true;
+
+                synchronized (this) {
+                    messageReceived = true;
+                    notifyAll();
+                }
             }
         }
     }
@@ -134,12 +138,9 @@
             echo(">>> START the CounterMonitor");
             counterMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: CounterMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -202,12 +203,9 @@
             echo(">>> START the GaugeMonitor");
             gaugeMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -269,12 +267,9 @@
             echo(">>> START the StringMonitor");
             stringMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
             // Check if notification was received
             //
+            doWait();
             if (messageReceived) {
                 echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
             } else {
@@ -347,8 +342,23 @@
         }
     }
 
+    /*
+     * Wait messageReceived to be true
+     */
+    synchronized void doWait() {
+        while (!messageReceived) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+                System.err.println("Got unexpected exception: " + e);
+                e.printStackTrace();
+                break;
+            }
+        }
+    }
+
     // Flag to notify that a message has been received
-    private boolean messageReceived = false;
+    private volatile boolean messageReceived = false;
 
     private MBeanServer server;
     private ObjectName obsObjName;
diff --git a/test/javax/management/mxbean/MXBeanFallbackTest.java b/test/javax/management/mxbean/MXBeanFallbackTest.java
index 388ffc9..cd10b6f 100644
--- a/test/javax/management/mxbean/MXBeanFallbackTest.java
+++ b/test/javax/management/mxbean/MXBeanFallbackTest.java
@@ -30,7 +30,7 @@
  * @author Jaroslav Bachorik
  * @run clean MXBeanFallbackTest
  * @run build MXBeanFallbackTest
- * @run main MXBeanFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MXBeanFallbackTest
  */
 
 import javax.management.MBeanServer;
@@ -40,7 +40,6 @@
 
 public class MXBeanFallbackTest {
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivateMXBean("Private", new Private());
 
         if (failures == 0)
diff --git a/test/javax/management/proxy/JMXProxyFallbackTest.java b/test/javax/management/proxy/JMXProxyFallbackTest.java
index d124359..2d96d06 100644
--- a/test/javax/management/proxy/JMXProxyFallbackTest.java
+++ b/test/javax/management/proxy/JMXProxyFallbackTest.java
@@ -36,7 +36,7 @@
  * @author Jaroslav Bachorik
  * @run clean JMXProxyFallbackTest
  * @run build JMXProxyFallbackTest
- * @run main JMXProxyFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true JMXProxyFallbackTest
  */
 public class JMXProxyFallbackTest {
     private static interface PrivateMBean {
@@ -56,7 +56,6 @@
     private static int failures = 0;
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivate(PrivateMBean.class);
         testPrivate(PrivateMXBean.class);
 
diff --git a/test/javax/net/ssl/TLSv12/ProtocolFilter.java b/test/javax/net/ssl/TLSv12/ProtocolFilter.java
new file mode 100644
index 0000000..0146107
--- /dev/null
+++ b/test/javax/net/ssl/TLSv12/ProtocolFilter.java
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8052406
+ * @summary SSLv2Hello protocol may be filter out unexpectedly
+ * @run main/othervm ProtocolFilter
+ */
+
+import java.io.*;
+import java.net.*;
+import javax.net.ssl.*;
+
+public class ProtocolFilter {
+
+    /*
+     * =============================================================
+     * 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 = "../../../../sun/security/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);
+
+        // Only enable cipher suites for TLS v1.2.
+        sslServerSocket.setEnabledCipherSuites(
+            new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA256"});
+
+        serverPort = sslServerSocket.getLocalPort();
+
+        /*
+         * Signal Client, we're ready for his connect.
+         */
+        serverReady = true;
+
+        SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslIS.read();
+        sslOS.write(85);
+        sslOS.flush();
+
+        sslSocket.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);
+
+        // Enable all supported protocols, including SSLv2Hello.
+        sslSocket.setEnabledProtocols(sslSocket.getSupportedProtocols());
+
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslOS.write(280);
+        sslOS.flush();
+        sslIS.read();
+
+        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 ProtocolFilter();
+    }
+
+    Thread clientThread = null;
+    Thread serverThread = null;
+
+    /*
+     * Primary constructor, used to drive remainder of the test.
+     *
+     * Fork off the other side, then do your work.
+     */
+    ProtocolFilter() 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() {
+                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() {
+                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;
+            }
+        }
+    }
+}
diff --git a/test/javax/swing/JComboBox/8057893/bug8057893.java b/test/javax/swing/JComboBox/8057893/bug8057893.java
new file mode 100644
index 0000000..5f58d3d
--- /dev/null
+++ b/test/javax/swing/JComboBox/8057893/bug8057893.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.WindowConstants;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8057893
+ * @author Alexander Scherbatiy
+ * @summary JComboBox actionListener never receives "comboBoxEdited"
+ *   from getActionCommand
+ * @run main bug8057893
+ */
+public class bug8057893 {
+
+    private static volatile boolean isComboBoxEdited = false;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        EventQueue.invokeAndWait(() -> {
+            JFrame frame = new JFrame();
+            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+            JComboBox<String> comboBox = new JComboBox<>(new String[]{"one", "two"});
+            comboBox.setEditable(true);
+            comboBox.addActionListener(new ActionListener() {
+
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    if ("comboBoxEdited".equals(e.getActionCommand())) {
+                        isComboBoxEdited = true;
+                    }
+                }
+            });
+            frame.add(comboBox);
+            frame.pack();
+            frame.setVisible(true);
+            comboBox.requestFocusInWindow();
+        });
+
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        if(!isComboBoxEdited){
+            throw new RuntimeException("ComboBoxEdited event is not fired!");
+        }
+    }
+}
diff --git a/test/javax/swing/JFileChooser/8046391/bug8046391.java b/test/javax/swing/JFileChooser/8046391/bug8046391.java
new file mode 100644
index 0000000..ff2b48a
--- /dev/null
+++ b/test/javax/swing/JFileChooser/8046391/bug8046391.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8046391
+ * @summary JFileChooser hangs if displayed in Windows L&F
+ * @author Alexey Ivanov
+ * @run main/othervm/timeout=10 bug8046391
+*/
+
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
+import sun.awt.OSInfo;
+import sun.awt.OSInfo.OSType;
+
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class bug8046391  {
+
+    public static void main(String[] args) throws Exception {
+        OSType type = OSInfo.getOSType();
+        if (type != OSType.WINDOWS) {
+            System.out.println("This test is for Windows only... skipping!");
+            return;
+        }
+
+        SwingUtilities.invokeAndWait(() -> {
+            try {
+                UIManager.setLookAndFeel(new WindowsLookAndFeel());
+            } catch (UnsupportedLookAndFeelException e) {
+                e.printStackTrace();
+            }
+            System.out.println("Creating JFileChooser...");
+            JFileChooser fileChooser = new JFileChooser();
+            System.out.println("Test passed: chooser = " + fileChooser);
+        });
+        // Test fails if creating JFileChooser hangs
+    }
+
+}
diff --git a/test/javax/swing/JMenuItem/8031573/bug8031573.java b/test/javax/swing/JMenuItem/8031573/bug8031573.java
index 5cb1dc5..2d36db7 100644
--- a/test/javax/swing/JMenuItem/8031573/bug8031573.java
+++ b/test/javax/swing/JMenuItem/8031573/bug8031573.java
@@ -28,7 +28,7 @@
 import javax.swing.SwingUtilities;
 
 /* @test
- * @bug 8031573
+ * @bug 8031573 8040279
  * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
  *           in high resolution on Retina
  * @author Alexander Scherbatiy
diff --git a/test/javax/swing/JOptionPane/8024926/bug8024926.java b/test/javax/swing/JOptionPane/8024926/bug8024926.java
index 42f976b..185537f 100644
--- a/test/javax/swing/JOptionPane/8024926/bug8024926.java
+++ b/test/javax/swing/JOptionPane/8024926/bug8024926.java
@@ -31,7 +31,7 @@
 
 /**
  * @test
- * @bug 8024926
+ * @bug 8024926 8040279
  * @summary [macosx] AquaIcon HiDPI support
  * @author Alexander Scherbatiy
  * @run applet/manual=yesno bug8024926.html
diff --git a/test/javax/swing/JRadioButton/8033699/bug8033699.java b/test/javax/swing/JRadioButton/8033699/bug8033699.java
new file mode 100644
index 0000000..63409de
--- /dev/null
+++ b/test/javax/swing/JRadioButton/8033699/bug8033699.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 8033699
+ * @summary  Incorrect radio button behavior when pressing tab key
+ * @author Vivi An
+ * @run main bug8033699
+ */
+
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+
+public class bug8033699 {
+    private static Robot robot;
+    private static SunToolkit toolkit;
+
+    private static JButton btnStart;
+    private static ButtonGroup btnGrp;
+    private static JButton btnEnd;
+    private static JButton btnMiddle;
+    private static JRadioButton radioBtn1;
+    private static JRadioButton radioBtn2;
+    private static JRadioButton radioBtn3;
+    private static JRadioButton radioBtnSingle;
+
+    public static void main(String args[]) throws Throwable {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        robot = new Robot();
+        Thread.sleep(100);
+
+        robot.setAutoDelay(100);
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        // tab key test grouped radio button
+        runTest1();
+
+        // tab key test non-grouped radio button
+        runTest2();
+
+        // shift tab key test grouped and non grouped radio button
+        runTest3();
+
+        // left/up key test in grouped radio button
+        runTest4();
+
+        // down/right key test in grouped radio button
+        runTest5();
+
+        // tab from radio button in group to next component in the middle of button group layout
+        runTest6();
+
+        // tab to radio button in group from component in the middle of button group layout
+        runTest7();
+
+        // down key circle back to first button in grouped radio button
+        runTest8();
+    }
+
+    private static void createAndShowGUI() {
+        JFrame mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons");
+
+        btnStart = new JButton("Start");
+        btnEnd = new JButton("End");
+        btnMiddle = new JButton("Middle");
+
+        JPanel box = new JPanel();
+        box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
+        box.setBorder(BorderFactory.createTitledBorder("Grouped Radio Buttons"));
+        radioBtn1 = new JRadioButton("A");
+        radioBtn2 = new JRadioButton("B");
+        radioBtn3 = new JRadioButton("C");
+
+        ButtonGroup btnGrp = new ButtonGroup();
+        btnGrp.add(radioBtn1);
+        btnGrp.add(radioBtn2);
+        btnGrp.add(radioBtn3);
+        radioBtn1.setSelected(true);
+
+        box.add(radioBtn1);
+        box.add(radioBtn2);
+        box.add(btnMiddle);
+        box.add(radioBtn3);
+
+        radioBtnSingle = new JRadioButton("Not Grouped");
+        radioBtnSingle.setSelected(true);
+
+        mainFrame.getContentPane().add(btnStart);
+        mainFrame.getContentPane().add(box);
+        mainFrame.getContentPane().add(radioBtnSingle);
+        mainFrame.getContentPane().add(btnEnd);
+
+        mainFrame.getRootPane().setDefaultButton(btnStart);
+        btnStart.requestFocus();
+
+        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.Y_AXIS));
+
+        mainFrame.setSize(300, 300);
+        mainFrame.setLocation(200, 200);
+        mainFrame.setVisible(true);
+        mainFrame.toFront();
+    }
+
+    // Radio button Group as a single component when traversing through tab key
+    private static void runTest1() throws Exception{
+        hitKey(robot, KeyEvent.VK_TAB);
+        hitKey(robot, KeyEvent.VK_TAB);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
+                    System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
+                    throw new RuntimeException("Focus is not on Radio Button Single as Expected");
+                }
+            }
+        });
+    }
+
+    // Non-Grouped Radio button as a single component when traversing through tab key
+    private static void runTest2() throws Exception{
+        hitKey(robot, KeyEvent.VK_TAB);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
+                    System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
+                    throw new RuntimeException("Focus is not on Button End as Expected");
+                }
+            }
+        });
+    }
+
+    // Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
+    private static void runTest3() throws Exception{
+        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
+        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                    System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
+                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                }
+            }
+        });
+    }
+
+    // Using arrow key to move focus in radio button group
+    private static void runTest4() throws Exception{
+        hitKey(robot, KeyEvent.VK_UP);
+        hitKey(robot, KeyEvent.VK_LEFT);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
+                    System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
+                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
+                }
+            }
+        });
+    }
+
+    private static void runTest5() throws Exception{
+        hitKey(robot, KeyEvent.VK_DOWN);
+        hitKey(robot, KeyEvent.VK_RIGHT);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                    System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
+                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                }
+            }
+        });
+    }
+
+    private static void runTest6() throws Exception{
+        hitKey(robot, KeyEvent.VK_DOWN);
+        hitKey(robot, KeyEvent.VK_DOWN);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
+                    System.out.println("Radio button Group Circle Back To First Button Test");
+                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
+                }
+            }
+        });
+    }
+
+    private static void runTest7() throws Exception{
+        hitKey(robot, KeyEvent.VK_TAB);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
+                    System.out.println("Separate Component added in button group layout");
+                    throw new RuntimeException("Focus is not on Middle Button as Expected");
+                }
+            }
+        });
+    }
+
+    private static void runTest8() throws Exception{
+        hitKey(robot, KeyEvent.VK_TAB);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                    System.out.println("Separate Component added in button group layout");
+                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                }
+            }
+        });
+    }
+
+    private static void hitKey(Robot robot, int keycode) {
+        robot.keyPress(keycode);
+        robot.keyRelease(keycode);
+        toolkit.realSync();
+    }
+
+    private static void hitKey(Robot robot, int mode, int keycode) {
+        robot.keyPress(mode);
+        robot.keyPress(keycode);
+        robot.keyRelease(mode);
+        robot.keyRelease(keycode);
+        toolkit.realSync();
+    }
+}
diff --git a/test/javax/swing/JTabbedPane/7170310/bug7170310.java b/test/javax/swing/JTabbedPane/7170310/bug7170310.java
new file mode 100644
index 0000000..2ceb8a4
--- /dev/null
+++ b/test/javax/swing/JTabbedPane/7170310/bug7170310.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.JViewport;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 7170310
+ * @author Alexey Ivanov
+ * @summary Selected tab should be scrolled into view.
+ * @run main bug7170310
+ */
+public class bug7170310 {
+    private static final int TABS_NUMBER = 3;
+
+    private static volatile JTabbedPane tabbedPane;
+    private static volatile int count = 1;
+
+    private static volatile JFrame frame;
+
+    private static volatile Exception exception = null;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            UIManager.setLookAndFeel(new MetalLookAndFeel());
+            SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);
+
+            SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+            toolkit.realSync();
+
+            for (int i = 0; i < TABS_NUMBER; i++) {
+                SwingUtilities.invokeAndWait(bug7170310::addTab);
+                toolkit.realSync();
+            }
+
+            SwingUtilities.invokeAndWait(bug7170310::check);
+
+            if (exception != null) {
+                System.out.println("Test failed: " + exception.getMessage());
+                throw exception;
+            } else {
+                System.out.printf("Test passed");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static void createAndShowUI() {
+        frame = new JFrame("bug7170310");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 100);
+
+        tabbedPane = new JTabbedPane();
+        tabbedPane.addTab("Main Tab", new JPanel());
+
+        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+
+        frame.getContentPane().add(tabbedPane);
+        frame.setVisible(true);
+    }
+
+    private static void addTab() {
+        tabbedPane.addTab("Added Tab " + count++, new JPanel());
+        tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
+    }
+
+    private static void check() {
+        try {
+            JViewport vp = null;
+            for (Component c : tabbedPane.getComponents()) {
+                if (c instanceof JViewport) {
+                    vp = (JViewport) c;
+                    break;
+                }
+            }
+
+            JComponent v = (JComponent) vp.getView();
+            Rectangle vr = vp.getViewRect();
+            Dimension vs = v.getSize();
+
+            // The tab view must be scrolled to the end so that the last tab is visible
+            if (vs.width != (vr.x + vr.width)) {
+                throw new RuntimeException("tabScroller.tabPanel view is positioned incorrectly: "
+                        + vs.width + " vs " + (vr.x + vr.width));
+            }
+        } catch (Exception e) {
+            exception = e;
+        }
+    }
+}
diff --git a/test/javax/swing/text/View/8048110/bug8048110.java b/test/javax/swing/text/View/8048110/bug8048110.java
new file mode 100644
index 0000000..2151e3f
--- /dev/null
+++ b/test/javax/swing/text/View/8048110/bug8048110.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8048110
+ * @summary Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow
+ * @author Dmitry Markov
+ * @run main bug8048110
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.text.Element;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.awt.*;
+
+public class bug8048110 {
+    private static SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+    private static Object lock = new Object();
+    private static boolean isRealSyncPerformed = false;
+    private static final String htmlText = "<table width=\"100%\" cellpadding=\"10\" cellspacing=\"5\" align=\"center\">" +
+            "<tr><th align=\"left\" bgcolor=\"#bec3c6\">Devices</th><th align=\"left\" bgcolor=\"#bec3c6\">State</th></tr>" +
+            "<tr><td align=\"left\" bgcolor=\"#bec3c6\">PC</td><td align=\"left\" bgcolor=\"#46a055\">Ok</td></tr></table>";
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                toolkit.realSync();
+                synchronized (lock) {
+                    isRealSyncPerformed = true;
+                    lock.notifyAll();
+                }
+            }
+        };
+        thread.start();
+
+        synchronized (lock) {
+            if (!isRealSyncPerformed) {
+                lock.wait(5000);
+            }
+        }
+
+        if (!isRealSyncPerformed) {
+            throw new RuntimeException("Test Failed!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        try {
+            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+        HTMLEditorKit editorKit = new HTMLEditorKit();
+        JTextPane textPane = new JTextPane();
+        textPane.setContentType("text/html");
+        textPane.setEditorKit(editorKit);
+        textPane.setText("Initial text without table");
+
+        JFrame frame = new JFrame("bug8048110");
+        frame.getContentPane().add(textPane, BorderLayout.CENTER);
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+        frame.setSize(500, 200);
+        frame.setVisible(true);
+
+        textPane.setDocument(textPane.getEditorKit().createDefaultDocument());
+        HTMLDocument htmlDocument = (HTMLDocument) textPane.getDocument();
+        Element firstParagraph = findFirstElement(textPane.getDocument().getDefaultRootElement(), "p");
+
+        try {
+            htmlDocument.setInnerHTML(firstParagraph, htmlText);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static Element findFirstElement(Element e, String name) {
+        String elementName = e.getName();
+        if (elementName != null && elementName.equalsIgnoreCase(name)) {
+            return e;
+        }
+        for (int i = 0; i < e.getElementCount(); i++) {
+            Element result = findFirstElement(e.getElement(i), name);
+            if (result != null) {
+                return result;
+            }
+        }
+        return null;
+    }
+}
+
diff --git a/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java b/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
new file mode 100644
index 0000000..2378fd2
--- /dev/null
+++ b/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8058120
+ * @summary Rendering / caret errors with HTMLDocument
+ * @author Dmitry Markov
+ * @run main bug8058120
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.text.Element;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.awt.*;
+
+public class bug8058120 {
+    private static SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+    private static HTMLDocument document = null;
+    private static final String text = "<p id = 'ab'>ab</p>";
+    private static final String textToInsert = "c";
+
+    public static void main(String[] args) {
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    document.insertAfterEnd(document.getElement("ab"), textToInsert);
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                Element parent = document.getElement("ab").getParentElement();
+                int count = parent.getElementCount();
+                if (count != 2) {
+                    throw new RuntimeException("Test Failed! Unexpected Element count = "+count);
+                }
+                Element insertedElement = parent.getElement(count - 1);
+                if (!HTML.Tag.IMPLIED.toString().equals(insertedElement.getName())) {
+                    throw new RuntimeException("Test Failed! Inserted text is not wrapped by " + HTML.Tag.IMPLIED + " tag");
+                }
+            }
+        });
+    }
+
+    private static void createAndShowGUI() {
+        try {
+            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+
+        JFrame frame = new JFrame("bug8058120");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JEditorPane editorPane = new JEditorPane();
+        editorPane.setContentType("text/html");
+        editorPane.setEditorKit(new HTMLEditorKit());
+
+        document = (HTMLDocument) editorPane.getDocument();
+
+        editorPane.setText(text);
+
+        frame.add(editorPane);
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+    }
+}
+
+
diff --git a/test/javax/xml/jaxp/common/8032908/TestFunc.java b/test/javax/xml/jaxp/common/8032908/TestFunc.java
new file mode 100644
index 0000000..20eb23f
--- /dev/null
+++ b/test/javax/xml/jaxp/common/8032908/TestFunc.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import org.w3c.dom.Node;
+
+public class TestFunc {
+
+    public static String test(Node node) {
+        String s = node.getTextContent();
+        return s;
+    }
+
+}
diff --git a/test/javax/xml/jaxp/common/8032908/XSLT.java b/test/javax/xml/jaxp/common/8032908/XSLT.java
new file mode 100644
index 0000000..77ddcbc
--- /dev/null
+++ b/test/javax/xml/jaxp/common/8032908/XSLT.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8032908
+ * @summary Test if Node.getTextContent() function correctly returns children
+ * content
+ * @compile TestFunc.java XSLT.java
+ * @run main/othervm XSLT
+ */
+import java.io.ByteArrayOutputStream;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+public class XSLT {
+
+    static final String XMLTOTRANSFORM = "/in.xml";
+    static final String XSLTRANSFORMER = "/test.xsl";
+    static final String EXPECTEDRESULT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>ABCDEFG";
+
+    public static void main(String[] args) throws TransformerException {
+        ByteArrayOutputStream resStream = new ByteArrayOutputStream();
+        TransformerFactory trf = TransformerFactory.newInstance();
+        Transformer tr = trf.newTransformer(new StreamSource(System.getProperty("test.src", ".") + XSLTRANSFORMER));
+        tr.transform(new StreamSource(System.getProperty("test.src", ".") + XMLTOTRANSFORM), new StreamResult(resStream));
+        System.out.println("Transformation completed. Result:" + resStream.toString());
+        if (!resStream.toString().equals(EXPECTEDRESULT)) {
+            throw new RuntimeException("Incorrect transformation result");
+        }
+    }
+}
diff --git a/test/javax/xml/jaxp/common/8032908/in.xml b/test/javax/xml/jaxp/common/8032908/in.xml
new file mode 100644
index 0000000..0058585
--- /dev/null
+++ b/test/javax/xml/jaxp/common/8032908/in.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root><elem><level2_0>ABCD</level2_0><level2_1>EFG</level2_1></elem></root>
diff --git a/test/javax/xml/jaxp/common/8032908/test.xsl b/test/javax/xml/jaxp/common/8032908/test.xsl
new file mode 100644
index 0000000..268be0a
--- /dev/null
+++ b/test/javax/xml/jaxp/common/8032908/test.xsl
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform exclude-result-prefixes="cscdt_ufunc" version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:cscdt_ufunc="http://xml.apache.org/xalan/java">
+    <xsl:template match="elem">
+        <xsl:value-of select="cscdt_ufunc:TestFunc.test(.)" />
+    </xsl:template>
+</xsl:transform>
diff --git a/test/javax/xml/jaxp/validation/8049514/FeaturePropagationTest.java b/test/javax/xml/jaxp/validation/8049514/FeaturePropagationTest.java
new file mode 100644
index 0000000..75ea5d9
--- /dev/null
+++ b/test/javax/xml/jaxp/validation/8049514/FeaturePropagationTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/**
+ * @test
+ * @bug 8049514
+ * @summary verifies that feature set on the factory is propagated properly
+ *          to the validator
+ * @run main/othervm FeaturePropagationTest
+ */
+
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.*;
+
+/**
+ * JDK-8049514
+ *
+ * FEATURE_SECURE_PROCESSING can not be turned off on a validator through
+ * SchemaFactory
+ */
+public class FeaturePropagationTest {
+
+    static String xsd = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n"
+            + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n"
+            + "        elementFormDefault='qualified'>\n"
+            + "    <element name='test' type='string'/>\n"
+            + "</schema>\n";
+
+    public static void main(String[] args) throws Exception {
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+        StreamSource xsdSource = new StreamSource(reader);
+
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+        Schema schema = null;
+        schema = schemaFactory.newSchema(xsdSource);
+
+        Validator validator = schema.newValidator();
+
+        if (validator.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+            throw new RuntimeException("Feature set on the factory is not inherited!");
+        }
+
+    }
+}
diff --git a/test/jdk/net/Sockets/SupportedOptions.java b/test/jdk/net/Sockets/SupportedOptions.java
new file mode 100644
index 0000000..cf1d0ce
--- /dev/null
+++ b/test/jdk/net/Sockets/SupportedOptions.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8062744
+ * @run main SupportedOptions
+ */
+
+import java.net.*;
+import java.io.IOException;
+import jdk.net.*;
+
+public class SupportedOptions {
+
+    public static void main(String[] args) throws Exception {
+        if (!Sockets.supportedOptions(ServerSocket.class)
+              .contains(StandardSocketOptions.IP_TOS)) {
+            throw new RuntimeException("Test failed");
+        }
+        // Now set the option
+        ServerSocket ss = new ServerSocket();
+        Sockets.setOption(ss, java.net.StandardSocketOptions.IP_TOS, 128);
+    }
+}
diff --git a/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/Helper.java b/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/Helper.java
index bbed7f4..3d720b3 100644
--- a/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/Helper.java
+++ b/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/Helper.java
@@ -52,7 +52,7 @@
     public static final long TEST_LIMIT;
     static {
         String str = System.getProperty("testLimit");
-        TEST_LIMIT = str != null ? Long.parseUnsignedLong(str) : 2_000L;
+        TEST_LIMIT = str != null ? Long.parseUnsignedLong(str) : 2000L;
         System.out.printf("-DtestLimit=%d%n", TEST_LIMIT);
     }
 
@@ -116,6 +116,48 @@
         return size <= lag ? null : calledLog.get(size - lag - 1);
     }
 
+    public static List<Class<?>> randomClasses(Class<?>[] classes, int size) {
+        List<Class<?>> result = new ArrayList<>(size);
+        for (int i = 0; i < size; ++i) {
+            result.add(classes[RNG.nextInt(classes.length)]);
+        }
+        return result;
+    }
+
+    public static List<Class<?>> getParams(List<Class<?>> classes,
+            boolean isVararg, int argsCount) {
+        boolean unmodifiable = true;
+        List<Class<?>> result = classes.subList(0,
+                Math.min(argsCount, (MAX_ARITY / 2) - 1));
+        int extra = 0;
+        if (argsCount >= MAX_ARITY / 2) {
+            result = new ArrayList<>(result);
+            unmodifiable = false;
+            extra = (int) result.stream().filter(Helper::isDoubleCost).count();
+            int i = result.size();
+            while (result.size() + extra < argsCount) {
+                Class<?> aClass = classes.get(i);
+                if (Helper.isDoubleCost(aClass)) {
+                    ++extra;
+                    if (result.size() + extra >= argsCount) {
+                        break;
+                    }
+                }
+                result.add(aClass);
+            }
+        }
+        if (isVararg && result.size() > 0) {
+            if (unmodifiable) {
+                result = new ArrayList<>(result);
+            }
+            int last = result.size() - 1;
+            Class<?> aClass = result.get(last);
+            aClass = Array.newInstance(aClass, 2).getClass();
+            result.set(last, aClass);
+        }
+        return result;
+    }
+
     public static MethodHandle addTrailingArgs(MethodHandle target, int nargs,
             List<Class<?>> classes) {
         int targetLen = target.type().parameterCount();
@@ -230,7 +272,7 @@
         return randomArgs(params.toArray(new Class<?>[params.size()]));
     }
 
-    private static Object castToWrapper(Object value, Class<?> dst) {
+    public static Object castToWrapper(Object value, Class<?> dst) {
         Object wrap = null;
         if (value instanceof Number) {
             wrap = castToWrapperOrNull(((Number) value).longValue(), dst);
@@ -268,7 +310,7 @@
         if (dst == byte.class || dst == Byte.class) {
             return (byte) (value);
         }
-        if (dst == boolean.class || dst == boolean.class) {
+        if (dst == boolean.class || dst == Boolean.class) {
             return ((value % 29) & 1) == 0;
         }
         return null;
diff --git a/test/sun/awt/datatransfer/DataFlavorComparatorTest1.java b/test/sun/awt/datatransfer/DataFlavorComparatorTest1.java
new file mode 100644
index 0000000..cc926c8
--- /dev/null
+++ b/test/sun/awt/datatransfer/DataFlavorComparatorTest1.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 8058473
+   @summary "Comparison method violates its general contract" when using Clipboard
+            Ensure that DataTransferer.DataFlavorComparator conforms to Comparator contract
+   @author Anton Nashatyrev
+   @run main DataFlavorComparatorTest1
+*/
+import sun.awt.datatransfer.DataTransferer;
+
+import java.awt.datatransfer.DataFlavor;
+import java.util.Comparator;
+
+public class DataFlavorComparatorTest1 {
+
+    public static void main(String[] args) throws Exception {
+        String[] mimes = new String[] {
+                "text/plain",
+                "text/plain; charset=unicode",
+                "text/plain; charset=cp1251",
+                "text/plain; charset=unicode; class=java.io.InputStream",
+                "text/plain; charset=unicode; class=java.io.Serializable",
+                "text/plain; charset=unicode; class=java.lang.Object",
+                "text/plain; class=java.lang.String",
+                "text/plain; class=java.io.Reader",
+                "text/plain; class=java.lang.Object",
+                "text/html",
+                "text/html; charset=unicode",
+                "text/html; charset=cp1251",
+                "text/html; charset=unicode; class=java.io.InputStream",
+                "text/html; charset=unicode; class=java.io.Serializable",
+                "text/html; charset=unicode; class=java.lang.Object",
+                "text/html; class=java.lang.String",
+                "text/html; class=java.io.Reader",
+                "text/html; class=java.lang.Object",
+                "text/unknown",
+                "text/unknown; charset=unicode",
+                "text/unknown; charset=cp1251",
+                "text/unknown; charset=unicode; class=java.io.InputStream",
+                "text/unknown; charset=unicode; class=java.io.Serializable",
+                "text/unknown; charset=unicode; class=java.lang.Object",
+                "text/unknown; class=java.lang.String",
+                "text/unknown; class=java.io.Reader",
+                "text/unknown; class=java.lang.Object",
+                "application/unknown; class=java.io.InputStream",
+                "application/unknown; class=java.lang.Object",
+                "application/unknown",
+                "application/x-java-jvm-local-objectref; class=java.io.InputStream",
+                "application/x-java-jvm-local-objectref; class=java.lang.Object",
+                "application/x-java-jvm-local-objectref",
+                "unknown/flavor",
+                "unknown/flavor; class=java.io.InputStream",
+                "unknown/flavor; class=java.lang.Object",
+        };
+
+        DataFlavor[] flavors = new DataFlavor[mimes.length];
+        for (int i = 0; i < flavors.length; i++) {
+            flavors[i] = new DataFlavor(mimes[i]);
+        }
+
+        testComparator(new DataTransferer.DataFlavorComparator(true), flavors);
+        testComparator(new DataTransferer.DataFlavorComparator(false), flavors);
+
+    }
+
+    private static void testComparator(Comparator cmp, DataFlavor[] flavs)
+            throws ClassNotFoundException {
+
+        for (DataFlavor x: flavs) {
+            for (DataFlavor y: flavs) {
+                if (Math.signum(cmp.compare(x,y)) != -Math.signum(cmp.compare(y,x))) {
+                    throw new RuntimeException("Antisymmetry violated: " + x + ", " + y);
+                }
+                if (cmp.compare(x,y) == 0 && !x.equals(y)) {
+                    throw new RuntimeException("Equals rule violated: " + x + ", " + y);
+                }
+                for (DataFlavor z: flavs) {
+                    if (cmp.compare(x,y) == 0) {
+                        if (Math.signum(cmp.compare(x, z)) != Math.signum(cmp.compare(y, z))) {
+                            throw new RuntimeException("Transitivity (1) violated: " + x + ", " + y + ", " + z);
+                        }
+                    } else {
+                        if (Math.signum(cmp.compare(x, y)) == Math.signum(cmp.compare(y, z))) {
+                            if (Math.signum(cmp.compare(x, y)) != Math.signum(cmp.compare(x, z))) {
+                                throw new RuntimeException("Transitivity (2) violated: " + x + ", " + y + ", " + z);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/test/sun/awt/image/bug8038000.java b/test/sun/awt/image/bug8038000.java
index 2bfdc27..20affe8 100644
--- a/test/sun/awt/image/bug8038000.java
+++ b/test/sun/awt/image/bug8038000.java
@@ -23,11 +23,13 @@
 
 /**
  * @test
- * @bug     8038000
+ * @bug     8038000 8047066
  *
  * @summary Verifies that we could create different type of Rasters with height 1
  * and strideline which exceeds raster width.
  * Also checks that a set of RasterOp work correctly with such kind of Rasters.
+ * For 8047066 verifies that ColorConvertOp could process
+ * Raster (ByteBuffer + SinglePixelPackedSampleModel)
  *
  * @run     main bug8038000
  */
diff --git a/test/sun/invoke/util/ValueConversionsTest.java b/test/sun/invoke/util/ValueConversionsTest.java
index 726e90d..483afb7 100644
--- a/test/sun/invoke/util/ValueConversionsTest.java
+++ b/test/sun/invoke/util/ValueConversionsTest.java
@@ -25,11 +25,11 @@
 
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.Wrapper;
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.MethodHandle;
 import java.io.Serializable;
 import java.util.Arrays;
-import java.util.Collections;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -37,24 +37,13 @@
  * @summary unit tests for value-type conversion utilities
  * @compile -XDignore.symbol.file ValueConversionsTest.java
  * @run junit/othervm test.sun.invoke.util.ValueConversionsTest
- * @run junit/othervm
- *          -DValueConversionsTest.MAX_ARITY=255 -DValueConversionsTest.START_ARITY=250
- *              test.sun.invoke.util.ValueConversionsTest
  */
 
-// This might take a while and burn lots of metadata:
-// @run junit/othervm -DValueConversionsTest.MAX_ARITY=255 -DValueConversionsTest.EXHAUSTIVE=true test.sun.invoke.util.ValueConversionsTest
-
 /**
  *
  * @author jrose
  */
 public class ValueConversionsTest {
-    private static final Class<?> CLASS = ValueConversionsTest.class;
-    private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 40);
-    private static final int START_ARITY = Integer.getInteger(CLASS.getSimpleName()+".START_ARITY", 0);
-    private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE");
-
     @Test
     public void testUnbox() throws Throwable {
         testUnbox(false);
@@ -66,9 +55,7 @@
     }
 
     private void testUnbox(boolean doCast) throws Throwable {
-        //System.out.println("unbox");
         for (Wrapper dst : Wrapper.values()) {
-            //System.out.println(dst);
             for (Wrapper src : Wrapper.values()) {
                 testUnbox(doCast, dst, src);
             }
@@ -78,6 +65,7 @@
     private void testUnbox(boolean doCast, Wrapper dst, Wrapper src) throws Throwable {
         boolean expectThrow = !doCast && !dst.isConvertibleFrom(src);
         if (dst == Wrapper.OBJECT || src == Wrapper.OBJECT)  return;  // must have prims
+        if (dst == Wrapper.VOID   || src == Wrapper.VOID  )  return;  // must have values
         if (dst == Wrapper.OBJECT)
             expectThrow = false;  // everything (even VOID==null here) converts to OBJECT
         try {
@@ -91,9 +79,9 @@
                 }
                 MethodHandle unboxer;
                 if (doCast)
-                    unboxer = ValueConversions.unboxCast(dst.primitiveType());
+                    unboxer = ValueConversions.unboxCast(dst);
                 else
-                    unboxer = ValueConversions.unbox(dst.primitiveType());
+                    unboxer = ValueConversions.unboxWiden(dst);
                 Object expResult = (box == null) ? dst.zero() : dst.wrap(box);
                 Object result = null;
                 switch (dst) {
@@ -104,9 +92,7 @@
                     case CHAR:    result = (char)    unboxer.invokeExact(box); break;
                     case BYTE:    result = (byte)    unboxer.invokeExact(box); break;
                     case SHORT:   result = (short)   unboxer.invokeExact(box); break;
-                    case OBJECT:  result = (Object)  unboxer.invokeExact(box); break;
                     case BOOLEAN: result = (boolean) unboxer.invokeExact(box); break;
-                    case VOID:    result = null;     unboxer.invokeExact(box); break;
                 }
                 if (expectThrow) {
                     expResult = "(need an exception)";
@@ -123,25 +109,23 @@
 
     @Test
     public void testBox() throws Throwable {
-        //System.out.println("box");
         for (Wrapper w : Wrapper.values()) {
-            if (w == Wrapper.VOID)  continue;  // skip this; no unboxed form
-            //System.out.println(w);
+            if (w == Wrapper.VOID)    continue;  // skip this; no unboxed form
+            if (w == Wrapper.OBJECT)  continue;  // skip this; already unboxed
             for (int n = -5; n < 10; n++) {
                 Object box = w.wrap(n);
-                MethodHandle boxer = ValueConversions.box(w.primitiveType());
+                MethodHandle boxer = ValueConversions.boxExact(w);
                 Object expResult = box;
                 Object result = null;
                 switch (w) {
-                    case INT:     result = boxer.invokeExact(/*int*/n); break;
-                    case LONG:    result = boxer.invokeExact((long)n); break;
-                    case FLOAT:   result = boxer.invokeExact((float)n); break;
-                    case DOUBLE:  result = boxer.invokeExact((double)n); break;
-                    case CHAR:    result = boxer.invokeExact((char)n); break;
-                    case BYTE:    result = boxer.invokeExact((byte)n); break;
-                    case SHORT:   result = boxer.invokeExact((short)n); break;
-                    case OBJECT:  result = boxer.invokeExact((Object)n); break;
-                    case BOOLEAN: result = boxer.invokeExact((n & 1) != 0); break;
+                    case INT:     result = (Integer) boxer.invokeExact(/*int*/n); break;
+                    case LONG:    result = (Long)    boxer.invokeExact((long)n); break;
+                    case FLOAT:   result = (Float)   boxer.invokeExact((float)n); break;
+                    case DOUBLE:  result = (Double)  boxer.invokeExact((double)n); break;
+                    case CHAR:    result = (Character) boxer.invokeExact((char)n); break;
+                    case BYTE:    result = (Byte)    boxer.invokeExact((byte)n); break;
+                    case SHORT:   result = (Short)   boxer.invokeExact((short)n); break;
+                    case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break;
                 }
                 assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box),
                              expResult, result);
@@ -151,16 +135,14 @@
 
     @Test
     public void testCast() throws Throwable {
-        //System.out.println("cast");
         Class<?>[] types = { Object.class, Serializable.class, String.class, Number.class, Integer.class };
         Object[] objects = { new Object(), Boolean.FALSE,      "hello",      (Long)12L,    (Integer)6    };
         for (Class<?> dst : types) {
-            MethodHandle caster = ValueConversions.cast(dst);
-            assertEquals(caster.type(), ValueConversions.identity().type());
+            MethodHandle caster = ValueConversions.cast().bindTo(dst);
+            assertEquals(caster.type(), MethodHandles.identity(Object.class).type());
             for (Object obj : objects) {
                 Class<?> src = obj.getClass();
                 boolean canCast = dst.isAssignableFrom(src);
-                //System.out.println("obj="+obj+" <: dst="+dst+(canCast ? " (OK)" : " (will fail)"));
                 try {
                     Object result = caster.invokeExact(obj);
                     if (canCast)
@@ -176,25 +158,12 @@
     }
 
     @Test
-    public void testIdentity() throws Throwable {
-        //System.out.println("identity");
-        MethodHandle id = ValueConversions.identity();
-        Object expResult = "foo";
-        Object result = id.invokeExact(expResult);
-        // compiler bug:  ValueConversions.identity().invokeExact("bar");
-        assertEquals(expResult, result);
-    }
-
-    @Test
     public void testConvert() throws Throwable {
-        //System.out.println("convert");
         for (long tval = 0, ctr = 0;;) {
             if (++ctr > 99999)  throw new AssertionError("too many test values");
-            // next test value:
-            //System.out.println(Long.toHexString(tval)); // prints 3776 test patterns
+            // prints 3776 test patterns (3776 = 8*59*8)
             tval = nextTestValue(tval);
             if (tval == 0) {
-                //System.out.println("test value count = "+ctr);  // 3776 = 8*59*8
                 break;  // repeat
             }
         }
@@ -205,15 +174,12 @@
         }
     }
     static void testConvert(Wrapper src, Wrapper dst, long tval) throws Throwable {
-        //System.out.println(src+" => "+dst);
+        if (dst == Wrapper.OBJECT || src == Wrapper.OBJECT)  return;  // must have prims
+        if (dst == Wrapper.VOID   || src == Wrapper.VOID  )  return;  // must have values
         boolean testSingleCase = (tval != 0);
         final long tvalInit = tval;
         MethodHandle conv = ValueConversions.convertPrimitive(src, dst);
-        MethodType convType;
-        if (src == Wrapper.VOID)
-            convType = MethodType.methodType(dst.primitiveType() /* , void */);
-        else
-            convType = MethodType.methodType(dst.primitiveType(), src.primitiveType());
+        MethodType convType = MethodType.methodType(dst.primitiveType(), src.primitiveType());
         assertEquals(convType, conv.type());
         MethodHandle converter = conv.asType(conv.type().changeReturnType(Object.class));
         for (;;) {
@@ -229,9 +195,7 @@
                 case CHAR:    result = converter.invokeExact((char)n); break;
                 case BYTE:    result = converter.invokeExact((byte)n); break;
                 case SHORT:   result = converter.invokeExact((short)n); break;
-                case OBJECT:  result = converter.invokeExact((Object)n); break;
                 case BOOLEAN: result = converter.invokeExact((n & 1) != 0); break;
-                case VOID:    result = converter.invokeExact(); break;
                 default:  throw new AssertionError();
             }
             assertEquals("(src,dst,n,testValue)="+Arrays.asList(src,dst,"0x"+Long.toHexString(n),testValue),
@@ -269,169 +233,4 @@
         }
         return tweakSign(ux);
     }
-
-    @Test
-    public void testVarargsArray() throws Throwable {
-        //System.out.println("varargsArray");
-        final int MIN = START_ARITY;
-        final int MAX = MAX_ARITY-2;  // 253+1 would cause parameter overflow with 'this' added
-        for (int nargs = MIN; nargs <= MAX; nargs = nextArgCount(nargs, 17, MAX)) {
-            MethodHandle target = ValueConversions.varargsArray(nargs);
-            Object[] args = new Object[nargs];
-            for (int i = 0; i < nargs; i++)
-                args[i] = "#"+i;
-            Object res = target.invokeWithArguments(args);
-            assertArrayEquals(args, (Object[])res);
-        }
-    }
-
-    @Test
-    public void testVarargsReferenceArray() throws Throwable {
-        //System.out.println("varargsReferenceArray");
-        testTypedVarargsArray(Object[].class);
-        testTypedVarargsArray(String[].class);
-        testTypedVarargsArray(Number[].class);
-    }
-
-    @Test
-    public void testVarargsPrimitiveArray() throws Throwable {
-        //System.out.println("varargsPrimitiveArray");
-        testTypedVarargsArray(int[].class);
-        testTypedVarargsArray(long[].class);
-        testTypedVarargsArray(byte[].class);
-        testTypedVarargsArray(boolean[].class);
-        testTypedVarargsArray(short[].class);
-        testTypedVarargsArray(char[].class);
-        testTypedVarargsArray(float[].class);
-        testTypedVarargsArray(double[].class);
-    }
-
-    private static int nextArgCount(int nargs, int density, int MAX) {
-        if (EXHAUSTIVE)  return nargs + 1;
-        if (nargs >= MAX)  return Integer.MAX_VALUE;
-        int BOT = 20, TOP = MAX-5;
-        if (density < 10) { BOT = 10; MAX = TOP-2; }
-        if (nargs <= BOT || nargs >= TOP) {
-            ++nargs;
-        } else {
-            int bump = Math.max(1, 100 / density);
-            nargs += bump;
-            if (nargs > TOP)  nargs = TOP;
-        }
-        return nargs;
-    }
-
-    private void testTypedVarargsArray(Class<?> arrayType) throws Throwable {
-        //System.out.println(arrayType.getSimpleName());
-        Class<?> elemType = arrayType.getComponentType();
-        int MIN = START_ARITY;
-        int MAX = MAX_ARITY-2;  // 253+1 would cause parameter overflow with 'this' added
-        int density = 3;
-        if (elemType == int.class || elemType == long.class)  density = 7;
-        if (elemType == long.class || elemType == double.class) { MAX /= 2; MIN /= 2; }
-        for (int nargs = MIN; nargs <= MAX; nargs = nextArgCount(nargs, density, MAX)) {
-            Object[] args = makeTestArray(elemType, nargs);
-            MethodHandle varargsArray = ValueConversions.varargsArray(arrayType, nargs);
-            MethodType vaType = varargsArray.type();
-            assertEquals(arrayType, vaType.returnType());
-            if (nargs != 0) {
-                assertEquals(elemType, vaType.parameterType(0));
-                assertEquals(elemType, vaType.parameterType(vaType.parameterCount()-1));
-            }
-            assertEquals(MethodType.methodType(arrayType, Collections.<Class<?>>nCopies(nargs, elemType)),
-                         vaType);
-            Object res = varargsArray.invokeWithArguments(args);
-            String resString = toArrayString(res);
-            assertEquals(Arrays.toString(args), resString);
-
-            MethodHandle spreader = varargsArray.asSpreader(arrayType, nargs);
-            MethodType stype = spreader.type();
-            assert(stype == MethodType.methodType(arrayType, arrayType));
-            if (nargs <= 5) {
-                // invoke target as a spreader also:
-                @SuppressWarnings("cast")
-                Object res2 = spreader.invokeWithArguments((Object)res);
-                String res2String = toArrayString(res2);
-                assertEquals(Arrays.toString(args), res2String);
-                // invoke the spreader on a generic Object[] array; check for error
-                try {
-                    Object res3 = spreader.invokeWithArguments((Object)args);
-                    String res3String = toArrayString(res3);
-                    assertTrue(arrayType.getName(), arrayType.isAssignableFrom(Object[].class));
-                    assertEquals(Arrays.toString(args), res3String);
-                } catch (ClassCastException ex) {
-                    assertFalse(arrayType.getName(), arrayType.isAssignableFrom(Object[].class));
-                }
-            }
-            if (nargs == 0) {
-                // invoke spreader on null arglist
-                Object res3 = spreader.invokeWithArguments((Object)null);
-                String res3String = toArrayString(res3);
-                assertEquals(Arrays.toString(args), res3String);
-            }
-        }
-    }
-
-    private static Object[] makeTestArray(Class<?> elemType, int len) {
-        Wrapper elem = null;
-        if (elemType.isPrimitive())
-            elem = Wrapper.forPrimitiveType(elemType);
-        else if (Wrapper.isWrapperType(elemType))
-            elem = Wrapper.forWrapperType(elemType);
-        Object[] args = new Object[len];
-        for (int i = 0; i < len; i++) {
-            Object arg = i * 100;
-            if (elem == null) {
-                if (elemType == String.class)
-                    arg = "#"+arg;
-                arg = elemType.cast(arg);  // just to make sure
-            } else {
-                switch (elem) {
-                    case BOOLEAN: arg = (i % 3 == 0);           break;
-                    case CHAR:    arg = 'a' + i;                break;
-                    case LONG:    arg = (long)i * 1000_000_000; break;
-                    case FLOAT:   arg = (float)i / 100;         break;
-                    case DOUBLE:  arg = (double)i / 1000_000;   break;
-                }
-                arg = elem.cast(arg, elemType);
-            }
-            args[i] = arg;
-        }
-        //System.out.println(elemType.getName()+Arrays.toString(args));
-        return args;
-    }
-
-    private static String toArrayString(Object a) {
-        if (a == null)  return "null";
-        Class<?> elemType = a.getClass().getComponentType();
-        if (elemType == null)  return a.toString();
-        if (elemType.isPrimitive()) {
-            switch (Wrapper.forPrimitiveType(elemType)) {
-                case INT:      return Arrays.toString((int[])a);
-                case BYTE:     return Arrays.toString((byte[])a);
-                case BOOLEAN:  return Arrays.toString((boolean[])a);
-                case SHORT:    return Arrays.toString((short[])a);
-                case CHAR:     return Arrays.toString((char[])a);
-                case FLOAT:    return Arrays.toString((float[])a);
-                case LONG:     return Arrays.toString((long[])a);
-                case DOUBLE:   return Arrays.toString((double[])a);
-            }
-        }
-        return Arrays.toString((Object[])a);
-    }
-
-    @Test
-    public void testVarargsList() throws Throwable {
-        //System.out.println("varargsList");
-        final int MIN = START_ARITY;
-        final int MAX = MAX_ARITY-2;  // 253+1 would cause parameter overflow with 'this' added
-        for (int nargs = MIN; nargs <= MAX; nargs = nextArgCount(nargs, 7, MAX)) {
-            MethodHandle target = ValueConversions.varargsList(nargs);
-            Object[] args = new Object[nargs];
-            for (int i = 0; i < nargs; i++)
-                args[i] = "#"+i;
-            Object res = target.invokeWithArguments(args);
-            assertEquals(Arrays.asList(args), res);
-        }
-    }
 }
diff --git a/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java b/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java
index 1cd02b5..604d7dc 100644
--- a/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java
+++ b/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java
@@ -34,6 +34,7 @@
  * @bug 6672135
  * @summary setInterval() for local MonitoredHost and local MonitoredVm
  * @author Tomas Hurka
+ * @run main/othervm -XX:+UsePerfData CR6672135
  */
 public class CR6672135 {
 
diff --git a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
index 9c2f063..7508209 100644
--- a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
+++ b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,228 +21,305 @@
  * questions.
  */
 
-import java.util.concurrent.CountDownLatch;
-import java.util.regex.*;
-import java.util.*;
-import java.net.URISyntaxException;
+import java.io.File;
 import java.io.IOException;
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Semaphore;
 
-public class MonitorVmStartTerminate {
+import jdk.testlibrary.OutputBuffer;
+import jdk.testlibrary.ProcessTools;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.MonitoredVmUtil;
+import sun.jvmstat.monitor.VmIdentifier;
+import sun.jvmstat.monitor.event.HostEvent;
+import sun.jvmstat.monitor.event.HostListener;
+import sun.jvmstat.monitor.event.VmStatusChangeEvent;
 
-    private static final int SLEEPERS = 10;
-    private static final int SLEEPTIME = 5000;     // sleep time for a sleeper
-    private static final int EXECINTERVAL = 3000;   // wait time between exec's
+/*
 
-    public static void main(String args[]) throws Exception {
+ Test starts ten Java processes, each with a unique id.
 
-        long now = System.currentTimeMillis();
+ Each process creates a file named after the id and then it waits for
+ the test to remove the file, at which the Java process exits.
 
-        String sleeperArgs = SLEEPTIME + " " + now;
-        String sleeperPattern = "Sleeper " + sleeperArgs + " \\d+$";
+ The processes are monitored by the test to make sure notifications
+ are sent when they are started/terminated.
+
+ To avoid Java processes being left behind, in case of an unexpected
+ failure, shutdown hooks are installed that remove files when the test
+ exits. If files are not removed, i.e. due to a JVM crash, the Java
+ processes will exit themselves after 1000 s.
+
+*/
+
+/*
+ * @test
+ * @bug 4990825
+ * @summary attach to external but local JVM processes
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main/othervm MonitorVmStartTerminate
+ */
+public final class MonitorVmStartTerminate {
+
+    private static final int PROCESS_COUNT = 10;
+
+    public static void main(String... args) throws Exception {
 
         MonitoredHost host = MonitoredHost.getMonitoredHost("localhost");
-        host.setInterval(200);
+        host.setInterval(1); // 1 ms
 
-        Matcher matcher = Pattern.compile(sleeperPattern).matcher("");
-        SleeperListener listener = new SleeperListener(host, matcher, SLEEPERS);
+        String id = UUID.randomUUID().toString();
+
+        List<JavaProcess> javaProcesses = new ArrayList<>();
+        for (int i = 0; i < PROCESS_COUNT; i++) {
+            javaProcesses.add(new JavaProcess(id + "_" + i));
+        }
+
+        Listener listener = new Listener(host, javaProcesses);
         host.addHostListener(listener);
-
-        SleeperStarter ss = new SleeperStarter(SLEEPERS, EXECINTERVAL,
-                                               sleeperArgs);
-        ss.start();
-
-        System.out.println("Waiting for "
-                           + SLEEPERS + " sleepers to terminate");
-        try {
-            ss.join();
-        } catch (InterruptedException e) {
-            throw new Exception("Timed out waiting for sleepers");
+        for (JavaProcess javaProcess : javaProcesses) {
+            javaProcess.start();
         }
-        listener.waitForSleepersToStart();
-        listener.waitForSleepersToTerminate();
+
+        // Wait for all processes to start before terminating
+        // them, so pids are not reused within a poll interval.
+        System.out.println("Waiting for all processes to get started notification");
+        listener.started.acquire(PROCESS_COUNT);
+
+        for (JavaProcess javaProcess : javaProcesses) {
+            javaProcess.terminate();
+        }
+        System.out.println("Waiting for all processes to get terminated notification");
+        listener.terminated.acquire(PROCESS_COUNT);
+
+        host.removeHostListener(listener);
     }
 
-    public static class SleeperListener implements HostListener {
-
-        private final List<Integer> targets =  new ArrayList<>();
-        private final CountDownLatch terminateLatch;
-        private final CountDownLatch startLatch;
+    private static final class Listener implements HostListener {
+        private final Semaphore started = new Semaphore(0);
+        private final Semaphore terminated = new Semaphore(0);
         private final MonitoredHost host;
-        private final Matcher patternMatcher;
+        private final List<JavaProcess> processes;
 
-        public SleeperListener(MonitoredHost host, Matcher matcher, int count) {
+        public Listener(MonitoredHost host, List<JavaProcess> processes) {
             this.host = host;
-            this.patternMatcher = matcher;
-            this.terminateLatch = new CountDownLatch(count);
-            this.startLatch = new CountDownLatch(count);
+            this.processes = processes;
+            printStatus();
         }
 
-        public void waitForSleepersToTerminate() throws InterruptedException {
-            terminateLatch.await();
-        }
-
-        public void waitForSleepersToStart() throws InterruptedException {
-            startLatch.await();
-        }
-
-        private void printList(Set<Integer> list, String msg) {
-            System.out.println(msg + ":");
-            for (Integer lvmid : list) {
-                try {
-                    VmIdentifier vmid = new VmIdentifier("//" + lvmid.intValue());
-                    MonitoredVm target = host.getMonitoredVm(vmid);
-
-                    StringMonitor cmdMonitor =
-                            (StringMonitor)target.findByName("sun.rt.javaCommand");
-                    String cmd = cmdMonitor.stringValue();
-
-                    System.out.println("\t" + lvmid.intValue() + ": "
-                                       + "\"" + cmd + "\"" + ": ");
-                } catch (URISyntaxException e) {
-                    System.err.println("Unexpected URISyntaxException: "
-                                       + e.getMessage());
-                } catch (MonitorException e) {
-                    System.out.println("\t" + lvmid.intValue()
-                                       + ": error reading monitoring data: "
-                                       + " target possibly terminated?");
-                }
-            }
-        }
-
-
-        private int addStarted(Set<Integer> started) {
-            int found = 0;
-            for (Integer lvmid : started) {
-                try {
-                    VmIdentifier vmid = new VmIdentifier("//" + lvmid.intValue());
-                    MonitoredVm target = host.getMonitoredVm(vmid);
-
-                    StringMonitor cmdMonitor =
-                            (StringMonitor)target.findByName("sun.rt.javaCommand");
-                    String cmd = cmdMonitor.stringValue();
-
-                    patternMatcher.reset(cmd);
-                    System.out.print("Started: " + lvmid.intValue()
-                                     + ": " + "\"" + cmd + "\"" + ": ");
-
-                    if (patternMatcher.matches()) {
-                        System.out.println("matches pattern - recorded");
-                        targets.add(lvmid);
-                        found++;
-                    }
-                    else {
-                        System.out.println("does not match pattern - ignored");
-                    }
-                } catch (URISyntaxException e) {
-                    System.err.println("Unexpected URISyntaxException: "
-                                       + e.getMessage());
-                } catch (MonitorException e) {
-                    System.err.println("Unexpected MonitorException: "
-                                       + e.getMessage());
-                }
-            }
-            return found;
-        }
-
-        private int removeTerminated(Set<Integer> terminated) {
-            int found = 0;
-            for (Integer lvmid : terminated) {
-                /*
-                 * we don't attempt to attach to the target here as it's
-                 * now dead and has no jvmstat share memory file. Just see
-                 * if the process id is among those that we saved when we
-                 * started the targets (note - duplicated allowed and somewhat
-                 * expected on windows);
-                 */
-                System.out.print("Terminated: " + lvmid.intValue() + ": ");
-                if (targets.contains(lvmid)) {
-                    System.out.println("matches pattern - termination recorded");
-                    targets.remove(lvmid);
-                    found++;
-                }
-                else {
-                    System.out.println("does not match pattern - ignored");
-                }
-            }
-            return found;
-        }
-
+        @Override
         @SuppressWarnings("unchecked")
-        public void vmStatusChanged(VmStatusChangeEvent ev) {
-            printList(ev.getActive(), "Active");
-            printList(ev.getStarted(), "Started");
-            printList(ev.getTerminated(), "Terminated");
+        public void vmStatusChanged(VmStatusChangeEvent event) {
+            releaseStarted(event.getStarted());
+            releaseTerminated(event.getTerminated());
+            printStatus();
+        }
 
-            int recentlyStarted = addStarted(ev.getStarted());
-            int recentlyTerminated = removeTerminated(ev.getTerminated());
+        private void printStatus() {
+            System.out.printf("started=%d, terminated=%d\n",
+                    started.availablePermits(), terminated.availablePermits());
+        }
 
-            for (int i = 0; i < recentlyTerminated; i++) {
-                terminateLatch.countDown();
-            }
-            for (int i = 0; i < recentlyStarted; i++) {
-                startLatch.countDown();
+        @Override
+        public void disconnected(HostEvent arg0) {
+            // ignore
+        }
+
+        private void releaseStarted(Set<Integer> ids) {
+            System.out.println("realeaseStarted(" + ids + ")");
+            for (Integer id : ids) {
+                releaseStarted(id);
             }
         }
 
-        public void disconnected(HostEvent ev) {
+        private void releaseStarted(Integer id) {
+            for (JavaProcess jp : processes) {
+                if (hasMainArgs(id, jp.getMainArgsIdentifier())) {
+                    // store id for terminated identification
+                    jp.setId(id);
+                    System.out.println("RELEASED (id=" + jp.getId() + ", args=" + jp.getMainArgsIdentifier() + ")");
+                    started.release();
+                    return;
+                }
+            }
+        }
+
+        private void releaseTerminated(Set<Integer> ids) {
+            System.out.println("releaseTerminated(" + ids + ")");
+            for (Integer id : ids) {
+                releaseTerminated(id);
+            }
+        }
+
+        private void releaseTerminated(Integer id) {
+            for (JavaProcess jp : processes) {
+                if (id.equals(jp.getId())) {
+                    System.out.println("RELEASED (id=" + jp.getId() + ", args=" + jp.getMainArgsIdentifier() + ")");
+                    terminated.release();
+                    return;
+                }
+            }
+        }
+
+        private boolean hasMainArgs(Integer id, String args) {
+            try {
+                VmIdentifier vmid = new VmIdentifier("//" + id.intValue());
+                MonitoredVm target = host.getMonitoredVm(vmid);
+                String monitoredArgs = MonitoredVmUtil.mainArgs(target);
+                if (monitoredArgs != null && monitoredArgs.contains(args)) {
+                    return true;
+                }
+            } catch (URISyntaxException | MonitorException e) {
+                // ok. process probably not running
+            }
+            return false;
         }
     }
 
-    public static class SleeperStarter extends Thread {
+    public final static class JavaProcess {
 
-        private final JavaProcess[] processes;
-        private final int execInterval;
-        private final String args;
+        private static final class ShutdownHook extends Thread {
+            private final JavaProcess javaProcess;
 
-        public SleeperStarter(int sleepers, int execInterval, String args) {
-            this.execInterval = execInterval;
-            this.args = args;
-            this.processes = new JavaProcess[sleepers];
-        }
-
-        private synchronized int active() {
-            int active = processes.length;
-            for(JavaProcess jp : processes) {
-                try {
-                    jp.exitValue();
-                    active--;
-                } catch (IllegalThreadStateException e) {
-                    // process hasn't exited yet
-                }
+            public ShutdownHook(JavaProcess javaProcess) {
+                this.javaProcess = javaProcess;
             }
-            return active;
+
+            public void run() {
+                javaProcess.terminate();
+            }
         }
 
-        public void run() {
-           System.out.println("Starting " + processes.length + " sleepers");
+        public static void main(String[] args) throws InterruptedException {
+            try {
+                Path path = Paths.get(args[0]);
+                createFile(path);
+                waitForRemoval(path);
+            } catch (Throwable t) {
+                t.printStackTrace();
+                System.exit(1);
+            }
+        }
 
-           String[] classpath = {
-               "-classpath",
-               System.getProperty("java.class.path")
-           };
+        public Integer getId() {
+            return id;
+        }
 
-           for (int i = 0; i < processes.length; i++) {
-               try {
-                   System.out.println("Starting Sleeper " + i);
-                   synchronized(this) {
-                       processes[i] = new JavaProcess("Sleeper", args + " " + i);
-                       processes[i].addOptions(classpath);
-                   }
-                   processes[i].start();
-                   Thread.sleep(execInterval);
-               } catch (InterruptedException ignore) {
-               } catch (IOException e) {
-                   System.err.println(
-                           "IOException trying to start Sleeper " + i + ": "
-                           + e.getMessage());
-               }
-           }
+        public void setId(Integer id) {
+            this.id = id;
+        }
 
-           // spin waiting for the processes to terminate
-           while (active() > 0) ;
+        private static void createFile(Path path) throws IOException {
+            Files.write(path, new byte[0], StandardOpenOption.CREATE);
+        }
+
+        private static void waitForRemoval(Path path) {
+            String timeoutFactorText = System.getProperty("test.timeout.factor", "1.0");
+            double timeoutFactor = Double.parseDouble(timeoutFactorText);
+            long timeoutNanos = 1000_000_000L*(long)(1000*timeoutFactor);
+            long start = System.nanoTime();
+            while (true) {
+                long now = System.nanoTime();
+                long waited = now - start;
+                System.out.println("Waiting for " + path + " to be removed, " + waited + " ns");
+                if (!Files.exists(path)) {
+                    return;
+                }
+                if (waited > timeoutNanos) {
+                    System.out.println("Start: " + start);
+                    System.out.println("Now: " + now);
+                    System.out.println("Process timed out after " + waited + " ns. Abort.");
+                    System.exit(1);
+                }
+                takeNap();
+            }
+        }
+
+        private static void takeNap() {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
+
+        private final String mainArgsIdentifier;
+        private final ShutdownHook shutdownHook;
+        private volatile Integer id;
+
+        public JavaProcess(String mainArgsIdentifier) {
+            this.mainArgsIdentifier = mainArgsIdentifier;
+            this.shutdownHook = new ShutdownHook(this);
+        }
+
+        /**
+         * Starts a Java process asynchronously.
+         *
+         * The process runs until {@link #stop()} is called. If test exits
+         * unexpectedly the process will be cleaned up by a shutdown hook.
+         *
+         * @throws Exception
+         */
+        public void start() throws Exception {
+            Runtime.getRuntime().addShutdownHook(shutdownHook);
+            System.out.println("Starting " + getMainArgsIdentifier());
+
+            Runnable r = new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        executeJava();
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
+                }
+            };
+            new Thread(r).start();
+        }
+
+        public void terminate() {
+            try {
+                System.out.println("Terminating " + mainArgsIdentifier);
+                // File must be created before proceeding,
+                // otherwise Java process may loop forever
+                // waiting for file to be removed.
+                Path path = Paths.get(mainArgsIdentifier);
+                while (!Files.exists(path)) {
+                    takeNap();
+                }
+                Files.delete(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            Runtime.getRuntime().removeShutdownHook(shutdownHook);
+        }
+
+        private void executeJava() throws Exception, IOException {
+            String className = JavaProcess.class.getName();
+            String classPath = System.getProperty("test.classes");
+            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-Dtest.timeout.factor=" + System.getProperty("test.timeout.factor", "1.0"),
+                "-cp", classPath, className, mainArgsIdentifier);
+            OutputBuffer ob = ProcessTools.getOutput(pb.start());
+            System.out.println("Java Process " + getMainArgsIdentifier() + " stderr:"
+                    + ob.getStderr());
+            System.err.println("Java Process " + getMainArgsIdentifier() + " stdout:"
+                    + ob.getStdout());
+        }
+
+        public String getMainArgsIdentifier() {
+            return mainArgsIdentifier;
         }
     }
 }
-
diff --git a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh
deleted file mode 100644
index 152ec93..0000000
--- a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @test
-# @bug 4990825
-# @summary attach to external but local JVM processes
-# @library ../../testlibrary
-# @build Sleeper
-# @build JavaProcess
-# @build MonitorVmStartTerminate
-# @run shell MonitorVmStartTerminate.sh
-#
-
-. ${TESTSRC-.}/../../testlibrary/utils.sh
-
-setup
-verify_os
-
-JAVA="${TESTJAVA}/bin/java"
-CP=${TESTJAVA}${FS}lib${FS}tools.jar${PS}${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${FS}..${FS}testlibrary
-
-${JAVA} ${TESTVMOPTS} -classpath ${CP} MonitorVmStartTerminate
diff --git a/test/sun/jvmstat/testlibrary/JavaProcess.java b/test/sun/jvmstat/testlibrary/JavaProcess.java
deleted file mode 100644
index 664947b..0000000
--- a/test/sun/jvmstat/testlibrary/JavaProcess.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- *
- */
-
-import java.io.*;
-
-public class JavaProcess {
-
-    protected Process process = null;
-
-    private String classname;
-    private StringBuilder classArgs;
-    private StringBuilder javaOptions;
-
-    private static String java = System.getProperty("java.home")
-                                 + File.separator + "bin"
-                                 + File.separator + "java";
-
-    public JavaProcess(String classname) {
-        this(classname, "", "");
-    }
-
-    public JavaProcess(String classname, String classArgs) {
-        this(classname, "", classArgs);
-    }
-
-    public JavaProcess(String classname, String javaOptions, String classArgs) {
-        this.classname = classname;
-        this.javaOptions = new StringBuilder(javaOptions);
-        this.classArgs = new StringBuilder(classArgs);
-    }
-
-    /**
-     * add java options to the java command
-     */
-    public void addOptions(String[] opts) {
-        if (javaOptions != null && javaOptions.length() > 0) {
-            javaOptions.append(" ");
-        }
-
-        for (int i = 0; i < opts.length; i++) {
-            if (i != 0) {
-                javaOptions.append(" ");
-            }
-            javaOptions.append(opts[i]);
-        }
-    }
-
-    /**
-     * add arguments to the class arguments
-     */
-    public void addArguments(String[] args) {
-        if (classArgs != null && classArgs.length() > 0) {
-            classArgs.append(" ");
-        }
-
-        for (int i = 0; i < args.length; i++) {
-            if (i != 0) {
-                classArgs.append(" ");
-            }
-            classArgs.append(args[i]);
-        }
-    }
-
-    /**
-     * start the java process
-     */
-    public void start() throws IOException {
-        if (process != null) {
-            return;
-        }
-
-        String javaCommand = java + " " + javaOptions + " "
-                             + classname + " " + classArgs;
-
-        System.out.println("exec'ing: " + javaCommand);
-
-        process = Runtime.getRuntime().exec(javaCommand);
-    }
-
-    /**
-     * destroy the java process
-     */
-    public void destroy() {
-        if (process != null) {
-            process.destroy();
-        }
-        process = null;
-    }
-
-    public int exitValue() {
-        if (process != null) {
-            return process.exitValue();
-        }
-        throw new RuntimeException("exitValue called with process == null");
-    }
-
-    public InputStream getErrorStream() {
-        if (process != null) {
-            return process.getErrorStream();
-        }
-        throw new RuntimeException(
-                "getErrorStream() called with process == null");
-    }
-
-    public InputStream getInputStream() {
-        if (process != null) {
-            return process.getInputStream();
-        }
-        throw new RuntimeException(
-                "getInputStream() called with process == null");
-    }
-
-    public OutputStream getOutputStream() {
-        if (process != null) {
-            return process.getOutputStream();
-        }
-        throw new RuntimeException(
-                "getOutputStream() called with process == null");
-    }
-
-    public int waitFor() throws InterruptedException {
-        if (process != null) {
-            return process.waitFor();
-        }
-        throw new RuntimeException("waitFor() called with process == null");
-    }
-}
diff --git a/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java b/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
index 2439765..558b2da 100644
--- a/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
+++ b/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,9 +143,12 @@
                 String vmid = name.substring(0, name.indexOf("@"));
                 System.out.println("vmid = " + vmid);
                 VirtualMachine vm = VirtualMachine.attach(vmid);
-                String agent = vm.getSystemProperties().getProperty("java.home") +
-                        File.separator + "lib" + File.separator + "management-agent.jar";
-                vm.loadAgent(agent, "com.sun.management.jmxremote.port=0,com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl=false");
+                Properties p = new Properties();
+                p.put("com.sun.management.jmxremote.port", "0");
+                p.put("com.sun.management.jmxremote.authenticate", "false");
+                p.put("com.sun.management.jmxremote.ssl", "false");
+                vm.startManagementAgent(p);
+                vm.startLocalManagementAgent();
                 vm.detach();
                 String localAddress2 = ConnectorAddressLink.importFrom(0);
                 if (localAddress2 == null) {
diff --git a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
index 6eecbda..54173e6 100644
--- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
+++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,16 +79,6 @@
         return doTest("1", "-Dcom.sun.management.jmxremote");
     }
 
-    private static boolean test2() throws Exception {
-        Path agentPath = findAgent();
-        if (agentPath != null) {
-            String agent = agentPath.toString();
-            return doTest("2", "-javaagent:" + agent);
-        } else {
-            return false;
-        }
-    }
-
     /**
      * no args (blank) - manager should attach and start agent
      */
@@ -97,68 +87,12 @@
     }
 
     /**
-     * sanity check arguments to management-agent.jar
-     */
-    private static boolean test4() throws Exception {
-        Path agentPath = findAgent();
-        if (agentPath != null) {
-            ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(
-                "-javaagent:" + agentPath.toString() +
-                "=com.sun.management.jmxremote.port=7775," +
-                "com.sun.management.jmxremote.authenticate=false," +
-                "com.sun.management.jmxremote.ssl=false",
-                "-cp",
-                TEST_CLASSPATH,
-                "TestApplication",
-                "-exit"
-            );
-
-            Process prc = null;
-            try {
-                prc = ProcessTools.startProcess(
-                    "TestApplication",
-                    builder
-                );
-                int exitCode = prc.waitFor();
-                return exitCode == 0;
-            } finally {
-                if (prc != null) {
-                    prc.destroy();
-                    prc.waitFor();
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
      * use DNS-only name service
      */
     private static boolean test5() throws Exception {
         return doTest("5", "-Dsun.net.spi.namservice.provider.1=\"dns,sun\"");
     }
 
-    private static Path findAgent() {
-        FileSystem FS = FileSystems.getDefault();
-        Path agentPath = FS.getPath(
-            TEST_JDK, "jre", "lib", "management-agent.jar"
-        );
-        if (!isFileOk(agentPath)) {
-            agentPath = FS.getPath(
-                TEST_JDK, "lib", "management-agent.jar"
-            );
-        }
-        if (!isFileOk(agentPath)) {
-            System.err.println("Can not locate management-agent.jar");
-            return null;
-        }
-        return agentPath;
-    }
-
-    private static boolean isFileOk(Path path) {
-        return Files.isRegularFile(path) && Files.isReadable(path);
-    }
-
     private static boolean doTest(String testId, String arg) throws Exception {
         List<String> args = new ArrayList<>();
         args.add("-cp");
diff --git a/test/sun/management/jmxremote/bootstrap/TestManager.java b/test/sun/management/jmxremote/bootstrap/TestManager.java
index 4495c2d..76b4324 100644
--- a/test/sun/management/jmxremote/bootstrap/TestManager.java
+++ b/test/sun/management/jmxremote/bootstrap/TestManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.net.Socket;
 import java.net.InetSocketAddress;
-import java.io.File;
 import java.io.IOException;
 
 // Sun specific
@@ -55,28 +54,8 @@
      * Starts the management agent in the target VM
      */
     private static void startManagementAgent(String pid) throws IOException {
-        /*
-         * JAR file normally in ${java.home}/jre/lib but may be in ${java.home}/lib
-         * with development/non-images builds
-         */
-        String home = System.getProperty("java.home");
-        String agent = home + File.separator + "jre" + File.separator + "lib"
-                + File.separator + "management-agent.jar";
-        File f = new File(agent);
-        if (!f.exists()) {
-            agent = home + File.separator + "lib" + File.separator +
-                "management-agent.jar";
-            f = new File(agent);
-            if (!f.exists()) {
-                throw new RuntimeException("management-agent.jar missing");
-            }
-        }
-        agent = f.getCanonicalPath();
-
-        System.out.println("Loading " + agent + " into target VM ...");
-
         try {
-            VirtualMachine.attach(pid).loadAgent(agent);
+            VirtualMachine.attach(pid).startLocalManagementAgent();
         } catch (Exception x) {
             throw new IOException(x.getMessage());
         }
@@ -122,8 +101,7 @@
 
         if (agentPropLocalConnectorAddress == null &&
             jvmstatLocalConnectorAddress == null) {
-            // No JMX Connector address so attach to VM, and load
-            // management-agent.jar
+            // No JMX Connector address so attach to VM, and start local agent
             startManagementAgent(pid);
             agentPropLocalConnectorAddress = (String)
                 vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP);
diff --git a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index cacb708..d937244 100644
--- a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,13 @@
 import java.rmi.registry.Registry;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
 
 import javax.management.*;
@@ -60,7 +57,6 @@
  *          JCMD achieves the desired results
  */
 public class JMXStartStopTest {
-    private static final String TEST_JDK = System.getProperty("test.jdk");
     private static final String TEST_SRC = System.getProperty("test.src");
 
     private static final boolean verbose = false;
@@ -76,8 +72,8 @@
                                   QueryExp query)
     throws Exception {
 
-        Set names = server.queryNames(pattern,query);
-        for (Iterator i=names.iterator(); i.hasNext(); ) {
+        Set<ObjectName> names = server.queryNames(pattern,query);
+        for (Iterator<ObjectName> i = names.iterator(); i.hasNext(); ) {
             ObjectName name = (ObjectName)i.next();
             MBeanInfo info = server.getMBeanInfo(name);
             dbg_print("Got MBean: " + name);
@@ -87,7 +83,7 @@
                 continue;
             for (MBeanAttributeInfo attr : attrs) {
                 if (attr.isReadable()) {
-                    Object o = server.getAttribute(name, attr.getName());
+                    server.getAttribute(name, attr.getName());
                 }
             }
         }
@@ -108,9 +104,8 @@
             }
 
             JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
-            Map m = new HashMap();
 
-            JMXConnector c = JMXConnectorFactory.connect(url,m);
+            JMXConnector c = JMXConnectorFactory.connect(url, null);
 
             MBeanServerConnection conn = c.getMBeanServerConnection();
             ObjectName pattern = new ObjectName("java.lang:type=Memory,*");
@@ -180,9 +175,8 @@
                 port);
 
         JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
-        Map m = new HashMap();
 
-        JMXConnector c = JMXConnectorFactory.connect(url,m);
+        JMXConnector c = JMXConnectorFactory.connect(url, null);
 
         MBeanServerConnection conn = c.getMBeanServerConnection();
         ObjectName pattern = new ObjectName("java.lang:type=Memory,*");
@@ -273,25 +267,6 @@
         }
     }
 
-    /**
-     * Retrieves the PID of the test application using JCMD
-     * @return The PID of the test application
-     * @throws InterruptedException
-     * @throws IOException
-     */
-    private static String getPID() throws InterruptedException, IOException {
-        final AtomicReference<String> pid = new AtomicReference<>();
-        jcmd(
-            null,
-            line -> {
-                if (line.endsWith("JMXStartStopDoSomething")) {
-                    pid.set(line.split(" ")[0]);
-                }
-            }
-        );
-        return pid.get();
-    }
-
     private static class Something {
         private Process p;
         private final ProcessBuilder pb;
@@ -434,7 +409,7 @@
     private static final int port1 = 50234;
     private static final int port2 = 50235;
 
-    private static void test_01() throws Exception {
+    static void test_01() throws Exception {
         // Run an app with JMX enabled stop it and
         // restart on other port
 
@@ -459,7 +434,7 @@
         }
     }
 
-    private static void test_02() throws Exception {
+    static void test_02() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd
 
@@ -478,7 +453,7 @@
         }
     }
 
-    private static void test_03() throws Exception {
+    static void test_03() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port than on other one
 
@@ -507,7 +482,7 @@
         }
     }
 
-    private static void test_04() throws Exception {
+    static void test_04() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port, specify rmi port explicitly
 
@@ -528,7 +503,7 @@
         }
     }
 
-    private static void test_05() throws Exception {
+    static void test_05() throws Exception {
         // Run an app without JMX enabled, it will enable local server
         // but should leave remote server disabled
 
@@ -545,7 +520,7 @@
         }
     }
 
-    private static void test_06() throws Exception {
+    static void test_06() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port, specify rmi port explicitly
         // attempt to start it again
@@ -569,7 +544,7 @@
             final boolean[] checks = new boolean[3];
             jcmd(
                 line -> {
-                    if (line.equals("java.lang.RuntimeException: Invalid agent state")) {
+                    if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
                         checks[0] = true;
                     }
                 },
@@ -580,7 +555,7 @@
 
             jcmd(
                 line -> {
-                    if (line.equals("java.lang.RuntimeException: Invalid agent state")) {
+                    if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
                         checks[1] = true;
                     }
                 },
@@ -648,7 +623,7 @@
         }
     }
 
-    private static void test_08() throws Exception {
+    static void test_08() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -682,7 +657,7 @@
         }
     }
 
-    private static void test_09() throws Exception {
+    static void test_09() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -718,7 +693,7 @@
         }
     }
 
-    private static void test_10() throws Exception {
+    static void test_10() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -754,7 +729,7 @@
         }
     }
 
-    private static void test_11() throws Exception {
+    static void test_11() throws Exception {
         // Run an app with JMX enabled
         // stop remote agent
         // make sure local agent is not affected
@@ -775,7 +750,7 @@
         }
     }
 
-    private static void test_12() throws Exception {
+    static void test_12() throws Exception {
         // Run an app with JMX disabled
         // start local agent only
 
@@ -793,28 +768,4 @@
             s.stop();
         }
     }
-
-    private static void test_13() throws Exception {
-        // Run an app with -javaagent make sure it works as expected -
-        // system properties are ignored
-
-        System.out.println("**** Test thirteen ****");
-
-        String agent = TEST_JDK + "/jre/lib/management-agent.jar";
-        if (!new File(agent).exists()) {
-            agent = TEST_JDK + "/lib/management-agent.jar";
-        }
-
-        Something s = doSomething("test_14",
-            "-javaagent:" + agent + "=com.sun.management.jmxremote.port=" +
-                port1 + ",com.sun.management.jmxremote.authenticate=false",
-            "-Dcom.sun.management.jmxremote.ssl=false"
-        );
-
-        try {
-            testNoConnect(port1);
-        } finally {
-            s.stop();
-        }
-    }
 }
diff --git a/test/sun/misc/URLClassPath/EnableLookupCache.java b/test/sun/misc/URLClassPath/EnableLookupCache.java
new file mode 100644
index 0000000..2ff3801
--- /dev/null
+++ b/test/sun/misc/URLClassPath/EnableLookupCache.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8061651
+ * @summary -Dsun.cds.enableSharedLookupCache specified on the command-line
+ *          should have no effect.
+ * @run main/othervm -Dsun.cds.enableSharedLookupCache=true -Xshare:off -Dfoo.foo.bar=xyz EnableLookupCache
+ */
+
+public class EnableLookupCache {
+    public static void main(String[] args) throws Exception {
+        // If JVM is started with -Xshare:off, the sun.cds.enableSharedLookupCache
+        // should never be true, even if it has been explicitly set in the
+        // command-line.
+        String prop = "sun.cds.enableSharedLookupCache";
+        String value = System.getProperty(prop);
+        System.out.println("System.getProperty(\"" + prop + "\") = \"" + value+ "\"");
+
+        if ("true".equals(value)) {
+            System.out.println("Test FAILED: system property " + prop +
+                               " is \"true\" (unexpected)");
+            throw new RuntimeException(prop + " should not be " + value);
+        }
+
+        // Make sure the -D... arguments in the @run tag are indeed used.
+        prop = "foo.foo.bar";
+        value = System.getProperty(prop);
+        System.out.println("System.getProperty(\"" + prop + "\") = \"" + value+ "\"");
+        if (!"xyz".equals(value)) {
+            System.out.println("Test FAILED: system property " + prop +
+                               " should be \"xyz\" -- is JTREG set up properly?");
+            throw new RuntimeException(prop + " should not be " + value);
+        }
+
+
+        // We should be able to load the other classes without issue.
+        A.test();
+        B.test();
+        System.out.println("Test PASSED");
+    }
+
+    static class A {static void test() {}}
+    static class B {static void test() {}}
+}
+
diff --git a/test/sun/net/ftp/FtpURL.java b/test/sun/net/ftp/FtpURL.java
index 117913f..64c4e8f 100644
--- a/test/sun/net/ftp/FtpURL.java
+++ b/test/sun/net/ftp/FtpURL.java
@@ -483,7 +483,7 @@
 
             // Now let's check the URL handler
 
-            url = new URL("ftp://user2:@localhost:" + port + "/%2Fusr/bin;type=d");
+            url = new URL("ftp://user2@localhost:" + port + "/%2Fusr/bin;type=d");
             con = url.openConnection();
             in = new BufferedReader(new InputStreamReader(con.getInputStream()));
             do {
diff --git a/test/sun/security/jgss/GssMemoryIssues.java b/test/sun/security/jgss/GssMemoryIssues.java
new file mode 100644
index 0000000..91f9a45
--- /dev/null
+++ b/test/sun/security/jgss/GssMemoryIssues.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8028780
+ * @summary JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
+ * @run main/othervm -Xmx8m GssMemoryIssues
+ */
+
+import org.ietf.jgss.GSSException;
+import org.ietf.jgss.GSSManager;
+import org.ietf.jgss.GSSName;
+
+public class GssMemoryIssues {
+
+    public static void main(String[] argv) throws Exception {
+        GSSManager man = GSSManager.getInstance();
+        String s = "me@REALM";
+        GSSName name = man.createName(s, GSSName.NT_USER_NAME);
+        byte[] exported = name.export();
+        // Offset of the length of the mech name. Length in big endian
+        int lenOffset = exported.length - s.length() - 4;
+        // Make it huge
+        exported[lenOffset] = 0x7f;
+        try {
+            man.createName(exported, GSSName.NT_EXPORT_NAME);
+        } catch (GSSException gsse) {
+            System.out.println(gsse);
+        }
+    }
+}
diff --git a/test/sun/security/jgss/spnego/NotPreferredMech.java b/test/sun/security/jgss/spnego/NotPreferredMech.java
new file mode 100644
index 0000000..5eb8150
--- /dev/null
+++ b/test/sun/security/jgss/spnego/NotPreferredMech.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8048194
+ * @run main/othervm NotPreferredMech
+ * @summary GSSContext.acceptSecContext fails when a supported mech is not initiator preferred
+ */
+
+import org.ietf.jgss.*;
+import sun.security.jgss.*;
+import sun.security.jgss.spnego.NegTokenInit;
+import sun.security.jgss.spnego.NegTokenTarg;
+import sun.security.util.BitArray;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+public class NotPreferredMech {
+
+    public static void main(String[] argv) throws Exception {
+
+        // Generates a NegTokenInit mechTypes field, with an
+        // unsupported mech as the preferred.
+        DerOutputStream mech = new DerOutputStream();
+        mech.write(new Oid("1.2.3.4").getDER());
+        mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER());
+        DerOutputStream mechTypeList = new DerOutputStream();
+        mechTypeList.write(DerValue.tag_Sequence, mech);
+
+        // Generates a NegTokenInit mechToken field for 1.2.3.4 mech
+        GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1);
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        h1.encode(bout);
+        bout.write(new byte[1]);
+
+        // Generates the NegTokenInit token
+        Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor(
+                byte[].class, BitArray.class, byte[].class, byte[].class);
+        ctor.setAccessible(true);
+        NegTokenInit initToken = ctor.newInstance(
+                mechTypeList.toByteArray(),
+                new BitArray(0),
+                bout.toByteArray(),
+                null);
+        Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken")
+                .getDeclaredMethod("getEncoded");
+        m.setAccessible(true);
+        byte[] spnegoToken = (byte[])m.invoke(initToken);
+
+        // and wraps it into a GSSToken
+        GSSHeader h = new GSSHeader(
+                new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()),
+                spnegoToken.length);
+        bout = new ByteArrayOutputStream();
+        h.encode(bout);
+        bout.write(spnegoToken);
+        byte[] token = bout.toByteArray();
+
+        // and feeds it to a GSS acceptor
+        GSSManager man = GSSManager.getInstance();
+        GSSContext ctxt = man.createContext((GSSCredential) null);
+        token = ctxt.acceptSecContext(token, 0, token.length);
+        NegTokenTarg targ = new NegTokenTarg(token);
+
+        // Make sure it's a GO-ON message
+        Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult");
+        m2.setAccessible(true);
+        int negResult = (int)m2.invoke(targ);
+
+        if (negResult != 1 /* ACCEPT_INCOMPLETE */) {
+            throw new Exception("Not a continue");
+        }
+    }
+}
diff --git a/test/sun/security/krb5/TimeInCCache.java b/test/sun/security/krb5/TimeInCCache.java
deleted file mode 100644
index 6c33d2e..0000000
--- a/test/sun/security/krb5/TimeInCCache.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6590930
- * @run main/othervm TimeInCCache
- * @summary read/write does not match for ccache
- */
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import sun.security.krb5.internal.ccache.CCacheInputStream;
-import sun.security.krb5.internal.ccache.Credentials;
-
-public class TimeInCCache {
-    public static void main(String[] args) throws Exception {
-        // A trivial cache file, with startdate and renewTill being zero.
-        // The endtime is set to sometime in year 2022, so that isValid()
-        // will always check starttime.
-        byte[] ccache = new byte[]{
-            5, 4, 0, 12, 0, 1, 0, 8, -1, -1, -1, 19, -1, -2, 89, 51,
-            0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 10, 77, 65, 88, 73,
-            46, 76, 79, 67, 65, 76, 0, 0, 0, 5, 100, 117, 109, 109, 121, 0,
-            0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 10, 77, 65, 88, 73, 46,
-            76, 79, 67, 65, 76, 0, 0, 0, 5, 100, 117, 109, 109, 121, 0, 0,
-            0, 0, 0, 0, 0, 2, 0, 0, 0, 10, 77, 65, 88, 73, 46, 76,
-            79, 67, 65, 76, 0, 0, 0, 6, 107, 114, 98, 116, 103, 116, 0, 0,
-            0, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, 0, 17, 0, 0,
-            0, 16, -78, -85, -90, -50, -68, 115, 68, 8, -39, -109, 91, 61, -17, -27,
-            -122, -120, 71, 69, 16, -121, 0, 0, 0, 0, 98, 69, 16, -121, 0, 0,
-            0, 0, 0, 64, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-            0, 1, 0, 97, -127, -3, 48, -127, -6, -96, 3, 2, 1, 5, -95, 12,
-            27, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, -94, 31, 48, 29,
-            -96, 3, 2, 1, 0, -95, 22, 48, 20, 27, 6, 107, 114, 98, 116, 103,
-            116, 27, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, -93, -127, -61,
-            48, -127, -64, -96, 3, 2, 1, 17, -95, 3, 2, 1, 1, -94, -127, -77,
-            4, -127, -80, 43, 65, -66, 34, 21, -34, 37, 35, 32, 50, -14, 122, 77,
-            -3, -29, 37, 99, 50, 125, -43, -96, -78, 85, 23, 41, -80, 68, 2, -109,
-            -27, 38, -41, -72, -32, 127, 63, -76, -22, 81, 33, -114, -30, 104, 125, -81,
-            -29, 70, -25, 23, 100, -75, -25, 62, -120, -78, -61, -100, -74, 50, -117, -127,
-            -16, 79, -106, 62, -39, 91, 100, -10, 23, -88, -18, -47, 51, -19, 113, 18,
-            98, -101, 31, 98, 22, -81, 11, -41, -42, 67, 87, 92, -2, 42, -54, 79,
-            49, -90, 43, -37, 90, -102, 125, 62, -88, -77, 100, 102, 23, -57, -51, 38,
-            68, -44, -57, -102, 103, -6, 85, -58, 74, -117, -87, 67, -103, -36, 110, -122,
-            115, 12, 118, -106, -114, -51, 79, 68, 32, -91, -53, -5, -51, 89, 72, 70,
-            123, -12, -95, 9, 40, -30, -117, 74, 77, 38, 91, 126, -82, 17, 98, 98,
-            -49, 78, 36, 36, 103, -76, -100, -23, 118, -92, -8, 80, 103, -23, -98, 56,
-            21, 65, -77, 0, 0, 0, 0
-        };
-        System.setProperty("sun.security.krb5.debug", "true");  // test code changes in DEBUG
-        CCacheInputStream cis = new CCacheInputStream(new ByteArrayInputStream(ccache));
-        cis.readVersion();
-        cis.readTag();
-        cis.readPrincipal(0x504);
-        Method m = CCacheInputStream.class.getDeclaredMethod("readCred", Integer.TYPE);
-        m.setAccessible(true);
-        Credentials c = (Credentials) m.invoke(cis, new Integer(0x504));
-        sun.security.krb5.Credentials cc = c.setKrbCreds();
-
-        // 1. Make sure starttime is still null
-        if (cc.getStartTime() != null) {
-            throw new Exception("Fail, starttime should be zero here");
-        }
-
-        // 2. Make sure renewTill is still null
-        if (cc.getRenewTill() != null) {
-            throw new Exception("Fail, renewTill should be zero here");
-        }
-
-        // 3. Make sure isValid works
-        c.isValid();
-    }
-}
diff --git a/test/sun/security/krb5/auto/S4U2proxy.java b/test/sun/security/krb5/auto/S4U2proxy.java
index dd7d50c..10e5652 100644
--- a/test/sun/security/krb5/auto/S4U2proxy.java
+++ b/test/sun/security/krb5/auto/S4U2proxy.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6355584
+ * @bug 6355584 8044215
  * @summary Introduce constrained Kerberos delegation
  * @compile -XDignore.symbol.file S4U2proxy.java
  * @run main/othervm S4U2proxy krb5
@@ -69,6 +69,10 @@
         Context p = s.delegated();
 
         p.startAsClient(OneKDC.BACKEND, mech);
+
+        // 8044215: requestCredDeleg is useless and harmless
+        p.x().requestCredDeleg(true);
+
         b.startAsServer(mech);
         Context.handshake(p, b);
 
diff --git a/test/sun/security/krb5/ccache/CorruptedCC.java b/test/sun/security/krb5/ccache/CorruptedCC.java
new file mode 100644
index 0000000..355e2ff
--- /dev/null
+++ b/test/sun/security/krb5/ccache/CorruptedCC.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8028780
+ * @summary JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
+ * @run main/othervm -Xmx8m CorruptedCC
+ */
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
+public class CorruptedCC {
+    public static void main(String[] args) throws Exception {
+        for (int i=0; i<TimeInCCache.ccache.length; i++) {
+            byte old = TimeInCCache.ccache[i];
+            TimeInCCache.ccache[i] = 0x7f;
+            Files.write(Paths.get("tmpcc"), TimeInCCache.ccache);
+            // The next line will return null for I/O issues. That's OK.
+            CredentialsCache.getInstance("tmpcc");
+            TimeInCCache.ccache[i] = old;
+        }
+    }
+}
diff --git a/test/sun/security/krb5/ccache/DefaultFile.java b/test/sun/security/krb5/ccache/DefaultFile.java
new file mode 100644
index 0000000..b2348e3
--- /dev/null
+++ b/test/sun/security/krb5/ccache/DefaultFile.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8054817
+ * @summary File ccache only recognizes Linux and Solaris defaults
+ */
+
+import sun.security.krb5.internal.ccache.FileCredentialsCache;
+
+public class DefaultFile {
+    public static void main(String[] args) throws Exception {
+        // There are 2 cases where default ccache name is not
+        // /tmp/krb5cc_uid.
+        if (System.getenv("KRB5CCNAME") != null) {
+            return;
+        }
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            return;
+        }
+        String name = FileCredentialsCache.getDefaultCacheName();
+        if (!name.startsWith("/tmp/krb5cc_")) {
+            throw new Exception("default name is " + name);
+        }
+    }
+}
diff --git a/test/sun/security/krb5/ccache/EmptyRealmCC.java b/test/sun/security/krb5/ccache/EmptyRealmCC.java
new file mode 100644
index 0000000..315cc06
--- /dev/null
+++ b/test/sun/security/krb5/ccache/EmptyRealmCC.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8048073
+ * @summary Cannot read ccache entry with a realm-less service name
+ * @compile -XDignore.symbol.file EmptyRealmCC.java
+ * @run main EmptyRealmCC
+ */
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
+public class EmptyRealmCC {
+    public static void main(String[] args) throws Exception {
+        byte[] ccache = TimeInCCache.ccache;
+
+        // The service name starts at 0x52:
+        //
+        //    0050:    00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C
+        //             ----------- -----------
+        //    0060: 4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00
+        //                      -----------                   -----
+        //    0070: 00 0A 4D 41 58 49 2E 4C 4F 43 41 4C
+        //          -----
+        //
+        // which contains 2 (the length of names), a 10-byte realm, a 6-byte
+        // name[0], and a 10-byte name[1].
+
+        // We will empty the realm, and pack the realm string to another
+        // name (6-byte ".LOCAL"). Finally "krbtgt/MAXI.LOCAL@MAXI.LOCAL"
+        // becomes ".LOCAL/krbtgt/MAXI.LOCAL@".
+
+        // length of names is now 3
+        ccache[0x55] = 3;
+        // The empty realm
+        System.arraycopy(new byte[4], 0, ccache, 0x56, 4);
+        // Length of inserted name is 6
+        System.arraycopy(new byte[]{0,0,0,6}, 0, ccache, 0x5A, 4);
+
+        Files.write(Paths.get("tmpcc"), TimeInCCache.ccache);
+        if (CredentialsCache.getInstance("tmpcc").getCredsList() != null) {
+            throw new Exception("Nothing should be there");
+        }
+    }
+}
diff --git a/test/sun/security/krb5/ccache/TimeInCCache.java b/test/sun/security/krb5/ccache/TimeInCCache.java
new file mode 100644
index 0000000..e81ff90
--- /dev/null
+++ b/test/sun/security/krb5/ccache/TimeInCCache.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6590930
+ * @run main/othervm TimeInCCache
+ * @summary read/write does not match for ccache
+ */
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.Method;
+
+import sun.security.krb5.internal.ccache.CCacheInputStream;
+import sun.security.krb5.internal.ccache.Credentials;
+
+public class TimeInCCache {
+    // Attention: this field is also used by 2 other tests:
+    // CorruptedCC.java and EmptyRealmCC.java
+    public static byte[] ccache;
+
+    static {
+        // A trivial cache file, with startdate and renewTill being zero.
+        // The endtime is set to sometime in year 2022, so that isValid()
+        // will always check starttime.
+        String var =
+            /*0000*/ "05 04 00 0C 00 01 00 08 FF FF FF 13 FF FE 59 33 " +
+            /*0010*/ "00 00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 " +
+            /*0020*/ "2E 4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 " +
+            /*0030*/ "00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 2E " +
+            /*0040*/ "4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 00 " +
+            /*0050*/ "00 00 00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C " +
+            /*0060*/ "4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00 " +
+            /*0070*/ "00 0A 4D 41 58 49 2E 4C 4F 43 41 4C 00 11 00 00 " +
+            /*0080*/ "00 10 B2 AB A6 CE BC 73 44 08 D9 93 5B 3D EF E5 " +
+            /*0090*/ "86 88 47 45 10 87 00 00 00 00 62 45 10 87 00 00 " +
+            /*00A0*/ "00 00 00 40 E0 00 00 00 00 00 00 00 00 00 00 00 " +
+            /*00B0*/ "00 01 00 61 81 FD 30 81 FA A0 03 02 01 05 A1 0C " +
+            /*00C0*/ "1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A2 1F 30 1D " +
+            /*00D0*/ "A0 03 02 01 00 A1 16 30 14 1B 06 6B 72 62 74 67 " +
+            /*00E0*/ "74 1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A3 81 C3 " +
+            /*00F0*/ "30 81 C0 A0 03 02 01 11 A1 03 02 01 01 A2 81 B3 " +
+            /*0100*/ "04 81 B0 2B 41 BE 22 15 DE 25 23 20 32 F2 7A 4D " +
+            /*0110*/ "FD E3 25 63 32 7D D5 A0 B2 55 17 29 B0 44 02 93 " +
+            /*0120*/ "E5 26 D7 B8 E0 7F 3F B4 EA 51 21 8E E2 68 7D AF " +
+            /*0130*/ "E3 46 E7 17 64 B5 E7 3E 88 B2 C3 9C B6 32 8B 81 " +
+            /*0140*/ "F0 4F 96 3E D9 5B 64 F6 17 A8 EE D1 33 ED 71 12 " +
+            /*0150*/ "62 9B 1F 62 16 AF 0B D7 D6 43 57 5C FE 2A CA 4F " +
+            /*0160*/ "31 A6 2B DB 5A 9A 7D 3E A8 B3 64 66 17 C7 CD 26 " +
+            /*0170*/ "44 D4 C7 9A 67 FA 55 C6 4A 8B A9 43 99 DC 6E 86 " +
+            /*0180*/ "73 0C 76 96 8E CD 4F 44 20 A5 CB FB CD 59 48 46 " +
+            /*0190*/ "7B F4 A1 09 28 E2 8B 4A 4D 26 5B 7E AE 11 62 62 " +
+            /*01A0*/ "CF 4E 24 24 67 B4 9C E9 76 A4 F8 50 67 E9 9E 38 " +
+            /*01B0*/ "15 41 B3 00 00 00 00 ";
+        ccache = new byte[var.length()/3];
+        for (int i=0; i<ccache.length; i++) {
+            ccache[i] = Integer.valueOf(var.substring(3*i,3*i+2), 16).byteValue();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.setProperty("sun.security.krb5.debug", "true");  // test code changes in DEBUG
+        CCacheInputStream cis = new CCacheInputStream(new ByteArrayInputStream(ccache));
+        cis.readVersion();
+        cis.readTag();
+        cis.readPrincipal(0x504);
+        Method m = CCacheInputStream.class.getDeclaredMethod("readCred", Integer.TYPE);
+        m.setAccessible(true);
+        Credentials c = (Credentials) m.invoke(cis, new Integer(0x504));
+        sun.security.krb5.Credentials cc = c.setKrbCreds();
+
+        // 1. Make sure starttime is still null
+        if (cc.getStartTime() != null) {
+            throw new Exception("Fail, starttime should be zero here");
+        }
+
+        // 2. Make sure renewTill is still null
+        if (cc.getRenewTill() != null) {
+            throw new Exception("Fail, renewTill should be zero here");
+        }
+
+        // 3. Make sure isValid works
+        c.isValid();
+    }
+}
diff --git a/test/sun/security/pkcs11/Cipher/JNICheck.java b/test/sun/security/pkcs11/Cipher/JNICheck.java
new file mode 100644
index 0000000..ecb1251
--- /dev/null
+++ b/test/sun/security/pkcs11/Cipher/JNICheck.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8063700
+ * @run main/othervm -Xcheck:jni JNICheck
+ */
+
+import javax.crypto.Cipher;
+import javax.crypto.SealedObject;
+import javax.crypto.SecretKey;
+import javax.crypto.KeyGenerator;
+import java.security.NoSuchProviderException;
+
+public class JNICheck {
+
+    /* This test is similar to the JCK test that found 8063700. */
+    static class SealedObjectTest {
+        Cipher c;
+
+        SealedObjectTest() throws Exception {
+            try {
+                c = Cipher.getInstance("AES", "SunPKCS11-Solaris");
+            } catch (NoSuchProviderException nspe) {
+                System.out.println("No SunPKCS11-Solaris provider.  Test skipped");
+                return;
+            }
+
+            String s = "Test string";
+            SealedObject so;
+            SecretKey key = KeyGenerator.getInstance("AES").generateKey();
+
+            c.init(Cipher.ENCRYPT_MODE, key);
+            so = new SealedObject(s, c);
+
+            so.getObject(key, "SunPKCS11-Solaris");
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        new SealedObjectTest();
+    }
+}
diff --git a/test/sun/security/smartcardio/TestAll.java b/test/sun/security/smartcardio/TestAll.java
index e83706f..72a0f85 100644
--- a/test/sun/security/smartcardio/TestAll.java
+++ b/test/sun/security/smartcardio/TestAll.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 // Because all the tests are marked @ignore as they require special hardware,
 // we cannot use jtreg to do this.
 
-import java.lang.reflect.*;
+import java.lang.reflect.Method;
 
 public class TestAll {
 
@@ -40,6 +40,7 @@
         TestMultiplePresent.class,
         TestPresent.class,
         TestTransmit.class,
+        TestDirect.class,
     };
 
     public static void main(String[] args) throws Exception {
diff --git a/test/sun/security/smartcardio/TestChannel.java b/test/sun/security/smartcardio/TestChannel.java
index bdb1bd5..3dc4029 100644
--- a/test/sun/security/smartcardio/TestChannel.java
+++ b/test/sun/security/smartcardio/TestChannel.java
@@ -30,10 +30,10 @@
  * @run main/manual TestExclusive
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CommandAPDU;
 
 public class TestChannel extends Utils {
 
@@ -94,7 +94,7 @@
         }
 
         // disconnect
-        card.disconnect(false);
+        card.disconnect(true);
 
         System.out.println("OK.");
     }
diff --git a/test/sun/security/smartcardio/TestConnect.java b/test/sun/security/smartcardio/TestConnect.java
index a581ace..b533b93 100644
--- a/test/sun/security/smartcardio/TestConnect.java
+++ b/test/sun/security/smartcardio/TestConnect.java
@@ -30,10 +30,11 @@
  * @run main/manual TestConnect
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import java.util.List;
+import javax.smartcardio.TerminalFactory;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.CardTerminal;
 
 public class TestConnect extends Utils {
 
@@ -62,7 +63,7 @@
             throw new Exception("Not T=0 protocol");
         }
         transmit(card);
-        card.disconnect(false);
+        card.disconnect(true);
 
         try {
             transmit(card);
@@ -95,7 +96,7 @@
             throw new Exception("Not T=0 protocol");
         }
         transmit(card);
-        card.disconnect(true);
+        card.disconnect(false);
 
         card = terminal.connect("*");
         System.out.println("card: " + card);
@@ -104,7 +105,6 @@
         }
         transmit(card);
         card.disconnect(true);
-        card.disconnect(true);
 
         System.out.println("OK.");
     }
diff --git a/test/sun/security/smartcardio/TestConnectAgain.java b/test/sun/security/smartcardio/TestConnectAgain.java
index 0d087e2..9a2889e 100644
--- a/test/sun/security/smartcardio/TestConnectAgain.java
+++ b/test/sun/security/smartcardio/TestConnectAgain.java
@@ -30,10 +30,10 @@
  * @run main/manual TestTransmit
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardException;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.CardTerminal;
 
 public class TestConnectAgain extends Utils {
 
@@ -94,7 +94,7 @@
         }
 
         // disconnect
-        card.disconnect(false);
+        card.disconnect(true);
 
         System.out.println("OK.");
     }
diff --git a/test/sun/security/smartcardio/TestControl.java b/test/sun/security/smartcardio/TestControl.java
index cbd7825..5160755 100644
--- a/test/sun/security/smartcardio/TestControl.java
+++ b/test/sun/security/smartcardio/TestControl.java
@@ -30,10 +30,9 @@
  * @run main/manual TestControl
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardException;
+import javax.smartcardio.CardTerminal;
 
 public class TestControl extends Utils {
 
@@ -67,7 +66,7 @@
         }
 
         // disconnect
-        card.disconnect(false);
+        card.disconnect(true);
 
         System.out.println("OK.");
     }
diff --git a/test/sun/security/smartcardio/TestDefault.java b/test/sun/security/smartcardio/TestDefault.java
index 4fa654f..0808df4 100644
--- a/test/sun/security/smartcardio/TestDefault.java
+++ b/test/sun/security/smartcardio/TestDefault.java
@@ -30,10 +30,9 @@
  * @run main/manual TestDefault
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import java.util.List;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.TerminalFactory;
 
 public class TestDefault {
 
diff --git a/test/sun/security/smartcardio/TestDirect.java b/test/sun/security/smartcardio/TestDirect.java
new file mode 100644
index 0000000..3dde7c3
--- /dev/null
+++ b/test/sun/security/smartcardio/TestDirect.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8046343
+ * @summary Make sure that direct protocol is available
+ * @run main/manual TestDirect
+ */
+
+// This test requires special hardware.
+
+import java.util.List;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CardTerminals;
+import javax.smartcardio.TerminalFactory;
+
+public class TestDirect {
+    public static void main(String[] args) throws Exception {
+        TerminalFactory terminalFactory = TerminalFactory.getDefault();
+        List<CardTerminal> cardTerminals = terminalFactory.terminals().list();
+        System.out.println("Terminals: " + cardTerminals);
+        if (cardTerminals.isEmpty()) {
+            throw new Exception("No card terminals available");
+        }
+        CardTerminal cardTerminal = cardTerminals.get(0);
+        Card card = cardTerminal.connect("DIRECT");
+        card.disconnect(true);
+
+        System.out.println("OK.");
+    }
+}
diff --git a/test/sun/security/smartcardio/TestExclusive.java b/test/sun/security/smartcardio/TestExclusive.java
index aa1e644..a4c75e6 100644
--- a/test/sun/security/smartcardio/TestExclusive.java
+++ b/test/sun/security/smartcardio/TestExclusive.java
@@ -30,10 +30,11 @@
  * @run main/manual TestExclusive
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.CardException;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CommandAPDU;
 
 public class TestExclusive extends Utils {
 
@@ -83,9 +84,9 @@
         Thread.sleep(1000);
 
         // disconnect
-        card.disconnect(false);
+        card.disconnect(true);
 
-        if (otherOK == false) {
+        if (! otherOK) {
             throw new Exception("Secondary thread failed");
         }
 
diff --git a/test/sun/security/smartcardio/TestMultiplePresent.java b/test/sun/security/smartcardio/TestMultiplePresent.java
index faf5bcd..271cb21 100644
--- a/test/sun/security/smartcardio/TestMultiplePresent.java
+++ b/test/sun/security/smartcardio/TestMultiplePresent.java
@@ -30,10 +30,10 @@
  * @run main/manual TestPresent
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import java.util.List;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CardTerminals;
+import javax.smartcardio.TerminalFactory;
 import static javax.smartcardio.CardTerminals.State.*;
 
 public class TestMultiplePresent {
diff --git a/test/sun/security/smartcardio/TestPresent.java b/test/sun/security/smartcardio/TestPresent.java
index 106c853..fbfebd5 100644
--- a/test/sun/security/smartcardio/TestPresent.java
+++ b/test/sun/security/smartcardio/TestPresent.java
@@ -30,10 +30,9 @@
  * @run main/manual TestPresent
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import java.util.List;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.TerminalFactory;
 
 public class TestPresent {
 
diff --git a/test/sun/security/smartcardio/TestTransmit.java b/test/sun/security/smartcardio/TestTransmit.java
index 9ec6588..9092683 100644
--- a/test/sun/security/smartcardio/TestTransmit.java
+++ b/test/sun/security/smartcardio/TestTransmit.java
@@ -30,10 +30,16 @@
  * @run main/manual TestTransmit
  */
 
-import java.io.*;
-import java.util.*;
-
-import javax.smartcardio.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import javax.smartcardio.Card;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CommandAPDU;
+import javax.smartcardio.ResponseAPDU;
 
 public class TestTransmit extends Utils {
 
@@ -78,7 +84,7 @@
         }
 
         // disconnect
-        card.disconnect(false);
+        card.disconnect(true);
 
         System.out.println("OK.");
     }
diff --git a/test/sun/security/smartcardio/Utils.java b/test/sun/security/smartcardio/Utils.java
index e67bdcf..b4edbcc 100644
--- a/test/sun/security/smartcardio/Utils.java
+++ b/test/sun/security/smartcardio/Utils.java
@@ -24,10 +24,16 @@
 
 // common utility functions for the PC/SC tests
 
-import javax.smartcardio.*;
-
-import java.io.*;
-import java.util.*;
+import java.io.StringReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CardChannel;
+import javax.smartcardio.ResponseAPDU;
+import javax.smartcardio.CommandAPDU;
+import javax.smartcardio.TerminalFactory;
 
 public class Utils {
 
diff --git a/test/sun/text/resources/LocaleData b/test/sun/text/resources/LocaleData
index 9dca93b..f6439c2 100644
--- a/test/sun/text/resources/LocaleData
+++ b/test/sun/text/resources/LocaleData
@@ -2502,7 +2502,7 @@
 CalendarData/pl_PL/minimalDaysInFirstWeek=4
 CalendarData/pt_PT/minimalDaysInFirstWeek=4
 
-#bug 4945388 
+#bug 4945388
 CurrencyNames/be_BY/BYR=\u0420\u0443\u0431
 CurrencyNames/bg_BG/BGN=\u043B\u0432.
 
@@ -5422,7 +5422,7 @@
 FormatData/en_SG/DatePatterns/2=MMM d, yyyy
 FormatData/en_SG/DatePatterns/3=M/d/yy
 FormatData/en_SG/DateTimePatterns/0={1} {0}
-# Use approved data 
+# Use approved data
 FormatData/ms/Eras/0=BCE
 FormatData/ms/Eras/1=CE
 FormatData/sr_BA/MonthNames/5=\u0458\u0443\u043d\u0438
@@ -5571,7 +5571,7 @@
 FormatData/fi/AmPmMarkers/0=ap.
 FormatData/fi/AmPmMarkers/1=ip.
 
-# bug 6507067 
+# bug 6507067
 TimeZoneNames/zh_TW/Asia\/Taipei/1=\u53f0\u7063\u6a19\u6e96\u6642\u9593
 TimeZoneNames/zh_TW/Asia\/Taipei/2=TST
 
@@ -7702,3 +7702,577 @@
 
 # bug 8055222
 CurrencyNames/lt_LT/EUR=\u20AC
+
+# bug 8042126 + missing MonthNarrows data
+FormatData//MonthNarrows/0=1
+FormatData//MonthNarrows/1=2
+FormatData//MonthNarrows/2=3
+FormatData//MonthNarrows/3=4
+FormatData//MonthNarrows/4=5
+FormatData//MonthNarrows/5=6
+FormatData//MonthNarrows/6=7
+FormatData//MonthNarrows/7=8
+FormatData//MonthNarrows/8=9
+FormatData//MonthNarrows/9=10
+FormatData//MonthNarrows/10=11
+FormatData//MonthNarrows/11=12
+FormatData//MonthNarrows/12=
+FormatData/bg/MonthNarrows/0=\u044f
+FormatData/bg/MonthNarrows/1=\u0444
+FormatData/bg/MonthNarrows/2=\u043c
+FormatData/bg/MonthNarrows/3=\u0430
+FormatData/bg/MonthNarrows/4=\u043c
+FormatData/bg/MonthNarrows/5=\u044e
+FormatData/bg/MonthNarrows/6=\u044e
+FormatData/bg/MonthNarrows/7=\u0430
+FormatData/bg/MonthNarrows/8=\u0441
+FormatData/bg/MonthNarrows/9=\u043e
+FormatData/bg/MonthNarrows/10=\u043d
+FormatData/bg/MonthNarrows/11=\u0434
+FormatData/bg/MonthNarrows/12=
+FormatData/zh_TW/MonthNarrows/0=1
+FormatData/zh_TW/MonthNarrows/1=2
+FormatData/zh_TW/MonthNarrows/2=3
+FormatData/zh_TW/MonthNarrows/3=4
+FormatData/zh_TW/MonthNarrows/4=5
+FormatData/zh_TW/MonthNarrows/5=6
+FormatData/zh_TW/MonthNarrows/6=7
+FormatData/zh_TW/MonthNarrows/7=8
+FormatData/zh_TW/MonthNarrows/8=9
+FormatData/zh_TW/MonthNarrows/9=10
+FormatData/zh_TW/MonthNarrows/10=11
+FormatData/zh_TW/MonthNarrows/11=12
+FormatData/zh_TW/MonthNarrows/12=
+FormatData/it/MonthNarrows/0=G
+FormatData/it/MonthNarrows/1=F
+FormatData/it/MonthNarrows/2=M
+FormatData/it/MonthNarrows/3=A
+FormatData/it/MonthNarrows/4=M
+FormatData/it/MonthNarrows/5=G
+FormatData/it/MonthNarrows/6=L
+FormatData/it/MonthNarrows/7=A
+FormatData/it/MonthNarrows/8=S
+FormatData/it/MonthNarrows/9=O
+FormatData/it/MonthNarrows/10=N
+FormatData/it/MonthNarrows/11=D
+FormatData/it/MonthNarrows/12=
+FormatData/ko/MonthNarrows/0=1\uc6d4
+FormatData/ko/MonthNarrows/1=2\uc6d4
+FormatData/ko/MonthNarrows/2=3\uc6d4
+FormatData/ko/MonthNarrows/3=4\uc6d4
+FormatData/ko/MonthNarrows/4=5\uc6d4
+FormatData/ko/MonthNarrows/5=6\uc6d4
+FormatData/ko/MonthNarrows/6=7\uc6d4
+FormatData/ko/MonthNarrows/7=8\uc6d4
+FormatData/ko/MonthNarrows/8=9\uc6d4
+FormatData/ko/MonthNarrows/9=10\uc6d4
+FormatData/ko/MonthNarrows/10=11\uc6d4
+FormatData/ko/MonthNarrows/11=12\uc6d4
+FormatData/ko/MonthNarrows/12=
+FormatData/uk/MonthNarrows/0=\u0421
+FormatData/uk/MonthNarrows/1=\u041b
+FormatData/uk/MonthNarrows/2=\u0411
+FormatData/uk/MonthNarrows/3=\u041a
+FormatData/uk/MonthNarrows/4=\u0422
+FormatData/uk/MonthNarrows/5=\u0427
+FormatData/uk/MonthNarrows/6=\u041b
+FormatData/uk/MonthNarrows/7=\u0421
+FormatData/uk/MonthNarrows/8=\u0412
+FormatData/uk/MonthNarrows/9=\u0416
+FormatData/uk/MonthNarrows/10=\u041b
+FormatData/uk/MonthNarrows/11=\u0413
+FormatData/uk/MonthNarrows/12=
+FormatData/lv/MonthNarrows/0=J
+FormatData/lv/MonthNarrows/1=F
+FormatData/lv/MonthNarrows/2=M
+FormatData/lv/MonthNarrows/3=A
+FormatData/lv/MonthNarrows/4=M
+FormatData/lv/MonthNarrows/5=J
+FormatData/lv/MonthNarrows/6=J
+FormatData/lv/MonthNarrows/7=A
+FormatData/lv/MonthNarrows/8=S
+FormatData/lv/MonthNarrows/9=O
+FormatData/lv/MonthNarrows/10=N
+FormatData/lv/MonthNarrows/11=D
+FormatData/lv/MonthNarrows/12=
+FormatData/pt/MonthNarrows/0=J
+FormatData/pt/MonthNarrows/1=F
+FormatData/pt/MonthNarrows/2=M
+FormatData/pt/MonthNarrows/3=A
+FormatData/pt/MonthNarrows/4=M
+FormatData/pt/MonthNarrows/5=J
+FormatData/pt/MonthNarrows/6=J
+FormatData/pt/MonthNarrows/7=A
+FormatData/pt/MonthNarrows/8=S
+FormatData/pt/MonthNarrows/9=O
+FormatData/pt/MonthNarrows/10=N
+FormatData/pt/MonthNarrows/11=D
+FormatData/pt/MonthNarrows/12=
+FormatData/sk/MonthNarrows/0=j
+FormatData/sk/MonthNarrows/1=f
+FormatData/sk/MonthNarrows/2=m
+FormatData/sk/MonthNarrows/3=a
+FormatData/sk/MonthNarrows/4=m
+FormatData/sk/MonthNarrows/5=j
+FormatData/sk/MonthNarrows/6=j
+FormatData/sk/MonthNarrows/7=a
+FormatData/sk/MonthNarrows/8=s
+FormatData/sk/MonthNarrows/9=o
+FormatData/sk/MonthNarrows/10=n
+FormatData/sk/MonthNarrows/11=d
+FormatData/sk/MonthNarrows/12=
+FormatData/hi_IN/MonthNarrows/0=\u091c
+FormatData/hi_IN/MonthNarrows/1=\u092b\u093c
+FormatData/hi_IN/MonthNarrows/2=\u092e\u093e
+FormatData/hi_IN/MonthNarrows/3=\u0905
+FormatData/hi_IN/MonthNarrows/4=\u092e
+FormatData/hi_IN/MonthNarrows/5=\u091c\u0942
+FormatData/hi_IN/MonthNarrows/6=\u091c\u0941
+FormatData/hi_IN/MonthNarrows/7=\u0905
+FormatData/hi_IN/MonthNarrows/8=\u0938\u093f
+FormatData/hi_IN/MonthNarrows/9=\u0905
+FormatData/hi_IN/MonthNarrows/10=\u0928
+FormatData/hi_IN/MonthNarrows/11=\u0926\u093f
+FormatData/hi_IN/MonthNarrows/12=
+FormatData/ga/MonthNarrows/0=E
+FormatData/ga/MonthNarrows/1=F
+FormatData/ga/MonthNarrows/2=M
+FormatData/ga/MonthNarrows/3=A
+FormatData/ga/MonthNarrows/4=B
+FormatData/ga/MonthNarrows/5=M
+FormatData/ga/MonthNarrows/6=I
+FormatData/ga/MonthNarrows/7=L
+FormatData/ga/MonthNarrows/8=M
+FormatData/ga/MonthNarrows/9=D
+FormatData/ga/MonthNarrows/10=S
+FormatData/ga/MonthNarrows/11=N
+FormatData/ga/MonthNarrows/12=
+FormatData/et/MonthNarrows/0=J
+FormatData/et/MonthNarrows/1=V
+FormatData/et/MonthNarrows/2=M
+FormatData/et/MonthNarrows/3=A
+FormatData/et/MonthNarrows/4=M
+FormatData/et/MonthNarrows/5=J
+FormatData/et/MonthNarrows/6=J
+FormatData/et/MonthNarrows/7=A
+FormatData/et/MonthNarrows/8=S
+FormatData/et/MonthNarrows/9=O
+FormatData/et/MonthNarrows/10=N
+FormatData/et/MonthNarrows/11=D
+FormatData/et/MonthNarrows/12=
+FormatData/sv/MonthNarrows/0=J
+FormatData/sv/MonthNarrows/1=F
+FormatData/sv/MonthNarrows/2=M
+FormatData/sv/MonthNarrows/3=A
+FormatData/sv/MonthNarrows/4=M
+FormatData/sv/MonthNarrows/5=J
+FormatData/sv/MonthNarrows/6=J
+FormatData/sv/MonthNarrows/7=A
+FormatData/sv/MonthNarrows/8=S
+FormatData/sv/MonthNarrows/9=O
+FormatData/sv/MonthNarrows/10=N
+FormatData/sv/MonthNarrows/11=D
+FormatData/sv/MonthNarrows/12=
+FormatData/cs/MonthNarrows/0=l
+FormatData/cs/MonthNarrows/1=\u00fa
+FormatData/cs/MonthNarrows/2=b
+FormatData/cs/MonthNarrows/3=d
+FormatData/cs/MonthNarrows/4=k
+FormatData/cs/MonthNarrows/5=\u010d
+FormatData/cs/MonthNarrows/6=\u010d
+FormatData/cs/MonthNarrows/7=s
+FormatData/cs/MonthNarrows/8=z
+FormatData/cs/MonthNarrows/9=\u0159
+FormatData/cs/MonthNarrows/10=l
+FormatData/cs/MonthNarrows/11=p
+FormatData/cs/MonthNarrows/12=
+FormatData/el/MonthNarrows/0=\u0399
+FormatData/el/MonthNarrows/1=\u03a6
+FormatData/el/MonthNarrows/2=\u039c
+FormatData/el/MonthNarrows/3=\u0391
+FormatData/el/MonthNarrows/4=\u039c
+FormatData/el/MonthNarrows/5=\u0399
+FormatData/el/MonthNarrows/6=\u0399
+FormatData/el/MonthNarrows/7=\u0391
+FormatData/el/MonthNarrows/8=\u03a3
+FormatData/el/MonthNarrows/9=\u039f
+FormatData/el/MonthNarrows/10=\u039d
+FormatData/el/MonthNarrows/11=\u0394
+FormatData/el/MonthNarrows/12=
+FormatData/hu/MonthNarrows/0=J
+FormatData/hu/MonthNarrows/1=F
+FormatData/hu/MonthNarrows/2=M
+FormatData/hu/MonthNarrows/3=\u00c1
+FormatData/hu/MonthNarrows/4=M
+FormatData/hu/MonthNarrows/5=J
+FormatData/hu/MonthNarrows/6=J
+FormatData/hu/MonthNarrows/7=A
+FormatData/hu/MonthNarrows/8=Sz
+FormatData/hu/MonthNarrows/9=O
+FormatData/hu/MonthNarrows/10=N
+FormatData/hu/MonthNarrows/11=D
+FormatData/hu/MonthNarrows/12=
+FormatData/es/MonthNarrows/0=E
+FormatData/es/MonthNarrows/1=F
+FormatData/es/MonthNarrows/2=M
+FormatData/es/MonthNarrows/3=A
+FormatData/es/MonthNarrows/4=M
+FormatData/es/MonthNarrows/5=J
+FormatData/es/MonthNarrows/6=J
+FormatData/es/MonthNarrows/7=A
+FormatData/es/MonthNarrows/8=S
+FormatData/es/MonthNarrows/9=O
+FormatData/es/MonthNarrows/10=N
+FormatData/es/MonthNarrows/11=D
+FormatData/es/MonthNarrows/12=
+FormatData/tr/MonthNarrows/0=O
+FormatData/tr/MonthNarrows/1=\u015e
+FormatData/tr/MonthNarrows/2=M
+FormatData/tr/MonthNarrows/3=N
+FormatData/tr/MonthNarrows/4=M
+FormatData/tr/MonthNarrows/5=H
+FormatData/tr/MonthNarrows/6=T
+FormatData/tr/MonthNarrows/7=A
+FormatData/tr/MonthNarrows/8=E
+FormatData/tr/MonthNarrows/9=E
+FormatData/tr/MonthNarrows/10=K
+FormatData/tr/MonthNarrows/11=A
+FormatData/tr/MonthNarrows/12=
+FormatData/hr/MonthNarrows/0=1.
+FormatData/hr/MonthNarrows/1=2.
+FormatData/hr/MonthNarrows/2=3.
+FormatData/hr/MonthNarrows/3=4.
+FormatData/hr/MonthNarrows/4=5.
+FormatData/hr/MonthNarrows/5=6.
+FormatData/hr/MonthNarrows/6=7.
+FormatData/hr/MonthNarrows/7=8.
+FormatData/hr/MonthNarrows/8=9.
+FormatData/hr/MonthNarrows/9=10.
+FormatData/hr/MonthNarrows/10=11.
+FormatData/hr/MonthNarrows/11=12.
+FormatData/hr/MonthNarrows/12=
+FormatData/lt/MonthNarrows/0=S
+FormatData/lt/MonthNarrows/1=V
+FormatData/lt/MonthNarrows/2=K
+FormatData/lt/MonthNarrows/3=B
+FormatData/lt/MonthNarrows/4=G
+FormatData/lt/MonthNarrows/5=B
+FormatData/lt/MonthNarrows/6=L
+FormatData/lt/MonthNarrows/7=R
+FormatData/lt/MonthNarrows/8=R
+FormatData/lt/MonthNarrows/9=S
+FormatData/lt/MonthNarrows/10=L
+FormatData/lt/MonthNarrows/11=G
+FormatData/lt/MonthNarrows/12=
+FormatData/sq/MonthNarrows/0=J
+FormatData/sq/MonthNarrows/1=S
+FormatData/sq/MonthNarrows/2=M
+FormatData/sq/MonthNarrows/3=P
+FormatData/sq/MonthNarrows/4=M
+FormatData/sq/MonthNarrows/5=Q
+FormatData/sq/MonthNarrows/6=K
+FormatData/sq/MonthNarrows/7=G
+FormatData/sq/MonthNarrows/8=S
+FormatData/sq/MonthNarrows/9=T
+FormatData/sq/MonthNarrows/10=N
+FormatData/sq/MonthNarrows/11=D
+FormatData/sq/MonthNarrows/12=
+FormatData/fr/MonthNarrows/0=J
+FormatData/fr/MonthNarrows/1=F
+FormatData/fr/MonthNarrows/2=M
+FormatData/fr/MonthNarrows/3=A
+FormatData/fr/MonthNarrows/4=M
+FormatData/fr/MonthNarrows/5=J
+FormatData/fr/MonthNarrows/6=J
+FormatData/fr/MonthNarrows/7=A
+FormatData/fr/MonthNarrows/8=S
+FormatData/fr/MonthNarrows/9=O
+FormatData/fr/MonthNarrows/10=N
+FormatData/fr/MonthNarrows/11=D
+FormatData/fr/MonthNarrows/12=
+FormatData/is/MonthNarrows/0=J
+FormatData/is/MonthNarrows/1=F
+FormatData/is/MonthNarrows/2=M
+FormatData/is/MonthNarrows/3=A
+FormatData/is/MonthNarrows/4=M
+FormatData/is/MonthNarrows/5=J
+FormatData/is/MonthNarrows/6=J
+FormatData/is/MonthNarrows/7=\u00c1
+FormatData/is/MonthNarrows/8=L
+FormatData/is/MonthNarrows/9=O
+FormatData/is/MonthNarrows/10=N
+FormatData/is/MonthNarrows/11=D
+FormatData/is/MonthNarrows/12=
+FormatData/de/MonthNarrows/0=J
+FormatData/de/MonthNarrows/1=F
+FormatData/de/MonthNarrows/2=M
+FormatData/de/MonthNarrows/3=A
+FormatData/de/MonthNarrows/4=M
+FormatData/de/MonthNarrows/5=J
+FormatData/de/MonthNarrows/6=J
+FormatData/de/MonthNarrows/7=A
+FormatData/de/MonthNarrows/8=S
+FormatData/de/MonthNarrows/9=O
+FormatData/de/MonthNarrows/10=N
+FormatData/de/MonthNarrows/11=D
+FormatData/de/MonthNarrows/12=
+FormatData/en/MonthNarrows/0=J
+FormatData/en/MonthNarrows/1=F
+FormatData/en/MonthNarrows/2=M
+FormatData/en/MonthNarrows/3=A
+FormatData/en/MonthNarrows/4=M
+FormatData/en/MonthNarrows/5=J
+FormatData/en/MonthNarrows/6=J
+FormatData/en/MonthNarrows/7=A
+FormatData/en/MonthNarrows/8=S
+FormatData/en/MonthNarrows/9=O
+FormatData/en/MonthNarrows/10=N
+FormatData/en/MonthNarrows/11=D
+FormatData/en/MonthNarrows/12=
+FormatData/ca/MonthNarrows/0=G
+FormatData/ca/MonthNarrows/1=F
+FormatData/ca/MonthNarrows/2=M
+FormatData/ca/MonthNarrows/3=A
+FormatData/ca/MonthNarrows/4=M
+FormatData/ca/MonthNarrows/5=J
+FormatData/ca/MonthNarrows/6=G
+FormatData/ca/MonthNarrows/7=A
+FormatData/ca/MonthNarrows/8=S
+FormatData/ca/MonthNarrows/9=O
+FormatData/ca/MonthNarrows/10=N
+FormatData/ca/MonthNarrows/11=D
+FormatData/ca/MonthNarrows/12=
+FormatData/sl/MonthNarrows/0=j
+FormatData/sl/MonthNarrows/1=f
+FormatData/sl/MonthNarrows/2=m
+FormatData/sl/MonthNarrows/3=a
+FormatData/sl/MonthNarrows/4=m
+FormatData/sl/MonthNarrows/5=j
+FormatData/sl/MonthNarrows/6=j
+FormatData/sl/MonthNarrows/7=a
+FormatData/sl/MonthNarrows/8=s
+FormatData/sl/MonthNarrows/9=o
+FormatData/sl/MonthNarrows/10=n
+FormatData/sl/MonthNarrows/11=d
+FormatData/sl/MonthNarrows/12=
+FormatData/fi/MonthNarrows/0=T
+FormatData/fi/MonthNarrows/1=H
+FormatData/fi/MonthNarrows/2=M
+FormatData/fi/MonthNarrows/3=H
+FormatData/fi/MonthNarrows/4=T
+FormatData/fi/MonthNarrows/5=K
+FormatData/fi/MonthNarrows/6=H
+FormatData/fi/MonthNarrows/7=E
+FormatData/fi/MonthNarrows/8=S
+FormatData/fi/MonthNarrows/9=L
+FormatData/fi/MonthNarrows/10=M
+FormatData/fi/MonthNarrows/11=J
+FormatData/fi/MonthNarrows/12=
+FormatData/mk/MonthNarrows/0=\u0458
+FormatData/mk/MonthNarrows/1=\u0444
+FormatData/mk/MonthNarrows/2=\u043c
+FormatData/mk/MonthNarrows/3=\u0430
+FormatData/mk/MonthNarrows/4=\u043c
+FormatData/mk/MonthNarrows/5=\u0458
+FormatData/mk/MonthNarrows/6=\u0458
+FormatData/mk/MonthNarrows/7=\u0430
+FormatData/mk/MonthNarrows/8=\u0441
+FormatData/mk/MonthNarrows/9=\u043e
+FormatData/mk/MonthNarrows/10=\u043d
+FormatData/mk/MonthNarrows/11=\u0434
+FormatData/mk/MonthNarrows/12=
+FormatData/sr-Latn/MonthNarrows/0=j
+FormatData/sr-Latn/MonthNarrows/1=f
+FormatData/sr-Latn/MonthNarrows/2=m
+FormatData/sr-Latn/MonthNarrows/3=a
+FormatData/sr-Latn/MonthNarrows/4=m
+FormatData/sr-Latn/MonthNarrows/5=j
+FormatData/sr-Latn/MonthNarrows/6=j
+FormatData/sr-Latn/MonthNarrows/7=a
+FormatData/sr-Latn/MonthNarrows/8=s
+FormatData/sr-Latn/MonthNarrows/9=o
+FormatData/sr-Latn/MonthNarrows/10=n
+FormatData/sr-Latn/MonthNarrows/11=d
+FormatData/sr-Latn/MonthNarrows/12=
+FormatData/th/MonthNarrows/0=\u0e21.\u0e04.
+FormatData/th/MonthNarrows/1=\u0e01.\u0e1e.
+FormatData/th/MonthNarrows/2=\u0e21\u0e35.\u0e04.
+FormatData/th/MonthNarrows/3=\u0e40\u0e21.\u0e22.
+FormatData/th/MonthNarrows/4=\u0e1e.\u0e04.
+FormatData/th/MonthNarrows/5=\u0e21\u0e34.\u0e22
+FormatData/th/MonthNarrows/6=\u0e01.\u0e04.
+FormatData/th/MonthNarrows/7=\u0e2a.\u0e04.
+FormatData/th/MonthNarrows/8=\u0e01.\u0e22.
+FormatData/th/MonthNarrows/9=\u0e15.\u0e04.
+FormatData/th/MonthNarrows/10=\u0e1e.\u0e22.
+FormatData/th/MonthNarrows/11=\u0e18.\u0e04.
+FormatData/th/MonthNarrows/12=
+FormatData/ar/MonthNarrows/0=\u064a
+FormatData/ar/MonthNarrows/1=\u0641
+FormatData/ar/MonthNarrows/2=\u0645
+FormatData/ar/MonthNarrows/3=\u0623
+FormatData/ar/MonthNarrows/4=\u0648
+FormatData/ar/MonthNarrows/5=\u0646
+FormatData/ar/MonthNarrows/6=\u0644
+FormatData/ar/MonthNarrows/7=\u063a
+FormatData/ar/MonthNarrows/8=\u0633
+FormatData/ar/MonthNarrows/9=\u0643
+FormatData/ar/MonthNarrows/10=\u0628
+FormatData/ar/MonthNarrows/11=\u062f
+FormatData/ar/MonthNarrows/12=
+FormatData/ru/MonthNarrows/0=\u042f
+FormatData/ru/MonthNarrows/1=\u0424
+FormatData/ru/MonthNarrows/2=\u041c
+FormatData/ru/MonthNarrows/3=\u0410
+FormatData/ru/MonthNarrows/4=\u041c
+FormatData/ru/MonthNarrows/5=\u0418
+FormatData/ru/MonthNarrows/6=\u0418
+FormatData/ru/MonthNarrows/7=\u0410
+FormatData/ru/MonthNarrows/8=\u0421
+FormatData/ru/MonthNarrows/9=\u041e
+FormatData/ru/MonthNarrows/10=\u041d
+FormatData/ru/MonthNarrows/11=\u0414
+FormatData/ru/MonthNarrows/12=
+FormatData/ms/MonthNarrows/0=J
+FormatData/ms/MonthNarrows/1=F
+FormatData/ms/MonthNarrows/2=M
+FormatData/ms/MonthNarrows/3=A
+FormatData/ms/MonthNarrows/4=M
+FormatData/ms/MonthNarrows/5=J
+FormatData/ms/MonthNarrows/6=J
+FormatData/ms/MonthNarrows/7=O
+FormatData/ms/MonthNarrows/8=S
+FormatData/ms/MonthNarrows/9=O
+FormatData/ms/MonthNarrows/10=N
+FormatData/ms/MonthNarrows/11=D
+FormatData/ms/MonthNarrows/12=
+FormatData/nl/MonthNarrows/0=J
+FormatData/nl/MonthNarrows/1=F
+FormatData/nl/MonthNarrows/2=M
+FormatData/nl/MonthNarrows/3=A
+FormatData/nl/MonthNarrows/4=M
+FormatData/nl/MonthNarrows/5=J
+FormatData/nl/MonthNarrows/6=J
+FormatData/nl/MonthNarrows/7=A
+FormatData/nl/MonthNarrows/8=S
+FormatData/nl/MonthNarrows/9=O
+FormatData/nl/MonthNarrows/10=N
+FormatData/nl/MonthNarrows/11=D
+FormatData/nl/MonthNarrows/12=
+FormatData/vi/MonthNarrows/0=1
+FormatData/vi/MonthNarrows/1=2
+FormatData/vi/MonthNarrows/2=3
+FormatData/vi/MonthNarrows/3=4
+FormatData/vi/MonthNarrows/4=5
+FormatData/vi/MonthNarrows/5=6
+FormatData/vi/MonthNarrows/6=7
+FormatData/vi/MonthNarrows/7=8
+FormatData/vi/MonthNarrows/8=9
+FormatData/vi/MonthNarrows/9=10
+FormatData/vi/MonthNarrows/10=11
+FormatData/vi/MonthNarrows/11=12
+FormatData/vi/MonthNarrows/12=
+FormatData/sr/MonthNarrows/0=\u0458
+FormatData/sr/MonthNarrows/1=\u0444
+FormatData/sr/MonthNarrows/2=\u043c
+FormatData/sr/MonthNarrows/3=\u0430
+FormatData/sr/MonthNarrows/4=\u043c
+FormatData/sr/MonthNarrows/5=\u0458
+FormatData/sr/MonthNarrows/6=\u0458
+FormatData/sr/MonthNarrows/7=\u0430
+FormatData/sr/MonthNarrows/8=\u0441
+FormatData/sr/MonthNarrows/9=\u043e
+FormatData/sr/MonthNarrows/10=\u043d
+FormatData/sr/MonthNarrows/11=\u0434
+FormatData/sr/MonthNarrows/12=
+FormatData/mt/MonthNarrows/0=J
+FormatData/mt/MonthNarrows/1=F
+FormatData/mt/MonthNarrows/2=M
+FormatData/mt/MonthNarrows/3=A
+FormatData/mt/MonthNarrows/4=M
+FormatData/mt/MonthNarrows/5=\u0120
+FormatData/mt/MonthNarrows/6=L
+FormatData/mt/MonthNarrows/7=A
+FormatData/mt/MonthNarrows/8=S
+FormatData/mt/MonthNarrows/9=O
+FormatData/mt/MonthNarrows/10=N
+FormatData/mt/MonthNarrows/11=D
+FormatData/mt/MonthNarrows/12=
+FormatData/da/MonthNarrows/0=J
+FormatData/da/MonthNarrows/1=F
+FormatData/da/MonthNarrows/2=M
+FormatData/da/MonthNarrows/3=A
+FormatData/da/MonthNarrows/4=M
+FormatData/da/MonthNarrows/5=J
+FormatData/da/MonthNarrows/6=J
+FormatData/da/MonthNarrows/7=A
+FormatData/da/MonthNarrows/8=S
+FormatData/da/MonthNarrows/9=O
+FormatData/da/MonthNarrows/10=N
+FormatData/da/MonthNarrows/11=D
+FormatData/da/MonthNarrows/12=
+FormatData/ro/MonthNarrows/0=I
+FormatData/ro/MonthNarrows/1=F
+FormatData/ro/MonthNarrows/2=M
+FormatData/ro/MonthNarrows/3=A
+FormatData/ro/MonthNarrows/4=M
+FormatData/ro/MonthNarrows/5=I
+FormatData/ro/MonthNarrows/6=I
+FormatData/ro/MonthNarrows/7=A
+FormatData/ro/MonthNarrows/8=S
+FormatData/ro/MonthNarrows/9=O
+FormatData/ro/MonthNarrows/10=N
+FormatData/ro/MonthNarrows/11=D
+FormatData/ro/MonthNarrows/12=
+FormatData/no/MonthNarrows/0=J
+FormatData/no/MonthNarrows/1=F
+FormatData/no/MonthNarrows/2=M
+FormatData/no/MonthNarrows/3=A
+FormatData/no/MonthNarrows/4=M
+FormatData/no/MonthNarrows/5=J
+FormatData/no/MonthNarrows/6=J
+FormatData/no/MonthNarrows/7=A
+FormatData/no/MonthNarrows/8=S
+FormatData/no/MonthNarrows/9=O
+FormatData/no/MonthNarrows/10=N
+FormatData/no/MonthNarrows/11=D
+FormatData/no/MonthNarrows/12=
+FormatData/pl/MonthNarrows/0=s
+FormatData/pl/MonthNarrows/1=l
+FormatData/pl/MonthNarrows/2=m
+FormatData/pl/MonthNarrows/3=k
+FormatData/pl/MonthNarrows/4=m
+FormatData/pl/MonthNarrows/5=c
+FormatData/pl/MonthNarrows/6=l
+FormatData/pl/MonthNarrows/7=s
+FormatData/pl/MonthNarrows/8=w
+FormatData/pl/MonthNarrows/9=p
+FormatData/pl/MonthNarrows/10=l
+FormatData/pl/MonthNarrows/11=g
+FormatData/pl/MonthNarrows/12=
+FormatData/iw/MonthNarrows/0=1
+FormatData/iw/MonthNarrows/1=2
+FormatData/iw/MonthNarrows/2=3
+FormatData/iw/MonthNarrows/3=4
+FormatData/iw/MonthNarrows/4=5
+FormatData/iw/MonthNarrows/5=6
+FormatData/iw/MonthNarrows/6=7
+FormatData/iw/MonthNarrows/7=8
+FormatData/iw/MonthNarrows/8=9
+FormatData/iw/MonthNarrows/9=10
+FormatData/iw/MonthNarrows/10=11
+FormatData/iw/MonthNarrows/11=12
+FormatData/iw/MonthNarrows/12=
+FormatData/zh/MonthNarrows/0=1
+FormatData/zh/MonthNarrows/1=2
+FormatData/zh/MonthNarrows/2=3
+FormatData/zh/MonthNarrows/3=4
+FormatData/zh/MonthNarrows/4=5
+FormatData/zh/MonthNarrows/5=6
+FormatData/zh/MonthNarrows/6=7
+FormatData/zh/MonthNarrows/7=8
+FormatData/zh/MonthNarrows/8=9
+FormatData/zh/MonthNarrows/9=10
+FormatData/zh/MonthNarrows/10=11
+FormatData/zh/MonthNarrows/11=12
+FormatData/zh/MonthNarrows/12=
diff --git a/test/sun/text/resources/LocaleDataTest.java b/test/sun/text/resources/LocaleDataTest.java
index e2cea1a..6ac5dc5 100644
--- a/test/sun/text/resources/LocaleDataTest.java
+++ b/test/sun/text/resources/LocaleDataTest.java
@@ -36,7 +36,7 @@
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 7090826
- *      8017142 8037343 8055222
+ *      8017142 8037343 8055222 8042126
  * @summary Verify locale data
  *
  */
diff --git a/test/sun/tools/jrunscript/jrunscriptTest.sh b/test/sun/tools/jrunscript/jrunscriptTest.sh
index 921524b..ab4cb16 100644
--- a/test/sun/tools/jrunscript/jrunscriptTest.sh
+++ b/test/sun/tools/jrunscript/jrunscriptTest.sh
@@ -42,7 +42,7 @@
 rm -f jrunscriptTest.out 2>/dev/null
 ${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn > jrunscriptTest.out 2>&1 <<EOF
 v = 2 + 5;
-v *= 5;
+v *= 5; v.doubleValue();
 v = v + " is the value";
 if (v != 0) { println('yes v != 0'); }
 java.lang.System.out.println('hello world from script');
diff --git a/test/tools/launcher/TestSpecialArgs.java b/test/tools/launcher/TestSpecialArgs.java
index 344869b..04344e6 100644
--- a/test/tools/launcher/TestSpecialArgs.java
+++ b/test/tools/launcher/TestSpecialArgs.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7124089 7131021
+ * @bug 7124089 7131021 8042469
  * @summary Checks for MacOSX specific flags are accepted or rejected, and
  *          MacOSX platforms specific environment is consistent.
  * @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
@@ -69,6 +69,137 @@
                 throw new RuntimeException("Error: argument was accepted ????");
             }
         }
+
+        /*
+         * test argument : -XX:NativeMemoryTracking=value
+         * A JVM flag, comsumed by the JVM, but requiring launcher
+         * to set an environmental variable if and only if value is supplied.
+         * Test and order:
+         * 1) execute with valid parameter: -XX:NativeMemoryTracking=MyValue
+         *    a) check for correct env variable name: "NMT_LEVEL_" + pid
+         *    b) check that "MyValue" was found in local env.
+         * 2) execute with invalid parameter: -XX:NativeMemoryTracking=
+         *    !) Won't find "NativeMemoryTracking:"
+         *       Code to create env variable not executed.
+         * 3) execute with invalid parameter: -XX:NativeMemoryTracking
+         *    !) Won't find "NativeMemoryTracking:"
+         *       Code to create env variable not executed.
+         * 4) give and invalid value and check to make sure JVM commented
+         */
+        { // NativeMemoryTracking
+            String launcherPidString = "launcher.pid=";
+            String envVarPidString = "TRACER_MARKER: NativeMemoryTracking: env var is NMT_LEVEL_";
+            String NMT_Option_Value = "off";
+            String myClassName = "helloworld";
+            boolean haveLauncherPid = false;
+
+            // === Run the tests ===
+
+            // ---Test 1a
+            tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=" + NMT_Option_Value,
+                        "-version");
+
+            // get the PID from the env var we set for the JVM
+            String envVarPid = null;
+            for (String line : tr.testOutput) {
+                if (line.contains(envVarPidString)) {
+                    int sindex = envVarPidString.length();
+                    envVarPid = line.substring(sindex);
+                    break;
+                }
+            }
+            // did we find envVarPid?
+            if (envVarPid == null) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: failed to find env Var Pid in tracking info");
+            }
+            // we think we found the pid string.  min test, not "".
+            if (envVarPid.length() < 1) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: env Var Pid in tracking info is empty string");
+            }
+
+            /*
+             * On Linux, Launcher Tracking will print the PID.  Use this info
+             * to validate what we got as the PID in the Launcher itself.
+             * Linux is the only one that prints this, and trying to get it
+             * here for win is awful.  So let the linux test make sure we get
+             * the valid pid, and for non-linux, just make sure pid string is
+             * non-zero.
+             */
+            if (isLinux) {
+                // get what the test says is the launcher pid
+                String launcherPid = null;
+                for (String line : tr.testOutput) {
+                    int index = line.indexOf(launcherPidString);
+                    if (index >= 0) {
+                        int sindex = index + launcherPidString.length();
+                        int tindex = sindex + line.substring(sindex).indexOf("'");
+                        System.out.println("DEBUG INFO: sindex = " + sindex);
+                        System.out.println("DEBUG INFO: searching substring: " + line.substring(sindex));
+                        System.out.println("DEBUG INFO: tindex = " + tindex);
+                        // DEBUG INFO
+                        System.out.println(tr);
+                        launcherPid = line.substring(sindex, tindex);
+                        break;
+                    }
+                }
+                if (launcherPid == null) {
+                    System.out.println(tr);
+                    throw new RuntimeException("Error: failed to find launcher Pid in launcher tracking info");
+                }
+
+                // did we create the env var with the correct pid?
+                if (!launcherPid.equals(envVarPid)) {
+                    System.out.println(tr);
+                    System.out.println("Error: wrong pid in creating env var");
+                    System.out.println("Error Info: launcherPid = " + launcherPid);
+                    System.out.println("Error Info: envVarPid   = " + envVarPid);
+                    throw new RuntimeException("Error: wrong pid in creating env var");
+                }
+            }
+
+
+            // --- Test 1b
+            if (!tr.contains("NativeMemoryTracking: got value " + NMT_Option_Value)) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: Valid param failed to set env variable");
+            }
+
+            // --- Test 2
+            tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=",
+                        "-version");
+            if (tr.contains("NativeMemoryTracking:")) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: invalid param caused env variable to be erroneously created");
+            }
+            if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: invalid param not checked by JVM");
+            }
+
+            // --- Test 3
+            tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking",
+                        "-version");
+            if (tr.contains("NativeMemoryTracking:")) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: invalid param caused env variable to be erroneously created");
+            }
+            if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: invalid param not checked by JVM");
+            }
+            // --- Test 4
+            tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=BADVALUE",
+                        "-version");
+            if (!tr.contains("expecting -XX:NativeMemoryTracking")) {
+                System.out.println(tr);
+                throw new RuntimeException("Error: invalid param did not get JVM Syntax error message");
+            }
+
+        } // NativeMemoryTracking
+
+
         // MacOSX specific tests ensue......
         if (!isMacOSX)
             return;