Merge
authortrims
Fri, 04 Feb 2011 16:29:41 -0800
changeset 8105 d5bd38a11ccd
parent 8095 6823ea7eb8eb (diff)
parent 8104 f51b1f1750ac (current diff)
child 8113 704d4d037c84
Merge
--- a/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 aa894c225b1a517b665ac2a58295217ea2245134 jdk7-b124
 f658ec2730fa29323c36d23c27e54c7219ef5e16 jdk7-b125
 f1df068076986679ea1105532a65529d63a89060 jdk7-b126
+f83cd8bd35c678f94e526990e03dc838d0ec2717 jdk7-b127
+7da3f5f30855dec6bf3a86529e87dee883b90c72 jdk7-b128
--- a/.hgtags-top-repo	Thu Feb 03 16:06:01 2011 -0500
+++ b/.hgtags-top-repo	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 024a6755895bf91b5a3c98984c89ee018efbf538 jdk7-b124
 5c4df7e992775c102f08e9f1c0a124b324641b70 jdk7-b125
 b566d490905691787f8931f69947a92c67c6d5e4 jdk7-b126
+bd70f76b0309068f157ae759c36eac8f2c6d098e jdk7-b127
+57d702105b23fb90e40beaf00f8f8aeae5e249e7 jdk7-b128
--- a/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -29,15 +29,6 @@
   TOPDIR:=.
 endif
 
-# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
-OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
-OPENJDK_BUILDDIR:=$(shell \
-  if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \
-    echo "$(OPENJDK_SOURCETREE)"; \
-  else \
-    echo "."; \
-  fi)
-
 ifndef JDK_TOPDIR
   JDK_TOPDIR=$(TOPDIR)/jdk
 endif
@@ -70,7 +61,7 @@
 all::
 	@$(START_ECHO)
 
-all:: openjdk_check sanity
+all:: sanity
 
 ifeq ($(SKIP_FASTDEBUG_BUILD), false)
   all:: fastdebug_build
@@ -80,10 +71,6 @@
   all:: debug_build
 endif
 
-ifneq ($(SKIP_OPENJDK_BUILD), true)
-  all:: openjdk_build
-endif
-
 all:: all_product_build 
 
 all:: 
@@ -267,81 +254,6 @@
 debug_build:: build_debug_image
 fastdebug_build:: build_fastdebug_image
 
-# Check on whether we really can build the openjdk, need source etc.
-openjdk_check: FRC
-ifneq ($(SKIP_OPENJDK_BUILD), true)
-	@$(ECHO) " "
-	@$(ECHO) "================================================="
-	@if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \
-	    $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \
-	    exit 1; \
-	else \
-	    $(ECHO) "OpenJDK will be built after JDK is built"; \
-	    $(ECHO) "  OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \
-	fi
-	@$(ECHO) "================================================="
-	@$(ECHO) " "
-endif
-
-# If we have bundle rules, we have a chance here to do a complete cycle
-#   build, of production and open build.
-# FIXUP: We should create the openjdk source bundle and build that?
-#   But how do we reliable create or get at a formal openjdk source tree?
-#   The one we have needs to be trimmed of built bits and closed dirs.
-#   The repositories might not be available.
-#   The openjdk source bundle is probably not available.
-
-ifneq ($(SKIP_OPENJDK_BUILD), true)
-  ifeq ($(BUILD_JDK), true)
-    ifeq ($(BUNDLE_RULES_AVAILABLE), true)
-
-OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
-OPENJDK_BUILD_NAME \
-  = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
-OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
-BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
-ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
-  OPENJDK_BOOTDIR=$(BOOTDIR)
-  OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
-else
-  OPENJDK_BOOTDIR=$(BUILT_IMAGE)
-  OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
-endif
-
-openjdk_build:
-	@$(START_ECHO)
-	@$(ECHO) " "
-	@$(ECHO) "================================================="
-	@$(ECHO) "Starting openjdk build"
-	@$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
-	@$(ECHO) "================================================="
-	@$(ECHO) " "
-	$(RM) -r $(OPENJDK_OUTPUTDIR)
-	$(MKDIR) -p $(OPENJDK_OUTPUTDIR)
-	($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
-	  OPENJDK=true \
-	  GENERATE_DOCS=false \
-	  ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
-	  ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
-	  ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
-	  ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
-		product_build )
-	$(RM) $(OPENJDK_BUILD_BINARY_ZIP)
-	( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
-	  $(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
-	$(RM) -r $(OPENJDK_OUTPUTDIR)
-	@$(ECHO) " "
-	@$(ECHO) "================================================="
-	@$(ECHO) "Finished openjdk build"
-	@$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
-	@$(ECHO) "================================================="
-	@$(ECHO) " "
-	@$(FINISH_ECHO)
-    
-    endif
-  endif
-endif
-
 clobber::
 	$(RM) -r $(OUTPUTDIR)/*
 	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
@@ -448,7 +360,6 @@
 DEVTOOLS_PATH.desc         = Directory containing zip and gnumake
 CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
 DXSDK_PATH.desc            = Root directory of DirectX SDK
-MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll
 
 # Make variables to print out (description and value)
 VARIABLE_PRINTVAL_LIST +=       \
@@ -477,12 +388,10 @@
 ifeq ($(PLATFORM), windows)
 
 VARIABLE_PRINTVAL_LIST +=       \
-    DXSDK_PATH                  \
-    MSVCRT_DLL_PATH
+    DXSDK_PATH
 
 VARIABLE_CHECKDIR_LIST +=       \
-    DXSDK_PATH                  \
-    MSVCRT_DLL_PATH
+    DXSDK_PATH
 
 endif
 
--- a/README-builds.html	Thu Feb 03 16:06:01 2011 -0500
+++ b/README-builds.html	Fri Feb 04 16:29:41 2011 -0800
@@ -921,7 +921,7 @@
             <!-- ------------------------------------------------------ -->
             <h4><a name="ant">Ant</a></h4>
             <blockquote>
-                All OpenJDK builds require access to least Ant 1.6.5.
+                All OpenJDK builds require access to least Ant 1.7.1.
                 The Ant tool is available from the 
                 <a href="http://ant.apache.org" target="_blank">
                     Ant download site</a>.
@@ -1414,14 +1414,14 @@
                 but it's normally found via the DirectX environment variable
                 <tt>DXSDK_DIR</tt>.
             </blockquote>
-            <strong><a name="msvcrt"><tt>MSVCR100.DLL</tt></a></strong>
+            <strong><a name="msvcrNN"><tt>MSVCR100.DLL</tt></a></strong>
             <blockquote> 
                 The OpenJDK build requires access to a redistributable
                 <tt>MSVCR100.DLL</tt>.
                 This is usually picked up automatically from the redist
                 directories of Visual Studio 2010.
                 If this cannot be found set the 
-                <a href="#ALT_MSVCRT_DLL_PATH"><tt>ALT_MSVCRT_DLL_PATH</tt></a>
+                <a href="#ALT_MSVCRNN_DLL_PATH"><tt>ALT_MSVCRNN_DLL_PATH</tt></a>
                 variable to the location of this file.
                 <p> 
             </blockquote>
@@ -1671,15 +1671,10 @@
                             variable <tt>DXSDK_DIR</tt>,
                             failing that, look in <tt>C:/DXSDK</tt>.
                         </dd>
-                        <dt><tt><a name="ALT_MSVCRT_DLL_PATH">ALT_MSVCRT_DLL_PATH</a></tt> </dt>
-                        <dd>
-                            The location of the 
-                            <a href="#msvcrt"><tt>MSVCRT.DLL</tt></a>. 
-                        </dd>
                         <dt><tt><a name="ALT_MSVCRNN_DLL_PATH">ALT_MSVCRNN_DLL_PATH</a></tt> </dt>
                         <dd>
                             The location of the 
-                            <a href="#msvcrt"><tt>MSVCR100.DLL</tt></a>. 
+                            <a href="#msvcrNN"><tt>MSVCR100.DLL</tt></a>. 
                         </dd>
                     </dl>
                 </dd>
--- a/corba/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 f90b3e014e831eb4f32ef035a1dad2b8ba87949f jdk7-b124
 1ce58c72b7892cb813eb920276c7e7f17a1b79fe jdk7-b125
 d7532bcd3742f1576dd07ff9fbb535c9c9a276e9 jdk7-b126
+64775e83f4df894355f45555f50c410de6727b4e jdk7-b127
+9baa8f94a11d6c5cab3f9f0e5a20106326d0932e jdk7-b128
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+; 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+; 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+; 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+; 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+; Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
 ; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 ;
 ; This code is free software; you can redistribute it and/or modify it
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,6 +1,6 @@
 ;
 
-; Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+; Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
 ; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 ;
 ; This code is free software; you can redistribute it and/or modify it
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+; 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc	Thu Feb 03 16:06:01 2011 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 ;
-; Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
+; Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
 ; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 ;
 ; This code is free software; you can redistribute it and/or modify it
--- a/hotspot/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/hotspot/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -144,3 +144,5 @@
 4c851c931d001a882cab809aaf3a55371b919244 jdk7-b126
 e24ab3fa6aafad3efabbe7dba9918c5f461a20b1 hs20-b06
 d535bf4c12355a2897e918da9f8910c0aceec4fb hs20-b07
+102466e70debc4b907afbd7624e34ddb1aafee9f jdk7-b127
+9a5762f448595794d449a8e17342abd81a3fadaf jdk7-b128
--- a/jaxp/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/jaxp/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 57ed1f3bec72924cdad102f9bf90f7449ea7bb83 jdk7-b124
 6c9bdee0cc3a8912acc5189cc092b8cba6851f9d jdk7-b125
 2fde639439c1fb3fbc44f533d48bb2916e813312 jdk7-b126
+c532d6dbc8d18d55b5d693599ee5cd8250e16eb4 jdk7-b127
+a42c6132c746c86e9fc27ec80cbd699f6ee5edca jdk7-b128
--- a/jaxws/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/jaxws/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 86f60e5b3975840968f3147ddce047a27a9fc83e jdk7-b124
 d72eea121c3bc2b649272a37b80d9417855b7146 jdk7-b125
 6d772c5119d5e247bc98a57ce8b1be121554ee0a jdk7-b126
+ef19f173578c804772d586a959fa3ab8a12c0598 jdk7-b127
+88d74afc55938033e744b537a22714bb2c82c9c0 jdk7-b128
--- a/jdk/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 1c72adc9d5f331cb882cf5354ba0dcb118a60b23 jdk7-b124
 0a56bdd709d01c1663047e55201d19152ffd3d69 jdk7-b125
 8361ef97a0f90086c9048beaf7cea1a37216c4cd jdk7-b126
+29e09de1d0b4f84faea114cf10b3ec08b59acc4e jdk7-b127
+f08682e23279d6cccbdcafda1eb0647ba4900874 jdk7-b128
--- a/jdk/make/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -100,7 +100,6 @@
 DEVTOOLS_PATH.desc         = Directory containing zip and unzip
 CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files
 DXSDK_PATH.desc            = Root directory of DirectX SDK
-MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll
 
 # Make variables to print out (description and value)
 VARIABLE_PRINTVAL_LIST +=       \
@@ -133,12 +132,10 @@
 ifeq ($(PLATFORM), windows)
 
 VARIABLE_PRINTVAL_LIST +=       \
-    DXSDK_PATH                  \
-    MSVCRT_DLL_PATH
+    DXSDK_PATH
 
 VARIABLE_CHECKDIR_LIST +=       \
-    DXSDK_PATH                  \
-    MSVCRT_DLL_PATH
+    DXSDK_PATH
 
 endif
 
--- a/jdk/make/com/sun/java/pack/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/com/sun/java/pack/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -155,6 +155,7 @@
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
 endif
 	$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
+	@$(call binary_file_verification,$@)
 	$(install-module-file)
 
 ifeq ($(PLATFORM), windows) 
--- a/jdk/make/common/Defs-linux.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Defs-linux.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -75,15 +75,6 @@
 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
 
 #
-# Default HPI libraries. Build will build only native, unless
-# overriden at the make command line. This makes it convenient for
-# people doing, say, a pthreads port -- they can create a posix
-# directory here, and say "gnumake HPIS=posix" at the top
-# level.
-#
-HPIS = native
-
-#
 # Default optimization
 #
 
--- a/jdk/make/common/Defs-solaris.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Defs-solaris.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -75,15 +75,6 @@
 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
 
 #
-# Default HPI libraries. Build will build only native unless
-# overriden at the make command line. This makes it convenient for
-# people doing, say, a pthreads port -- they can create a posix
-# directory here, and say "gnumake HPIS=posix" at the top
-# level.
-#
-HPIS = native
-
-#
 # Java default optimization (-x04/-O2) etc.  Applies to the VM.
 #
 ifndef OPTIMIZATION_LEVEL
--- a/jdk/make/common/Defs-windows.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Defs-windows.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -43,7 +43,6 @@
 # The suffix applied to scripts (.bat for windows, nothing for unix)
 SCRIPT_SUFFIX = .bat
 
-HPIS = windows
 # LIB_LOCATION, which for windows identifies where .exe files go, may be
 # set by each GNUmakefile. The default is BINDIR.
 ifndef LIB_LOCATION
@@ -68,28 +67,27 @@
 
 # The following DLL's are considered MS runtime libraries and should
 #     not to be REBASEd, see deploy/make/common/Release.gmk.
-#     msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes
-MS_RUNTIME_LIBRARIES = msvcrt.dll
+#     msvcr*.dll: Microsoft runtimes
 ifeq ($(ARCH_DATA_MODEL), 32)
   ifeq ($(COMPILER_VERSION), VS2003)
     MSVCRNN_DLL = msvcr71.dll
     MSVCPNN_DLL = msvcp71.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
   endif
   ifeq ($(COMPILER_VERSION), VS2005)
     MSVCRNN_DLL = msvcr80.dll
     MSVCPNN_DLL = msvcp80.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
   endif
   ifeq ($(COMPILER_VERSION), VS2008)
     MSVCRNN_DLL = msvcr90.dll
     MSVCPNN_DLL = msvcp90.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
   endif
   ifeq ($(COMPILER_VERSION), VS2010)
     MSVCRNN_DLL = msvcr100.dll
     MSVCPNN_DLL = msvcp100.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
   endif
 endif
 
@@ -97,12 +95,12 @@
   ifeq ($(COMPILER_VERSION), VS2008)
     MSVCRNN_DLL = msvcr90.dll
     MSVCPNN_DLL = msvcp90.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
   endif
   ifeq ($(COMPILER_VERSION), VS2010)
     MSVCRNN_DLL = msvcr100.dll
     MSVCPNN_DLL = msvcp100.dll
-    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+    MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
   endif
 endif
 
@@ -284,7 +282,7 @@
     MS_RUNTIME_OPTION=-MTd
   else
     # This MS debugging flag forces a dependence on the debug
-    #     version of the runtime library (MSVCRTD.DLL), as does -MDd.
+    #     version of the runtime library (MSVCR*D.DLL), as does -MDd.
     #     We cannot re-distribute this debug runtime.
     MS_RUNTIME_OPTION=-MDd
   endif
@@ -365,10 +363,6 @@
 
   # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
   BASELFLAGS = -nologo /opt:REF /incremental:no
-ifdef MT
-    # VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
-    BASELFLAGS += /manifest
-endif
 
   LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
   LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
--- a/jdk/make/common/Defs.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Defs.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -271,10 +271,9 @@
 # An attempt is made to generate unique enough directories for the
 # generated files to not have name collisisons. Most build units
 # defines PRODUCT (except Release.gmk), but then they may or may 
-# not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and 
-# LIBRARY. This code chunk attempts to generate a unique 
-# OBJDIR/CLASSHDRDIR for each build unit based on which of those 
-# values are set within each build unit.
+# not define PACKAGE, PROGRAM, and LIBRARY. This code attempts to
+# generate a unique OBJDIR/CLASSHDRDIR for each build unit based
+# on which of those values are set within each build unit.
 
 UNIQUE_LOCATION_STRING = tmp
 
@@ -298,10 +297,6 @@
   endif
 endif
 
-ifneq ($(THREADDIR),)
-  UNIQUE_LOCATION_STRING += /$(THREADDIR)
-endif
-
 #
 # Build units may or may not define MODULE.  Default to "other".
 #
--- a/jdk/make/common/Demo.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Demo.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -73,8 +73,11 @@
 
 # Destination "src" directory
 DEMO_BUILD_SRCDIR     = $(DEMO_BUILD_AREA)/src
-DEMO_BUILD_SRCZIP     = $(DEMO_BUILD_AREA)/src.zip
-DEMO_SOURCE_ZIP       = $(DEMO_DESTDIR)/src.zip
+
+ifndef DEMO_SKIP_SRCZIP
+  DEMO_BUILD_SRCZIP     = $(DEMO_BUILD_AREA)/src.zip
+  DEMO_SOURCE_ZIP       = $(DEMO_DESTDIR)/src.zip
+endif
 
 # Place to hold the jar image we are creating
 DEMO_JAR_IMAGE      = $(DEMO_BUILD_AREA)/jar_image
@@ -258,14 +261,16 @@
 
 endif
 
-# Create a src.zip file
-$(DEMO_BUILD_SRCZIP): $(DEMO_FULL_SOURCES)
+ifndef DEMO_SKIP_SRCZIP
+  # Create a src.zip file
+  $(DEMO_BUILD_SRCZIP): $(DEMO_FULL_SOURCES)
 	@$(prep-target)
 	$(CD) $(DEMO_BUILD_AREA)/src && $(ZIPEXE) -q -r ../$(@F) .
 
-# Install the destination src.zip file and create the src tree
-$(DEMO_SOURCE_ZIP): $(DEMO_BUILD_SRCZIP)
+  # Install the destination src.zip file and create the src tree
+  $(DEMO_SOURCE_ZIP): $(DEMO_BUILD_SRCZIP)
 	$(install-file)
+endif
 
 # Native library building
 ifdef DEMO_LIBRARY
@@ -289,6 +294,7 @@
 	@$(prep-target)
 	$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
 	    $(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
+	@$(call binary_file_verification,$@)
 
   # Generation of any javah include file, make sure objects are dependent on it
   ifdef DEMO_NATIVECLASS
@@ -362,7 +368,7 @@
 	$(RM) -r $(DEMO_BUILD_AREA)
 	$(RM) -r $(DEMO_DESTDIR)
 
-# This should not be needed, but some versions of GNU amke have a bug that
+# This should not be needed, but some versions of GNU make have a bug that
 #   sometimes deleted these files  for some strange  and unknown reason 
 #   (GNU make version 3.78.1 has the problem, GNU make version 3.80 doesn't?)
 .PRECIOUS: $(DEMO_FULL_SOURCES) $(DEMO_BUILD_SRCZIP) $(DEMO_SOURCE_ZIP)
--- a/jdk/make/common/Library.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Library.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -159,9 +159,6 @@
 # build it into $(OBJDIR) so that the other generated files get put 
 # there, then copy just the DLL (and MAP file) to the requested directory.
 #
-# In VS2005 or VS2008 the link command creates a .manifest file that we want
-# to insert into the linked artifact so we do not need to track it separately.
-# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
 $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
 	@$(prep-target)
 	@$(MKDIR) -p $(OBJDIR)
@@ -169,10 +166,8 @@
 	  -map:$(OBJDIR)/$(LIBRARY).map \
 	  $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
 	  $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
-ifdef MT
-	$(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2
-endif
 	$(CP) $(OBJDIR)/$(@F) $@
+	@$(call binary_file_verification,$@)
 	$(install-module-file)
 	$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
 	$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
@@ -239,6 +234,7 @@
 	$(AR) -r $@ $(FILES_o)
 else # LIBRARY
 	$(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS)
+	@$(call binary_file_verification,$@)
 	$(install-module-file)
 ifeq ($(WRITE_LIBVERSION),true)
 	$(MCS) -d -a "$(FULL_VERSION)" $@
--- a/jdk/make/common/Modules.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Modules.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -73,47 +73,20 @@
 
 #
 # Paths to these files we need
-JDK_MODULE_LICENSES   = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
-JDK_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%64)
-JDK_MODULE_DOCFILES   = $(OTHER_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
-
-JRE_MODULE_LICENSES   = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
-JRE_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%64)
-JRE_MODULE_DOCFILES   = $(OTHER_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
-JRE_MODULE_DOCFILES  += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX))
+JDK_MODULE_DOCFILES   = $(IMAGE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
+JRE_MODULE_DOCFILES   = $(IMAGE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
 
 ###### RULES
 
 # JDK files
 $(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
 	$(process-doc-file)
-# Removes LICENSE_VERSION or not
-ifdef LICENSE_VERSION
-$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-else
-$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%
-	$(process-doc-file)
-endif
 
 # JRE files 
 $(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
 	$(process-doc-file)
-# Add $(TEXT_SUFFIX) suffix
-ifdef TEXT_SUFFIX
-$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/%
-	$(process-doc-file)
-endif
-# Removes LICENSE_VERSION or not
-ifdef LICENSE_VERSION
-$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-else
-$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%
+ifeq ($(PLATFORM), windows)
+$(JRE_MODULE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
 	$(process-doc-file)
 endif
 
@@ -157,8 +130,7 @@
 	$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)
 
 # 64-bit solaris jre image contains only the 64-bit add-on files.
-initial-module-image-jre-sol64:: initial-module-image-jre-setup \
-			  $(JRE_MODULE_LICENSES) $(JRE_MODULE_64_LICENSES)
+initial-module-image-jre-sol64:: initial-module-image-jre-setup
 	@# Use tar instead of cp to preserve the symbolic links
 	for dir in bin lib ; do \
 	  ( $(CD) $(OUTPUTDIR) && \
@@ -174,7 +146,7 @@
 
 # Construct an initial jre image (initial jdk jre) no trimming or stripping
 initial-module-image-jre:: initial-module-image-jre-setup \
-		    $(JRE_LICENSES) $(JRE_MODULE_DOCFILES) \
+		    $(JRE_MODULE_DOCFILES) \
 		    $(BUILDMETAINDEX_JARFILE)
 	@# Copy in bin directory
 	$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
@@ -222,7 +194,7 @@
 	@# Remove certain *.lib files
 	$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
             $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
-                  hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
+                  awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
   ifeq ($(ARCH_DATA_MODEL), 32)
 	@# The Java Kernel JRE image ships with a special VM.  It is not included
 	@# in the full JRE image, so remove it.  Also, is it only for 32-bit windows.
@@ -310,8 +282,7 @@
 
 # Solaris 64 bit image is special
 initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \
-			  initial-module-image-jdk64-bindemos \
-			  $(JDK_MODULE_LICENSES) $(JDK_MODULARLIZED_64_LICENSES)
+			  initial-module-image-jdk64-bindemos
 
 # DB files to add
 ifeq ($(OPENJDK),true)
@@ -335,7 +306,7 @@
 # Standard jdk image
 initial-module-image-jdk:: initial-module-image-jdk-setup \
 		    initial-module-image-jdk-db \
-		    $(JDK_MODULE_LICENSES) $(JDK_MODULE_DOCFILES)
+		    $(JDK_MODULE_DOCFILES)
 	$(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib
 	@#
 	@# copy jdk modules to jdk/lib
@@ -415,8 +386,7 @@
 trim-module-image-jdk::
 	@# Remove tools that should not be part of SDK.
 	for t in $(NOTJDKTOOLS); do \
-	    $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \
-		  $(JDK_MODULE_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \
+	    $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
 	done
 
 # Get list of Elf files in the jdk
--- a/jdk/make/common/Program.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Program.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -142,10 +142,15 @@
   STACK_SIZE=1048576
 endif
 
-# In VS2005 or VS2008 the link command creates a .manifest file that we want
-# to insert into the linked artifact so we do not need to track it separately.
+IMVERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
+$(OBJDIR)/$(PROGRAM).exe.manifest: $(JDK_TOPDIR)/src/windows/resource/java.manifest
+	@$(prep-target)
+	$(SED) 's%IMVERSION%$(IMVERSION)%g;s%PROGRAM%$(PROGRAM)%g' $< > $@
+
+# We used a hand-crafted manifest file for all executables.
+# It is tweaked to embed the build number and executable name.
 # Use ";#2" for .dll and ";#1" for .exe in the MT command below:
-$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) 
+$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) $(OBJDIR)/$(PROGRAM).exe.manifest
 	@$(prep-target)
 	@set -- $?; \
 	    $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
@@ -155,6 +160,7 @@
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
 endif
+	@$(call binary_file_verification,$@)
 
 else # PLATFORM
 
@@ -179,6 +185,7 @@
 	@$(MKDIR) -p $(TEMPDIR)
 	$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
 	    $(FILES_o) $(THREADLIBS) $(LDLIBS)
+	@$(call binary_file_verification,$@)
 	$(install-module-file)
 
 endif # PLATFORM
--- a/jdk/make/common/Release.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/Release.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -26,6 +26,9 @@
 include $(JDK_TOPDIR)/make/docs/CORE_PKGS.gmk
 include $(JDK_TOPDIR)/make/docs/NON_CORE_PKGS.gmk
 
+# What jdk version are we building
+THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
+
 #
 # Perform release engineering tasks.
 #
@@ -72,14 +75,6 @@
 
 JTG_DOCS            = $(JDK_TOPDIR)/src/solaris/doc
 
-#We use this for man page header
-jdkversion := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
-
-# Text documents on windows use this suffix
-ifeq ($(PLATFORM), windows)
-  TEXT_SUFFIX = .txt
-endif
-
 # The base names of all the license and document files for the jdk and jre
 #   (These files get placed in the jdk and jre install images)
 ifdef OPENJDK
@@ -87,53 +82,28 @@
   SHARE_JDK_DOC_SRC = $(JDK_TOPDIR)
   SHARE_JRE_DOC_SRC = $(JDK_TOPDIR)
   # Same files for jdk and jre, no name changes
-  LICENSE_DOCLIST_JDK = LICENSE     ASSEMBLY_EXCEPTION
-  LICENSE_DOCLIST_JRE = LICENSE     ASSEMBLY_EXCEPTION
-  OTHER_DOCLIST_JDK   = THIRD_PARTY_README
-  OTHER_DOCLIST_JRE   = THIRD_PARTY_README
+  IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+  IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
 else
   # Where to find these files
   SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
   SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
-  # Select the pre-release or FCS license version based on the build milestone.
-  LICENSE_VERSION=.pre
-  ifeq ($(MILESTONE), fcs)
-    LICENSE_VERSION=.fcs
-  endif
+  IMAGE_DOCLIST_JDK = COPYRIGHT README.html  THIRDPARTYLICENSEREADME.txt
+  IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt
   ifeq ($(PLATFORM), windows)
-    LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\
-		   $(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
-		           $(LS) *LICENSE*$(LICENSE_VERSION)))
-    LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
-		   $(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
-		           $(LS) *LICENSE*$(LICENSE_VERSION)))
+    IMAGE_DOCLIST_JRE += README.txt
   else
-    LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\
-	         $(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
-		         $(LS) *LICENSE*$(LICENSE_VERSION) | $(GREP) -v rtf))
-    LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
-	         $(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
-		         $(LS) *LICENSE*$(LICENSE_VERSION) | $(GREP) -v rtf))
+    IMAGE_DOCLIST_JRE += README
   endif
-  OTHER_DOCLIST_JDK = COPYRIGHT README.html README_ja.html README_zh_CN.html
-  OTHER_DOCLIST_JRE = COPYRIGHT Welcome.html
-  JRE_NAMECHANGE_DOCLIST = README
 endif
 
 # Paths to these files we need
-JDK_LICENSES   = $(LICENSE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
-JDK64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%64)
-JDK_DOCFILES   = $(OTHER_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
-
-JRE_LICENSES   = $(LICENSE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
-JRE64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%64)
-JRE_DOCFILES   = $(OTHER_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
-JRE_DOCFILES  += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_IMAGE_DIR)/%$(TEXT_SUFFIX))
+JDK_DOCFILES   = $(IMAGE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
+JRE_DOCFILES   = $(IMAGE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
 
 # absolute directory names: note, these must exist prior to build
 # time - they are created in the main Makefile.
 JRE_IMAGE_BINDIR   = $(JRE_IMAGE_DIR)/bin
-JRE_IMAGE_THREADIR = $(JRE_IMAGE_DIR)/bin/*/native_threads
 
 MAINMANIFEST  = $(JDK_TOPDIR)/make/tools/manifest.mf
 BEANMANIFEST  = $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest
@@ -214,7 +184,7 @@
         $(MKDIR) -p $1/man/$${ja_dir}/man1; \
         $(CAT) $${manbase}/ja/$${manpage} \
           | $(NATIVE2ASCII) -encoding $(JA_SOURCE_ENCODING) \
-          | $(SED) 's/@@VERSION@@/$(jdkversion)/g' \
+          | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
           | $(NATIVE2ASCII) -reverse -encoding $${ja_encoding} \
             > $1/man/$${ja_dir}/man1/$${manpage}; \
       done; \
@@ -244,6 +214,7 @@
 initial-image-jre initial-image-jdk \
 initial-image-jre-sol64 initial-image-jdk-sol64 \
 trim-image-jre trim-image-jdk \
+identify-image-jre identify-image-jdk \
 process-image-jre process-image-jdk \
 compare-image \
 sec-files sec-files-win jgss-files ::
@@ -253,11 +224,12 @@
 images:: sanity-images post-sanity-images  \
 	 $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
 	 trim-image-jre trim-image-jdk \
+         identify-image-jre identify-image-jdk \
 	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files
 
 # Don't use these
-image-jre:: initial-image-jre trim-image-jre process-image-jre
-image-jdk:: initial-image-jdk trim-image-jdk process-image-jdk
+image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
+image-jdk:: initial-image-jdk trim-image-jdk identify-image-jdk process-image-jdk
 
 #
 # Sources we ship in the SDK.
@@ -504,33 +476,12 @@
 # JDK files
 $(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
 	$(process-doc-file)
-# Removes LICENSE_VERSION or not
-ifdef LICENSE_VERSION
-$(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-$(JDK_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-else
-$(JDK_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%
-	$(process-doc-file)
-endif
 
 # JRE files 
 $(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
 	$(process-doc-file)
-# Add $(TEXT_SUFFIX) suffix
-ifdef TEXT_SUFFIX
-$(JRE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/%
-	$(process-doc-file)
-endif
-# Removes LICENSE_VERSION or not
-ifdef LICENSE_VERSION
-$(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-$(JRE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
-	$(process-doc-file)
-else
-$(JRE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%
+ifeq ($(PLATFORM), windows)
+$(JRE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
 	$(process-doc-file)
 endif
 
@@ -738,8 +689,7 @@
 	$(MKDIR) -p $(JRE_IMAGE_DIR)
 
 # 64-bit solaris jre image contains only the 64-bit add-on files.
-initial-image-jre-sol64:: initial-image-jre-setup \
-			  $(JRE_LICENSES) $(JRE64_LICENSES)
+initial-image-jre-sol64:: initial-image-jre-setup
 	@# Use tar instead of cp to preserve the symbolic links
 	for dir in bin lib ; do \
 	  ( $(CD) $(OUTPUTDIR) && \
@@ -760,7 +710,7 @@
 # See "initial-image-jdk-setup" for an explanation of the rm of
 # drive names like C:
 initial-image-jre:: initial-image-jre-setup \
-		    $(JRE_LICENSES) $(JRE_DOCFILES) \
+		    $(JRE_DOCFILES) \
 		    $(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) \
 		    $(BUILDMETAINDEX_JARFILE)
 	@# Copy in bin directory
@@ -802,7 +752,7 @@
 	@# Remove certain *.lib files
 	$(CD) $(JRE_IMAGE_DIR)/lib && \
             $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
-                  hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
+                  awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
   ifeq ($(ARCH_DATA_MODEL), 32)
 	@# The Java Kernel JRE image ships with a special VM.  It is not included
 	@# in the full JRE image, so remove it.  Also, is it only for 32-bit windows.
@@ -836,11 +786,14 @@
   endif
 endif # PLATFORM
 
-# Get list of all Elf files in the jre
-JRE_ELF_LIST=$(TEMPDIR)/jre-elf-files.list
-$(JRE_ELF_LIST):
-ifneq ($(PLATFORM), windows)
+# Get list of all binary (COFF or Elf) files in the jre
+JRE_BIN_LIST=$(TEMPDIR)/jre-bin-files.list
+$(JRE_BIN_LIST):
 	$(RM) $@
+ifeq ($(PLATFORM), windows)
+	$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*.exe \
+	   -o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
+else
 	$(FIND) $(JRE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
 	$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
 	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
@@ -848,9 +801,9 @@
 
 # Post process the image (strips and mcs on Elf files we are shipping)
 #   (Note the jdk WILL want the jre image before this processing)
-process-image-jre:: $(JRE_ELF_LIST)
+process-image-jre:: $(JRE_BIN_LIST)
 ifneq ($(POST_STRIP_PROCESS), )
-	for f in `$(CAT) $(JRE_ELF_LIST)`; do \
+	@for f in `$(CAT) $(JRE_BIN_LIST)`; do \
 	  $(CHMOD) u+w $${f}; \
 	  $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
 	  $(POST_STRIP_PROCESS) $${f}; \
@@ -858,14 +811,17 @@
 	done
 endif
 ifneq ($(POST_MCS_PROCESS), )
-	for f in `$(CAT) $(JRE_ELF_LIST)`; do \
+	@for f in `$(CAT) $(JRE_BIN_LIST)`; do \
 	  $(CHMOD) u+w $${f}; \
 	  $(ECHO) $(POST_MCS_PROCESS) $${f}; \
 	  $(POST_MCS_PROCESS) $${f}; \
 	  $(CHMOD) go-w $${f}; \
 	done
 endif
-	$(RM) $(JRE_ELF_LIST)
+	@for f in `$(CAT) $(JRE_BIN_LIST)`; do \
+	  $(call binary_file_verification,$${f}); \
+	done
+	$(RM) $(JRE_BIN_LIST)
 
 ######################################################
 # JDK Image
@@ -905,8 +861,7 @@
 
 # Solaris 64 bit image is special
 initial-image-jdk-sol64:: initial-image-jdk-setup \
-			  initial-image-jdk64-bindemos \
-			  $(JDK_LICENSES) $(JDK64_LICENSES)
+			  initial-image-jdk64-bindemos
 
 # DB files to add
 ifdef OPENJDK
@@ -930,7 +885,7 @@
 # Standard jdk image
 initial-image-jdk:: initial-image-jdk-setup \
 		    initial-image-jdk-db \
-		    $(JDK_LICENSES) $(JDK_DOCFILES)
+		    $(JDK_DOCFILES)
 	$(MKDIR) $(JDK_IMAGE_DIR)/lib
 	@#
 	@# Copy in the jars in lib that only belong in the JDK
@@ -1089,14 +1044,18 @@
 trim-image-jdk::
 	@# Remove tools that should not be part of SDK.
 	for t in $(NOTJDKTOOLS); do \
-	    $(RM) $(JDK_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \
-		  $(JDK_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \
+	    $(RM) $(JDK_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
 	done
 
-# Get list of Elf files in the jdk
-JDK_ELF_LIST=$(TEMPDIR)/jdk-elf-files.list
-$(JDK_ELF_LIST):
-ifneq ($(PLATFORM), windows)
+# Get list of binary (COFF or Elf) files in the jdk
+JDK_BIN_LIST=$(TEMPDIR)/jdk-bin-files.list
+$(JDK_BIN_LIST):
+ifeq ($(PLATFORM), windows)
+	$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*.exe \
+	   -o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
+	$(FIND) $(JDK_IMAGE_DIR)/bin -type f -name \*.exe \
+	   -o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" >> $@
+else
 	$(RM) $@
 	$(FIND) $(JDK_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
 	$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
@@ -1106,9 +1065,9 @@
 endif
 
 # Post process the image (strips and mcs on files we are shipping)
-process-image-jdk:: $(JDK_ELF_LIST)
+process-image-jdk:: $(JDK_BIN_LIST)
 ifneq ($(POST_STRIP_PROCESS), )
-	for f in `$(CAT) $(JDK_ELF_LIST)`; do \
+	@for f in `$(CAT) $(JDK_BIN_LIST)`; do \
 	  $(CHMOD) u+w $${f}; \
 	  $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
 	  $(POST_STRIP_PROCESS) $${f}; \
@@ -1116,14 +1075,56 @@
 	done
 endif
 ifneq ($(POST_MCS_PROCESS), )
-	for f in `$(CAT) $(JDK_ELF_LIST)`; do \
+	@for f in `$(CAT) $(JDK_BIN_LIST)`; do \
 	  $(CHMOD) u+w $${f}; \
 	  $(ECHO) $(POST_MCS_PROCESS) $${f}; \
 	  $(POST_MCS_PROCESS) $${f}; \
 	  $(CHMOD) go-w $${f}; \
 	done
 endif
-	$(RM) $(JDK_ELF_LIST)
+	@for f in `$(CAT) $(JDK_BIN_LIST)`; do \
+	  $(call binary_file_verification,$${f}); \
+	done
+	$(RM) $(JDK_BIN_LIST)
+
+###################################################################
+# What did we build
+###################################################################
+
+# The jdk text info file that lives at the root of the install image.
+
+JDK_INFO_FILE = $(JDK_IMAGE_DIR)/release
+JRE_INFO_FILE = $(JRE_IMAGE_DIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+$(PRINTF) "%s=\"%s\"\n" $1 $2 >> $@
+endef
+
+# Values to emit
+MINIMUM_OS_NAME    := $(REQUIRED_OS_NAME)
+MINIMUM_OS_VERSION := $(REQUIRED_OS_VERSION)
+MINIMUM_OS_ARCH    := $(ARCH)
+
+$(JDK_INFO_FILE): FRC
+	$(prep-target)
+	$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(MINIMUM_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(MINIMUM_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(MINIMUM_OS_ARCH)")
+
+# Create release file to identify this image
+identify-image-jdk:: $(JDK_INFO_FILE)
+
+$(JRE_INFO_FILE): FRC
+	$(prep-target)
+	$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(MINIMUM_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(MINIMUM_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(MINIMUM_OS_ARCH)")
+
+# Create release file to identify this image
+identify-image-jre:: $(JRE_INFO_FILE)
 
 ###################################################################
 # What do we compare against
@@ -1278,6 +1279,7 @@
         initial-image-jre-setup \
 	trim-image-jre trim-image-jdk \
 	process-image-jre process-image-jdk \
+	identify-image-jre identify-image-jdk \
 	install-previous-jre install-previous-jdk \
 	compare-image-jre compare-image-jdk \
 	compare-image compare-image-clobber \
--- a/jdk/make/common/shared/Compiler-msvc.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Compiler-msvc.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -35,6 +35,7 @@
   LIBEXE       = $(COMPILER_PATH)lib
   LINK         = $(COMPILER_PATH)link
   LINK32       = $(LINK)
+  DUMPBIN      = $(COMPILER_PATH)dumpbin.exe
  
   # Fill in unknown values
   COMPILER_NAME=Unknown MSVC Compiler
@@ -139,8 +140,8 @@
         _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/x64
       endif
     endif
-    RC     = $(_OTHER_TOOLS_BIN)/rc.exe
-    REBASE = $(_OTHER_TOOLS_BIN)/rebase.exe
+    RC     = $(_OTHER_TOOLS_BIN)/RC.Exe
+    REBASE = $(_OTHER_TOOLS_BIN)/ReBase.Exe
     MT     = $(_OTHER_TOOLS_BIN)/mt.exe
     MTL    = $(_OTHER_TOOLS_BIN)/midl.exe
   endif
--- a/jdk/make/common/shared/Defs-control.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-control.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -76,12 +76,9 @@
 ABS_SRC_BUNDLEDIR   = $(ABS_OUTPUTDIR)/source-bundles
 BIN_BUNDLEDIR       = $(OUTPUTDIR)/bundles
 ABS_BIN_BUNDLEDIR   = $(ABS_OUTPUTDIR)/bundles
-JRL_BUNDLEDIR       = $(OUTPUTDIR)/java.net
-ABS_JRL_BUNDLEDIR   = $(ABS_OUTPUTDIR)/java.net
 
 dummy := $(shell $(MKDIR) -p $(BIN_BUNDLEDIR))
 dummy := $(shell $(MKDIR) -p $(SRC_BUNDLEDIR) )
-dummy := $(shell $(MKDIR) -p $(JRL_BUNDLEDIR) )
 
 TEMP_DIR = $(OUTPUTDIR)/tmp
 ABS_TEMP_DIR = $(ABS_OUTPUTDIR)/tmp
--- a/jdk/make/common/shared/Defs-linux.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-linux.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -177,3 +177,20 @@
 endif
 HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
 
+# Special define for checking the binaries
+
+# Macro to check it's input file for banned dependencies and verify the
+#   binary built properly. Relies on process exit code.
+define binary_file_verification # binary_file
+( \
+  $(ECHO) "Checking for mapfile use in: $1" && \
+  if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
+    $(ECHO) "WARNING: File was not built with a mapfile: $1"; \
+  fi && \
+  $(ECHO) "Library loads for: $1" && \
+  $(LDD) $1 && \
+  $(ECHO) "RUNPATH for: $1" && \
+  ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
+)
+endef
+
--- a/jdk/make/common/shared/Defs-solaris.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-solaris.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -186,3 +186,20 @@
 endif
 HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
 
+# Special define for checking the binaries
+
+# Macro to check it's input file for banned dependencies and verify the
+#   binary built properly. Relies on process exit code.
+define binary_file_verification # binary_file
+( \
+  $(ECHO) "Checking for mapfile use in: $1" && \
+  if [ "`$(NM) -g -D $1 | $(EGREP) -v 'UNDEF' | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
+    $(ECHO) "WARNING: File was not built with a mapfile: $1"; \
+  fi && \
+  $(ECHO) "Library loads for: $1" && \
+  $(LDD) $1 && \
+  $(ECHO) "RUNPATH for: $1" && \
+  ( $(DUMP) -L -v $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
+)
+endef
+
--- a/jdk/make/common/shared/Defs-utils.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-utils.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -85,6 +85,7 @@
 DF             = $(UTILS_COMMAND_PATH)df
 DIFF           = $(UTILS_USR_BIN_PATH)diff
 DIRNAME        = $(UTILS_USR_BIN_PATH)dirname
+DUMP           = $(UTILS_CCS_BIN_PATH)dump
 ECHO           = $(UTILS_COMMAND_PATH)echo
 EGREP          = $(UTILS_COMMAND_PATH)egrep
 EXPR           = $(UTILS_USR_BIN_PATH)expr
@@ -99,6 +100,7 @@
 ISAINFO        = $(UTILS_COMMAND_PATH)isainfo
 KSH            = $(UTILS_COMMAND_PATH)ksh
 LD             = $(UTILS_CCS_BIN_PATH)ld
+LDD            = $(UTILS_USR_BIN_PATH)ldd
 LEX            = $(UTILS_CCS_BIN_PATH)lex
 LN             = $(UTILS_COMMAND_PATH)ln
 LS             = $(UTILS_COMMAND_PATH)ls
@@ -114,6 +116,7 @@
 PRINTF         = $(UTILS_USR_BIN_PATH)printf
 PWD            = $(UTILS_COMMAND_PATH)pwd
 RC             = $(UTILS_COMMAND_PATH)rc
+READELF        = $(UTILS_USR_BIN_PATH)readelf
 RMDIR          = $(UTILS_COMMAND_PATH)rmdir
 RPM            = $(UTILS_COMMAND_PATH)rpm
 RPMBUILD       = $(UTILS_COMMAND_PATH)rpmbuild
--- a/jdk/make/common/shared/Defs-versions.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-versions.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -127,6 +127,7 @@
 
 # Solaris specific
 ifeq ($(PLATFORM), solaris)
+  REQUIRED_OS_NAME            = SunOS
   REQUIRED_OS_VERSION         = 5.10
   REQUIRED_OS_VARIANT_NAME    = Solaris
   REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION)
@@ -148,6 +149,7 @@
 
 # Linux specific
 ifeq ($(PLATFORM), linux)
+  REQUIRED_OS_NAME            = Linux
   REQUIRED_OS_VERSION         = 2.6
   REQUIRED_OS_VARIANT_NAME    = Fedora
   REQUIRED_OS_VARIANT_VERSION = 9
@@ -166,6 +168,7 @@
 
 # Windows specific
 ifeq ($(PLATFORM), windows)
+  REQUIRED_OS_NAME            = Windows
   ifeq ($(ARCH_DATA_MODEL),64)
     REQUIRED_OS_VERSION       = 5.2
     REQUIRED_OS_VARIANT_NAME  = Windows2003
@@ -205,7 +208,7 @@
 endif
 
 # Generic
-REQUIRED_ANT_VER          = 1.6.3
+REQUIRED_ANT_VER          = 1.7.1
 REQUIRED_BOOT_VER         = 1.6
 REQUIRED_FREETYPE_VERSION = 2.3.0
 REQUIRED_MAKE_VER         = 3.81
--- a/jdk/make/common/shared/Defs-windows.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Defs-windows.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -288,8 +288,8 @@
     xVS100COMNTOOLS :="$(_program_files32)/Microsoft Visual Studio 10.0/Common7/Tools/"
     fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
   else
+    xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
     ifneq ($(word 2,$(VS100COMNTOOLS)),)
-      xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
       fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
     else
       fVS100COMNTOOLS :=$(xVS100COMNTOOLS)
@@ -551,18 +551,6 @@
   _BOOTDIR3  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
-# 32 bit always needs 2 runtimes, 64 bit usually does too
-
-# MSVCRT_DLL_PATH: location of msvcrt.dll that will be re-distributed
-ifdef ALT_MSVCRT_DLL_PATH
-  xALT_MSVCRT_DLL_PATH :="$(subst \,/,$(ALT_MSVCRT_DLL_PATH))"
-  MSVCRT_DLL_PATH      :=$(call FullPath,$(xALT_MSVCRT_DLL_PATH))
-else
-  MSVCRT_DLL_PATH :=$(call FullPath,$(_system_root)/system32/)
-endif
-MSVCRT_DLL_PATH:=$(call AltCheckSpaces,MSVCRT_DLL_PATH)
-MSVCRT_DLL_PATH:=$(call AltCheckValue,MSVCRT_DLL_PATH)
-
 # 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
 ifeq ($(ARCH_DATA_MODEL), 32)
   _NEEDS_MSVCRNN = true
@@ -641,15 +629,6 @@
 endif
 INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK)
 
-# INSTALL_MSIVAL2: Installation of MsiVal2 for this platform (for install)
-ifdef ALT_INSTALL_MSIVAL2
-  xALT_INSTALL_MSIVAL2 :="$(subst \,/,$(ALT_INSTALL_MSIVAL2))"
-  INSTALL_MSIVAL2      :=$(call FullPath,$(xALT_INSTALL_MSIVAL2))
-else
-  INSTALL_MSIVAL2      :=$(_program_files32)/MsiVal2
-endif
-INSTALL_MSIVAL2:=$(call AltCheckSpaces,INSTALL_MSIVAL2)
-
 # WSCRIPT: path to wscript.exe (used in creating install bundles)
 ifdef ALT_WSCRIPT
   xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))"
@@ -685,43 +664,6 @@
 endif
 CABARC:=$(call AltCheckSpaces,CABARC)
 
-# MSIVAL2: path to msival2.exe (used in validating install msi files)
-ifdef ALT_MSIVAL2
-  xALT_MSIVAL2 :="$(subst \,/,$(ALT_MSIVAL2))"
-  MSIVAL2  =$(xALT_MSIVAL2)
-else
-  _MSIVAL2_1 :=$(INSTALL_MSIVAL2)/msival2.exe
-  _MSIVAL2_2 :=$(DEVTOOLS_PATH)msival2.exe
-  MSIVAL2    :=$(call FileExists,$(_MSIVAL2_1),$(_MSIVAL2_2))
-endif
-MSIVAL2:=$(call AltCheckSpaces,MSIVAL2)
-# suppress msival2 checks, as it hangs jprt builds
-ifdef SKIP_MSIVAL2
-  MSIVAL2    := $(ECHO)
-endif
-
-# LOGOCUB: path to cub file for (used in validating install msi files)
-ifdef ALT_LOGOCUB
-  xALT_LOGOCUB :="$(subst \,/,$(ALT_LOGOCUB))"
-  LOGOCUB  =$(xALT_LOGOCUB)
-else
-  _LOGOCUB1 :=$(INSTALL_MSIVAL2)/logo.cub
-  _LOGOCUB2 :=$(DEVTOOLS_PATH)logo.cub
-  LOGOCUB   :=$(call FileExists,$(_LOGOCUB1),$(_LOGOCUB2))
-endif
-LOGOCUB:=$(call AltCheckSpaces,LOGOCUB)
-
-# MSITRAN: path to msitran.exe (used in creating install bundles and sponsors)
-ifdef ALT_MSITRAN
-  xALT_MSITRAN :="$(subst \,/,$(ALT_MSITRAN))"
-  MSITRAN  =$(xALT_MSITRAN)
-else
-  _MSITRAN1 :=$(INSTALL_MSSDK)/Bin/msitran.exe
-  _MSITRAN2 :=$(DEVTOOLS_PATH)msitran.exe
-  MSITRAN   :=$(call FileExists,$(_MSITRAN1),$(_MSITRAN2))
-endif
-MSITRAN:=$(call AltCheckSpaces,MSITRAN)
-
 # MSICERT: path to msicert.exe (used in creating install bundles)
 ifdef ALT_MSICERT
   xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))"
@@ -798,3 +740,50 @@
 endif
 HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH)
 HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH)
+
+# Special define for checking the binaries
+
+ifeq ($(VS2010_EXISTS),true)
+
+# All windows dll and exe files should have been built with /NXCOMPAT
+#   and be setup for dynamic base addresses.
+#   In addition, we should not be dependent on certain dll files that
+#   we do not or cannot redistribute.
+
+# List of filenames we should NOT be dependent on
+BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
+
+# Macro to check it's input file for banned dependencies and verify the
+#   binary was built properly. Relies on process exit code.
+define binary_file_verification # binary_file
+( \
+  $(ECHO) "Checking for /NXCOMPAT usage in: $1" && \
+  if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
+    $(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \
+    $(DUMPBIN) /headers $1 ; \
+    exit 7 ; \
+  fi ; \
+  $(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \
+  if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
+    $(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \
+    $(DUMPBIN) /headers $1 ; \
+    exit 8 ; \
+  fi ; \
+  $(ECHO) "Checking for banned dependencies in: $1" && \
+  if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
+    $(ECHO) "ERROR: Found us of $(BANNED_DLLS)"; \
+    $(DUMPBIN) /dependents $1 ; \
+    exit 9 ; \
+  fi ; \
+)
+endef
+
+else
+
+# Macro to check it's input file for banned dependencies and verify the
+#   binary was built properly. Relies on process exit code.
+define binary_file_verification # binary_file
+endef
+
+endif
+
--- a/jdk/make/common/shared/Sanity-Settings.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -96,7 +96,6 @@
   endif
 endif
 ifeq ($(PLATFORM),windows)
-  ALL_SETTINGS+=$(call addAltSetting,MSVCRT_DLL_PATH)
   ifneq ($(MSVCRNN_DLL),)
     ALL_SETTINGS+=$(call addAltSetting,MSVCRNN_DLL_PATH)
   endif
@@ -117,6 +116,9 @@
 ALL_SETTINGS+=$(call addRequiredVersionSetting,UNZIP_VER)
 ifeq ($(PLATFORM),windows)
   ALL_SETTINGS+=$(call addRequiredVersionSetting,LINK_VER)
+  ALL_SETTINGS+=$(call addRequiredSetting,CC)
+  ALL_SETTINGS+=$(call addRequiredSetting,LINK)
+  ALL_SETTINGS+=$(call addRequiredSetting,DUMPBIN)
 endif
 ALL_SETTINGS+=$(call addRequiredVersionSetting,ANT_VER)
 ALL_SETTINGS+=$(call addRequiredSetting,TEMPDIR)
@@ -226,13 +228,13 @@
   ALL_SETTINGS+=$(call addAltSetting,DXSDK_INCLUDE_PATH)
   ALL_SETTINGS+=$(call addAltSetting,DXSDK_LIB_PATH)
   ALL_SETTINGS+=$(call addAltSetting,WINDOWSSDKDIR)
+  ALL_SETTINGS+=$(call addRequiredSetting,RC)
+  ALL_SETTINGS+=$(call addRequiredSetting,REBASE)
   ifndef OPENJDK
     ALL_SETTINGS+=$(call addAltSetting,DEPLOY_MSSDK)
     ALL_SETTINGS+=$(call addAltSetting,INSTALL_MSSDK)
     ALL_SETTINGS+=$(call addAltSetting,WSCRIPT)
     ALL_SETTINGS+=$(call addAltSetting,MSICERT)
-    ALL_SETTINGS+=$(call addAltSetting,MSITRAN)
-    ALL_SETTINGS+=$(call addAltSetting,MSIVAL2)
   endif
 endif
 ALL_SETTINGS+=$(call addAltSetting,CACERTS_FILE)
--- a/jdk/make/common/shared/Sanity.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/common/shared/Sanity.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -255,10 +255,10 @@
 MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER))
 sane-make:
 	@if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \
-	  $(ECHO) "WARNING: The version of make being used is older than \n" \
+	  $(ECHO) "ERROR: The version of make being used is older than \n" \
 	    "      the required version of '$(REQUIRED_MAKE_VER)'. \n" \
 	    "      The version of make found was '$(MAKE_VER)'. \n" \
-	    "" >> $(WARNING_FILE) ; \
+	    "" >> $(ERROR_FILE) ; \
 	fi
 
 ######################################################
@@ -879,13 +879,6 @@
 ######################################################
 sane-msvcrt_path:
 ifeq ($(PLATFORM), windows)
-	@if [ ! -r "$(MSVCRT_DLL_PATH)/msvcrt.dll" ]; then \
-	  $(ECHO) "ERROR: You do not have access to msvcrt.dll. \n" \
-	    "      Please check your access to \n" \
-	    "          $(MSVCRT_DLL_PATH) \n" \
-	    "      and/or check your value of ALT_MSVCRT_DLL_PATH. \n" \
-	    "" >> $(ERROR_FILE) ; \
-	fi
   ifneq ($(MSVCRNN_DLL),)
 	@if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \
 	  $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \
@@ -1018,6 +1011,22 @@
 	    "      and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
+  else
+    ifeq ($(wildcard $(REBASE)),)
+	@$(ECHO) "ERROR: Cannot find the REBASE utility from path: $(REBASE)\n" \
+	    "      This is normally obtained from the WINDOWSSDKDIR." \
+	    "" >> $(ERROR_FILE)
+    endif
+    ifeq ($(wildcard $(RC)),)
+	@$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
+	    "      This is normally obtained from the WINDOWSSDKDIR." \
+	    "" >> $(ERROR_FILE)
+    endif
+    ifeq ($(wildcard $(DUMPBIN)),)
+	@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
+	    "      This is normally obtained from the WINDOWSSDKDIR." \
+	    "" >> $(ERROR_FILE)
+    endif
   endif
 endif
 
@@ -1250,10 +1259,10 @@
 sane-ant_version:
 	@if [ "$(ANT_CHECK)" != "same" \
 	      -a "$(ANT_CHECK)" != "newer" ]; then \
-	  $(ECHO) "WARNING: The version of ant being used is older than \n" \
+	  $(ECHO) "ERROR: The version of ant being used is older than \n" \
 	    "      the required version of '$(REQUIRED_ANT_VER)'. \n" \
 	    "      The version of ant found was '$(ANT_VER)'. \n" \
-	    "" >> $(WARNING_FILE) ; \
+	    "" >> $(ERROR_FILE) ; \
 	fi
 
 ######################################################
@@ -1460,25 +1469,6 @@
 endif
 
 ######################################################
-# Check for existence of INSTALL_MSIVAL2 on windows
-######################################################
-sane-install-msival2_path:
-ifeq ($(PLATFORM), windows)
-	@if [ -z "$(INSTALL_MSIVAL2)" ]; then \
-	  $(ECHO) "WARNING: Your INSTALL_MSIVAL2 setting is empty.\n" \
-	    "        It is recommended to set ALT_INSTALL_MSIVAL2.\n" \
-	    "" >> $(WARNING_FILE) ; \
-	fi
-	@if [ ! -r "$(INSTALL_MSIVAL2)" ]; then \
-	  $(ECHO) "ERROR: You do not have a valid INSTALL_MSIVAL2 setting. \n" \
-	    "      Please check your access to \n" \
-	    "          $(INSTALL_MSIVAL2) \n" \
-	    "      and/or check your value of ALT_INSTALL_MSIVAL2. \n" \
-	    "" >> $(ERROR_FILE) ; \
-	fi
-endif
-
-######################################################
 # Check the GNU C++ compiler for OJI plugin
 ######################################################
 sane-gcc-compiler:
--- a/jdk/make/java/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/java/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
 #
 # The order of subdirs here is important
 #
-SUBDIRS += hpi version jvm redist verify fdlibm java sun_nio jli main zip
+SUBDIRS += version jvm redist verify fdlibm java sun_nio jli main zip
 
 # Others
 #    Note: java_crw_demo java_hprof_demo are demos but must be delivered built in sdk
--- a/jdk/make/java/fdlibm/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/java/fdlibm/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -24,7 +24,7 @@
 #
 
 #
-# Makefile for native threads HPI.
+# Makefile for fdlibm
 #
 # Note:
 # The fdlibm libraries are built using special rules in Library.gmk.
--- a/jdk/make/java/hpi/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#
-# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-#
-# Build HPI (Host Porting Interface) libraries
-#
-
-BUILDDIR = ../..
-include $(BUILDDIR)/common/Defs.gmk
-
-#
-# Build specified the HPI implementations
-#
-SUBDIRS = $(HPIS)
-include $(BUILDDIR)/common/Subdirs.gmk
-
-all build clean clobber::
-	$(SUBDIRS-loop)
-
--- a/jdk/make/java/hpi/hpi_common.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-#
-# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-#
-# Shared files between the different threads types on Solaris. Be
-# careful when including this, you must get your variables right.
-#
-
-#
-# Common files on Solaris.
-#
-ifneq ($(PLATFORM), windows)
-FILES_c += \
-    interrupt.c \
-    linker_md.c \
-    memory_md.c \
-    system_md.c \
-    hpi.c
-endif
-
-#
-# Include paths can also be shared.
-#
-ifneq ($(PLATFORM), windows)
-OTHER_INCLUDES += \
-    -I$(PLATFORM_SRC)/hpi/$(THREADDIR)/include \
-    -I$(PLATFORM_SRC)/hpi/include \
-    -I$(PLATFORM_SRC)/hpi/export \
-    -I$(SHARE_SRC)/hpi/include \
-    -I$(SHARE_SRC)/hpi/export
-else
-OTHER_INCLUDES += \
-    -I$(PLATFORM_SRC)/hpi/include \
-    -I$(PLATFORM_SRC)/hpi/export \
-    -I$(SHARE_SRC)/hpi/include \
-    -I$(SHARE_SRC)/hpi/export
-endif
-
-#
-# Add to the default C and assembly file search paths.  Clear any initial
-# vpath settings to ensure that we don't look in unexpected places for HPI
-# files.
-#
-vpath %.c
-vpath %.c   $(PLATFORM_SRC)/hpi/$(THREADDIR)/src
-vpath %.c   $(PLATFORM_SRC)/hpi/src
-vpath %.c   $(SHARE_SRC)/hpi/src
-
-vpath %.s
-vpath %.s   $(PLATFORM_SRC)/hpi/$(THREADDIR)/src
-vpath %.s   $(PLATFORM_SRC)/hpi/src
-
-#
-# By default leave out locking statistics
-#
-ifneq ($(PLATFORM), windows)
-LOCKSTATS = false
-ifeq ($(LOCKSTATS), true)
-    CFLAGS_COMMON += -DLOCKSTATS
-endif
-endif
-
-#
-# Things that must be linked in.
-#
-ifneq ($(PLATFORM), windows)
-OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) $(LIBM) -ldl
-endif
--- a/jdk/make/java/hpi/native/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#
-# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-#
-# Makefile for native threads HPI.
-#
-
-BUILDDIR     = ../../..
-MODULE       = base
-LIBRARY      = hpi
-PRODUCT      = java
-THREADDIR    = native_threads
-LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/$(THREADDIR)
-include $(BUILDDIR)/common/Defs.gmk
-
-#
-# Native threads specific C and .s files.
-#
-FILES_c = \
-	monitor_md.c \
-	threads_md.c \
-	condvar_md.c \
-	interrupt_md.c \
-	mutex_md.c \
-	sys_api_td.c \
-	threads_$(PLATFORM).c
-
-#
-# Other files/flags shared between the HPIs.
-#
-include $(BUILDDIR)/java/hpi/hpi_common.gmk
-
-#
-# Rules for the .so file.
-#
-ifeq ($(PLATFORM), solaris)
-  ifneq ($(ARCH), amd64)
-    FILES_reorder += reorder-$(ARCH)
-  endif
-endif
-include $(BUILDDIR)/common/Mapfile-vers.gmk
-include $(BUILDDIR)/common/Library.gmk
-
-#
-# HPI flags for native threads.
-#
-OTHER_CPPFLAGS += -D_REENTRANT -DNATIVE
-
-ifeq ($(USE_PTHREADS),true)
-OTHER_CPPFLAGS += -DUSE_PTHREADS
-ifeq ($(MOOT_PRIORITIES),true)
-OTHER_CPPFLAGS += -DMOOT_PRIORITIES
-endif
-LIBPOSIX4	= -lposix4
-OTHER_LDLIBS   += -lpthread $(LIBPOSIX4)
-endif
-
-HAVE_GETHRVTIME=true
-ifeq ($(HAVE_GETHRVTIME),true)
-OTHER_CPPFLAGS += -DHAVE_GETHRVTIME
-endif
-
-HAVE_FILIOH=true
-ifeq ($(HAVE_FILIOH),true)
-OTHER_CPPFLAGS += -DHAVE_FILIOH
-endif
-
-ifeq ($(NO_INTERRUPTIBLE_IO),true)
-OTHER_CPPFLAGS += -DNO_INTERRUPTIBLE_IO
-endif
-
--- a/jdk/make/java/hpi/native/mapfile-vers	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-SUNWprivate_1.1 {
-   global:
-		DLL_Initialize;
-
-   local:
-           *;
-};
--- a/jdk/make/java/hpi/native/reorder-i586	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-text: .text%_init;
-text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj/threads_solaris.o;
-text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj/system_md.o;
-text: .text%DLL_Initialize;
-text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj/hpi.o;
-text: .text%sysBuildLibName;
-text: .text%sysLoadLibrary;
-text: .text%sysFindLibraryEntry;
-text: .text%sysNativePath;
-text: .text%sysOpen;
-text: .text%sysSeek;
-text: .text%lseek64_w;
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%sysAvailable;
-text: .text%sysFfileMode;
-text: .text%sysGetLastErrorString;
-# Test LoadFrame
-# Test LoadJFrame
-# Test JHello
-# SwingSet
--- a/jdk/make/java/hpi/native/reorder-sparc	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj/threads_solaris.o;
-text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj/system_md.o;
-text: .text%DLL_Initialize;
-text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj/hpi.o;
-text: .text%sysBuildLibName;
-text: .text%sysLoadLibrary;
-text: .text%sysFindLibraryEntry;
-text: .text%sysNativePath;
-text: .text%sysOpen;
-text: .text%sysFfileMode;
-text: .text%sysSeek;
-text: .text%lseek64_w;
-text: .text%sysAvailable;
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%sysGetLastErrorString;
-# Test LoadFrame
-# Test LoadJFrame
-# Test JHello
-# SwingSet
--- a/jdk/make/java/hpi/native/reorder-sparcv9	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/threads_solaris.o;
-text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/system_md.o;
-text: .text%DLL_Initialize;
-text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/hpi.o;
-text: .text%sysBuildLibName;
-text: .text%sysLoadLibrary;
-text: .text%sysFindLibraryEntry;
-text: .text%sysNativePath;
-text: .text%sysOpen;
-text: .text%sysFfileMode;
-text: .text%sysSeek;
-text: .text%lseek64_w;
-text: .text%sysAvailable;
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%sysGetLastErrorString;
-# Test LoadFrame
-# Test LoadJFrame
-# Test JHello
-# SwingSet
--- a/jdk/make/java/hpi/windows/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-#
-# Makefile for Windows HPI DLL
-#
-BUILDDIR     = ../../..
-MODULE       = base
-LIBRARY      = hpi
-PRODUCT      = java
-THREADDIR    = windows_threads
-LIB_LOCATION = $(BINDIR)
-
-include $(BUILDDIR)/common/Defs.gmk
-
-# windows compiler flags
-ifeq ($(PLATFORM),windows)
-  CPPFLAGS_DBG += -DLOGGING
-endif
-
-FILES_c = \
-    linker_md.c \
-    memory_md.c \
-    monitor_md.c \
-    path_md.c \
-    socket_md.c \
-    sys_api_md.c \
-    system_md.c \
-    threads_md.c \
-    hpi.c # trailing blank required!
-
-JVMLIB = 
-JAVALIB =
-OTHER_LCF = -export:DLL_Initialize
-EXTRA_LIBS =
-
-
-#
-# Other files/flags shared between the HPIs.
-#
-include $(BUILDDIR)/java/hpi/hpi_common.gmk
-
-#
-# Rules for the .so file.
-#
-include $(BUILDDIR)/common/Library.gmk
-
--- a/jdk/make/java/management/mapfile-vers	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/java/management/mapfile-vers	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -70,14 +70,18 @@
 	    Java_sun_management_ThreadImpl_dumpThreads0;
 	    Java_sun_management_ThreadImpl_findDeadlockedThreads0;
 	    Java_sun_management_ThreadImpl_findMonitorDeadlockedThreads0;
-	    Java_sun_management_ThreadImpl_getThreadInfo0;
+	    Java_sun_management_ThreadImpl_getThreadInfo1;
 	    Java_sun_management_ThreadImpl_getThreads;
 	    Java_sun_management_ThreadImpl_getThreadTotalCpuTime0;
+	    Java_sun_management_ThreadImpl_getThreadTotalCpuTime1;
 	    Java_sun_management_ThreadImpl_getThreadUserCpuTime0;
+	    Java_sun_management_ThreadImpl_getThreadUserCpuTime1;
+	    Java_sun_management_ThreadImpl_getThreadAllocatedMemory1;
 	    Java_sun_management_ThreadImpl_resetContentionTimes0;
 	    Java_sun_management_ThreadImpl_resetPeakThreadCount0;
 	    Java_sun_management_ThreadImpl_setThreadContentionMonitoringEnabled0;
 	    Java_sun_management_ThreadImpl_setThreadCpuTimeEnabled0;
+	    Java_sun_management_ThreadImpl_setThreadAllocatedMemoryEnabled0;
 	    Java_sun_management_VMManagementImpl_getAvailableProcessors;
 	    Java_sun_management_VMManagementImpl_getClassInitializationTime;
 	    Java_sun_management_VMManagementImpl_getClassLoadingTime;
@@ -106,6 +110,7 @@
 	    Java_sun_management_VMManagementImpl_initOptionalSupportFields;
 	    Java_sun_management_VMManagementImpl_isThreadContentionMonitoringEnabled;
 	    Java_sun_management_VMManagementImpl_isThreadCpuTimeEnabled;
+	    Java_sun_management_VMManagementImpl_isThreadAllocatedMemoryEnabled;
             JNI_OnLoad;
 	local:
 	    *;
--- a/jdk/make/java/nio/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/java/nio/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -296,7 +296,7 @@
 OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread -ldl
 endif
 ifeq ($(PLATFORM), solaris)
-OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl \
+OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl -lsendfile \
 		-L$(LIBDIR)/$(LIBARCH) -ljava -lnet
 endif # PLATFORM
 
--- a/jdk/make/java/redist/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/java/redist/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -93,10 +93,6 @@
 
 IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%)
 
-# NOTE: These might actually come from BUILDDIR, depends on the settings.
-$(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll
-	$(install-import-file)
-	$(call chmod-file, a+x)
 $(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)
 	$(install-import-file)
 	$(call chmod-file, a+x)
@@ -223,12 +219,15 @@
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVM_NAME): $(HOTSPOT_KERNEL_PATH)/$(JVM_NAME)
 	$(install-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
@@ -237,30 +236,39 @@
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_NAME)
 	$(install-import-file)
+	@$(call binary_file_verification,$@)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt : $(HOTSPOT_SERVER_PATH)/Xusage.txt
 	$(install-import-file)
--- a/jdk/make/jdk_generic_profile.sh	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/jdk_generic_profile.sh	Fri Feb 04 16:29:41 2011 -0800
@@ -50,7 +50,7 @@
 #
 # Assumes basic unix utilities are in the PATH already (uname, hostname, etc.).
 #
-# On Windows, assumes PROCESSOR_IDENTIFIER, VS71COMNTOOLS,
+# On Windows, assumes PROCESSOR_IDENTIFIER, VS100COMNTOOLS,
 #   SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and
 #   USERNAME is defined in the environment.
 #   This profile does not rely on using vcvars32.bat and 64bit Setup.bat.
@@ -81,8 +81,7 @@
 #    Windows Only:
 #      ALT_UNIXCOMMAND_PATH
 #      ALT_DXSDK_PATH
-#      ALT_MSVCRT_DLL_PATH
-#      ALT_MSVCR71_DLL_PATH
+#      ALT_MSVCRNN_DLL_PATH
 #
 #############################################################################
 #
@@ -213,78 +212,17 @@
   # Compiler setup (nasty part)
   #   NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
   #   NOTE: CYGWIN has a link.exe too, make sure the compilers are first
-  if [ "${windows_arch}" = i586 ] ; then
-    # 32bit Windows compiler settings
-    # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
-    vs_root=$(${cygpath} "${VS71COMNTOOLS}/../..")
-    # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
-    vc7_root="${vs_root}/Vc7"
-    compiler_path="${vc7_root}/bin"
-    platform_sdk="${vc7_root}/PlatformSDK"
-        
-    # LIB and INCLUDE must use ; as a separator
-    include4sdk="${vc7_root}/atlmfc/include"
-    include4sdk="${include4sdk};${vc7_root}/include"
-    include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
-    include4sdk="${include4sdk};${platform_sdk}/include"
-    include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
-    lib4sdk="${lib4sdk};${vc7_root}/lib"
-    lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
-    lib4sdk="${lib4sdk};${platform_sdk}/lib"
-    lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
-    # Search path and DLL locating path
-    #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
-    path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
-    path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
-    path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
-    path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
-    path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
-    path4sdk="${compiler_path};${path4sdk}"
-  elif [ "${windows_arch}" = amd64 ] ; then
-    # AMD64 64bit Windows compiler settings
-    if [ "${ALT_DEPLOY_MSSDK}" != "" ] ; then
-      platform_sdk=${ALT_DEPLOY_MSSDK}
-    else
-      platform_sdk=$(${cygpath} "C:/Program Files/Microsoft Platform SDK/")
-    fi
-    if [ "${ALT_COMPILER_PATH}" != "" ] ; then
-      compiler_path=${ALT_COMPILER_PATH}
-      if [ "${ALT_DEPLOY_MSSDK}" = "" ] ; then
-        platform_sdk=${ALT_COMPILER_PATH}/../../../..
-      fi
-    else
-      compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
-    fi
-    # LIB and INCLUDE must use ; as a separator
-    include4sdk="${platform_sdk}/Include"
-    include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
-    include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
-    include4sdk="${include4sdk};${platform_sdk}/Include/atl"
-    include4sdk="${include4sdk};${platform_sdk}/Include/crt"
-    lib4sdk="${platform_sdk}/Lib/AMD64"
-    lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
-    # Search path and DLL locating path
-    #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
-    path4sdk="${platform_sdk}/bin;${path4sdk}"
-    path4sdk="${compiler_path};${path4sdk}"
+
+  # Use supplied vsvars.sh
+  repo=`hg root`
+  if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then
+    eval `sh ${repo}/make/scripts/vsvars.sh -v10`
+  elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then
+    eval `sh ${repo}/../make/scripts/vsvars.sh -v10`
+  else
+    echo "WARNING: No make/scripts/vsvars.sh file found"
   fi
-  # Export LIB and INCLUDE
-  unset lib
-  unset Lib
-  LIB="${lib4sdk}"
-  export LIB
-  unset include
-  unset Include
-  INCLUDE="${include4sdk}"
-  export INCLUDE
     
-  # Turn all \\ into /, remove duplicates and trailing /
-  slash_path="$(echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g')"
-  path4sdk="${slash_path}"
-   
-  # Convert path4sdk to cygwin style
-  path4sdk="$(/usr/bin/cygpath -p ${path4sdk})"
-
 fi
 
 # Get the previous JDK to be used to bootstrap the build
--- a/jdk/make/mkdemo/jfc/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/mkdemo/jfc/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -43,7 +43,7 @@
 
 # Some demos aren't currently included in OpenJDK
 ifndef OPENJDK
-  SUBDIRS += Java2D SwingSet2 Stylepad
+  SUBDIRS += Java2D SwingSet2 SwingSet3 Stylepad
 endif
 
 include $(BUILDDIR)/common/Subdirs.gmk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mkdemo/jfc/SwingSet3/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+#
+# Makefile to build the SwingSet3 demo.
+#
+
+BUILDDIR = ../../..
+PRODUCT = demo/jfc
+DEMONAME = SwingSet3
+include $(BUILDDIR)/common/Defs.gmk
+
+DEMO_ROOT       = $(CLOSED_SRC)/share/demo/jfc/$(DEMONAME)
+DEMO_DESTDIR    = $(DEMODIR)/jfc/$(DEMONAME)
+DEMO_TOPFILES	= ./readme.html ./swingset3.png
+DEMO_SKIP_SRCZIP = true
+
+#
+# Demo jar building rules.
+#
+include $(BUILDDIR)/common/Demo.gmk
--- a/jdk/make/sun/awt/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/awt/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -369,10 +369,6 @@
 _FONTCONFIGS	= \
 	fontconfig.properties				\
 	fontconfig.RedHat.properties			\
-	fontconfig.RedHat.2.1.properties		\
-	fontconfig.RedHat.3.properties		        \
-	fontconfig.RedHat.4.properties			\
-	fontconfig.Sun.properties			\
 	fontconfig.Turbo.properties			\
 	fontconfig.SuSE.10.properties                   \
 	fontconfig.SuSE.11.properties
@@ -388,9 +384,7 @@
 
 FONTCONFIGS_SRC	= $(PLATFORM_SRC)/classes/sun/awt/fontconfigs
 _FONTCONFIGS	= \
-	fontconfig.properties	\
-	fontconfig.5.9.properties	\
-	fontconfig.5.8.properties
+	fontconfig.properties
 
 FONTCONFIGS_SRC_PREFIX = $(PLATFORM).
 
--- a/jdk/make/sun/awt/mapfile-mawt-vers	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/awt/mapfile-mawt-vers	Fri Feb 04 16:29:41 2011 -0800
@@ -515,8 +515,7 @@
 		getDefaultConfig;
                 Java_sun_font_FontConfigManager_getFontConfig;
                 Java_sun_font_FontConfigManager_getFontConfigAASettings;
-		Java_sun_awt_X11FontManager_getFontPath;
-		Java_sun_awt_X11FontManager_setNativeFontPath;
+		Java_sun_awt_X11FontManager_getFontPathNative;
 		Java_sun_font_SunFontManager_populateFontFileNameMap;
 
 		# CDE private entry point
--- a/jdk/make/sun/awt/mapfile-vers-linux	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/awt/mapfile-vers-linux	Fri Feb 04 16:29:41 2011 -0800
@@ -537,8 +537,7 @@
 		getDefaultConfig;
                 Java_sun_font_FontConfigManager_getFontConfig;
                 Java_sun_font_FontConfigManager_getFontConfigAASettings;
-		Java_sun_awt_X11FontManager_getFontPath;
-		Java_sun_awt_X11FontManager_setNativeFontPath;
+		Java_sun_awt_X11FontManager_getFontPathNative;
 		Java_sun_font_SunFontManager_populateFontFileNameMap;
 
 		# CDE private entry point
--- a/jdk/make/sun/headless/mapfile-vers	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/headless/mapfile-vers	Fri Feb 04 16:29:41 2011 -0800
@@ -65,7 +65,7 @@
                 Java_sun_font_FontConfigManager_getFontConfig;
                 Java_sun_font_FontConfigManager_getFontConfigAASettings;
                 Java_sun_font_FontConfigManager_getFontConfigVersion;
-		Java_sun_awt_X11FontManager_getFontPath;
+                Java_sun_awt_X11FontManager_getFontPathNative;
 
 		Java_sun_awt_FontDescriptor_initIDs;
 		Java_sun_awt_PlatformFont_initIDs;
--- a/jdk/make/sun/net/FILES_java.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/net/FILES_java.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -33,6 +33,7 @@
 	sun/net/ProgressEvent.java \
 	sun/net/ProgressListener.java \
 	sun/net/ProgressMeteringPolicy.java \
+	sun/net/SocksProxy.java \
 	sun/net/TelnetInputStream.java \
 	sun/net/TelnetOutputStream.java \
 	sun/net/TelnetProtocolException.java \
--- a/jdk/make/sun/xawt/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/xawt/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -136,8 +136,25 @@
               -I$(OPENWIN_HOME)/include 
 endif
 
+# We have some odd logic here because some Solaris 10 updates
+# have a render.h file that suggests gradients are supported, but
+# the Xrender.h doesn't have the corresponding type definitions.
+# Earlier updates have neither. We'd like to know if there's a mismatch.
+# Whilst in the C preprocessor we can tell if the render.h define's are set
+# we can't tell anything about C declarations.
+# A grep of Xrender.h is the only way to know this. If they are absent
+# we will set a flag indicating this mismatch and the JDK source file
+# will interpret it to resolve the problem.
 ifeq ($(PLATFORM), solaris)
   CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
+  OS_VERSION := $(shell uname -r)
+  XRENDER_H := $(OPENWIN_HOME)/share/include/X11/extensions/Xrender.h
+  ifeq ($(OS_VERSION),5.10) 
+     LINEARGRADIENT_CNT := $(shell $(EGREP) -c XLinearGradient $(XRENDER_H))
+     ifeq ($(LINEARGRADIENT_CNT),0) 
+       CFLAGS+= -DSOLARIS10_NO_XRENDER_STRUCTS
+     endif
+ endif
 endif
 
 ifeq ($(MILESTONE), internal)
--- a/jdk/make/sun/xawt/mapfile-vers	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/sun/xawt/mapfile-vers	Fri Feb 04 16:29:41 2011 -0800
@@ -188,8 +188,7 @@
         Java_sun_font_FontConfigManager_getFontConfig;
         Java_sun_font_FontConfigManager_getFontConfigAASettings;
         Java_sun_font_FontConfigManager_getFontConfigVersion;
-	Java_sun_awt_X11FontManager_getFontPath;
-	Java_sun_font_X11FontManager_setNativeFontPath;
+	Java_sun_awt_X11FontManager_getFontPathNative;
         Java_sun_awt_X11GraphicsEnvironment_initDisplay;
         Java_sun_awt_X11GraphicsEnvironment_initGLX;
 	Java_sun_awt_X11GraphicsEnvironment_initXRender;
--- a/jdk/make/tools/reorder/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/make/tools/reorder/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -85,7 +85,6 @@
 libs.reorder :
 ifeq ($(PLATFORM), solaris)
 	$(MAKE) LIBBLDDIR=java/zip        LIBTMPDIR=sun/java.util.zip/zip   reorder.lib
-	$(MAKE) LIBBLDDIR=java/hpi/native LIBTMPDIR=java/hpi/native_threads reorder.lib
 	$(MAKE) LIBBLDDIR=java/java       LIBTMPDIR=java/java.lang/java     reorder.lib
 	$(MAKE) LIBBLDDIR=java/nio        LIBTMPDIR=java/java.nio/nio       reorder.lib
 	$(MAKE) LIBBLDDIR=sun/font        LIBTMPDIR=sun/sun.awt.font/fontmanager reorder.lib
@@ -96,7 +95,6 @@
 libs.copy:
 ifeq ($(PLATFORM), solaris)
 	$(CP) $(OUTDIR)/reorder_java_zip-$(ARCH) ../../java/zip/reorder-$(ARCH)
-	$(CP) $(OUTDIR)/reorder_java_hpi_native-$(ARCH) ../../java/hpi/native/reorder-$(ARCH)
 	$(CP) $(OUTDIR)/reorder_java_java-$(ARCH) ../../java/java/reorder-$(ARCH)
 	$(CP) $(OUTDIR)/reorder_sun_font-$(ARCH) ../../sun/font/reorder-$(ARCH)
 	$(CP) $(OUTDIR)/reorder_sun_jpeg-$(ARCH) ../../sun/jpeg/reorder-$(ARCH)
--- a/jdk/src/share/back/debugInit.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/back/debugInit.c	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,27 +133,60 @@
     return error;
 }
 
+typedef struct {
+    int major;
+    int minor;
+} version_type;
+
+typedef struct {
+    version_type runtime;
+    version_type compiletime;
+} compatible_versions_type;
+
+/*
+ * List of explicitly compatible JVMTI versions, specified as
+ * { runtime version, compile-time version } pairs. -1 is a wildcard.
+ */
+static int nof_compatible_versions = 3;
+static compatible_versions_type compatible_versions_list[] = {
+    /*
+     * FIXUP: Allow version 0 to be compatible with anything
+     * Special check for FCS of 1.0.
+     */
+    { {  0, -1 }, { -1, -1 } },
+    { { -1, -1 }, {  0, -1 } },
+    /*
+     * 1.2 is runtime compatible with 1.1 -- just make sure to check the
+     * version before using any new 1.2 features
+     */
+    { {  1,  1 }, {  1,  2 } }
+};
+
+
 /* Logic to determine JVMTI version compatibility */
 static jboolean
 compatible_versions(jint major_runtime,     jint minor_runtime,
                     jint major_compiletime, jint minor_compiletime)
 {
-#if 1 /* FIXUP: We allow version 0 to be compatible with anything */
-    /* Special check for FCS of 1.0. */
-    if ( major_runtime == 0 || major_compiletime == 0 ) {
-        return JNI_TRUE;
+    /*
+     * First check to see if versions are explicitly compatible via the
+     * list specified above.
+     */
+    int i;
+    for (i = 0; i < nof_compatible_versions; ++i) {
+        version_type runtime = compatible_versions_list[i].runtime;
+        version_type comptime = compatible_versions_list[i].compiletime;
+
+        if ((major_runtime     == runtime.major  || runtime.major  == -1) &&
+            (minor_runtime     == runtime.minor  || runtime.minor  == -1) &&
+            (major_compiletime == comptime.major || comptime.major == -1) &&
+            (minor_compiletime == comptime.minor || comptime.minor == -1)) {
+            return JNI_TRUE;
+        }
     }
-#endif
-    /* Runtime major version must match. */
-    if ( major_runtime != major_compiletime ) {
-        return JNI_FALSE;
-    }
-    /* Runtime minor version must be >= the version compiled with. */
-    if ( minor_runtime < minor_compiletime ) {
-        return JNI_FALSE;
-    }
-    /* Assumed compatible */
-    return JNI_TRUE;
+
+    return major_runtime == major_compiletime &&
+           minor_runtime >= minor_compiletime;
 }
 
 /* OnLoad startup:
--- a/jdk/src/share/back/eventFilter.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/back/eventFilter.c	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 #include "stepControl.h"
 #include "threadControl.h"
 #include "SDE.h"
+#include "jvmti.h"
 
 typedef struct ClassFilter {
     jclass clazz;
@@ -275,6 +276,24 @@
     }
 }
 
+static jboolean isVersionGte12x() {
+    jint version;
+    jvmtiError err =
+        JVMTI_FUNC_PTR(gdata->jvmti,GetVersionNumber)(gdata->jvmti, &version);
+
+    if (err == JVMTI_ERROR_NONE) {
+        jint major, minor;
+
+        major = (version & JVMTI_VERSION_MASK_MAJOR)
+                    >> JVMTI_VERSION_SHIFT_MAJOR;
+        minor = (version & JVMTI_VERSION_MASK_MINOR)
+                    >> JVMTI_VERSION_SHIFT_MINOR;
+        return (major > 1 || major == 1 && minor >= 2);
+    } else {
+        return JNI_FALSE;
+    }
+}
+
 /* Return the object instance in which the event occurred */
 /* Return NULL if static or if an error occurs */
 static jobject
@@ -286,6 +305,14 @@
     jint        modifiers       = 0;
     jvmtiError  error;
 
+    static jboolean got_version = JNI_FALSE;
+    static jboolean is_version_gte_12x = JNI_FALSE;
+
+    if (!got_version) {
+        is_version_gte_12x = isVersionGte12x();
+        got_version = JNI_TRUE;
+    }
+
     switch (evinfo->ei) {
         case EI_SINGLE_STEP:
         case EI_BREAKPOINT:
@@ -314,11 +341,18 @@
     /* fail if error or static (0x8) */
     if (error == JVMTI_ERROR_NONE && thread!=NULL && (modifiers & 0x8) == 0) {
         FrameNumber fnum            = 0;
-        /* get slot zero object "this" */
-        error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalObject)
-                    (gdata->jvmti, thread, fnum, 0, &object);
-        if (error != JVMTI_ERROR_NONE)
+        if (is_version_gte_12x) {
+            /* Use new 1.2.x function, GetLocalInstance */
+            error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalInstance)
+                        (gdata->jvmti, thread, fnum, &object);
+        } else {
+            /* get slot zero object "this" */
+            error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalObject)
+                        (gdata->jvmti, thread, fnum, 0, &object);
+        }
+        if (error != JVMTI_ERROR_NONE) {
             object = NULL;
+        }
     }
 
     return object;
--- a/jdk/src/share/bin/java.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/bin/java.c	Fri Feb 04 16:29:41 2011 -0800
@@ -94,15 +94,15 @@
  * Prototypes for functions internal to launcher.
  */
 static void SetClassPath(const char *s);
-static void SetModulesBootClassPath(const char *s);
 static void SelectVersion(int argc, char **argv, char **main_class);
-static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile,
-                               char **pclassname, int *pret, const char *jvmpath);
+static jboolean ParseArguments(int *pargc, char ***pargv,
+                               int *pmode, char **pwhat,
+                               int *pret, const char *jrepath);
 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
                               InvocationFunctions *ifn);
 static jstring NewPlatformString(JNIEnv *env, char *s);
 static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
-static jclass LoadMainClass(JNIEnv *env, jboolean isJar, char *name);
+static jclass LoadMainClass(JNIEnv *env, int mode, char *name);
 
 static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv);
 static jboolean AddApplicationOptions(int cpathc, const char **cpathv);
@@ -158,18 +158,27 @@
  * Running Java code in primordial thread caused many problems. We will
  * create a new thread to invoke JVM. See 6316197 for more information.
  */
-static jlong threadStackSize    = 0;  /* stack size of the new thread */
+static jlong threadStackSize = 0;  /* stack size of the new thread */
 static jlong maxHeapSize        = 0;  /* max heap size */
 static jlong initialHeapSize    = 0;  /* inital heap size */
 
 int JNICALL JavaMain(void * args); /* entry point                  */
 
+enum LaunchMode {               // cf. sun.launcher.LauncherHelper
+    LM_UNKNOWN = 0,
+    LM_CLASS,
+    LM_JAR
+};
+
+static const char *launchModeNames[]
+    = { "Unknown", "Main class", "JAR file" };
+
 typedef struct {
-  int     argc;
-  char ** argv;
-  char *  jarfile;
-  char *  classname;
-  InvocationFunctions ifn;
+    int    argc;
+    char **argv;
+    int    mode;
+    char  *what;
+    InvocationFunctions ifn;
 } JavaMainArgs;
 
 /*
@@ -189,8 +198,8 @@
         jint ergo                               /* ergonomics class policy */
 )
 {
-    char *jarfile = 0;
-    char *classname = 0;
+    int mode = LM_UNKNOWN;
+    char *what = NULL;
     char *cpath = 0;
     char *main_class = NULL;
     int ret;
@@ -277,24 +286,21 @@
         SetClassPath(cpath);
     }
 
-    /*
-     *  Parse command line options; if the return value of
-     *  ParseArguments is false, the program should exit.
+    /* Parse command line options; if the return value of
+     * ParseArguments is false, the program should exit.
      */
-    if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret, jvmpath)) {
+    if (!ParseArguments(&argc, &argv, &mode, &what, &ret, jrepath))
+    {
         return(ret);
     }
 
-    /* Set bootclasspath for modules */
-    SetModulesBootClassPath(jrepath);
-
     /* Override class path if -jar flag was specified */
-    if (jarfile != 0) {
-        SetClassPath(jarfile);
+    if (mode == LM_JAR) {
+        SetClassPath(what);     /* Override class path */
     }
 
     /* set the -Dsun.java.command pseudo property */
-    SetJavaCommandLineProp(classname, jarfile, argc, argv);
+    SetJavaCommandLineProp(what, argc, argv);
 
     /* Set the -Dsun.java.launcher pseudo property */
     SetJavaLauncherProp();
@@ -305,7 +311,7 @@
     /* Show the splash screen if needed */
     ShowSplashScreen();
 
-    return ContinueInNewThread(&ifn, argc, argv, jarfile, classname, ret);
+    return ContinueInNewThread(&ifn, argc, argv, mode, what, ret);
 
 }
 /*
@@ -353,13 +359,13 @@
     JavaMainArgs *args = (JavaMainArgs *)_args;
     int argc = args->argc;
     char **argv = args->argv;
-    char *jarfile = args->jarfile;
-    char *classname = args->classname;
+    int mode = args->mode;
+    char *what = args->what;
     InvocationFunctions ifn = args->ifn;
 
     JavaVM *vm = 0;
     JNIEnv *env = 0;
-    jclass mainClass;
+    jclass mainClass = NULL;
     jmethodID mainID;
     jobjectArray mainArgs;
     int ret = 0;
@@ -385,7 +391,7 @@
         CHECK_EXCEPTION_LEAVE(1);
     }
     /* If the user specified neither a class name nor a JAR file */
-    if (printXUsage || printUsage || (jarfile == 0 && classname == 0)) {
+    if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
         PrintUsage(env, printXUsage);
         CHECK_EXCEPTION_LEAVE(1);
         LEAVE();
@@ -399,11 +405,11 @@
                (long)(jint)Counter2Micros(end-start));
     }
 
-    /* At this stage, argc/argv have the applications' arguments */
+    /* At this stage, argc/argv have the application's arguments */
     if (JLI_IsTraceLauncher()){
         int i;
-        printf("Main-Class is '%s'\n", classname ? classname : "");
-        printf("Apps' argc is %d\n", argc);
+        printf("%s is '%s'\n", launchModeNames[mode], what);
+        printf("App's argc is %d\n", argc);
         for (i=0; i < argc; i++) {
             printf("    argv[%2d] = '%s'\n", i, argv[i]);
         }
@@ -431,11 +437,7 @@
      *     2)   Remove the vestages of maintaining main_class through
      *          the environment (and remove these comments).
      */
-    if (jarfile != 0) {
-        mainClass = LoadMainClass(env, JNI_TRUE, jarfile);
-    } else {
-        mainClass = LoadMainClass(env, JNI_FALSE, classname);
-    }
+    mainClass = LoadMainClass(env, mode, what);
     CHECK_EXCEPTION_NULL_LEAVE(mainClass);
 
     /*
@@ -697,7 +699,7 @@
     if (JLI_StrCCmp(str, "-Xms") == 0) {
         jlong tmp;
         if (parse_size(str + 4, &tmp)) {
-            initialHeapSize = tmp;
+           initialHeapSize = tmp;
         }
     }
 }
@@ -719,44 +721,6 @@
 }
 
 /*
- * Set the bootclasspath for modules.
- * A temporary workaround until jigsaw is integrated into JDK 7.
- */
-static void
-SetModulesBootClassPath(const char *jrepath)
-{
-    char *def, *s;
-    char pathname[MAXPATHLEN];
-    const char separator[] = { FILE_SEPARATOR, '\0' };
-    const char *orig = jrepath;
-    static const char format[] = "-Xbootclasspath/p:%s";
-    struct stat statbuf;
-
-    /* return if jre/lib/rt.jar exists */
-    JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%srt.jar", jrepath, separator, separator);
-    if (stat(pathname, &statbuf) == 0) {
-        return;
-    }
-
-    /* return if jre/classes exists */
-    JLI_Snprintf(pathname, sizeof(pathname), "%s%sclasses", jrepath, separator);
-    if (stat(pathname, &statbuf) == 0) {
-        return;
-    }
-
-    /* modularized jre */
-    JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%s*", jrepath, separator, separator);
-    s = (char *) JLI_WildcardExpandClasspath(pathname);
-    def = JLI_MemAlloc(sizeof(format)
-                       - 2 /* strlen("%s") */
-                       + JLI_StrLen(s));
-    sprintf(def, format, s);
-    AddOption(def, NULL);
-    if (s != orig)
-        JLI_MemFree((char *) s);
-}
-
-/*
  * The SelectVersion() routine ensures that an appropriate version of
  * the JRE is running.  The specification for the appropriate version
  * is obtained from either the manifest of a jar file (preferred) or
@@ -1000,16 +964,17 @@
 /*
  * Parses command line arguments.  Returns JNI_FALSE if launcher
  * should exit without starting vm, returns JNI_TRUE if vm needs
- * to be started to process  given options. *pret (the launcher
+ * to be started to process given options.  *pret (the launcher
  * process return value) is set to 0 for a normal exit.
  */
 static jboolean
-ParseArguments(int *pargc, char ***pargv, char **pjarfile,
-                       char **pclassname, int *pret, const char *jvmpath)
+ParseArguments(int *pargc, char ***pargv,
+               int *pmode, char **pwhat,
+               int *pret, const char *jrepath)
 {
     int argc = *pargc;
     char **argv = *pargv;
-    jboolean jarflag = JNI_FALSE;
+    int mode = LM_UNKNOWN;
     char *arg;
 
     *pret = 0;
@@ -1019,10 +984,11 @@
         if (JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) {
             ARG_CHECK (argc, ARG_ERROR1, arg);
             SetClassPath(*argv);
+            mode = LM_CLASS;
             argv++; --argc;
         } else if (JLI_StrCmp(arg, "-jar") == 0) {
             ARG_CHECK (argc, ARG_ERROR2, arg);
-            jarflag = JNI_TRUE;
+            mode = LM_JAR;
         } else if (JLI_StrCmp(arg, "-help") == 0 ||
                    JLI_StrCmp(arg, "-h") == 0 ||
                    JLI_StrCmp(arg, "-?") == 0) {
@@ -1102,19 +1068,24 @@
     }
 
     if (--argc >= 0) {
-        if (jarflag) {
-            *pjarfile = *argv++;
-            *pclassname = NULL;
-        } else {
-            *pjarfile = NULL;
-            *pclassname = *argv++;
-        }
+        *pwhat = *argv++;
+    }
+
+    if (*pwhat == NULL) {
+        *pret = 1;
+    } else if (mode == LM_UNKNOWN) {
+        /* default to LM_CLASS if -jar and -cp option are
+         * not specified */
+        mode = LM_CLASS;
+    }
+
+    if (argc >= 0) {
         *pargc = argc;
         *pargv = argv;
     }
-    if (*pjarfile == NULL && *pclassname == NULL) {
-        *pret = 1;
-    }
+
+    *pmode = mode;
+
     return JNI_TRUE;
 }
 
@@ -1263,7 +1234,7 @@
  * call it for more details refer to the java implementation.
  */
 static jclass
-LoadMainClass(JNIEnv *env, jboolean isJar, char *name)
+LoadMainClass(JNIEnv *env, int mode, char *name)
 {
     jclass cls;
     jmethodID mid;
@@ -1276,9 +1247,9 @@
     }
     NULL_CHECK0(cls = FindBootStrapClass(env, "sun/launcher/LauncherHelper"));
     NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, "checkAndLoadMain",
-                                          "(ZZLjava/lang/String;)Ljava/lang/Object;"));
+                                          "(ZILjava/lang/String;)Ljava/lang/Class;"));
     str = (*env)->NewStringUTF(env, name);
-    result = (*env)->CallStaticObjectMethod(env, cls, mid, JNI_TRUE, isJar, str);
+    result = (*env)->CallStaticObjectMethod(env, cls, mid, JNI_TRUE, mode, str);
 
     if (JLI_IsTraceLauncher()) {
         end   = CounterGet();
@@ -1424,8 +1395,7 @@
  * property is not exported by HotSpot to the Java layer.
  */
 void
-SetJavaCommandLineProp(char *classname, char *jarfile,
-                       int argc, char **argv)
+SetJavaCommandLineProp(char *what, int argc, char **argv)
 {
 
     int i = 0;
@@ -1433,22 +1403,17 @@
     char* javaCommand = NULL;
     char* dashDstr = "-Dsun.java.command=";
 
-    if (classname == NULL && jarfile == NULL) {
+    if (what == NULL) {
         /* unexpected, one of these should be set. just return without
          * setting the property
          */
         return;
     }
 
-    /* if the class name is not set, then use the jarfile name */
-    if (classname == NULL) {
-        classname = jarfile;
-    }
-
     /* determine the amount of memory to allocate assuming
      * the individual components will be space separated
      */
-    len = JLI_StrLen(classname);
+    len = JLI_StrLen(what);
     for (i = 0; i < argc; i++) {
         len += JLI_StrLen(argv[i]) + 1;
     }
@@ -1459,7 +1424,7 @@
     /* build the -D string */
     *javaCommand = '\0';
     JLI_StrCat(javaCommand, dashDstr);
-    JLI_StrCat(javaCommand, classname);
+    JLI_StrCat(javaCommand, what);
 
     for (i = 0; i < argc; i++) {
         /* the components of the string are space separated. In
@@ -1479,7 +1444,8 @@
  * JVM would like to know if it's created by a standard Sun launcher, or by
  * user native application, the following property indicates the former.
  */
-void SetJavaLauncherProp() {
+void
+SetJavaLauncherProp() {
   AddOption("-Dsun.java.launcher=SUN_STANDARD", NULL);
 }
 
@@ -1913,8 +1879,8 @@
 }
 
 static int
-ContinueInNewThread(InvocationFunctions* ifn, int argc,
-                     char **argv, char *jarfile, char *classname, int ret)
+ContinueInNewThread(InvocationFunctions* ifn, int argc, char **argv,
+                    int mode, char *what, int ret)
 {
 
     /*
@@ -1938,8 +1904,8 @@
 
       args.argc = argc;
       args.argv = argv;
-      args.jarfile = jarfile;
-      args.classname = classname;
+      args.mode = mode;
+      args.what = what;
       args.ifn = *ifn;
 
       rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);
--- a/jdk/src/share/bin/java.h	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/bin/java.h	Fri Feb 04 16:29:41 2011 -0800
@@ -153,7 +153,7 @@
 
 /* sun.java.launcher.* platform properties. */
 void SetJavaLauncherPlatformProps(void);
-void SetJavaCommandLineProp(char* classname, char* jarfile, int argc, char** argv);
+void SetJavaCommandLineProp(char* what, int argc, char** argv);
 void SetJavaLauncherProp(void);
 
 /*
@@ -178,8 +178,9 @@
 
 jboolean ServerClassMachine();
 
-static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv,
-                        char* jarfile, char* classname, int ret);
+static int ContinueInNewThread(InvocationFunctions* ifn,
+                               int argc, char** argv,
+                               int mode, char *what, int ret);
 
 /*
  * Initialize platform specific settings
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1704,7 +1704,7 @@
         for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
             assert(attrIndexLimit[i] == 0);
             attrIndexLimit[i] = 32;  // just for the sake of predefs.
-            attrDefs.set(i, new ArrayList<>(Collections.nCopies(
+            attrDefs.set(i, new ArrayList<Attribute.Layout>(Collections.nCopies(
                     attrIndexLimit[i], (Attribute.Layout)null)));
 
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/management/ThreadMXBean.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 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.  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.management;
+
+import java.util.Map;
+
+/**
+ * Platform-specific management interface for the thread system
+ * of the Java virtual machine.
+ * <p>
+ * This platform extension is only available to a thread
+ * implementation that supports this extension.
+ *
+ * @author  Paul Hohensee
+ * @since   6u25
+ */
+
+public interface ThreadMXBean extends java.lang.management.ThreadMXBean {
+    /**
+     * Returns the total CPU time for each thread whose ID is
+     * in the input array {@code ids} in nanoseconds.
+     * The returned values are of nanoseconds precision but
+     * not necessarily nanoseconds accuracy.
+     * <p>
+     * This method is equivalent to calling the
+     * {@link ThreadMXBean#getThreadCpuTime(long)}
+     * method for each thread ID in the input array {@code ids} and setting the
+     * returned value in the corresponding element of the returned array.
+     *
+     * @param ids an array of thread IDs.
+     * @return an array of long values, each of which is the amount of CPU
+     * time the thread whose ID is in the corresponding element of the input
+     * array of IDs has used,
+     * if the thread of a specified ID exists, the thread is alive,
+     * and CPU time measurement is enabled;
+     * {@code -1} otherwise.
+     *
+     * @throws NullPointerException if {@code ids} is {@code null}
+     * @throws IllegalArgumentException if any element in the input array
+     *         {@code ids} is {@code <=} {@code 0}.
+     * @throws java.lang.UnsupportedOperationException if the Java
+     *         virtual machine implementation does not support CPU time
+     *         measurement.
+     *
+     * @see ThreadMXBean#getThreadCpuTime(long)
+     * @see #getThreadUserTime
+     * @see ThreadMXBean#isThreadCpuTimeSupported
+     * @see ThreadMXBean#isThreadCpuTimeEnabled
+     * @see ThreadMXBean#setThreadCpuTimeEnabled
+     */
+    public long[] getThreadCpuTime(long[] ids);
+
+    /**
+     * Returns the CPU time that each thread whose ID is in the input array
+     * {@code ids} has executed in user mode in nanoseconds.
+     * The returned values are of nanoseconds precision but
+     * not necessarily nanoseconds accuracy.
+     * <p>
+     * This method is equivalent to calling the
+     * {@link ThreadMXBean#getThreadUserTime(long)}
+     * method for each thread ID in the input array {@code ids} and setting the
+     * returned value in the corresponding element of the returned array.
+     *
+     * @param ids an array of thread IDs.
+     * @return an array of long values, each of which is the amount of user
+     * mode CPU time the thread whose ID is in the corresponding element of
+     * the input array of IDs has used,
+     * if the thread of a specified ID exists, the thread is alive,
+     * and CPU time measurement is enabled;
+     * {@code -1} otherwise.
+     *
+     * @throws NullPointerException if {@code ids} is {@code null}
+     * @throws IllegalArgumentException if any element in the input array
+     *         {@code ids} is {@code <=} {@code 0}.
+     * @throws java.lang.UnsupportedOperationException if the Java
+     *         virtual machine implementation does not support CPU time
+     *         measurement.
+     *
+     * @see ThreadMXBean#getThreadUserTime(long)
+     * @see #getThreadCpuTime
+     * @see ThreadMXBean#isThreadCpuTimeSupported
+     * @see ThreadMXBean#isThreadCpuTimeEnabled
+     * @see ThreadMXBean#setThreadCpuTimeEnabled
+     */
+    public long[] getThreadUserTime(long[] ids);
+
+    /**
+     * Returns an approximation of the total amount of memory, in bytes,
+     * allocated in heap memory for the thread of the specified ID.
+     * The returned value is an approximation because some Java virtual machine
+     * implementations may use object allocation mechanisms that result in a
+     * delay between the time an object is allocated and the time its size is
+     * recorded.
+     * <p>
+     * If the thread of the specified ID is not alive or does not exist,
+     * this method returns {@code -1}. If thread memory allocation measurement
+     * is disabled, this method returns {@code -1}.
+     * A thread is alive if it has been started and has not yet died.
+     * <p>
+     * If thread memory allocation measurement is enabled after the thread has
+     * started, the Java virtual machine implementation may choose any time up
+     * to and including the time that the capability is enabled as the point
+     * where thread memory allocation measurement starts.
+     *
+     * @param id the thread ID of a thread
+     * @return an approximation of the total memory allocated, in bytes, in
+     * heap memory for a thread of the specified ID
+     * if the thread of the specified ID exists, the thread is alive,
+     * and thread memory allocation measurement is enabled;
+     * {@code -1} otherwise.
+     *
+     * @throws IllegalArgumentException if {@code id} {@code <=} {@code 0}.
+     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     *         machine implementation does not support thread memory allocation
+     *         measurement.
+     *
+     * @see #isThreadAllocatedMemorySupported
+     * @see #isThreadAllocatedMemoryEnabled
+     * @see #setThreadAllocatedMemoryEnabled
+     */
+    public long getThreadAllocatedBytes(long id);
+
+    /**
+     * Returns an approximation of the total amount of memory, in bytes,
+     * allocated in heap memory for each thread whose ID is in the input
+     * array {@code ids}.
+     * The returned values are approximations because some Java virtual machine
+     * implementations may use object allocation mechanisms that result in a
+     * delay between the time an object is allocated and the time its size is
+     * recorded.
+     * <p>
+     * This method is equivalent to calling the
+     * {@link #getThreadAllocatedBytes(long)}
+     * method for each thread ID in the input array {@code ids} and setting the
+     * returned value in the corresponding element of the returned array.
+     *
+     * @param ids an array of thread IDs.
+     * @return an array of long values, each of which is an approximation of
+     * the total memory allocated, in bytes, in heap memory for the thread
+     * whose ID is in the corresponding element of the input array of IDs.
+     *
+     * @throws NullPointerException if {@code ids} is {@code null}
+     * @throws IllegalArgumentException if any element in the input array
+     *         {@code ids} is {@code <=} {@code 0}.
+     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     *         machine implementation does not support thread memory allocation
+     *         measurement.
+     *
+     * @see #getThreadAllocatedBytes(long)
+     * @see #isThreadAllocatedMemorySupported
+     * @see #isThreadAllocatedMemoryEnabled
+     * @see #setThreadAllocatedMemoryEnabled
+     */
+    public long[] getThreadAllocatedBytes(long[] ids);
+
+    /**
+     * Tests if the Java virtual machine implementation supports thread memory
+     * allocation measurement.
+     *
+     * @return
+     *   {@code true}
+     *     if the Java virtual machine implementation supports thread memory
+     *     allocation measurement;
+     *   {@code false} otherwise.
+     */
+    public boolean isThreadAllocatedMemorySupported();
+
+    /**
+     * Tests if thread memory allocation measurement is enabled.
+     *
+     * @return {@code true} if thread memory allocation measurement is enabled;
+     *         {@code false} otherwise.
+     *
+     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     *         machine does not support thread memory allocation measurement.
+     *
+     * @see #isThreadAllocatedMemorySupported
+     */
+    public boolean isThreadAllocatedMemoryEnabled();
+
+    /**
+     * Enables or disables thread memory allocation measurement.  The default
+     * is platform dependent.
+     *
+     * @param enable {@code true} to enable;
+     *               {@code false} to disable.
+     *
+     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     *         machine does not support thread memory allocation measurement.
+     *
+     * @throws java.lang.SecurityException if a security manager
+     *         exists and the caller does not have
+     *         ManagementPermission("control").
+     *
+     * @see #isThreadAllocatedMemorySupported
+     */
+    public void setThreadAllocatedMemoryEnabled(boolean enable);
+}
--- a/jdk/src/share/classes/com/sun/script/javascript/RhinoScriptEngine.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/script/javascript/RhinoScriptEngine.java	Fri Feb 04 16:29:41 2011 -0800
@@ -223,7 +223,9 @@
         } catch (RhinoException re) {
             if (DEBUG) re.printStackTrace();
             int line = (line = re.lineNumber()) == 0 ? -1 : line;
-            throw new ScriptException(re.toString(), re.sourceName(), line);
+            ScriptException se = new ScriptException(re.toString(), re.sourceName(), line);
+            se.initCause(re);
+            throw se;
         } finally {
             cx.exit();
         }
@@ -257,6 +259,8 @@
             "        str = 'null';                         \n" +
             "    }                                         \n" +
             "    var out = context.getWriter();            \n" +
+            "    if (!(out instanceof java.io.PrintWriter))\n" +
+            "        out = new java.io.PrintWriter(out);   \n" +
             "    out.print(String(str));                   \n" +
             "    if (newline) out.print('\\n');            \n" +
             "    out.flush();                              \n" +
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1180,7 +1180,7 @@
             // Done
             return certs;
 
-        ArrayList<Certificate> userCertList = new ArrayList<Certificate>();
+        ArrayList<Certificate> userCertList = new ArrayList<>();
         i = 0;
         while (i < certs.length) {
             userCertList.add(certs[i]);
--- a/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -99,10 +99,10 @@
         throws UnsupportedCallbackException
     {
         /* Collect messages to display in the dialog */
-        final List<Object> messages = new ArrayList<Object>(3);
+        final List<Object> messages = new ArrayList<>(3);
 
         /* Collection actions to perform if the user clicks OK */
-        final List<Action> okActions = new ArrayList<Action>(2);
+        final List<Action> okActions = new ArrayList<>(2);
 
         ConfirmationInfo confirmation = new ConfirmationInfo();
 
--- a/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Fri Feb 04 16:29:41 2011 -0800
@@ -152,7 +152,7 @@
 
         // new configuration
         HashMap<String, LinkedList<AppConfigurationEntry>> newConfig =
-                new HashMap<String, LinkedList<AppConfigurationEntry>>();
+                new HashMap<>();
 
         if (url != null) {
 
@@ -392,8 +392,7 @@
         String moduleClass;
         String sflag;
         AppConfigurationEntry.LoginModuleControlFlag controlFlag;
-        LinkedList<AppConfigurationEntry> configEntries =
-                                new LinkedList<AppConfigurationEntry>();
+        LinkedList<AppConfigurationEntry> configEntries = new LinkedList<>();
 
         // application name
         appName = st.sval;
@@ -433,7 +432,7 @@
             }
 
             // get the args
-            HashMap<String, String> options = new HashMap<String, String>();
+            HashMap<String, String> options = new HashMap<>();
             String key;
             String value;
             while (peek(";") == false) {
--- a/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Fri Feb 04 16:29:41 2011 -0800
@@ -184,7 +184,7 @@
     private UnixNumericUserPrincipal UIDPrincipal;
     private UnixNumericGroupPrincipal GIDPrincipal;
     private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
-                                new LinkedList<UnixNumericGroupPrincipal>();
+                                new LinkedList<>();
 
     // initial state
     private Subject subject;
--- a/jdk/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java	Fri Feb 04 16:29:41 2011 -0800
@@ -658,8 +658,7 @@
                 throw new FailedLoginException(
                     "Unable to find X.509 certificate chain in keystore");
             } else {
-                LinkedList<Certificate> certList =
-                                new LinkedList<Certificate>();
+                LinkedList<Certificate> certList = new LinkedList<>();
                 for (int i=0; i < fromKeyStore.length; i++) {
                     certList.add(fromKeyStore[i]);
                 }
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Fri Feb 04 16:29:41 2011 -0800
@@ -76,7 +76,7 @@
     private SolarisNumericUserPrincipal UIDPrincipal;
     private SolarisNumericGroupPrincipal GIDPrincipal;
     private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups =
-                new LinkedList<SolarisNumericGroupPrincipal>();
+                new LinkedList<>();
 
     /**
      * Initialize this <code>LoginModule</code>.
--- a/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Fri Feb 04 16:29:41 2011 -0800
@@ -70,7 +70,7 @@
     private UnixNumericUserPrincipal UIDPrincipal;
     private UnixNumericGroupPrincipal GIDPrincipal;
     private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
-                new LinkedList<UnixNumericGroupPrincipal>();
+                new LinkedList<>();
 
     /**
      * Initialize this <code>LoginModule</code>.
--- a/jdk/src/share/classes/java/awt/geom/CubicCurve2D.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/awt/geom/CubicCurve2D.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1387,203 +1387,13 @@
             return false;
         }
 
-        // Trivially accept if either endpoint is inside the rectangle
-        // (not on its border since it may end there and not go inside)
-        // Record where they lie with respect to the rectangle.
-        //     -1 => left, 0 => inside, 1 => right
-        double x1 = getX1();
-        double y1 = getY1();
-        int x1tag = getTag(x1, x, x+w);
-        int y1tag = getTag(y1, y, y+h);
-        if (x1tag == INSIDE && y1tag == INSIDE) {
-            return true;
-        }
-        double x2 = getX2();
-        double y2 = getY2();
-        int x2tag = getTag(x2, x, x+w);
-        int y2tag = getTag(y2, y, y+h);
-        if (x2tag == INSIDE && y2tag == INSIDE) {
-            return true;
-        }
-
-        double ctrlx1 = getCtrlX1();
-        double ctrly1 = getCtrlY1();
-        double ctrlx2 = getCtrlX2();
-        double ctrly2 = getCtrlY2();
-        int ctrlx1tag = getTag(ctrlx1, x, x+w);
-        int ctrly1tag = getTag(ctrly1, y, y+h);
-        int ctrlx2tag = getTag(ctrlx2, x, x+w);
-        int ctrly2tag = getTag(ctrly2, y, y+h);
-
-        // Trivially reject if all points are entirely to one side of
-        // the rectangle.
-        if (x1tag < INSIDE && x2tag < INSIDE &&
-            ctrlx1tag < INSIDE && ctrlx2tag < INSIDE)
-        {
-            return false;       // All points left
-        }
-        if (y1tag < INSIDE && y2tag < INSIDE &&
-            ctrly1tag < INSIDE && ctrly2tag < INSIDE)
-        {
-            return false;       // All points above
-        }
-        if (x1tag > INSIDE && x2tag > INSIDE &&
-            ctrlx1tag > INSIDE && ctrlx2tag > INSIDE)
-        {
-            return false;       // All points right
-        }
-        if (y1tag > INSIDE && y2tag > INSIDE &&
-            ctrly1tag > INSIDE && ctrly2tag > INSIDE)
-        {
-            return false;       // All points below
-        }
-
-        // Test for endpoints on the edge where either the segment
-        // or the curve is headed "inwards" from them
-        // Note: These tests are a superset of the fast endpoint tests
-        //       above and thus repeat those tests, but take more time
-        //       and cover more cases
-        if (inwards(x1tag, x2tag, ctrlx1tag) &&
-            inwards(y1tag, y2tag, ctrly1tag))
-        {
-            // First endpoint on border with either edge moving inside
-            return true;
-        }
-        if (inwards(x2tag, x1tag, ctrlx2tag) &&
-            inwards(y2tag, y1tag, ctrly2tag))
-        {
-            // Second endpoint on border with either edge moving inside
-            return true;
-        }
-
-        // Trivially accept if endpoints span directly across the rectangle
-        boolean xoverlap = (x1tag * x2tag <= 0);
-        boolean yoverlap = (y1tag * y2tag <= 0);
-        if (x1tag == INSIDE && x2tag == INSIDE && yoverlap) {
-            return true;
-        }
-        if (y1tag == INSIDE && y2tag == INSIDE && xoverlap) {
-            return true;
-        }
-
-        // We now know that both endpoints are outside the rectangle
-        // but the 4 points are not all on one side of the rectangle.
-        // Therefore the curve cannot be contained inside the rectangle,
-        // but the rectangle might be contained inside the curve, or
-        // the curve might intersect the boundary of the rectangle.
-
-        double[] eqn = new double[4];
-        double[] res = new double[4];
-        if (!yoverlap) {
-            // Both y coordinates for the closing segment are above or
-            // below the rectangle which means that we can only intersect
-            // if the curve crosses the top (or bottom) of the rectangle
-            // in more than one place and if those crossing locations
-            // span the horizontal range of the rectangle.
-            fillEqn(eqn, (y1tag < INSIDE ? y : y+h), y1, ctrly1, ctrly2, y2);
-            int num = solveCubic(eqn, res);
-            num = evalCubic(res, num, true, true, null,
-                            x1, ctrlx1, ctrlx2, x2);
-            // odd counts imply the crossing was out of [0,1] bounds
-            // otherwise there is no way for that part of the curve to
-            // "return" to meet its endpoint
-            return (num == 2 &&
-                    getTag(res[0], x, x+w) * getTag(res[1], x, x+w) <= 0);
-        }
-
-        // Y ranges overlap.  Now we examine the X ranges
-        if (!xoverlap) {
-            // Both x coordinates for the closing segment are left of
-            // or right of the rectangle which means that we can only
-            // intersect if the curve crosses the left (or right) edge
-            // of the rectangle in more than one place and if those
-            // crossing locations span the vertical range of the rectangle.
-            fillEqn(eqn, (x1tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
-            int num = solveCubic(eqn, res);
-            num = evalCubic(res, num, true, true, null,
-                            y1, ctrly1, ctrly2, y2);
-            // odd counts imply the crossing was out of [0,1] bounds
-            // otherwise there is no way for that part of the curve to
-            // "return" to meet its endpoint
-            return (num == 2 &&
-                    getTag(res[0], y, y+h) * getTag(res[1], y, y+h) <= 0);
-        }
-
-        // The X and Y ranges of the endpoints overlap the X and Y
-        // ranges of the rectangle, now find out how the endpoint
-        // line segment intersects the Y range of the rectangle
-        double dx = x2 - x1;
-        double dy = y2 - y1;
-        double k = y2 * x1 - x2 * y1;
-        int c1tag, c2tag;
-        if (y1tag == INSIDE) {
-            c1tag = x1tag;
-        } else {
-            c1tag = getTag((k + dx * (y1tag < INSIDE ? y : y+h)) / dy, x, x+w);
-        }
-        if (y2tag == INSIDE) {
-            c2tag = x2tag;
-        } else {
-            c2tag = getTag((k + dx * (y2tag < INSIDE ? y : y+h)) / dy, x, x+w);
-        }
-        // If the part of the line segment that intersects the Y range
-        // of the rectangle crosses it horizontally - trivially accept
-        if (c1tag * c2tag <= 0) {
-            return true;
-        }
-
-        // Now we know that both the X and Y ranges intersect and that
-        // the endpoint line segment does not directly cross the rectangle.
-        //
-        // We can almost treat this case like one of the cases above
-        // where both endpoints are to one side, except that we may
-        // get one or three intersections of the curve with the vertical
-        // side of the rectangle.  This is because the endpoint segment
-        // accounts for the other intersection in an even pairing.  Thus,
-        // with the endpoint crossing we end up with 2 or 4 total crossings.
-        //
-        // (Remember there is overlap in both the X and Y ranges which
-        //  means that the segment itself must cross at least one vertical
-        //  edge of the rectangle - in particular, the "near vertical side"
-        //  - leaving an odd number of intersections for the curve.)
-        //
-        // Now we calculate the y tags of all the intersections on the
-        // "near vertical side" of the rectangle.  We will have one with
-        // the endpoint segment, and one or three with the curve.  If
-        // any pair of those vertical intersections overlap the Y range
-        // of the rectangle, we have an intersection.  Otherwise, we don't.
-
-        // c1tag = vertical intersection class of the endpoint segment
-        //
-        // Choose the y tag of the endpoint that was not on the same
-        // side of the rectangle as the subsegment calculated above.
-        // Note that we can "steal" the existing Y tag of that endpoint
-        // since it will be provably the same as the vertical intersection.
-        c1tag = ((c1tag * x1tag <= 0) ? y1tag : y2tag);
-
-        // Now we have to calculate an array of solutions of the curve
-        // with the "near vertical side" of the rectangle.  Then we
-        // need to sort the tags and do a pairwise range test to see
-        // if either of the pairs of crossings spans the Y range of
-        // the rectangle.
-        //
-        // Note that the c2tag can still tell us which vertical edge
-        // to test against.
-        fillEqn(eqn, (c2tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
-        int num = solveCubic(eqn, res);
-        num = evalCubic(res, num, true, true, null, y1, ctrly1, ctrly2, y2);
-
-        // Now put all of the tags into a bucket and sort them.  There
-        // is an intersection iff one of the pairs of tags "spans" the
-        // Y range of the rectangle.
-        int tags[] = new int[num+1];
-        for (int i = 0; i < num; i++) {
-            tags[i] = getTag(res[i], y, y+h);
-        }
-        tags[num] = c1tag;
-        Arrays.sort(tags);
-        return ((num >= 1 && tags[0] * tags[1] <= 0) ||
-                (num >= 3 && tags[2] * tags[3] <= 0));
+        int numCrossings = rectCrossings(x, y, w, h);
+        // the intended return value is
+        // numCrossings != 0 || numCrossings == Curve.RECT_INTERSECTS
+        // but if (numCrossings != 0) numCrossings == INTERSECTS won't matter
+        // and if !(numCrossings != 0) then numCrossings == 0, so
+        // numCrossings != RECT_INTERSECT
+        return numCrossings != 0;
     }
 
     /**
@@ -1602,20 +1412,32 @@
         if (w <= 0 || h <= 0) {
             return false;
         }
-        // Assertion: Cubic curves closed by connecting their
-        // endpoints form either one or two convex halves with
-        // the closing line segment as an edge of both sides.
-        if (!(contains(x, y) &&
-              contains(x + w, y) &&
-              contains(x + w, y + h) &&
-              contains(x, y + h))) {
-            return false;
+
+        int numCrossings = rectCrossings(x, y, w, h);
+        return !(numCrossings == 0 || numCrossings == Curve.RECT_INTERSECTS);
+    }
+
+    private int rectCrossings(double x, double y, double w, double h) {
+        int crossings = 0;
+        if (!(getX1() == getX2() && getY1() == getY2())) {
+            crossings = Curve.rectCrossingsForLine(crossings,
+                                                   x, y,
+                                                   x+w, y+h,
+                                                   getX1(), getY1(),
+                                                   getX2(), getY2());
+            if (crossings == Curve.RECT_INTERSECTS) {
+                return crossings;
+            }
         }
-        // Either the rectangle is entirely inside one of the convex
-        // halves or it crosses from one to the other, in which case
-        // it must intersect the closing line segment.
-        Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
-        return !rect.intersectsLine(getX1(), getY1(), getX2(), getY2());
+        // we call this with the curve's direction reversed, because we wanted
+        // to call rectCrossingsForLine first, because it's cheaper.
+        return Curve.rectCrossingsForCubic(crossings,
+                                           x, y,
+                                           x+w, y+h,
+                                           getX2(), getY2(),
+                                           getCtrlX2(), getCtrlY2(),
+                                           getCtrlX1(), getCtrlY1(),
+                                           getX1(), getY1(), 0);
     }
 
     /**
--- a/jdk/src/share/classes/java/io/ObjectStreamClass.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/io/ObjectStreamClass.java	Fri Feb 04 16:29:41 2011 -0800
@@ -329,7 +329,7 @@
                 entry = th;
             }
             if (future.set(entry)) {
-                Caches.localDescs.put(key, new SoftReference<>(entry));
+                Caches.localDescs.put(key, new SoftReference<Object>(entry));
             } else {
                 // nested lookup call already set future
                 entry = future.get();
@@ -2118,7 +2118,7 @@
                 entry = th;
             }
             future.set(entry);
-            Caches.reflectors.put(key, new SoftReference<>(entry));
+            Caches.reflectors.put(key, new SoftReference<Object>(entry));
         }
 
         if (entry instanceof FieldReflector) {
--- a/jdk/src/share/classes/java/io/PrintStream.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/io/PrintStream.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -27,7 +27,9 @@
 
 import java.util.Formatter;
 import java.util.Locale;
-
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
 
 /**
  * A <code>PrintStream</code> adds functionality to another output stream,
@@ -56,7 +58,7 @@
     implements Appendable, Closeable
 {
 
-    private boolean autoFlush = false;
+    private final boolean autoFlush;
     private boolean trouble = false;
     private Formatter formatter;
 
@@ -68,6 +70,60 @@
     private OutputStreamWriter charOut;
 
     /**
+     * nonNull is explicitly declared here so as not to create an extra
+     * dependency on java.util.Objects.nonNull. PrintStream is loaded
+     * early during system initialization.
+     */
+    private static <T> T nonNull(T obj, String message) {
+        if (obj == null)
+            throw new NullPointerException(message);
+        return obj;
+    }
+
+    /**
+     * Returns a charset object for the given charset name.
+     * @throws NullPointerException          is csn is null
+     * @throws UnsupportedEncodingException  if the charset is not supported
+     */
+    private static Charset toCharset(String csn)
+        throws UnsupportedEncodingException
+    {
+        nonNull(csn, "charsetName");
+        try {
+            return Charset.forName(csn);
+        } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
+            // UnsupportedEncodingException should be thrown
+            throw new UnsupportedEncodingException(csn);
+        }
+    }
+
+    /* Private constructors */
+    private PrintStream(boolean autoFlush, OutputStream out) {
+        super(out);
+        this.autoFlush = autoFlush;
+        this.charOut = new OutputStreamWriter(this);
+        this.textOut = new BufferedWriter(charOut);
+    }
+
+    private PrintStream(boolean autoFlush, OutputStream out, Charset charset) {
+        super(out);
+        this.autoFlush = autoFlush;
+        this.charOut = new OutputStreamWriter(this, charset);
+        this.textOut = new BufferedWriter(charOut);
+    }
+
+    /* Variant of the private constructor so that the given charset name
+     * can be verified before evaluating the OutputStream argument. Used
+     * by constructors creating a FileOutputStream that also take a
+     * charset name.
+     */
+    private PrintStream(boolean autoFlush, Charset charset, OutputStream out)
+        throws UnsupportedEncodingException
+    {
+        this(autoFlush, out, charset);
+    }
+
+    /**
      * Creates a new print stream.  This stream will not flush automatically.
      *
      * @param  out        The output stream to which values and objects will be
@@ -79,27 +135,6 @@
         this(out, false);
     }
 
-    /* Initialization is factored into a private constructor (note the swapped
-     * parameters so that this one isn't confused with the public one) and a
-     * separate init method so that the following two public constructors can
-     * share code.  We use a separate init method so that the constructor that
-     * takes an encoding will throw an NPE for a null stream before it throws
-     * an UnsupportedEncodingException for an unsupported encoding.
-     */
-
-    private PrintStream(boolean autoFlush, OutputStream out)
-    {
-        super(out);
-        if (out == null)
-            throw new NullPointerException("Null output stream");
-        this.autoFlush = autoFlush;
-    }
-
-    private void init(OutputStreamWriter osw) {
-        this.charOut = osw;
-        this.textOut = new BufferedWriter(osw);
-    }
-
     /**
      * Creates a new print stream.
      *
@@ -113,8 +148,7 @@
      * @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
      */
     public PrintStream(OutputStream out, boolean autoFlush) {
-        this(autoFlush, out);
-        init(new OutputStreamWriter(this));
+        this(autoFlush, nonNull(out, "Null output stream"));
     }
 
     /**
@@ -138,8 +172,9 @@
     public PrintStream(OutputStream out, boolean autoFlush, String encoding)
         throws UnsupportedEncodingException
     {
-        this(autoFlush, out);
-        init(new OutputStreamWriter(this, encoding));
+        this(autoFlush,
+             nonNull(out, "Null output stream"),
+             toCharset(encoding));
     }
 
     /**
@@ -171,7 +206,6 @@
      */
     public PrintStream(String fileName) throws FileNotFoundException {
         this(false, new FileOutputStream(fileName));
-        init(new OutputStreamWriter(this));
     }
 
     /**
@@ -210,8 +244,8 @@
     public PrintStream(String fileName, String csn)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        this(false, new FileOutputStream(fileName));
-        init(new OutputStreamWriter(this, csn));
+        // ensure charset is checked before the file is opened
+        this(false, toCharset(csn), new FileOutputStream(fileName));
     }
 
     /**
@@ -243,7 +277,6 @@
      */
     public PrintStream(File file) throws FileNotFoundException {
         this(false, new FileOutputStream(file));
-        init(new OutputStreamWriter(this));
     }
 
     /**
@@ -282,8 +315,8 @@
     public PrintStream(File file, String csn)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        this(false, new FileOutputStream(file));
-        init(new OutputStreamWriter(this, csn));
+        // ensure charset is checked before the file is opened
+        this(false, toCharset(csn), new FileOutputStream(file));
     }
 
     /** Check to make sure that the stream has not been closed */
--- a/jdk/src/share/classes/java/io/PrintWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/io/PrintWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -25,8 +25,12 @@
 
 package java.io;
 
+import java.util.Objects;
 import java.util.Formatter;
 import java.util.Locale;
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
 
 /**
  * Prints formatted representations of objects to a text-output stream.  This
@@ -59,7 +63,7 @@
      */
     protected Writer out;
 
-    private boolean autoFlush = false;
+    private final boolean autoFlush;
     private boolean trouble = false;
     private Formatter formatter;
     private PrintStream psOut = null;
@@ -68,7 +72,24 @@
      * Line separator string.  This is the value of the line.separator
      * property at the moment that the stream was created.
      */
-    private String lineSeparator;
+    private final String lineSeparator;
+
+    /**
+     * Returns a charset object for the given charset name.
+     * @throws NullPointerException          is csn is null
+     * @throws UnsupportedEncodingException  if the charset is not supported
+     */
+    private static Charset toCharset(String csn)
+        throws UnsupportedEncodingException
+    {
+        Objects.nonNull(csn, "charsetName");
+        try {
+            return Charset.forName(csn);
+        } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
+            // UnsupportedEncodingException should be thrown
+            throw new UnsupportedEncodingException(csn);
+        }
+    }
 
     /**
      * Creates a new PrintWriter, without automatic line flushing.
@@ -164,6 +185,14 @@
              false);
     }
 
+    /* Private constructor */
+    private PrintWriter(Charset charset, File file)
+        throws FileNotFoundException
+    {
+        this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)),
+             false);
+    }
+
     /**
      * Creates a new PrintWriter, without automatic line flushing, with the
      * specified file name and charset.  This convenience constructor creates
@@ -200,8 +229,7 @@
     public PrintWriter(String fileName, String csn)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), csn)),
-             false);
+        this(toCharset(csn), new File(fileName));
     }
 
     /**
@@ -272,8 +300,7 @@
     public PrintWriter(File file, String csn)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), csn)),
-             false);
+        this(toCharset(csn), file);
     }
 
     /** Checks to make sure that the stream has not been closed */
--- a/jdk/src/share/classes/java/lang/AutoCloseable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/lang/AutoCloseable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -33,7 +33,7 @@
  */
 public interface AutoCloseable {
     /**
-     * Close this resource, relinquishing any underlying resources.
+     * Closes this resource, relinquishing any underlying resources.
      * This method is invoked automatically by the {@code
      * try}-with-resources statement.
      *
@@ -48,6 +48,10 @@
      * visible side effect, unlike {@code Closeable.close} which is
      * required to have no effect if called more than once.
      *
+     * However, while not required to be idempotent, implementers of
+     * this interface are strongly encouraged to make their {@code
+     * close} methods idempotent.
+     *
      * @throws Exception if this resource cannot be closed
      */
     void close() throws Exception;
--- a/jdk/src/share/classes/java/lang/StringCoding.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/lang/StringCoding.java	Fri Feb 04 16:29:41 2011 -0800
@@ -67,7 +67,7 @@
     }
 
     private static <T> void set(ThreadLocal<SoftReference<T>> tl, T ob) {
-        tl.set(new SoftReference<>(ob));
+        tl.set(new SoftReference<T>(ob));
     }
 
     // Trim the given byte array to the given length
--- a/jdk/src/share/classes/java/lang/Throwable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -809,7 +809,7 @@
     native StackTraceElement getStackTraceElement(int index);
 
     /**
-     * Read a {@code Throwable} from a stream, enforcing
+     * Reads a {@code Throwable} from a stream, enforcing
      * well-formedness constraints on fields.  Null entries and
      * self-pointers are not allowed in the list of {@code
      * suppressedExceptions}.  Null entries are not allowed for stack
@@ -865,9 +865,10 @@
     }
 
     /**
-     * Adds the specified exception to the list of exceptions that
-     * were suppressed, typically by the {@code try}-with-resources
-     * statement, in order to deliver this exception.
+     * Appends the specified exception to the exceptions that were
+     * suppressed in order to deliver this exception. This method is
+     * typically called (automatically and implicitly) by the {@code
+     * try}-with-resources statement.
      *
      * If the first exception to be suppressed is {@code null}, that
      * indicates suppressed exception information will <em>not</em> be
--- a/jdk/src/share/classes/java/net/InetAddress.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/net/InetAddress.java	Fri Feb 04 16:29:41 2011 -0800
@@ -677,8 +677,7 @@
 
     static InetAddressImpl  impl;
 
-    private static HashMap<String, InetAddress[]> lookupTable
-        = new HashMap<String, InetAddress[]>();
+    private static final HashMap<String, Void> lookupTable = new HashMap<>();
 
     /**
      * Represents a cache entry
@@ -737,7 +736,7 @@
 
                 // As we iterate in insertion order we can
                 // terminate when a non-expired entry is found.
-                LinkedList<String> expired = new LinkedList<String>();
+                LinkedList<String> expired = new LinkedList<>();
                 long now = System.currentTimeMillis();
                 for (String key : cache.keySet()) {
                     CacheEntry entry = cache.get(key);
@@ -1227,43 +1226,45 @@
         //         lookupTable and return null so the
         //         following code would do  a lookup itself.
         if ((addresses = checkLookupTable(host)) == null) {
-            // This is the first thread which looks up the addresses
-            // this host or the cache entry for this host has been
-            // expired so this thread should do the lookup.
-            for (NameService nameService : nameServices) {
-                try {
-                    /*
-                     * Do not put the call to lookup() inside the
-                     * constructor.  if you do you will still be
-                     * allocating space when the lookup fails.
-                     */
+            try {
+                // This is the first thread which looks up the addresses
+                // this host or the cache entry for this host has been
+                // expired so this thread should do the lookup.
+                for (NameService nameService : nameServices) {
+                    try {
+                        /*
+                         * Do not put the call to lookup() inside the
+                         * constructor.  if you do you will still be
+                         * allocating space when the lookup fails.
+                         */
 
-                    addresses = nameService.lookupAllHostAddr(host);
-                    success = true;
-                    break;
-                } catch (UnknownHostException uhe) {
-                    if (host.equalsIgnoreCase("localhost")) {
-                        InetAddress[] local = new InetAddress[] { impl.loopbackAddress() };
-                        addresses = local;
+                        addresses = nameService.lookupAllHostAddr(host);
                         success = true;
                         break;
-                    }
-                    else {
-                        addresses = unknown_array;
-                        success = false;
-                        ex = uhe;
+                    } catch (UnknownHostException uhe) {
+                        if (host.equalsIgnoreCase("localhost")) {
+                            InetAddress[] local = new InetAddress[] { impl.loopbackAddress() };
+                            addresses = local;
+                            success = true;
+                            break;
+                        }
+                        else {
+                            addresses = unknown_array;
+                            success = false;
+                            ex = uhe;
+                        }
                     }
                 }
+
+                // Cache the addresses.
+                cacheAddresses(host, addresses, success);
+                if (!success && ex != null)
+                    throw ex;
+            } finally {
+                // Delete host from the lookupTable and notify
+                // all threads waiting on the lookupTable monitor.
+                updateLookupTable(host);
             }
-
-            // Cache the addresses.
-            cacheAddresses(host, addresses, success);
-            // Delete the host from the lookupTable, and
-            // notify all threads waiting for the monitor
-            // for lookupTable.
-            updateLookupTable(host);
-            if (!success && ex != null)
-                throw ex;
         }
 
         return addresses;
@@ -1271,16 +1272,13 @@
 
 
     private static InetAddress[] checkLookupTable(String host) {
-        // make sure addresses is null.
-        InetAddress[] addresses = null;
-
         synchronized (lookupTable) {
             // If the host isn't in the lookupTable, add it in the
             // lookuptable and return null. The caller should do
             // the lookup.
             if (lookupTable.containsKey(host) == false) {
                 lookupTable.put(host, null);
-                return addresses;
+                return null;
             }
 
             // If the host is in the lookupTable, it means that another
@@ -1298,10 +1296,11 @@
         // the host. This thread should retry to get the addresses
         // from the addressCache. If it doesn't get the addresses from
         // the cache, it will try to look up the addresses itself.
-        addresses = getCachedAddresses(host);
+        InetAddress[] addresses = getCachedAddresses(host);
         if (addresses == null) {
             synchronized (lookupTable) {
                 lookupTable.put(host, null);
+                return null;
             }
         }
 
--- a/jdk/src/share/classes/java/net/NetworkInterface.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/net/NetworkInterface.java	Fri Feb 04 16:29:41 2011 -0800
@@ -493,55 +493,44 @@
      * @see     java.net.InetAddress#getAddress()
      */
     public boolean equals(Object obj) {
-        if ((obj == null) || !(obj instanceof NetworkInterface)) {
+        if (!(obj instanceof NetworkInterface)) {
             return false;
         }
-        NetworkInterface netIF = (NetworkInterface)obj;
-        if (name != null ) {
-            if (netIF.getName() != null) {
-                if (!name.equals(netIF.getName())) {
-                    return false;
-                }
-            } else {
-                return false;
-            }
-        } else {
-            if (netIF.getName() != null) {
-                return false;
-            }
-        }
-        Enumeration newAddrs = netIF.getInetAddresses();
-        int i = 0;
-        for (i = 0; newAddrs.hasMoreElements();newAddrs.nextElement(), i++);
-        if (addrs == null) {
-            if (i != 0) {
+        NetworkInterface that = (NetworkInterface)obj;
+        if (this.name != null ) {
+            if (!this.name.equals(that.name)) {
                 return false;
             }
         } else {
-            /*
-             * Compare number of addresses (in the checked subset)
-             */
-            int count = 0;
-            Enumeration e = getInetAddresses();
-            for (; e.hasMoreElements(); count++) {
-                e.nextElement();
-            }
-            if (i != count) {
+            if (that.name != null) {
                 return false;
             }
         }
-        newAddrs = netIF.getInetAddresses();
-        for (; newAddrs.hasMoreElements();) {
-            boolean equal = false;
-            Enumeration thisAddrs = getInetAddresses();
-            InetAddress newAddr = (InetAddress)newAddrs.nextElement();
-            for (; thisAddrs.hasMoreElements();) {
-                InetAddress thisAddr = (InetAddress)thisAddrs.nextElement();
-                if (thisAddr.equals(newAddr)) {
-                    equal = true;
+
+        if (this.addrs == null) {
+            return that.addrs == null;
+        } else if (that.addrs == null) {
+            return false;
+        }
+
+        /* Both addrs not null. Compare number of addresses */
+
+        if (this.addrs.length != that.addrs.length) {
+            return false;
+        }
+
+        InetAddress[] thatAddrs = that.addrs;
+        int count = thatAddrs.length;
+
+        for (int i=0; i<count; i++) {
+            boolean found = false;
+            for (int j=0; j<count; j++) {
+                if (addrs[i].equals(thatAddrs[j])) {
+                    found = true;
+                    break;
                 }
             }
-            if (!equal) {
+            if (!found) {
                 return false;
             }
         }
@@ -549,12 +538,7 @@
     }
 
     public int hashCode() {
-        int count = name == null? 0: name.hashCode();
-        Enumeration<InetAddress> addrs = getInetAddresses();
-        while (addrs.hasMoreElements()) {
-            count += addrs.nextElement().hashCode();
-        }
-        return count;
+        return name == null? 0: name.hashCode();
     }
 
     public String toString() {
--- a/jdk/src/share/classes/java/net/SocksSocketImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -29,6 +29,7 @@
 import java.io.BufferedOutputStream;
 import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
+import sun.net.SocksProxy;
 import sun.net.www.ParseUtil;
 /* import org.ietf.jgss.*; */
 
@@ -397,6 +398,11 @@
                 // Use getHostString() to avoid reverse lookups
                 server = ((InetSocketAddress) p.address()).getHostString();
                 serverPort = ((InetSocketAddress) p.address()).getPort();
+                if (p instanceof SocksProxy) {
+                    if (((SocksProxy)p).protocolVersion() == 4) {
+                        useV4 = true;
+                    }
+                }
 
                 // Connects to the SOCKS server
                 try {
@@ -700,6 +706,11 @@
                 // Use getHostString() to avoid reverse lookups
                 server = ((InetSocketAddress) p.address()).getHostString();
                 serverPort = ((InetSocketAddress) p.address()).getPort();
+                if (p instanceof SocksProxy) {
+                    if (((SocksProxy)p).protocolVersion() == 4) {
+                        useV4 = true;
+                    }
+                }
 
                 // Connects to the SOCKS server
                 try {
--- a/jdk/src/share/classes/java/net/URLClassLoader.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/net/URLClassLoader.java	Fri Feb 04 16:29:41 2011 -0800
@@ -27,19 +27,15 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.io.File;
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Closeable;
+import java.lang.ref.*;
+import java.io.*;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandlerFactory;
 import java.util.Enumeration;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.StringTokenizer;
+import java.util.*;
 import java.util.jar.Manifest;
+import java.util.jar.JarFile;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
 import java.security.CodeSigner;
@@ -194,6 +190,65 @@
         acc = AccessController.getContext();
     }
 
+    /* A map (used as a set) to keep track of closeable local resources
+     * (either JarFiles or FileInputStreams). We don't care about
+     * Http resources since they don't need to be closed.
+     *
+     * If the resource is coming from a jar file
+     * we keep a (weak) reference to the JarFile object which can
+     * be closed if URLClassLoader.close() called. Due to jar file
+     * caching there will typically be only one JarFile object
+     * per underlying jar file.
+     *
+     * For file resources, which is probably a less common situation
+     * we have to keep a weak reference to each stream.
+     */
+
+    private WeakHashMap<Closeable,Void>
+        closeables = new WeakHashMap<>();
+
+    /**
+     * Returns an input stream for reading the specified resource.
+     * If this loader is closed, then any resources opened by this method
+     * will be closed.
+     *
+     * <p> The search order is described in the documentation for {@link
+     * #getResource(String)}.  </p>
+     *
+     * @param  name
+     *         The resource name
+     *
+     * @return  An input stream for reading the resource, or <tt>null</tt>
+     *          if the resource could not be found
+     *
+     * @since  1.7
+     */
+    public InputStream getResourceAsStream(String name) {
+        URL url = getResource(name);
+        try {
+            if (url == null) {
+                return null;
+            }
+            URLConnection urlc = url.openConnection();
+            InputStream is = urlc.getInputStream();
+            if (urlc instanceof JarURLConnection) {
+                JarURLConnection juc = (JarURLConnection)urlc;
+                JarFile jar = juc.getJarFile();
+                synchronized (closeables) {
+                    if (!closeables.containsKey(jar)) {
+                        closeables.put(jar, null);
+                    }
+                }
+            } else if (urlc instanceof sun.net.www.protocol.file.FileURLConnection) {
+                synchronized (closeables) {
+                    closeables.put(is, null);
+                }
+            }
+            return is;
+        } catch (IOException e) {
+            return null;
+        }
+    }
 
    /**
     * Closes this URLClassLoader, so that it can no longer be used to load
@@ -202,8 +257,8 @@
     * delegation hierarchy are still accessible. Also, any classes or resources
     * that are already loaded, are still accessible.
     * <p>
-    * In the case of jar: and file: URLs, it also closes any class files,
-    * or JAR files that were opened by it. If another thread is loading a
+    * In the case of jar: and file: URLs, it also closes any files
+    * that were opened by it. If another thread is loading a
     * class when the {@code close} method is invoked, then the result of
     * that load is undefined.
     * <p>
@@ -213,10 +268,10 @@
     * loader has no effect.
     * <p>
     * @throws IOException if closing any file opened by this class loader
-    * resulted in an IOException. Any such exceptions are caught, and a
-    * single IOException is thrown after the last file has been closed.
-    * If only one exception was thrown, it will be set as the <i>cause</i>
-    * of this IOException.
+    * resulted in an IOException. Any such exceptions are caught internally.
+    * If only one is caught, then it is re-thrown. If more than one exception
+    * is caught, then the second and following exceptions are added
+    * as suppressed exceptions of the first one caught, which is then re-thrown.
     *
     * @throws SecurityException if a security manager is set, and it denies
     *   {@link RuntimePermission}<tt>("closeClassLoader")</tt>
@@ -229,21 +284,33 @@
             security.checkPermission(new RuntimePermission("closeClassLoader"));
         }
         List<IOException> errors = ucp.closeLoaders();
+
+        // now close any remaining streams.
+
+        synchronized (closeables) {
+            Set<Closeable> keys = closeables.keySet();
+            for (Closeable c : keys) {
+                try {
+                    c.close();
+                } catch (IOException ioex) {
+                    errors.add(ioex);
+                }
+            }
+            closeables.clear();
+        }
+
         if (errors.isEmpty()) {
             return;
         }
-        if (errors.size() == 1) {
-            throw new IOException (
-                "Error closing URLClassLoader resource",
-                errors.get(0)
-            );
+
+        IOException firstex = errors.remove(0);
+
+        // Suppress any remaining exceptions
+
+        for (IOException error: errors) {
+            firstex.addSuppressed(error);
         }
-        // Several exceptions. So, just combine the error messages
-        String errormsg = "Error closing resources: ";
-        for (IOException error: errors) {
-            errormsg = errormsg + "[" + error.toString() + "] ";
-        }
-        throw new IOException (errormsg);
+        throw firstex;
     }
 
     /**
--- a/jdk/src/share/classes/java/net/doc-files/net-properties.html	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/net/doc-files/net-properties.html	Fri Feb 04 16:29:41 2011 -0800
@@ -127,10 +127,15 @@
 	are specified. If SOCKS is supported by a Java SE implementation, the
 	following properties will be used:</P>
 	<UL>
-		<LI><P><B>socksProxyHost</B> (default: &lt;non&gt;)<BR>
+		<LI><P><B>socksProxyHost</B> (default: &lt;none&gt;)<BR>
 	        The hostname, or address, of the proxy server.</P>
 		<LI><P><B>socksProxyPort</B> (default: 1080)<BR>
 	        The port number of the proxy server.</P>
+                <LI><P><B>socksProxyVersion</B> (default: 5)<BR>
+                The version of the SOCKS protocol supported by the server. The
+                default is <code>5</code> indicating SOCKS V5, alternatively
+                <code>4</code> can be specified for SOCKS V4. Setting the property
+                to values other than these leads to unspecified behavior.</P>
 		<LI><P><B>java.net.socks.username</B> (default: &lt;none&gt;)<BR>
 	        Username to use if the SOCKSv5 server asks for authentication
 	        and no java.net.Authenticator instance was found.</P>
--- a/jdk/src/share/classes/java/security/AccessControlContext.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/AccessControlContext.java	Fri Feb 04 16:29:41 2011 -0800
@@ -121,7 +121,7 @@
                 this.context = null;
             }
         } else {
-            List<ProtectionDomain> v = new ArrayList<ProtectionDomain>(context.length);
+            List<ProtectionDomain> v = new ArrayList<>(context.length);
             for (int i =0; i< context.length; i++) {
                 if ((context[i] != null) &&  (!v.contains(context[i])))
                     v.add(context[i]);
--- a/jdk/src/share/classes/java/security/BasicPermission.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/BasicPermission.java	Fri Feb 04 16:29:41 2011 -0800
@@ -515,7 +515,7 @@
 
         // Copy perms into a Hashtable
         Hashtable<String, Permission> permissions =
-                new Hashtable<String, Permission>(perms.size()*2);
+                new Hashtable<>(perms.size()*2);
 
         synchronized (this) {
             permissions.putAll(perms);
--- a/jdk/src/share/classes/java/security/CodeSource.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/CodeSource.java	Fri Feb 04 16:29:41 2011 -0800
@@ -188,7 +188,7 @@
         } else if (signers != null) {
             // Convert the code signers to certs
             ArrayList<java.security.cert.Certificate> certChains =
-                        new ArrayList<java.security.cert.Certificate>();
+                        new ArrayList<>();
             for (int i = 0; i < signers.length; i++) {
                 certChains.addAll(
                     signers[i].getSignerCertPath().getCertificates());
@@ -606,10 +606,10 @@
 
             // Iterate through all the certificates
             int i = 0;
-            List<CodeSigner> signers = new ArrayList<CodeSigner>();
+            List<CodeSigner> signers = new ArrayList<>();
             while (i < certs.length) {
                 List<java.security.cert.Certificate> certChain =
-                        new ArrayList<java.security.cert.Certificate>();
+                        new ArrayList<>();
                 certChain.add(certs[i++]); // first cert is an end-entity cert
                 int j = i;
 
--- a/jdk/src/share/classes/java/security/Permissions.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/Permissions.java	Fri Feb 04 16:29:41 2011 -0800
@@ -362,7 +362,7 @@
 
         // Copy perms into a Hashtable
         Hashtable<Class<?>, PermissionCollection> perms =
-            new Hashtable<Class<?>, PermissionCollection>(permsMap.size()*2); // no sync; estimate
+            new Hashtable<>(permsMap.size()*2); // no sync; estimate
         synchronized (this) {
             perms.putAll(permsMap);
         }
@@ -567,7 +567,7 @@
 
         // Copy perms into a Hashtable
         Hashtable<Permission, Permission> perms =
-                new Hashtable<Permission, Permission>(permsMap.size()*2);
+                new Hashtable<>(permsMap.size()*2);
         synchronized (this) {
             perms.putAll(permsMap);
         }
--- a/jdk/src/share/classes/java/security/ProtectionDomain.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/ProtectionDomain.java	Fri Feb 04 16:29:41 2011 -0800
@@ -336,8 +336,8 @@
         int swag = 32;
         int vcap = 8;
         Enumeration<Permission> e;
-        List<Permission> pdVector = new ArrayList<Permission>(vcap);
-        List<Permission> plVector = new ArrayList<Permission>(swag);
+        List<Permission> pdVector = new ArrayList<>(vcap);
+        List<Permission> plVector = new ArrayList<>(swag);
 
         //
         // Build a vector of domain permissions for subsequent merge
--- a/jdk/src/share/classes/java/security/Provider.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/Provider.java	Fri Feb 04 16:29:41 2011 -0800
@@ -437,7 +437,7 @@
 
     private void readObject(ObjectInputStream in)
                 throws IOException, ClassNotFoundException {
-        Map<Object,Object> copy = new HashMap<Object,Object>();
+        Map<Object,Object> copy = new HashMap<>();
         for (Map.Entry<Object,Object> entry : super.entrySet()) {
             copy.put(entry.getKey(), entry.getValue());
         }
@@ -719,7 +719,7 @@
         }
         if (serviceSet == null) {
             ensureLegacyParsed();
-            Set<Service> set = new LinkedHashSet<Service>();
+            Set<Service> set = new LinkedHashSet<>();
             if (serviceMap != null) {
                 set.addAll(serviceMap.values());
             }
@@ -1395,7 +1395,7 @@
                     if (s != null) {
                         String[] classNames = s.split("\\|");
                         List<Class> classList =
-                            new ArrayList<Class>(classNames.length);
+                            new ArrayList<>(classNames.length);
                         for (String className : classNames) {
                             Class clazz = getKeyClass(className);
                             if (clazz != null) {
--- a/jdk/src/share/classes/java/security/SecureClassLoader.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/SecureClassLoader.java	Fri Feb 04 16:29:41 2011 -0800
@@ -50,7 +50,7 @@
     // HashMap that maps CodeSource to ProtectionDomain
     // @GuardedBy("pdcache")
     private final HashMap<CodeSource, ProtectionDomain> pdcache =
-                        new HashMap<CodeSource, ProtectionDomain>(11);
+                        new HashMap<>(11);
 
     private static final Debug debug = Debug.getInstance("scl");
 
--- a/jdk/src/share/classes/java/security/Security.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/Security.java	Fri Feb 04 16:29:41 2011 -0800
@@ -545,8 +545,7 @@
             value = filter.substring(index + 1);
         }
 
-        Hashtable<String, String> hashtableFilter =
-                new Hashtable<String, String>(1);
+        Hashtable<String, String> hashtableFilter = new Hashtable<>(1);
         hashtableFilter.put(key, value);
 
         return (getProviders(hashtableFilter));
@@ -606,7 +605,7 @@
         // Then only return those providers who satisfy the selection criteria.
         Provider[] allProviders = Security.getProviders();
         Set<String> keySet = filter.keySet();
-        LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5);
+        LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
 
         // Returns all installed providers
         // if the selection criteria is null.
@@ -660,8 +659,7 @@
     }
 
     // Map containing cached Spi Class objects of the specified type
-    private static final Map<String,Class> spiMap =
-                                new ConcurrentHashMap<String,Class>();
+    private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
 
     /**
      * Return the Class object for the given engine type
@@ -885,7 +883,7 @@
                                                 String attrName,
                                                 String filterValue,
                                                 Provider[] allProviders) {
-        LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5);
+        LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
         for (int i = 0; i < allProviders.length; i++) {
             if (isCriterionSatisfied(allProviders[i], serviceName,
                                      algName,
@@ -1082,7 +1080,7 @@
             return Collections.EMPTY_SET;
         }
 
-        HashSet<String> result = new HashSet<String>();
+        HashSet<String> result = new HashSet<>();
         Provider[] providers = Security.getProviders();
 
         for (int i = 0; i < providers.length; i++) {
--- a/jdk/src/share/classes/java/security/UnresolvedPermission.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/UnresolvedPermission.java	Fri Feb 04 16:29:41 2011 -0800
@@ -198,7 +198,7 @@
                 if (this.certs == null) {
                     // extract the signer certs
                     ArrayList<java.security.cert.Certificate> signerCerts =
-                        new ArrayList<java.security.cert.Certificate>();
+                        new ArrayList<>();
                     i = 0;
                     while (i < certs.length) {
                         signerCerts.add(certs[i]);
--- a/jdk/src/share/classes/java/security/UnresolvedPermissionCollection.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/security/UnresolvedPermissionCollection.java	Fri Feb 04 16:29:41 2011 -0800
@@ -119,7 +119,7 @@
 
     public Enumeration<Permission> elements() {
         List<Permission> results =
-            new ArrayList<Permission>(); // where results are stored
+            new ArrayList<>(); // where results are stored
 
         // Get iterator of Map values (which are lists of permissions)
         synchronized (this) {
@@ -161,7 +161,7 @@
 
         // Copy perms into a Hashtable
         Hashtable<String, Vector<UnresolvedPermission>> permissions =
-            new Hashtable<String, Vector<UnresolvedPermission>>(perms.size()*2);
+            new Hashtable<>(perms.size()*2);
 
         // Convert each entry (List) into a Vector
         synchronized (this) {
@@ -169,8 +169,7 @@
             for (Map.Entry<String, List<UnresolvedPermission>> e : set) {
                 // Convert list into Vector
                 List<UnresolvedPermission> list = e.getValue();
-                Vector<UnresolvedPermission> vec =
-                        new Vector<UnresolvedPermission>(list.size());
+                Vector<UnresolvedPermission> vec = new Vector<>(list.size());
                 synchronized (list) {
                     vec.addAll(list);
                 }
@@ -207,8 +206,7 @@
         for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) {
             // Convert Vector into ArrayList
             Vector<UnresolvedPermission> vec = e.getValue();
-            List<UnresolvedPermission> list =
-                        new ArrayList<UnresolvedPermission>(vec.size());
+            List<UnresolvedPermission> list = new ArrayList<>(vec.size());
             list.addAll(vec);
 
             // Add to Hashtable being serialized
--- a/jdk/src/share/classes/java/sql/Timestamp.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/sql/Timestamp.java	Fri Feb 04 16:29:41 2011 -0800
@@ -473,7 +473,9 @@
      * @since   1.4
      */
     public int compareTo(Timestamp ts) {
-        int i = super.compareTo(ts);
+        long thisTime = this.getTime();
+        long anotherTime = ts.getTime();
+        int i = (thisTime<anotherTime ? -1 :(thisTime==anotherTime?0 :1));
         if (i == 0) {
             if (nanos > ts.nanos) {
                     return 1;
--- a/jdk/src/share/classes/java/util/Collections.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/Collections.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1452,10 +1452,10 @@
              * when o is a Map.Entry, and calls o.setValue.
              */
             public boolean containsAll(Collection<?> coll) {
-                Iterator<?> it = coll.iterator();
-                while (it.hasNext())
-                    if (!contains(it.next())) // Invokes safe contains() above
+                for (Object e : coll) {
+                    if (!contains(e)) // Invokes safe contains() above
                         return false;
+                }
                 return true;
             }
             public boolean equals(Object o) {
@@ -3713,45 +3713,91 @@
     }
 
     /**
-     * Returns <tt>true</tt> if the two specified collections have no
+     * Returns {@code true} if the two specified collections have no
      * elements in common.
      *
      * <p>Care must be exercised if this method is used on collections that
-     * do not comply with the general contract for <tt>Collection</tt>.
+     * do not comply with the general contract for {@code Collection}.
      * Implementations may elect to iterate over either collection and test
      * for containment in the other collection (or to perform any equivalent
      * computation).  If either collection uses a nonstandard equality test
-     * (as does a {@link SortedSet} whose ordering is not <i>compatible with
-     * equals</i>, or the key set of an {@link IdentityHashMap}), both
+     * (as does a {@link SortedSet} whose ordering is not <em>compatible with
+     * equals</em>, or the key set of an {@link IdentityHashMap}), both
      * collections must use the same nonstandard equality test, or the
      * result of this method is undefined.
      *
+     * <p>Care must also be exercised when using collections that have
+     * restrictions on the elements that they may contain. Collection
+     * implementations are allowed to throw exceptions for any operation
+     * involving elements they deem ineligible. For absolute safety the
+     * specified collections should contain only elements which are
+     * eligible elements for both collections.
+     *
      * <p>Note that it is permissible to pass the same collection in both
-     * parameters, in which case the method will return true if and only if
-     * the collection is empty.
+     * parameters, in which case the method will return {@code true} if and
+     * only if the collection is empty.
      *
      * @param c1 a collection
      * @param c2 a collection
-     * @throws NullPointerException if either collection is null
+     * @return {@code true} if the two specified collections have no
+     * elements in common.
+     * @throws NullPointerException if either collection is {@code null}.
+     * @throws NullPointerException if one collection contains a {@code null}
+     * element and {@code null} is not an eligible element for the other collection.
+     * (optional)
+     * @throws ClassCastException if one collection contains an element that is
+     * of a type which is ineligible for the other collection. (optional)
      * @since 1.5
      */
     public static boolean disjoint(Collection<?> c1, Collection<?> c2) {
-        /*
-         * We're going to iterate through c1 and test for inclusion in c2.
-         * If c1 is a Set and c2 isn't, swap the collections.  Otherwise,
-         * place the shorter collection in c1.  Hopefully this heuristic
-         * will minimize the cost of the operation.
-         */
-        if ((c1 instanceof Set) && !(c2 instanceof Set) ||
-            (c1.size() > c2.size())) {
-            Collection<?> tmp = c1;
-            c1 = c2;
-            c2 = tmp;
+        // The collection to be used for contains(). Preference is given to
+        // the collection who's contains() has lower O() complexity.
+        Collection<?> contains = c2;
+        // The collection to be iterated. If the collections' contains() impl
+        // are of different O() complexity, the collection with slower
+        // contains() will be used for iteration. For collections who's
+        // contains() are of the same complexity then best performance is
+        // achieved by iterating the smaller collection.
+        Collection<?> iterate = c1;
+
+        // Performance optimization cases. The heuristics:
+        //   1. Generally iterate over c1.
+        //   2. If c1 is a Set then iterate over c2.
+        //   3. If either collection is empty then result is always true.
+        //   4. Iterate over the smaller Collection.
+        if (c1 instanceof Set) {
+            // Use c1 for contains as a Set's contains() is expected to perform
+            // better than O(N/2)
+            iterate = c2;
+            contains = c1;
+        } else if (!(c2 instanceof Set)) {
+            // Both are mere Collections. Iterate over smaller collection.
+            // Example: If c1 contains 3 elements and c2 contains 50 elements and
+            // assuming contains() requires ceiling(N/2) comparisons then
+            // checking for all c1 elements in c2 would require 75 comparisons
+            // (3 * ceiling(50/2)) vs. checking all c2 elements in c1 requiring
+            // 100 comparisons (50 * ceiling(3/2)).
+            int c1size = c1.size();
+            int c2size = c2.size();
+            if (c1size == 0 || c2size == 0) {
+                // At least one collection is empty. Nothing will match.
+                return true;
+            }
+
+            if (c1size > c2size) {
+                iterate = c2;
+                contains = c1;
+            }
         }
 
-        for (Object e : c1)
-            if (c2.contains(e))
+        for (Object e : iterate) {
+            if (contains.contains(e)) {
+               // Found a common element. Collections are not disjoint.
                 return false;
+            }
+        }
+
+        // No common elements were found.
         return true;
     }
 
--- a/jdk/src/share/classes/java/util/Formatter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/Formatter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -41,6 +41,8 @@
 import java.math.MathContext;
 import java.math.RoundingMode;
 import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
 import java.text.DateFormatSymbols;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
@@ -1838,22 +1840,53 @@
  */
 public final class Formatter implements Closeable, Flushable {
     private Appendable a;
-    private Locale l;
+    private final Locale l;
 
     private IOException lastException;
 
-    private char zero = '0';
+    private final char zero;
     private static double scaleUp;
 
     // 1 (sign) + 19 (max # sig digits) + 1 ('.') + 1 ('e') + 1 (sign)
     // + 3 (max # exp digits) + 4 (error) = 30
     private static final int MAX_FD_CHARS = 30;
 
-    // Initialize internal data.
-    private void init(Appendable a, Locale l) {
+    /**
+     * Returns a charset object for the given charset name.
+     * @throws NullPointerException          is csn is null
+     * @throws UnsupportedEncodingException  if the charset is not supported
+     */
+    private static Charset toCharset(String csn)
+        throws UnsupportedEncodingException
+    {
+        Objects.nonNull(csn, "charsetName");
+        try {
+            return Charset.forName(csn);
+        } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
+            // UnsupportedEncodingException should be thrown
+            throw new UnsupportedEncodingException(csn);
+        }
+    }
+
+    private static final Appendable nonNullAppendable(Appendable a) {
+        if (a == null)
+            return new StringBuilder();
+
+        return a;
+    }
+
+    /* Private constructors */
+    private Formatter(Locale l, Appendable a) {
         this.a = a;
         this.l = l;
-        setZero();
+        this.zero = getZero(l);
+    }
+
+    private Formatter(Charset charset, Locale l, File file)
+        throws FileNotFoundException
+    {
+        this(l,
+             new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)));
     }
 
     /**
@@ -1867,7 +1900,7 @@
      * virtual machine.
      */
     public Formatter() {
-        init(new StringBuilder(), Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT), new StringBuilder());
     }
 
     /**
@@ -1881,9 +1914,7 @@
      *         {@code null} then a {@link StringBuilder} will be created.
      */
     public Formatter(Appendable a) {
-        if (a == null)
-            a = new StringBuilder();
-        init(a, Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT), nonNullAppendable(a));
     }
 
     /**
@@ -1900,7 +1931,7 @@
      *         is applied.
      */
     public Formatter(Locale l) {
-        init(new StringBuilder(), l);
+        this(l, new StringBuilder());
     }
 
     /**
@@ -1916,9 +1947,7 @@
      *         is applied.
      */
     public Formatter(Appendable a, Locale l) {
-        if (a == null)
-            a = new StringBuilder();
-        init(a, l);
+        this(l, nonNullAppendable(a));
     }
 
     /**
@@ -1949,8 +1978,8 @@
      *          creating the file
      */
     public Formatter(String fileName) throws FileNotFoundException {
-        init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName))),
-             Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT),
+             new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName))));
     }
 
     /**
@@ -2025,8 +2054,7 @@
     public Formatter(String fileName, String csn, Locale l)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), csn)),
-             l);
+        this(toCharset(csn), l, new File(fileName));
     }
 
     /**
@@ -2057,8 +2085,8 @@
      *          creating the file
      */
     public Formatter(File file) throws FileNotFoundException {
-        init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))),
-             Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT),
+             new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))));
     }
 
     /**
@@ -2133,8 +2161,7 @@
     public Formatter(File file, String csn, Locale l)
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), csn)),
-             l);
+        this(toCharset(csn), l, file);
     }
 
     /**
@@ -2151,9 +2178,8 @@
      *         The stream to use as the destination of this formatter.
      */
     public Formatter(PrintStream ps) {
-        if (ps == null)
-            throw new NullPointerException();
-        init((Appendable)ps, Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT),
+             (Appendable)Objects.nonNull(ps));
     }
 
     /**
@@ -2171,8 +2197,8 @@
      *         The output will be buffered.
      */
     public Formatter(OutputStream os) {
-        init(new BufferedWriter(new OutputStreamWriter(os)),
-             Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault(Locale.Category.FORMAT),
+             new BufferedWriter(new OutputStreamWriter(os)));
     }
 
     /**
@@ -2222,13 +2248,15 @@
     public Formatter(OutputStream os, String csn, Locale l)
         throws UnsupportedEncodingException
     {
-        init(new BufferedWriter(new OutputStreamWriter(os, csn)), l);
+        this(l, new BufferedWriter(new OutputStreamWriter(os, csn)));
     }
 
-    private void setZero() {
+    private static char getZero(Locale l) {
         if ((l != null) && !l.equals(Locale.US)) {
             DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
-            zero = dfs.getZeroDigit();
+            return dfs.getZeroDigit();
+        } else {
+            return '0';
         }
     }
 
--- a/jdk/src/share/classes/java/util/LinkedList.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Fri Feb 04 16:29:41 2011 -0800
@@ -26,9 +26,9 @@
 package java.util;
 
 /**
- * Linked list implementation of the {@link List} and {@link Deque} interfaces.
- * Implements all optional operations, and permits all elements (including
- * {@code null}).
+ * Doubly-linked list implementation of the {@code List} and {@code Deque}
+ * interfaces.  Implements all optional list operations, and permits all
+ * elements (including {@code null}).
  *
  * <p>All of the operations perform as could be expected for a doubly-linked
  * list.  Operations that index into the list will traverse the list from
@@ -249,7 +249,7 @@
      * @return the last element in this list
      * @throws NoSuchElementException if this list is empty
      */
-    public E getLast()  {
+    public E getLast() {
         final Node<E> l = last;
         if (l == null)
             throw new NoSuchElementException();
--- a/jdk/src/share/classes/java/util/Scanner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/Scanner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -571,10 +571,8 @@
      * @return A scanner with the specified source and pattern
      */
     private Scanner(Readable source, Pattern pattern) {
-        if (source == null)
-            throw new NullPointerException("source");
-        if (pattern == null)
-            throw new NullPointerException("pattern");
+        assert source != null : "source should not be null";
+        assert pattern != null : "pattern should not be null";
         this.source = source;
         delimPattern = pattern;
         buf = CharBuffer.allocate(BUFFER_SIZE);
@@ -593,7 +591,7 @@
      *         interface
      */
     public Scanner(Readable source) {
-        this(source, WHITESPACE_PATTERN);
+        this(Objects.nonNull(source, "source"), WHITESPACE_PATTERN);
     }
 
     /**
@@ -620,23 +618,27 @@
      *         does not exist
      */
     public Scanner(InputStream source, String charsetName) {
-        this(makeReadable(source, charsetName), WHITESPACE_PATTERN);
+        this(makeReadable(Objects.nonNull(source, "source"), toCharset(charsetName)),
+             WHITESPACE_PATTERN);
     }
 
-    private static Readable makeReadable(InputStream source,
-                                         String charsetName)
-    {
-        if (source == null)
-            throw new NullPointerException("source");
-        InputStreamReader isr = null;
+    /**
+     * Returns a charset object for the given charset name.
+     * @throws NullPointerException          is csn is null
+     * @throws IllegalArgumentException      if the charset is not supported
+     */
+    private static Charset toCharset(String csn) {
+        Objects.nonNull(csn, "charsetName");
         try {
-            isr = new InputStreamReader(source, charsetName);
-        } catch (UnsupportedEncodingException uee) {
-            IllegalArgumentException iae = new IllegalArgumentException();
-            iae.initCause(uee);
-            throw iae;
+            return Charset.forName(csn);
+        } catch (IllegalCharsetNameException|UnsupportedCharsetException e) {
+            // IllegalArgumentException should be thrown
+            throw new IllegalArgumentException(e);
         }
-        return isr;
+    }
+
+    private static Readable makeReadable(InputStream source, Charset charset) {
+        return new InputStreamReader(source, charset);
     }
 
     /**
@@ -648,9 +650,7 @@
      * @param  source A file to be scanned
      * @throws FileNotFoundException if source is not found
      */
-    public Scanner(File source)
-        throws FileNotFoundException
-    {
+    public Scanner(File source) throws FileNotFoundException {
         this((ReadableByteChannel)(new FileInputStream(source).getChannel()));
     }
 
@@ -669,8 +669,27 @@
     public Scanner(File source, String charsetName)
         throws FileNotFoundException
     {
-        this((ReadableByteChannel)(new FileInputStream(source).getChannel()),
-             charsetName);
+        this(Objects.nonNull(source), toDecoder(charsetName));
+    }
+
+    private Scanner(File source, CharsetDecoder dec)
+        throws FileNotFoundException
+    {
+        this(makeReadable((ReadableByteChannel)(new FileInputStream(source).getChannel()), dec));
+    }
+
+    private static CharsetDecoder toDecoder(String charsetName) {
+        Objects.nonNull(charsetName, "charsetName");
+        try {
+            return Charset.forName(charsetName).newDecoder();
+        } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
+            throw new IllegalArgumentException(charsetName);
+        }
+    }
+
+    private static Readable makeReadable(ReadableByteChannel source,
+                                         CharsetDecoder dec) {
+        return Channels.newReader(source, dec, -1);
     }
 
     /**
@@ -708,10 +727,12 @@
      *          if the specified encoding is not found
      * @since   1.7
      */
-    public Scanner(FileRef source, String charsetName)
-        throws IOException
-    {
-        this(source.newInputStream(), charsetName);
+    public Scanner(FileRef source, String charsetName) throws IOException {
+        this(Objects.nonNull(source), toCharset(charsetName));
+    }
+
+    private Scanner(FileRef source, Charset charset)  throws IOException {
+        this(makeReadable(source.newInputStream(), charset));
     }
 
     /**
@@ -733,16 +754,12 @@
      * @param  source A channel to scan
      */
     public Scanner(ReadableByteChannel source) {
-        this(makeReadable(source), WHITESPACE_PATTERN);
+        this(makeReadable(Objects.nonNull(source, "source")),
+             WHITESPACE_PATTERN);
     }
 
     private static Readable makeReadable(ReadableByteChannel source) {
-        if (source == null)
-            throw new NullPointerException("source");
-        String defaultCharsetName =
-            java.nio.charset.Charset.defaultCharset().name();
-        return Channels.newReader(source,
-                           java.nio.charset.Charset.defaultCharset().name());
+        return makeReadable(source, Charset.defaultCharset().newDecoder());
     }
 
     /**
@@ -757,17 +774,8 @@
      *         does not exist
      */
     public Scanner(ReadableByteChannel source, String charsetName) {
-        this(makeReadable(source, charsetName), WHITESPACE_PATTERN);
-    }
-
-    private static Readable makeReadable(ReadableByteChannel source,
-                                  String charsetName)
-    {
-        if (source == null)
-            throw new NullPointerException("source");
-        if (!Charset.isSupported(charsetName))
-            throw new IllegalArgumentException(charsetName);
-        return Channels.newReader(source, charsetName);
+        this(makeReadable(Objects.nonNull(source, "source"), toDecoder(charsetName)),
+             WHITESPACE_PATTERN);
     }
 
     // Private primitives used to support scanning
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -49,14 +49,14 @@
  * <p>This is a classic &quot;bounded buffer&quot;, in which a
  * fixed-sized array holds elements inserted by producers and
  * extracted by consumers.  Once created, the capacity cannot be
- * increased.  Attempts to <tt>put</tt> an element into a full queue
- * will result in the operation blocking; attempts to <tt>take</tt> an
+ * changed.  Attempts to {@code put} an element into a full queue
+ * will result in the operation blocking; attempts to {@code take} an
  * element from an empty queue will similarly block.
  *
- * <p> This class supports an optional fairness policy for ordering
+ * <p>This class supports an optional fairness policy for ordering
  * waiting producer and consumer threads.  By default, this ordering
  * is not guaranteed. However, a queue constructed with fairness set
- * to <tt>true</tt> grants threads access in FIFO order. Fairness
+ * to {@code true} grants threads access in FIFO order. Fairness
  * generally decreases throughput but reduces variability and avoids
  * starvation.
  *
@@ -83,14 +83,17 @@
      */
     private static final long serialVersionUID = -817911632652898426L;
 
-    /** The queued items  */
-    private final E[] items;
-    /** items index for next take, poll or remove */
-    private int takeIndex;
-    /** items index for next put, offer, or add. */
-    private int putIndex;
-    /** Number of items in the queue */
-    private int count;
+    /** The queued items */
+    final Object[] items;
+
+    /** items index for next take, poll, peek or remove */
+    int takeIndex;
+
+    /** items index for next put, offer, or add */
+    int putIndex;
+
+    /** Number of elements in the queue */
+    int count;
 
     /*
      * Concurrency control uses the classic two-condition algorithm
@@ -98,7 +101,7 @@
      */
 
     /** Main lock guarding all access */
-    private final ReentrantLock lock;
+    final ReentrantLock lock;
     /** Condition for waiting takes */
     private final Condition notEmpty;
     /** Condition for waiting puts */
@@ -110,7 +113,36 @@
      * Circularly increment i.
      */
     final int inc(int i) {
-        return (++i == items.length)? 0 : i;
+        return (++i == items.length) ? 0 : i;
+    }
+
+    /**
+     * Circularly decrement i.
+     */
+    final int dec(int i) {
+        return ((i == 0) ? items.length : i) - 1;
+    }
+
+    @SuppressWarnings("unchecked")
+    static <E> E cast(Object item) {
+        return (E) item;
+    }
+
+    /**
+     * Returns item at index i.
+     */
+    final E itemAt(int i) {
+        return this.<E>cast(items[i]);
+    }
+
+    /**
+     * Throws NullPointerException if argument is null.
+     *
+     * @param v the element
+     */
+    private static void checkNotNull(Object v) {
+        if (v == null)
+            throw new NullPointerException();
     }
 
     /**
@@ -129,8 +161,8 @@
      * Call only when holding lock.
      */
     private E extract() {
-        final E[] items = this.items;
-        E x = items[takeIndex];
+        final Object[] items = this.items;
+        E x = this.<E>cast(items[takeIndex]);
         items[takeIndex] = null;
         takeIndex = inc(takeIndex);
         --count;
@@ -139,11 +171,12 @@
     }
 
     /**
-     * Utility for remove and iterator.remove: Delete item at position i.
+     * Deletes item at position i.
+     * Utility for remove and iterator.remove.
      * Call only when holding lock.
      */
     void removeAt(int i) {
-        final E[] items = this.items;
+        final Object[] items = this.items;
         // if removing front item, just advance
         if (i == takeIndex) {
             items[takeIndex] = null;
@@ -167,69 +200,82 @@
     }
 
     /**
-     * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+     * Creates an {@code ArrayBlockingQueue} with the given (fixed)
      * capacity and default access policy.
      *
      * @param capacity the capacity of this queue
-     * @throws IllegalArgumentException if <tt>capacity</tt> is less than 1
+     * @throws IllegalArgumentException if {@code capacity < 1}
      */
     public ArrayBlockingQueue(int capacity) {
         this(capacity, false);
     }
 
     /**
-     * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+     * Creates an {@code ArrayBlockingQueue} with the given (fixed)
      * capacity and the specified access policy.
      *
      * @param capacity the capacity of this queue
-     * @param fair if <tt>true</tt> then queue accesses for threads blocked
+     * @param fair if {@code true} then queue accesses for threads blocked
      *        on insertion or removal, are processed in FIFO order;
-     *        if <tt>false</tt> the access order is unspecified.
-     * @throws IllegalArgumentException if <tt>capacity</tt> is less than 1
+     *        if {@code false} the access order is unspecified.
+     * @throws IllegalArgumentException if {@code capacity < 1}
      */
     public ArrayBlockingQueue(int capacity, boolean fair) {
         if (capacity <= 0)
             throw new IllegalArgumentException();
-        this.items = (E[]) new Object[capacity];
+        this.items = new Object[capacity];
         lock = new ReentrantLock(fair);
         notEmpty = lock.newCondition();
         notFull =  lock.newCondition();
     }
 
     /**
-     * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+     * Creates an {@code ArrayBlockingQueue} with the given (fixed)
      * capacity, the specified access policy and initially containing the
      * elements of the given collection,
      * added in traversal order of the collection's iterator.
      *
      * @param capacity the capacity of this queue
-     * @param fair if <tt>true</tt> then queue accesses for threads blocked
+     * @param fair if {@code true} then queue accesses for threads blocked
      *        on insertion or removal, are processed in FIFO order;
-     *        if <tt>false</tt> the access order is unspecified.
+     *        if {@code false} the access order is unspecified.
      * @param c the collection of elements to initially contain
-     * @throws IllegalArgumentException if <tt>capacity</tt> is less than
-     *         <tt>c.size()</tt>, or less than 1.
+     * @throws IllegalArgumentException if {@code capacity} is less than
+     *         {@code c.size()}, or less than 1.
      * @throws NullPointerException if the specified collection or any
      *         of its elements are null
      */
     public ArrayBlockingQueue(int capacity, boolean fair,
                               Collection<? extends E> c) {
         this(capacity, fair);
-        if (capacity < c.size())
-            throw new IllegalArgumentException();
 
-        for (E e : c)
-            add(e);
+        final ReentrantLock lock = this.lock;
+        lock.lock(); // Lock only for visibility, not mutual exclusion
+        try {
+            int i = 0;
+            try {
+                for (E e : c) {
+                    checkNotNull(e);
+                    items[i++] = e;
+                }
+            } catch (ArrayIndexOutOfBoundsException ex) {
+                throw new IllegalArgumentException();
+            }
+            count = i;
+            putIndex = (i == capacity) ? 0 : i;
+        } finally {
+            lock.unlock();
+        }
     }
 
     /**
      * Inserts the specified element at the tail of this queue if it is
      * possible to do so immediately without exceeding the queue's capacity,
-     * returning <tt>true</tt> upon success and throwing an
-     * <tt>IllegalStateException</tt> if this queue is full.
+     * returning {@code true} upon success and throwing an
+     * {@code IllegalStateException} if this queue is full.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Collection#add})
+     * @return {@code true} (as specified by {@link Collection#add})
      * @throws IllegalStateException if this queue is full
      * @throws NullPointerException if the specified element is null
      */
@@ -240,14 +286,14 @@
     /**
      * Inserts the specified element at the tail of this queue if it is
      * possible to do so immediately without exceeding the queue's capacity,
-     * returning <tt>true</tt> upon success and <tt>false</tt> if this queue
+     * returning {@code true} upon success and {@code false} if this queue
      * is full.  This method is generally preferable to method {@link #add},
      * which can fail to insert an element only by throwing an exception.
      *
      * @throws NullPointerException if the specified element is null
      */
     public boolean offer(E e) {
-        if (e == null) throw new NullPointerException();
+        checkNotNull(e);
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
@@ -270,18 +316,12 @@
      * @throws NullPointerException {@inheritDoc}
      */
     public void put(E e) throws InterruptedException {
-        if (e == null) throw new NullPointerException();
-        final E[] items = this.items;
+        checkNotNull(e);
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
         try {
-            try {
-                while (count == items.length)
-                    notFull.await();
-            } catch (InterruptedException ie) {
-                notFull.signal(); // propagate to non-interrupted thread
-                throw ie;
-            }
+            while (count == items.length)
+                notFull.await();
             insert(e);
         } finally {
             lock.unlock();
@@ -299,25 +339,18 @@
     public boolean offer(E e, long timeout, TimeUnit unit)
         throws InterruptedException {
 
-        if (e == null) throw new NullPointerException();
+        checkNotNull(e);
         long nanos = unit.toNanos(timeout);
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
         try {
-            for (;;) {
-                if (count != items.length) {
-                    insert(e);
-                    return true;
-                }
+            while (count == items.length) {
                 if (nanos <= 0)
                     return false;
-                try {
-                    nanos = notFull.awaitNanos(nanos);
-                } catch (InterruptedException ie) {
-                    notFull.signal(); // propagate to non-interrupted thread
-                    throw ie;
-                }
+                nanos = notFull.awaitNanos(nanos);
             }
+            insert(e);
+            return true;
         } finally {
             lock.unlock();
         }
@@ -327,10 +360,7 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            if (count == 0)
-                return null;
-            E x = extract();
-            return x;
+            return (count == 0) ? null : extract();
         } finally {
             lock.unlock();
         }
@@ -340,15 +370,9 @@
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
         try {
-            try {
-                while (count == 0)
-                    notEmpty.await();
-            } catch (InterruptedException ie) {
-                notEmpty.signal(); // propagate to non-interrupted thread
-                throw ie;
-            }
-            E x = extract();
-            return x;
+            while (count == 0)
+                notEmpty.await();
+            return extract();
         } finally {
             lock.unlock();
         }
@@ -359,21 +383,12 @@
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
         try {
-            for (;;) {
-                if (count != 0) {
-                    E x = extract();
-                    return x;
-                }
+            while (count == 0) {
                 if (nanos <= 0)
                     return null;
-                try {
-                    nanos = notEmpty.awaitNanos(nanos);
-                } catch (InterruptedException ie) {
-                    notEmpty.signal(); // propagate to non-interrupted thread
-                    throw ie;
-                }
-
+                nanos = notEmpty.awaitNanos(nanos);
             }
+            return extract();
         } finally {
             lock.unlock();
         }
@@ -383,7 +398,7 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return (count == 0) ? null : items[takeIndex];
+            return (count == 0) ? null : itemAt(takeIndex);
         } finally {
             lock.unlock();
         }
@@ -412,10 +427,10 @@
      * Returns the number of additional elements that this queue can ideally
      * (in the absence of memory or resource constraints) accept without
      * blocking. This is always equal to the initial capacity of this queue
-     * less the current <tt>size</tt> of this queue.
+     * less the current {@code size} of this queue.
      *
      * <p>Note that you <em>cannot</em> always tell if an attempt to insert
-     * an element will succeed by inspecting <tt>remainingCapacity</tt>
+     * an element will succeed by inspecting {@code remainingCapacity}
      * because it may be the case that another thread is about to
      * insert or remove an element.
      */
@@ -431,59 +446,56 @@
 
     /**
      * Removes a single instance of the specified element from this queue,
-     * if it is present.  More formally, removes an element <tt>e</tt> such
-     * that <tt>o.equals(e)</tt>, if this queue contains one or more such
+     * if it is present.  More formally, removes an element {@code e} such
+     * that {@code o.equals(e)}, if this queue contains one or more such
      * elements.
-     * Returns <tt>true</tt> if this queue contained the specified element
+     * Returns {@code true} if this queue contained the specified element
      * (or equivalently, if this queue changed as a result of the call).
      *
+     * <p>Removal of interior elements in circular array based queues
+     * is an intrinsically slow and disruptive operation, so should
+     * be undertaken only in exceptional circumstances, ideally
+     * only when the queue is known not to be accessible by other
+     * threads.
+     *
      * @param o element to be removed from this queue, if present
-     * @return <tt>true</tt> if this queue changed as a result of the call
+     * @return {@code true} if this queue changed as a result of the call
      */
     public boolean remove(Object o) {
         if (o == null) return false;
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            int i = takeIndex;
-            int k = 0;
-            for (;;) {
-                if (k++ >= count)
-                    return false;
+            for (int i = takeIndex, k = count; k > 0; i = inc(i), k--) {
                 if (o.equals(items[i])) {
                     removeAt(i);
                     return true;
                 }
-                i = inc(i);
             }
-
+            return false;
         } finally {
             lock.unlock();
         }
     }
 
     /**
-     * Returns <tt>true</tt> if this queue contains the specified element.
-     * More formally, returns <tt>true</tt> if and only if this queue contains
-     * at least one element <tt>e</tt> such that <tt>o.equals(e)</tt>.
+     * Returns {@code true} if this queue contains the specified element.
+     * More formally, returns {@code true} if and only if this queue contains
+     * at least one element {@code e} such that {@code o.equals(e)}.
      *
      * @param o object to be checked for containment in this queue
-     * @return <tt>true</tt> if this queue contains the specified element
+     * @return {@code true} if this queue contains the specified element
      */
     public boolean contains(Object o) {
         if (o == null) return false;
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            int i = takeIndex;
-            int k = 0;
-            while (k++ < count) {
+            for (int i = takeIndex, k = count; k > 0; i = inc(i), k--)
                 if (o.equals(items[i]))
                     return true;
-                i = inc(i);
-            }
             return false;
         } finally {
             lock.unlock();
@@ -504,17 +516,14 @@
      * @return an array containing all of the elements in this queue
      */
     public Object[] toArray() {
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
+            final int count = this.count;
             Object[] a = new Object[count];
-            int k = 0;
-            int i = takeIndex;
-            while (k < count) {
-                a[k++] = items[i];
-                i = inc(i);
-            }
+            for (int i = takeIndex, k = 0; k < count; i = inc(i), k++)
+                a[k] = items[i];
             return a;
         } finally {
             lock.unlock();
@@ -531,22 +540,22 @@
      * <p>If this queue fits in the specified array with room to spare
      * (i.e., the array has more elements than this queue), the element in
      * the array immediately following the end of the queue is set to
-     * <tt>null</tt>.
+     * {@code null}.
      *
      * <p>Like the {@link #toArray()} method, this method acts as bridge between
      * array-based and collection-based APIs.  Further, this method allows
      * precise control over the runtime type of the output array, and may,
      * under certain circumstances, be used to save allocation costs.
      *
-     * <p>Suppose <tt>x</tt> is a queue known to contain only strings.
+     * <p>Suppose {@code x} is a queue known to contain only strings.
      * The following code can be used to dump the queue into a newly
-     * allocated array of <tt>String</tt>:
+     * allocated array of {@code String}:
      *
      * <pre>
      *     String[] y = x.toArray(new String[0]);</pre>
      *
-     * Note that <tt>toArray(new Object[0])</tt> is identical in function to
-     * <tt>toArray()</tt>.
+     * Note that {@code toArray(new Object[0])} is identical in function to
+     * {@code toArray()}.
      *
      * @param a the array into which the elements of the queue are to
      *          be stored, if it is big enough; otherwise, a new array of the
@@ -557,24 +566,20 @@
      *         this queue
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            if (a.length < count)
+            final int count = this.count;
+            final int len = a.length;
+            if (len < count)
                 a = (T[])java.lang.reflect.Array.newInstance(
-                    a.getClass().getComponentType(),
-                    count
-                    );
-
-            int k = 0;
-            int i = takeIndex;
-            while (k < count) {
-                a[k++] = (T)items[i];
-                i = inc(i);
-            }
-            if (a.length > count)
+                    a.getClass().getComponentType(), count);
+            for (int i = takeIndex, k = 0; k < count; i = inc(i), k++)
+                a[k] = (T) items[i];
+            if (len > count)
                 a[count] = null;
             return a;
         } finally {
@@ -586,7 +591,19 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return super.toString();
+            int k = count;
+            if (k == 0)
+                return "[]";
+
+            StringBuilder sb = new StringBuilder();
+            sb.append('[');
+            for (int i = takeIndex; ; i = inc(i)) {
+                Object e = items[i];
+                sb.append(e == this ? "(this Collection)" : e);
+                if (--k == 0)
+                    return sb.append(']').toString();
+                sb.append(',').append(' ');
+            }
         } finally {
             lock.unlock();
         }
@@ -597,16 +614,12 @@
      * The queue will be empty after this call returns.
      */
     public void clear() {
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            int i = takeIndex;
-            int k = count;
-            while (k-- > 0) {
+            for (int i = takeIndex, k = count; k > 0; i = inc(i), k--)
                 items[i] = null;
-                i = inc(i);
-            }
             count = 0;
             putIndex = 0;
             takeIndex = 0;
@@ -623,11 +636,10 @@
      * @throws IllegalArgumentException      {@inheritDoc}
      */
     public int drainTo(Collection<? super E> c) {
-        if (c == null)
-            throw new NullPointerException();
+        checkNotNull(c);
         if (c == this)
             throw new IllegalArgumentException();
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
@@ -635,7 +647,7 @@
             int n = 0;
             int max = count;
             while (n < max) {
-                c.add(items[i]);
+                c.add(this.<E>cast(items[i]));
                 items[i] = null;
                 i = inc(i);
                 ++n;
@@ -659,22 +671,20 @@
      * @throws IllegalArgumentException      {@inheritDoc}
      */
     public int drainTo(Collection<? super E> c, int maxElements) {
-        if (c == null)
-            throw new NullPointerException();
+        checkNotNull(c);
         if (c == this)
             throw new IllegalArgumentException();
         if (maxElements <= 0)
             return 0;
-        final E[] items = this.items;
+        final Object[] items = this.items;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
             int i = takeIndex;
             int n = 0;
-            int sz = count;
-            int max = (maxElements < count)? maxElements : count;
+            int max = (maxElements < count) ? maxElements : count;
             while (n < max) {
-                c.add(items[i]);
+                c.add(this.<E>cast(items[i]));
                 items[i] = null;
                 i = inc(i);
                 ++n;
@@ -690,11 +700,13 @@
         }
     }
 
-
     /**
      * Returns an iterator over the elements in this queue in proper sequence.
-     * The returned <tt>Iterator</tt> is a "weakly consistent" iterator that
-     * will never throw {@link ConcurrentModificationException},
+     * The elements will be returned in order from first (head) to last (tail).
+     *
+     * <p>The returned {@code Iterator} is a "weakly consistent" iterator that
+     * will never throw {@link java.util.ConcurrentModificationException
+     * ConcurrentModificationException},
      * and guarantees to traverse elements as they existed upon
      * construction of the iterator, and may (but is not guaranteed to)
      * reflect any modifications subsequent to construction.
@@ -702,83 +714,65 @@
      * @return an iterator over the elements in this queue in proper sequence
      */
     public Iterator<E> iterator() {
-        final ReentrantLock lock = this.lock;
-        lock.lock();
-        try {
-            return new Itr();
-        } finally {
-            lock.unlock();
-        }
+        return new Itr();
     }
 
     /**
-     * Iterator for ArrayBlockingQueue
+     * Iterator for ArrayBlockingQueue. To maintain weak consistency
+     * with respect to puts and takes, we (1) read ahead one slot, so
+     * as to not report hasNext true but then not have an element to
+     * return -- however we later recheck this slot to use the most
+     * current value; (2) ensure that each array slot is traversed at
+     * most once (by tracking "remaining" elements); (3) skip over
+     * null slots, which can occur if takes race ahead of iterators.
+     * However, for circular array-based queues, we cannot rely on any
+     * well established definition of what it means to be weakly
+     * consistent with respect to interior removes since these may
+     * require slot overwrites in the process of sliding elements to
+     * cover gaps. So we settle for resiliency, operating on
+     * established apparent nexts, which may miss some elements that
+     * have moved between calls to next.
      */
     private class Itr implements Iterator<E> {
-        /**
-         * Index of element to be returned by next,
-         * or a negative number if no such.
-         */
-        private int nextIndex;
-
-        /**
-         * nextItem holds on to item fields because once we claim
-         * that an element exists in hasNext(), we must return it in
-         * the following next() call even if it was in the process of
-         * being removed when hasNext() was called.
-         */
-        private E nextItem;
-
-        /**
-         * Index of element returned by most recent call to next.
-         * Reset to -1 if this element is deleted by a call to remove.
-         */
-        private int lastRet;
+        private int remaining; // Number of elements yet to be returned
+        private int nextIndex; // Index of element to be returned by next
+        private E nextItem;    // Element to be returned by next call to next
+        private E lastItem;    // Element returned by last call to next
+        private int lastRet;   // Index of last element returned, or -1 if none
 
         Itr() {
-            lastRet = -1;
-            if (count == 0)
-                nextIndex = -1;
-            else {
-                nextIndex = takeIndex;
-                nextItem = items[takeIndex];
+            final ReentrantLock lock = ArrayBlockingQueue.this.lock;
+            lock.lock();
+            try {
+                lastRet = -1;
+                if ((remaining = count) > 0)
+                    nextItem = itemAt(nextIndex = takeIndex);
+            } finally {
+                lock.unlock();
             }
         }
 
         public boolean hasNext() {
-            /*
-             * No sync. We can return true by mistake here
-             * only if this iterator passed across threads,
-             * which we don't support anyway.
-             */
-            return nextIndex >= 0;
-        }
-
-        /**
-         * Checks whether nextIndex is valid; if so setting nextItem.
-         * Stops iterator when either hits putIndex or sees null item.
-         */
-        private void checkNext() {
-            if (nextIndex == putIndex) {
-                nextIndex = -1;
-                nextItem = null;
-            } else {
-                nextItem = items[nextIndex];
-                if (nextItem == null)
-                    nextIndex = -1;
-            }
+            return remaining > 0;
         }
 
         public E next() {
             final ReentrantLock lock = ArrayBlockingQueue.this.lock;
             lock.lock();
             try {
-                if (nextIndex < 0)
+                if (remaining <= 0)
                     throw new NoSuchElementException();
                 lastRet = nextIndex;
-                E x = nextItem;
-                nextIndex = inc(nextIndex);
-                checkNext();
+                E x = itemAt(nextIndex);  // check for fresher value
+                if (x == null) {
+                    x = nextItem;         // we are forced to report old value
+                    lastItem = null;      // but ensure remove fails
+                }
+                else
+                    lastItem = x;
+                while (--remaining > 0 && // skip over nulls
+                       (nextItem = itemAt(nextIndex = inc(nextIndex))) == null)
+                    ;
                 return x;
             } finally {
                 lock.unlock();
@@ -793,15 +787,19 @@
                 if (i == -1)
                     throw new IllegalStateException();
                 lastRet = -1;
-
-                int ti = takeIndex;
-                removeAt(i);
-                // back up cursor (reset to front if was first element)
-                nextIndex = (i == ti) ? takeIndex : i;
-                checkNext();
+                E x = lastItem;
+                lastItem = null;
+                // only remove if item still at index
+                if (x != null && x == items[i]) {
+                    boolean removingHead = (i == takeIndex);
+                    removeAt(i);
+                    if (!removingHead)
+                        nextIndex = dec(nextIndex);
+                }
             } finally {
                 lock.unlock();
             }
         }
     }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Fri Feb 04 16:29:41 2011 -0800
@@ -869,6 +869,8 @@
 
     /**
      * Inserts the specified element at the front of this deque.
+     * As the deque is unbounded, this method will never throw
+     * {@link IllegalStateException}.
      *
      * @throws NullPointerException if the specified element is null
      */
@@ -878,6 +880,8 @@
 
     /**
      * Inserts the specified element at the end of this deque.
+     * As the deque is unbounded, this method will never throw
+     * {@link IllegalStateException}.
      *
      * <p>This method is equivalent to {@link #add}.
      *
@@ -889,8 +893,9 @@
 
     /**
      * Inserts the specified element at the front of this deque.
+     * As the deque is unbounded, this method will never return {@code false}.
      *
-     * @return {@code true} always
+     * @return {@code true} (as specified by {@link Deque#offerFirst})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offerFirst(E e) {
@@ -900,10 +905,11 @@
 
     /**
      * Inserts the specified element at the end of this deque.
+     * As the deque is unbounded, this method will never return {@code false}.
      *
      * <p>This method is equivalent to {@link #add}.
      *
-     * @return {@code true} always
+     * @return {@code true} (as specified by {@link Deque#offerLast})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offerLast(E e) {
@@ -983,6 +989,7 @@
 
     /**
      * Inserts the specified element at the tail of this deque.
+     * As the deque is unbounded, this method will never return {@code false}.
      *
      * @return {@code true} (as specified by {@link Queue#offer})
      * @throws NullPointerException if the specified element is null
@@ -993,6 +1000,8 @@
 
     /**
      * Inserts the specified element at the tail of this deque.
+     * As the deque is unbounded, this method will never throw
+     * {@link IllegalStateException} or return {@code false}.
      *
      * @return {@code true} (as specified by {@link Collection#add})
      * @throws NullPointerException if the specified element is null
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -269,6 +269,8 @@
 
     /**
      * Inserts the specified element at the tail of this queue.
+     * As the queue is unbounded, this method will never throw
+     * {@link IllegalStateException} or return {@code false}.
      *
      * @return {@code true} (as specified by {@link Collection#add})
      * @throws NullPointerException if the specified element is null
@@ -298,6 +300,7 @@
 
     /**
      * Inserts the specified element at the tail of this queue.
+     * As the queue is unbounded, this method will never return {@code false}.
      *
      * @return {@code true} (as specified by {@link Queue#offer})
      * @throws NullPointerException if the specified element is null
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Fri Feb 04 16:29:41 2011 -0800
@@ -374,17 +374,11 @@
                                   null, null, 1);
     }
 
-    /** Updater for casHead */
-    private static final
-        AtomicReferenceFieldUpdater<ConcurrentSkipListMap, HeadIndex>
-        headUpdater = AtomicReferenceFieldUpdater.newUpdater
-        (ConcurrentSkipListMap.class, HeadIndex.class, "head");
-
     /**
      * compareAndSet head node
      */
     private boolean casHead(HeadIndex<K,V> cmp, HeadIndex<K,V> val) {
-        return headUpdater.compareAndSet(this, cmp, val);
+        return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val);
     }
 
     /* ---------------- Nodes -------------- */
@@ -423,28 +417,18 @@
             this.next = next;
         }
 
-        /** Updater for casNext */
-        static final AtomicReferenceFieldUpdater<Node, Node>
-            nextUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (Node.class, Node.class, "next");
-
-        /** Updater for casValue */
-        static final AtomicReferenceFieldUpdater<Node, Object>
-            valueUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (Node.class, Object.class, "value");
-
         /**
          * compareAndSet value field
          */
         boolean casValue(Object cmp, Object val) {
-            return valueUpdater.compareAndSet(this, cmp, val);
+            return UNSAFE.compareAndSwapObject(this, valueOffset, cmp, val);
         }
 
         /**
          * compareAndSet next field
          */
         boolean casNext(Node<K,V> cmp, Node<K,V> val) {
-            return nextUpdater.compareAndSet(this, cmp, val);
+            return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val);
         }
 
         /**
@@ -522,6 +506,14 @@
                 return null;
             return new AbstractMap.SimpleImmutableEntry<K,V>(key, v);
         }
+
+        // Unsafe mechanics
+        private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+        private static final long valueOffset =
+            objectFieldOffset(UNSAFE, "value", Node.class);
+        private static final long nextOffset =
+            objectFieldOffset(UNSAFE, "next", Node.class);
+
     }
 
     /* ---------------- Indexing -------------- */
@@ -547,16 +539,11 @@
             this.right = right;
         }
 
-        /** Updater for casRight */
-        static final AtomicReferenceFieldUpdater<Index, Index>
-            rightUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (Index.class, Index.class, "right");
-
         /**
          * compareAndSet right field
          */
         final boolean casRight(Index<K,V> cmp, Index<K,V> val) {
-            return rightUpdater.compareAndSet(this, cmp, val);
+            return UNSAFE.compareAndSwapObject(this, rightOffset, cmp, val);
         }
 
         /**
@@ -591,6 +578,12 @@
         final boolean unlink(Index<K,V> succ) {
             return !indexesDeletedNode() && casRight(succ, succ.right);
         }
+
+        // Unsafe mechanics
+        private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+        private static final long rightOffset =
+            objectFieldOffset(UNSAFE, "right", Index.class);
+
     }
 
     /* ---------------- Head nodes -------------- */
@@ -640,7 +633,8 @@
      * cast key as Comparable, which may cause ClassCastException,
      * which is propagated back to caller.
      */
-    private Comparable<? super K> comparable(Object key) throws ClassCastException {
+    private Comparable<? super K> comparable(Object key)
+            throws ClassCastException {
         if (key == null)
             throw new NullPointerException();
         if (comparator != null)
@@ -799,68 +793,12 @@
     }
 
     /**
-     * Specialized variant of findNode to perform Map.get. Does a weak
-     * traversal, not bothering to fix any deleted index nodes,
-     * returning early if it happens to see key in index, and passing
-     * over any deleted base nodes, falling back to getUsingFindNode
-     * only if it would otherwise return value from an ongoing
-     * deletion. Also uses "bound" to eliminate need for some
-     * comparisons (see Pugh Cookbook). Also folds uses of null checks
-     * and node-skipping because markers have null keys.
+     * Gets value for key using findNode.
      * @param okey the key
      * @return the value, or null if absent
      */
     private V doGet(Object okey) {
         Comparable<? super K> key = comparable(okey);
-        Node<K,V> bound = null;
-        Index<K,V> q = head;
-        Index<K,V> r = q.right;
-        Node<K,V> n;
-        K k;
-        int c;
-        for (;;) {
-            Index<K,V> d;
-            // Traverse rights
-            if (r != null && (n = r.node) != bound && (k = n.key) != null) {
-                if ((c = key.compareTo(k)) > 0) {
-                    q = r;
-                    r = r.right;
-                    continue;
-                } else if (c == 0) {
-                    Object v = n.value;
-                    return (v != null)? (V)v : getUsingFindNode(key);
-                } else
-                    bound = n;
-            }
-
-            // Traverse down
-            if ((d = q.down) != null) {
-                q = d;
-                r = d.right;
-            } else
-                break;
-        }
-
-        // Traverse nexts
-        for (n = q.node.next;  n != null; n = n.next) {
-            if ((k = n.key) != null) {
-                if ((c = key.compareTo(k)) == 0) {
-                    Object v = n.value;
-                    return (v != null)? (V)v : getUsingFindNode(key);
-                } else if (c < 0)
-                    break;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Performs map.get via findNode.  Used as a backup if doGet
-     * encounters an in-progress deletion.
-     * @param key the key
-     * @return the value, or null if absent
-     */
-    private V getUsingFindNode(Comparable<? super K> key) {
         /*
          * Loop needed here and elsewhere in case value field goes
          * null just as it is about to be returned, in which case we
@@ -943,7 +881,7 @@
         x ^= x << 13;
         x ^= x >>> 17;
         randomSeed = x ^= x << 5;
-        if ((x & 0x8001) != 0) // test highest and lowest bits
+        if ((x & 0x80000001) != 0) // test highest and lowest bits
             return 0;
         int level = 1;
         while (((x >>>= 1) & 1) != 0) ++level;
@@ -1256,7 +1194,7 @@
                 Node<K,V> n = b.next;
                 for (;;) {
                     if (n == null)
-                        return (b.isBaseHeader())? null : b;
+                        return b.isBaseHeader() ? null : b;
                     Node<K,V> f = n.next;            // inconsistent read
                     if (n != b.next)
                         break;
@@ -1374,7 +1312,7 @@
             Node<K,V> n = b.next;
             for (;;) {
                 if (n == null)
-                    return ((rel & LT) == 0 || b.isBaseHeader())? null : b;
+                    return ((rel & LT) == 0 || b.isBaseHeader()) ? null : b;
                 Node<K,V> f = n.next;
                 if (n != b.next)                  // inconsistent read
                     break;
@@ -1390,7 +1328,7 @@
                     (c <  0 && (rel & LT) == 0))
                     return n;
                 if ( c <= 0 && (rel & LT) != 0)
-                    return (b.isBaseHeader())? null : b;
+                    return b.isBaseHeader() ? null : b;
                 b = n;
                 n = f;
             }
@@ -1744,7 +1682,7 @@
             if (n.getValidValue() != null)
                 ++count;
         }
-        return (count >= Integer.MAX_VALUE)? Integer.MAX_VALUE : (int)count;
+        return (count >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) count;
     }
 
     /**
@@ -2099,7 +2037,7 @@
      */
     public K lowerKey(K key) {
         Node<K,V> n = findNear(key, LT);
-        return (n == null)? null : n.key;
+        return (n == null) ? null : n.key;
     }
 
     /**
@@ -2123,7 +2061,7 @@
      */
     public K floorKey(K key) {
         Node<K,V> n = findNear(key, LT|EQ);
-        return (n == null)? null : n.key;
+        return (n == null) ? null : n.key;
     }
 
     /**
@@ -2145,7 +2083,7 @@
      */
     public K ceilingKey(K key) {
         Node<K,V> n = findNear(key, GT|EQ);
-        return (n == null)? null : n.key;
+        return (n == null) ? null : n.key;
     }
 
     /**
@@ -2169,7 +2107,7 @@
      */
     public K higherKey(K key) {
         Node<K,V> n = findNear(key, GT);
-        return (n == null)? null : n.key;
+        return (n == null) ? null : n.key;
     }
 
     /**
@@ -2342,7 +2280,8 @@
         return list;
     }
 
-    static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> {
+    static final class KeySet<E>
+            extends AbstractSet<E> implements NavigableSet<E> {
         private final ConcurrentNavigableMap<E,Object> m;
         KeySet(ConcurrentNavigableMap<E,Object> map) { m = map; }
         public int size() { return m.size(); }
@@ -2359,11 +2298,11 @@
         public E last() { return m.lastKey(); }
         public E pollFirst() {
             Map.Entry<E,Object> e = m.pollFirstEntry();
-            return e == null? null : e.getKey();
+            return (e == null) ? null : e.getKey();
         }
         public E pollLast() {
             Map.Entry<E,Object> e = m.pollLastEntry();
-            return e == null? null : e.getKey();
+            return (e == null) ? null : e.getKey();
         }
         public Iterator<E> iterator() {
             if (m instanceof ConcurrentSkipListMap)
@@ -2710,9 +2649,9 @@
                     rel &= ~m.LT;
             }
             if (tooLow(key))
-                return ((rel & m.LT) != 0)? null : lowestEntry();
+                return ((rel & m.LT) != 0) ? null : lowestEntry();
             if (tooHigh(key))
-                return ((rel & m.LT) != 0)? highestEntry() : null;
+                return ((rel & m.LT) != 0) ? highestEntry() : null;
             for (;;) {
                 Node<K,V> n = m.findNear(key, rel);
                 if (n == null || !inBounds(n.key))
@@ -2783,7 +2722,7 @@
 
         public V remove(Object key) {
             K k = (K)key;
-            return (!inBounds(k))? null : m.remove(k);
+            return (!inBounds(k)) ? null : m.remove(k);
         }
 
         public int size() {
@@ -2794,7 +2733,7 @@
                 if (n.getValidValue() != null)
                     ++count;
             }
-            return count >= Integer.MAX_VALUE? Integer.MAX_VALUE : (int)count;
+            return count >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)count;
         }
 
         public boolean isEmpty() {
@@ -2972,27 +2911,27 @@
         }
 
         public K firstKey() {
-            return isDescending? highestKey() : lowestKey();
+            return isDescending ? highestKey() : lowestKey();
         }
 
         public K lastKey() {
-            return isDescending? lowestKey() : highestKey();
+            return isDescending ? lowestKey() : highestKey();
         }
 
         public Map.Entry<K,V> firstEntry() {
-            return isDescending? highestEntry() : lowestEntry();
+            return isDescending ? highestEntry() : lowestEntry();
         }
 
         public Map.Entry<K,V> lastEntry() {
-            return isDescending? lowestEntry() : highestEntry();
+            return isDescending ? lowestEntry() : highestEntry();
         }
 
         public Map.Entry<K,V> pollFirstEntry() {
-            return isDescending? removeHighest() : removeLowest();
+            return isDescending ? removeHighest() : removeLowest();
         }
 
         public Map.Entry<K,V> pollLastEntry() {
-            return isDescending? removeLowest() : removeHighest();
+            return isDescending ? removeLowest() : removeHighest();
         }
 
         /* ---------------- Submap Views -------------- */
@@ -3141,4 +3080,22 @@
             }
         }
     }
+
+    // Unsafe mechanics
+    private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+    private static final long headOffset =
+        objectFieldOffset(UNSAFE, "head", ConcurrentSkipListMap.class);
+
+    static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
+                                  String field, Class<?> klazz) {
+        try {
+            return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
+        } catch (NoSuchFieldException e) {
+            // Convert Exception to corresponding Error
+            NoSuchFieldError error = new NoSuchFieldError(field);
+            error.initCause(e);
+            throw error;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Fri Feb 04 16:29:41 2011 -0800
@@ -832,7 +832,7 @@
     }
 
     /**
-     * Save the state of the list to a stream (i.e., serialize it).
+     * Saves the state of the list to a stream (that is, serializes it).
      *
      * @serialData The length of the array backing the list is emitted
      *               (int), followed by all of its elements (each an Object)
@@ -842,27 +842,25 @@
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException{
 
-        // Write out element count, and any hidden stuff
         s.defaultWriteObject();
 
         Object[] elements = getArray();
-        int len = elements.length;
         // Write out array length
-        s.writeInt(len);
+        s.writeInt(elements.length);
 
         // Write out all elements in the proper order.
-        for (int i = 0; i < len; i++)
-            s.writeObject(elements[i]);
+        for (Object element : elements)
+            s.writeObject(element);
     }
 
     /**
-     * Reconstitute the list from a stream (i.e., deserialize it).
+     * Reconstitutes the list from a stream (that is, deserializes it).
+     *
      * @param s the stream
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
 
-        // Read in size, and any hidden stuff
         s.defaultReadObject();
 
         // bind to new lock
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Fri Feb 04 16:29:41 2011 -0800
@@ -525,8 +525,8 @@
      */
     private volatile long eventWaiters;
 
-    private static final int  EVENT_COUNT_SHIFT = 32;
-    private static final long WAITER_ID_MASK    = (1L << 16) - 1L;
+    private static final int EVENT_COUNT_SHIFT = 32;
+    private static final int WAITER_ID_MASK    = (1 << 16) - 1;
 
     /**
      * A counter for events that may wake up worker threads:
@@ -615,7 +615,7 @@
     // are usually manually inlined by callers
 
     /**
-     * Increments running count part of workerCounts
+     * Increments running count part of workerCounts.
      */
     final void incrementRunningCount() {
         int c;
@@ -625,7 +625,17 @@
     }
 
     /**
-     * Tries to decrement running count unless already zero
+     * Tries to increment running count part of workerCounts.
+     */
+    final boolean tryIncrementRunningCount() {
+        int c;
+        return UNSAFE.compareAndSwapInt(this, workerCountsOffset,
+                                        c = workerCounts,
+                                        c + ONE_RUNNING);
+    }
+
+    /**
+     * Tries to decrement running count unless already zero.
      */
     final boolean tryDecrementRunningCount() {
         int wc = workerCounts;
@@ -698,10 +708,11 @@
                 for (k = 0; k < n && ws[k] != null; ++k)
                     ;
                 if (k == n)
-                    ws = Arrays.copyOf(ws, n << 1);
+                    ws = workers = Arrays.copyOf(ws, n << 1);
             }
             ws[k] = w;
-            workers = ws; // volatile array write ensures slot visibility
+            int c = eventCount; // advance event count to ensure visibility
+            UNSAFE.compareAndSwapInt(this, eventCountOffset, c, c+1);
         } finally {
             lock.unlock();
         }
@@ -734,7 +745,7 @@
      */
     final void workerTerminated(ForkJoinWorkerThread w) {
         forgetWorker(w);
-        decrementWorkerCounts(w.isTrimmed()? 0 : ONE_RUNNING, ONE_TOTAL);
+        decrementWorkerCounts(w.isTrimmed() ? 0 : ONE_RUNNING, ONE_TOTAL);
         while (w.stealCount != 0) // collect final count
             tryAccumulateStealCount(w);
         tryTerminate(false);
@@ -746,24 +757,23 @@
      * Releases workers blocked on a count not equal to current count.
      * Normally called after precheck that eventWaiters isn't zero to
      * avoid wasted array checks. Gives up upon a change in count or
-     * upon releasing two workers, letting others take over.
+     * upon releasing four workers, letting others take over.
      */
     private void releaseEventWaiters() {
         ForkJoinWorkerThread[] ws = workers;
         int n = ws.length;
         long h = eventWaiters;
         int ec = eventCount;
-        boolean releasedOne = false;
+        int releases = 4;
         ForkJoinWorkerThread w; int id;
-        while ((id = ((int)(h & WAITER_ID_MASK)) - 1) >= 0 &&
+        while ((id = (((int)h) & WAITER_ID_MASK) - 1) >= 0 &&
                (int)(h >>> EVENT_COUNT_SHIFT) != ec &&
                id < n && (w = ws[id]) != null) {
             if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset,
                                           h,  w.nextWaiter)) {
                 LockSupport.unpark(w);
-                if (releasedOne) // exit on second release
+                if (--releases == 0)
                     break;
-                releasedOne = true;
             }
             if (eventCount != ec)
                 break;
@@ -793,7 +803,7 @@
         long nh = (((long)ec) << EVENT_COUNT_SHIFT) | ((long)(w.poolIndex+1));
         long h;
         while ((runState < SHUTDOWN || !tryTerminate(false)) &&
-               (((int)((h = eventWaiters) & WAITER_ID_MASK)) == 0 ||
+               (((int)(h = eventWaiters) & WAITER_ID_MASK) == 0 ||
                 (int)(h >>> EVENT_COUNT_SHIFT) == ec) &&
                eventCount == ec) {
             if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset,
@@ -820,9 +830,9 @@
             if (tryAccumulateStealCount(w)) { // transfer while idle
                 boolean untimed = (w.nextWaiter != 0L ||
                                    (workerCounts & RUNNING_COUNT_MASK) <= 1);
-                long startTime = untimed? 0 : System.nanoTime();
+                long startTime = untimed ? 0 : System.nanoTime();
                 Thread.interrupted();         // clear/ignore interrupt
-                if (eventCount != ec || w.isTerminating())
+                if (w.isTerminating() || eventCount != ec)
                     break;                    // recheck after clear
                 if (untimed)
                     LockSupport.park(w);
@@ -860,7 +870,8 @@
         if ((sw = spareWaiters) != 0 &&
             (id = (sw & SPARE_ID_MASK) - 1) >= 0 &&
             id < n && (w = ws[id]) != null &&
-            (workerCounts & RUNNING_COUNT_MASK) < parallelism &&
+            (runState >= TERMINATING ||
+             (workerCounts & RUNNING_COUNT_MASK) < parallelism) &&
             spareWaiters == sw &&
             UNSAFE.compareAndSwapInt(this, spareWaitersOffset,
                                      sw, w.nextSpare)) {
@@ -914,12 +925,8 @@
                     break;
                 }
                 w.start(recordWorker(w), ueh);
-                if ((workerCounts >>> TOTAL_COUNT_SHIFT) >= pc) {
-                    int c; // advance event count
-                    UNSAFE.compareAndSwapInt(this, eventCountOffset,
-                                             c = eventCount, c+1);
+                if ((workerCounts >>> TOTAL_COUNT_SHIFT) >= pc)
                     break; // add at most one unless total below target
-                }
             }
         }
         if (eventWaiters != 0L)
@@ -955,7 +962,7 @@
             }
             else if ((h = eventWaiters) != 0L) {
                 long nh;
-                int id = ((int)(h & WAITER_ID_MASK)) - 1;
+                int id = (((int)h) & WAITER_ID_MASK) - 1;
                 if (id >= 0 && id < n && (w = ws[id]) != null &&
                     (nh = w.nextWaiter) != 0L && // keep at least one worker
                     UNSAFE.compareAndSwapLong(this, eventWaitersOffset, h, nh))
@@ -1003,24 +1010,31 @@
         int pc = parallelism;
         while (w.runState == 0) {
             int rs = runState;
-            if (rs >= TERMINATING) { // propagate shutdown
+            if (rs >= TERMINATING) {           // propagate shutdown
                 w.shutdown();
                 break;
             }
             if ((inactivate || (active && (rs & ACTIVE_COUNT_MASK) >= pc)) &&
-                UNSAFE.compareAndSwapInt(this, runStateOffset, rs, rs - 1))
+                UNSAFE.compareAndSwapInt(this, runStateOffset, rs, --rs)) {
                 inactivate = active = w.active = false;
-            int wc = workerCounts;
+                if (rs == SHUTDOWN) {          // all inactive and shut down
+                    tryTerminate(false);
+                    continue;
+                }
+            }
+            int wc = workerCounts;             // try to suspend as spare
             if ((wc & RUNNING_COUNT_MASK) > pc) {
                 if (!(inactivate |= active) && // must inactivate to suspend
-                    workerCounts == wc &&      // try to suspend as spare
+                    workerCounts == wc &&
                     UNSAFE.compareAndSwapInt(this, workerCountsOffset,
                                              wc, wc - ONE_RUNNING))
                     w.suspendAsSpare();
             }
             else if ((wc >>> TOTAL_COUNT_SHIFT) < pc)
                 helpMaintainParallelism();     // not enough workers
-            else if (!ran) {
+            else if (ran)
+                break;
+            else {
                 long h = eventWaiters;
                 int ec = eventCount;
                 if (h != 0L && (int)(h >>> EVENT_COUNT_SHIFT) != ec)
@@ -1032,8 +1046,6 @@
                 else if (!(inactivate |= active))
                     eventSync(w, wec);         // must inactivate before sync
             }
-            else
-                break;
         }
     }
 
@@ -1043,35 +1055,67 @@
      *
      * @param joinMe the task to join
      * @param worker the current worker thread
+     * @param timed true if wait should time out
+     * @param nanos timeout value if timed
      */
-    final void awaitJoin(ForkJoinTask<?> joinMe, ForkJoinWorkerThread worker) {
+    final void awaitJoin(ForkJoinTask<?> joinMe, ForkJoinWorkerThread worker,
+                         boolean timed, long nanos) {
+        long startTime = timed ? System.nanoTime() : 0L;
         int retries = 2 + (parallelism >> 2); // #helpJoins before blocking
+        boolean running = true;               // false when count decremented
         while (joinMe.status >= 0) {
-            int wc;
-            worker.helpJoinTask(joinMe);
+            if (runState >= TERMINATING) {
+                joinMe.cancelIgnoringExceptions();
+                break;
+            }
+            running = worker.helpJoinTask(joinMe, running);
             if (joinMe.status < 0)
                 break;
-            else if (retries > 0)
+            if (retries > 0) {
                 --retries;
-            else if (((wc = workerCounts) & RUNNING_COUNT_MASK) != 0 &&
-                     UNSAFE.compareAndSwapInt(this, workerCountsOffset,
-                                              wc, wc - ONE_RUNNING)) {
-                int stat, c; long h;
-                while ((stat = joinMe.status) >= 0 &&
-                       (h = eventWaiters) != 0L && // help release others
-                       (int)(h >>> EVENT_COUNT_SHIFT) != eventCount)
+                continue;
+            }
+            int wc = workerCounts;
+            if ((wc & RUNNING_COUNT_MASK) != 0) {
+                if (running) {
+                    if (!UNSAFE.compareAndSwapInt(this, workerCountsOffset,
+                                                  wc, wc - ONE_RUNNING))
+                        continue;
+                    running = false;
+                }
+                long h = eventWaiters;
+                if (h != 0L && (int)(h >>> EVENT_COUNT_SHIFT) != eventCount)
                     releaseEventWaiters();
-                if (stat >= 0 &&
-                    ((workerCounts & RUNNING_COUNT_MASK) == 0 ||
-                     (stat =
-                      joinMe.internalAwaitDone(JOIN_TIMEOUT_MILLIS)) >= 0))
-                    helpMaintainParallelism(); // timeout or no running workers
-                do {} while (!UNSAFE.compareAndSwapInt
-                             (this, workerCountsOffset,
-                              c = workerCounts, c + ONE_RUNNING));
-                if (stat < 0)
-                    break;   // else restart
+                if ((workerCounts & RUNNING_COUNT_MASK) != 0) {
+                    long ms; int ns;
+                    if (!timed) {
+                        ms = JOIN_TIMEOUT_MILLIS;
+                        ns = 0;
+                    }
+                    else { // at most JOIN_TIMEOUT_MILLIS per wait
+                        long nt = nanos - (System.nanoTime() - startTime);
+                        if (nt <= 0L)
+                            break;
+                        ms = nt / 1000000;
+                        if (ms > JOIN_TIMEOUT_MILLIS) {
+                            ms = JOIN_TIMEOUT_MILLIS;
+                            ns = 0;
+                        }
+                        else
+                            ns = (int) (nt % 1000000);
+                    }
+                    joinMe.internalAwaitDone(ms, ns);
+                }
+                if (joinMe.status < 0)
+                    break;
             }
+            helpMaintainParallelism();
+        }
+        if (!running) {
+            int c;
+            do {} while (!UNSAFE.compareAndSwapInt
+                         (this, workerCountsOffset,
+                          c = workerCounts, c + ONE_RUNNING));
         }
     }
 
@@ -1082,9 +1126,10 @@
         throws InterruptedException {
         while (!blocker.isReleasable()) {
             int wc = workerCounts;
-            if ((wc & RUNNING_COUNT_MASK) != 0 &&
-                UNSAFE.compareAndSwapInt(this, workerCountsOffset,
-                                         wc, wc - ONE_RUNNING)) {
+            if ((wc & RUNNING_COUNT_MASK) == 0)
+                helpMaintainParallelism();
+            else if (UNSAFE.compareAndSwapInt(this, workerCountsOffset,
+                                              wc, wc - ONE_RUNNING)) {
                 try {
                     while (!blocker.isReleasable()) {
                         long h = eventWaiters;
@@ -1129,12 +1174,11 @@
         // Finish now if all threads terminated; else in some subsequent call
         if ((workerCounts >>> TOTAL_COUNT_SHIFT) == 0) {
             advanceRunLevel(TERMINATED);
-            termination.arrive();
+            termination.forceTermination();
         }
         return true;
     }
 
-
     /**
      * Actions on transition to TERMINATING
      *
@@ -1325,17 +1369,13 @@
     // Execution methods
 
     /**
-     * Common code for execute, invoke and submit
+     * Submits task and creates, starts, or resumes some workers if necessary
      */
     private <T> void doSubmit(ForkJoinTask<T> task) {
-        if (task == null)
-            throw new NullPointerException();
-        if (runState >= SHUTDOWN)
-            throw new RejectedExecutionException();
         submissionQueue.offer(task);
         int c; // try to increment event count -- CAS failure OK
         UNSAFE.compareAndSwapInt(this, eventCountOffset, c = eventCount, c+1);
-        helpMaintainParallelism(); // create, start, or resume some workers
+        helpMaintainParallelism();
     }
 
     /**
@@ -1348,8 +1388,33 @@
      *         scheduled for execution
      */
     public <T> T invoke(ForkJoinTask<T> task) {
-        doSubmit(task);
-        return task.join();
+        if (task == null)
+            throw new NullPointerException();
+        if (runState >= SHUTDOWN)
+            throw new RejectedExecutionException();
+        Thread t = Thread.currentThread();
+        if ((t instanceof ForkJoinWorkerThread) &&
+            ((ForkJoinWorkerThread)t).pool == this)
+            return task.invoke();  // bypass submit if in same pool
+        else {
+            doSubmit(task);
+            return task.join();
+        }
+    }
+
+    /**
+     * Unless terminating, forks task if within an ongoing FJ
+     * computation in the current pool, else submits as external task.
+     */
+    private <T> void forkOrSubmit(ForkJoinTask<T> task) {
+        if (runState >= SHUTDOWN)
+            throw new RejectedExecutionException();
+        Thread t = Thread.currentThread();
+        if ((t instanceof ForkJoinWorkerThread) &&
+            ((ForkJoinWorkerThread)t).pool == this)
+            task.fork();
+        else
+            doSubmit(task);
     }
 
     /**
@@ -1361,7 +1426,9 @@
      *         scheduled for execution
      */
     public void execute(ForkJoinTask<?> task) {
-        doSubmit(task);
+        if (task == null)
+            throw new NullPointerException();
+        forkOrSubmit(task);
     }
 
     // AbstractExecutorService methods
@@ -1372,12 +1439,14 @@
      *         scheduled for execution
      */
     public void execute(Runnable task) {
+        if (task == null)
+            throw new NullPointerException();
         ForkJoinTask<?> job;
         if (task instanceof ForkJoinTask<?>) // avoid re-wrap
             job = (ForkJoinTask<?>) task;
         else
             job = ForkJoinTask.adapt(task, null);
-        doSubmit(job);
+        forkOrSubmit(job);
     }
 
     /**
@@ -1390,7 +1459,9 @@
      *         scheduled for execution
      */
     public <T> ForkJoinTask<T> submit(ForkJoinTask<T> task) {
-        doSubmit(task);
+        if (task == null)
+            throw new NullPointerException();
+        forkOrSubmit(task);
         return task;
     }
 
@@ -1400,8 +1471,10 @@
      *         scheduled for execution
      */
     public <T> ForkJoinTask<T> submit(Callable<T> task) {
+        if (task == null)
+            throw new NullPointerException();
         ForkJoinTask<T> job = ForkJoinTask.adapt(task);
-        doSubmit(job);
+        forkOrSubmit(job);
         return job;
     }
 
@@ -1411,8 +1484,10 @@
      *         scheduled for execution
      */
     public <T> ForkJoinTask<T> submit(Runnable task, T result) {
+        if (task == null)
+            throw new NullPointerException();
         ForkJoinTask<T> job = ForkJoinTask.adapt(task, result);
-        doSubmit(job);
+        forkOrSubmit(job);
         return job;
     }
 
@@ -1422,12 +1497,14 @@
      *         scheduled for execution
      */
     public ForkJoinTask<?> submit(Runnable task) {
+        if (task == null)
+            throw new NullPointerException();
         ForkJoinTask<?> job;
         if (task instanceof ForkJoinTask<?>) // avoid re-wrap
             job = (ForkJoinTask<?>) task;
         else
             job = ForkJoinTask.adapt(task, null);
-        doSubmit(job);
+        forkOrSubmit(job);
         return job;
     }
 
@@ -1725,8 +1802,11 @@
      * commenced but not yet completed.  This method may be useful for
      * debugging. A return of {@code true} reported a sufficient
      * period after shutdown may indicate that submitted tasks have
-     * ignored or suppressed interruption, causing this executor not
-     * to properly terminate.
+     * ignored or suppressed interruption, or are waiting for IO,
+     * causing this executor not to properly terminate. (See the
+     * advisory notes for class {@link ForkJoinTask} stating that
+     * tasks should not normally entail blocking operations.  But if
+     * they do, they must abort them on interrupt.)
      *
      * @return {@code true} if terminating but not yet terminated
      */
@@ -1764,10 +1844,11 @@
     public boolean awaitTermination(long timeout, TimeUnit unit)
         throws InterruptedException {
         try {
-            return termination.awaitAdvanceInterruptibly(0, timeout, unit) > 0;
+            termination.awaitAdvanceInterruptibly(0, timeout, unit);
         } catch (TimeoutException ex) {
             return false;
         }
+        return true;
     }
 
     /**
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Fri Feb 04 16:29:41 2011 -0800
@@ -42,6 +42,16 @@
 import java.util.RandomAccess;
 import java.util.Map;
 import java.util.WeakHashMap;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.RunnableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 /**
  * Abstract base class for tasks that run within a {@link ForkJoinPool}.
@@ -129,6 +139,16 @@
  * result in exceptions or errors, possibly including
  * {@code ClassCastException}.
  *
+ * <p>Method {@link #join} and its variants are appropriate for use
+ * only when completion dependencies are acyclic; that is, the
+ * parallel computation can be described as a directed acyclic graph
+ * (DAG). Otherwise, executions may encounter a form of deadlock as
+ * tasks cyclically wait for each other.  However, this framework
+ * supports other methods and techniques (for example the use of
+ * {@link Phaser}, {@link #helpQuiesce}, and {@link #complete}) that
+ * may be of use in constructing custom subclasses for problems that
+ * are not statically structured as DAGs.
+ *
  * <p>Most base support methods are {@code final}, to prevent
  * overriding of implementations that are intrinsically tied to the
  * underlying lightweight task scheduling framework.  Developers
@@ -143,9 +163,10 @@
  * computation. Large tasks should be split into smaller subtasks,
  * usually via recursive decomposition. As a very rough rule of thumb,
  * a task should perform more than 100 and less than 10000 basic
- * computational steps. If tasks are too big, then parallelism cannot
- * improve throughput. If too small, then memory and internal task
- * maintenance overhead may overwhelm processing.
+ * computational steps, and should avoid indefinite looping. If tasks
+ * are too big, then parallelism cannot improve throughput. If too
+ * small, then memory and internal task maintenance overhead may
+ * overwhelm processing.
  *
  * <p>This class provides {@code adapt} methods for {@link Runnable}
  * and {@link Callable}, that may be of use when mixing execution of
@@ -242,17 +263,20 @@
     }
 
     /**
-     * Blocks a worker thread until completion. Called only by
-     * pool. Currently unused -- pool-based waits use timeout
-     * version below.
+     * Blocks a worker thread until completed or timed out.  Called
+     * only by pool.
      */
-    final void internalAwaitDone() {
-        int s;         // the odd construction reduces lock bias effects
-        while ((s = status) >= 0) {
-            try {
+    final void internalAwaitDone(long millis, int nanos) {
+        int s = status;
+        if ((s == 0 &&
+             UNSAFE.compareAndSwapInt(this, statusOffset, 0, SIGNAL)) ||
+            s > 0)  {
+            try {     // the odd construction reduces lock bias effects
                 synchronized (this) {
-                    if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL))
-                        wait();
+                    if (status > 0)
+                        wait(millis, nanos);
+                    else
+                        notifyAll();
                 }
             } catch (InterruptedException ie) {
                 cancelIfTerminating();
@@ -261,46 +285,61 @@
     }
 
     /**
-     * Blocks a worker thread until completed or timed out.  Called
-     * only by pool.
-     *
-     * @return status on exit
-     */
-    final int internalAwaitDone(long millis) {
-        int s;
-        if ((s = status) >= 0) {
-            try {
-                synchronized (this) {
-                    if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL))
-                        wait(millis, 0);
-                }
-            } catch (InterruptedException ie) {
-                cancelIfTerminating();
-            }
-            s = status;
-        }
-        return s;
-    }
-
-    /**
      * Blocks a non-worker-thread until completion.
      */
     private void externalAwaitDone() {
-        int s;
-        while ((s = status) >= 0) {
+        if (status >= 0) {
+            boolean interrupted = false;
             synchronized (this) {
-                if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)){
-                    boolean interrupted = false;
-                    while (status >= 0) {
+                for (;;) {
+                    int s = status;
+                    if (s == 0)
+                        UNSAFE.compareAndSwapInt(this, statusOffset,
+                                                 0, SIGNAL);
+                    else if (s < 0) {
+                        notifyAll();
+                        break;
+                    }
+                    else {
                         try {
                             wait();
                         } catch (InterruptedException ie) {
                             interrupted = true;
                         }
                     }
-                    if (interrupted)
-                        Thread.currentThread().interrupt();
-                    break;
+                }
+            }
+            if (interrupted)
+                Thread.currentThread().interrupt();
+        }
+    }
+
+    /**
+     * Blocks a non-worker-thread until completion or interruption or timeout.
+     */
+    private void externalInterruptibleAwaitDone(boolean timed, long nanos)
+        throws InterruptedException {
+        if (Thread.interrupted())
+            throw new InterruptedException();
+        if (status >= 0) {
+            long startTime = timed ? System.nanoTime() : 0L;
+            synchronized (this) {
+                for (;;) {
+                    long nt;
+                    int s = status;
+                    if (s == 0)
+                        UNSAFE.compareAndSwapInt(this, statusOffset,
+                                                 0, SIGNAL);
+                    else if (s < 0) {
+                        notifyAll();
+                        break;
+                    }
+                    else if (!timed)
+                        wait();
+                    else if ((nt = nanos - (System.nanoTime()-startTime)) > 0L)
+                        wait(nt / 1000000, (int)(nt % 1000000));
+                    else
+                        break;
                 }
             }
         }
@@ -335,7 +374,7 @@
      * #isDone} returning {@code true}.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -349,10 +388,13 @@
     }
 
     /**
-     * Returns the result of the computation when it {@link #isDone is done}.
-     * This method differs from {@link #get()} in that
+     * Returns the result of the computation when it {@link #isDone is
+     * done}.  This method differs from {@link #get()} in that
      * abnormal completion results in {@code RuntimeException} or
-     * {@code Error}, not {@code ExecutionException}.
+     * {@code Error}, not {@code ExecutionException}, and that
+     * interrupts of the calling thread do <em>not</em> cause the
+     * method to abruptly return by throwing {@code
+     * InterruptedException}.
      *
      * @return the computed result
      */
@@ -394,7 +436,7 @@
      * unprocessed.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -422,7 +464,7 @@
      * normally or exceptionally, or left unprocessed.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -477,7 +519,7 @@
      * unprocessed.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -529,25 +571,28 @@
 
     /**
      * Attempts to cancel execution of this task. This attempt will
-     * fail if the task has already completed, has already been
-     * cancelled, or could not be cancelled for some other reason. If
-     * successful, and this task has not started when cancel is
-     * called, execution of this task is suppressed, {@link
-     * #isCancelled} will report true, and {@link #join} will result
-     * in a {@code CancellationException} being thrown.
+     * fail if the task has already completed or could not be
+     * cancelled for some other reason. If successful, and this task
+     * has not started when {@code cancel} is called, execution of
+     * this task is suppressed. After this method returns
+     * successfully, unless there is an intervening call to {@link
+     * #reinitialize}, subsequent calls to {@link #isCancelled},
+     * {@link #isDone}, and {@code cancel} will return {@code true}
+     * and calls to {@link #join} and related methods will result in
+     * {@code CancellationException}.
      *
      * <p>This method may be overridden in subclasses, but if so, must
-     * still ensure that these minimal properties hold. In particular,
-     * the {@code cancel} method itself must not throw exceptions.
+     * still ensure that these properties hold. In particular, the
+     * {@code cancel} method itself must not throw exceptions.
      *
      * <p>This method is designed to be invoked by <em>other</em>
      * tasks. To terminate the current task, you can just return or
      * throw an unchecked exception from its computation method, or
      * invoke {@link #completeExceptionally}.
      *
-     * @param mayInterruptIfRunning this value is ignored in the
-     * default implementation because tasks are not
-     * cancelled via interruption
+     * @param mayInterruptIfRunning this value has no effect in the
+     * default implementation because interrupts are not used to
+     * control cancellation.
      *
      * @return {@code true} if this task is now cancelled
      */
@@ -681,23 +726,13 @@
      * member of a ForkJoinPool and was interrupted while waiting
      */
     public final V get() throws InterruptedException, ExecutionException {
-        int s;
-        if (Thread.currentThread() instanceof ForkJoinWorkerThread) {
+        Thread t = Thread.currentThread();
+        if (t instanceof ForkJoinWorkerThread)
             quietlyJoin();
-            s = status;
-        }
-        else {
-            while ((s = status) >= 0) {
-                synchronized (this) { // interruptible form of awaitDone
-                    if (UNSAFE.compareAndSwapInt(this, statusOffset,
-                                                 s, SIGNAL)) {
-                        while (status >= 0)
-                            wait();
-                    }
-                }
-            }
-        }
-        if (s < NORMAL) {
+        else
+            externalInterruptibleAwaitDone(false, 0L);
+        int s = status;
+        if (s != NORMAL) {
             Throwable ex;
             if (s == CANCELLED)
                 throw new CancellationException();
@@ -723,72 +758,18 @@
      */
     public final V get(long timeout, TimeUnit unit)
         throws InterruptedException, ExecutionException, TimeoutException {
+        long nanos = unit.toNanos(timeout);
         Thread t = Thread.currentThread();
-        ForkJoinPool pool;
-        if (t instanceof ForkJoinWorkerThread) {
-            ForkJoinWorkerThread w = (ForkJoinWorkerThread) t;
-            if (status >= 0 && w.unpushTask(this))
-                quietlyExec();
-            pool = w.pool;
-        }
+        if (t instanceof ForkJoinWorkerThread)
+            ((ForkJoinWorkerThread)t).joinTask(this, true, nanos);
         else
-            pool = null;
-        /*
-         * Timed wait loop intermixes cases for FJ (pool != null) and
-         * non FJ threads. For FJ, decrement pool count but don't try
-         * for replacement; increment count on completion. For non-FJ,
-         * deal with interrupts. This is messy, but a little less so
-         * than is splitting the FJ and nonFJ cases.
-         */
-        boolean interrupted = false;
-        boolean dec = false; // true if pool count decremented
-        long nanos = unit.toNanos(timeout);
-        for (;;) {
-            if (pool == null && Thread.interrupted()) {
-                interrupted = true;
-                break;
-            }
-            int s = status;
-            if (s < 0)
-                break;
-            if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) {
-                long startTime = System.nanoTime();
-                long nt; // wait time
-                while (status >= 0 &&
-                       (nt = nanos - (System.nanoTime() - startTime)) > 0) {
-                    if (pool != null && !dec)
-                        dec = pool.tryDecrementRunningCount();
-                    else {
-                        long ms = nt / 1000000;
-                        int ns = (int) (nt % 1000000);
-                        try {
-                            synchronized (this) {
-                                if (status >= 0)
-                                    wait(ms, ns);
-                            }
-                        } catch (InterruptedException ie) {
-                            if (pool != null)
-                                cancelIfTerminating();
-                            else {
-                                interrupted = true;
-                                break;
-                            }
-                        }
-                    }
-                }
-                break;
-            }
-        }
-        if (pool != null && dec)
-            pool.incrementRunningCount();
-        if (interrupted)
-            throw new InterruptedException();
-        int es = status;
-        if (es != NORMAL) {
+            externalInterruptibleAwaitDone(true, nanos);
+        int s = status;
+        if (s != NORMAL) {
             Throwable ex;
-            if (es == CANCELLED)
+            if (s == CANCELLED)
                 throw new CancellationException();
-            if (es == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null)
+            if (s == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null)
                 throw new ExecutionException(ex);
             throw new TimeoutException();
         }
@@ -819,7 +800,7 @@
                         return;
                     }
                 }
-                w.joinTask(this);
+                w.joinTask(this, false, 0L);
             }
         }
         else
@@ -855,7 +836,7 @@
      * processed.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -874,6 +855,12 @@
      * under any other usage conditions are not guaranteed.
      * This method may be useful when executing
      * pre-constructed trees of subtasks in loops.
+     *
+     * <p>Upon completion of this method, {@code isDone()} reports
+     * {@code false}, and {@code getException()} reports {@code
+     * null}. However, the value returned by {@code getRawResult} is
+     * unaffected. To clear this value, you can invoke {@code
+     * setRawResult(null)}.
      */
     public void reinitialize() {
         if (status == EXCEPTIONAL)
@@ -895,11 +882,12 @@
     }
 
     /**
-     * Returns {@code true} if the current thread is executing as a
-     * ForkJoinPool computation.
+     * Returns {@code true} if the current thread is a {@link
+     * ForkJoinWorkerThread} executing as a ForkJoinPool computation.
      *
-     * @return {@code true} if the current thread is executing as a
-     * ForkJoinPool computation, or false otherwise
+     * @return {@code true} if the current thread is a {@link
+     * ForkJoinWorkerThread} executing as a ForkJoinPool computation,
+     * or {@code false} otherwise
      */
     public static boolean inForkJoinPool() {
         return Thread.currentThread() instanceof ForkJoinWorkerThread;
@@ -914,7 +902,7 @@
      * were not, stolen.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -933,7 +921,7 @@
      * fork other tasks.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -956,7 +944,7 @@
      * exceeded.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -1014,7 +1002,7 @@
      * otherwise.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -1033,7 +1021,7 @@
      * be useful otherwise.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
@@ -1056,7 +1044,7 @@
      * otherwise.
      *
      * <p>This method may be invoked only from within {@code
-     * ForkJoinTask} computations (as may be determined using method
+     * ForkJoinPool} computations (as may be determined using method
      * {@link #inForkJoinPool}).  Attempts to invoke in other contexts
      * result in exceptions or errors, possibly including {@code
      * ClassCastException}.
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Fri Feb 04 16:29:41 2011 -0800
@@ -38,16 +38,18 @@
 import java.util.Random;
 import java.util.Collection;
 import java.util.concurrent.locks.LockSupport;
+import java.util.concurrent.RejectedExecutionException;
 
 /**
- * A thread managed by a {@link ForkJoinPool}.  This class is
- * subclassable solely for the sake of adding functionality -- there
- * are no overridable methods dealing with scheduling or execution.
- * However, you can override initialization and termination methods
- * surrounding the main task processing loop.  If you do create such a
- * subclass, you will also need to supply a custom {@link
- * ForkJoinPool.ForkJoinWorkerThreadFactory} to use it in a {@code
- * ForkJoinPool}.
+ * A thread managed by a {@link ForkJoinPool}, which executes
+ * {@link ForkJoinTask}s.
+ * This class is subclassable solely for the sake of adding
+ * functionality -- there are no overridable methods dealing with
+ * scheduling or execution.  However, you can override initialization
+ * and termination methods surrounding the main task processing loop.
+ * If you do create such a subclass, you will also need to supply a
+ * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to use it
+ * in a {@code ForkJoinPool}.
  *
  * @since 1.7
  * @author Doug Lea
@@ -376,7 +378,7 @@
     /**
      * Initializes internal state after construction but before
      * processing any tasks. If you override this method, you must
-     * invoke @code{super.onStart()} at the beginning of the method.
+     * invoke {@code super.onStart()} at the beginning of the method.
      * Initialization requires care: Most fields must have legal
      * default values, to ensure that attempted accesses from other
      * threads work correctly even before this thread starts
@@ -384,7 +386,7 @@
      */
     protected void onStart() {
         int rs = seedGenerator.nextInt();
-        seed = rs == 0? 1 : rs; // seed must be nonzero
+        seed = (rs == 0) ? 1 : rs; // seed must be nonzero
 
         // Allocate name string and arrays in this thread
         String pid = Integer.toString(pool.getPoolNumber());
@@ -426,7 +428,7 @@
     /**
      * This method is required to be public, but should never be
      * called explicitly. It performs the main run loop to execute
-     * ForkJoinTasks.
+     * {@link ForkJoinTask}s.
      */
     public void run() {
         Throwable exception = null;
@@ -628,6 +630,19 @@
                 if (t == null)   // lost to stealer
                     break;
                 if (UNSAFE.compareAndSwapObject(q, u, t, null)) {
+                    /*
+                     * Note: here and in related methods, as a
+                     * performance (not correctness) issue, we'd like
+                     * to encourage compiler not to arbitrarily
+                     * postpone setting sp after successful CAS.
+                     * Currently there is no intrinsic for arranging
+                     * this, but using Unsafe putOrderedInt may be a
+                     * preferable strategy on some compilers even
+                     * though its main effect is a pre-, not post-
+                     * fence. To simplify possible changes, the option
+                     * is left in comments next to the associated
+                     * assignments.
+                     */
                     sp = s; // putOrderedInt may encourage more timely write
                     // UNSAFE.putOrderedInt(this, spOffset, s);
                     return t;
@@ -777,10 +792,10 @@
     // Run State management
 
     // status check methods used mainly by ForkJoinPool
-    final boolean isRunning()     { return runState == 0; }
-    final boolean isTerminated()  { return (runState & TERMINATED) != 0; }
-    final boolean isSuspended()   { return (runState & SUSPENDED) != 0; }
-    final boolean isTrimmed()     { return (runState & TRIMMED) != 0; }
+    final boolean isRunning()    { return runState == 0; }
+    final boolean isTerminated() { return (runState & TERMINATED) != 0; }
+    final boolean isSuspended()  { return (runState & SUSPENDED) != 0; }
+    final boolean isTrimmed()    { return (runState & TRIMMED) != 0; }
 
     final boolean isTerminating() {
         if ((runState & TERMINATING) != 0)
@@ -884,8 +899,7 @@
      */
     final void cancelTasks() {
         ForkJoinTask<?> cj = currentJoin; // try to cancel ongoing tasks
-        if (cj != null) {
-            currentJoin = null;
+        if (cj != null && cj.status >= 0) {
             cj.cancelIgnoringExceptions();
             try {
                 this.interrupt(); // awaken wait
@@ -893,10 +907,8 @@
             }
         }
         ForkJoinTask<?> cs = currentSteal;
-        if (cs != null) {
-            currentSteal = null;
+        if (cs != null && cs.status >= 0)
             cs.cancelIgnoringExceptions();
-        }
         while (base != sp) {
             ForkJoinTask<?> t = deqTask();
             if (t != null)
@@ -959,57 +971,23 @@
      * Possibly runs some tasks and/or blocks, until task is done.
      *
      * @param joinMe the task to join
+     * @param timed true if use timed wait
+     * @param nanos wait time if timed
      */
-    final void joinTask(ForkJoinTask<?> joinMe) {
+    final void joinTask(ForkJoinTask<?> joinMe, boolean timed, long nanos) {
         // currentJoin only written by this thread; only need ordered store
         ForkJoinTask<?> prevJoin = currentJoin;
         UNSAFE.putOrderedObject(this, currentJoinOffset, joinMe);
-        if (sp != base)
-            localHelpJoinTask(joinMe);
-        if (joinMe.status >= 0)
-            pool.awaitJoin(joinMe, this);
+        pool.awaitJoin(joinMe, this, timed, nanos);
         UNSAFE.putOrderedObject(this, currentJoinOffset, prevJoin);
     }
 
     /**
-     * Run tasks in local queue until given task is done.
-     *
-     * @param joinMe the task to join
-     */
-    private void localHelpJoinTask(ForkJoinTask<?> joinMe) {
-        int s;
-        ForkJoinTask<?>[] q;
-        while (joinMe.status >= 0 && (s = sp) != base && (q = queue) != null) {
-            int i = (q.length - 1) & --s;
-            long u = (i << qShift) + qBase; // raw offset
-            ForkJoinTask<?> t = q[i];
-            if (t == null)  // lost to a stealer
-                break;
-            if (UNSAFE.compareAndSwapObject(q, u, t, null)) {
-                /*
-                 * This recheck (and similarly in helpJoinTask)
-                 * handles cases where joinMe is independently
-                 * cancelled or forced even though there is other work
-                 * available. Back out of the pop by putting t back
-                 * into slot before we commit by writing sp.
-                 */
-                if (joinMe.status < 0) {
-                    UNSAFE.putObjectVolatile(q, u, t);
-                    break;
-                }
-                sp = s;
-                // UNSAFE.putOrderedInt(this, spOffset, s);
-                t.quietlyExec();
-            }
-        }
-    }
-
-    /**
-     * Unless terminating, tries to locate and help perform tasks for
-     * a stealer of the given task, or in turn one of its stealers.
-     * Traces currentSteal->currentJoin links looking for a thread
-     * working on a descendant of the given task and with a non-empty
-     * queue to steal back and execute tasks from.
+     * Tries to locate and help perform tasks for a stealer of the
+     * given task, or in turn one of its stealers.  Traces
+     * currentSteal->currentJoin links looking for a thread working on
+     * a descendant of the given task and with a non-empty queue to
+     * steal back and execute tasks from.
      *
      * The implementation is very branchy to cope with potential
      * inconsistencies or loops encountering chains that are stale,
@@ -1019,77 +997,127 @@
      * don't work out.
      *
      * @param joinMe the task to join
+     * @param running if false, then must update pool count upon
+     *  running a task
+     * @return value of running on exit
      */
-    final void helpJoinTask(ForkJoinTask<?> joinMe) {
-        ForkJoinWorkerThread[] ws;
-        int n;
-        if (joinMe.status < 0)                // already done
-            return;
-        if ((runState & TERMINATING) != 0) {  // cancel if shutting down
-            joinMe.cancelIgnoringExceptions();
-            return;
-        }
-        if ((ws = pool.workers) == null || (n = ws.length) <= 1)
-            return;                           // need at least 2 workers
-
-        ForkJoinTask<?> task = joinMe;        // base of chain
-        ForkJoinWorkerThread thread = this;   // thread with stolen task
-        for (int d = 0; d < MAX_HELP_DEPTH; ++d) { // chain length
-            // Try to find v, the stealer of task, by first using hint
-            ForkJoinWorkerThread v = ws[thread.stealHint & (n - 1)];
-            if (v == null || v.currentSteal != task) {
-                for (int j = 0; ; ++j) {      // search array
-                    if (j < n) {
-                        ForkJoinTask<?> vs;
-                        if ((v = ws[j]) != null &&
-                            (vs = v.currentSteal) != null) {
-                            if (joinMe.status < 0 || task.status < 0)
-                                return;       // stale or done
-                            if (vs == task) {
-                                thread.stealHint = j;
-                                break;        // save hint for next time
-                            }
-                        }
-                    }
-                    else
-                        return;               // no stealer
+    final boolean helpJoinTask(ForkJoinTask<?> joinMe, boolean running) {
+        /*
+         * Initial checks to (1) abort if terminating; (2) clean out
+         * old cancelled tasks from local queue; (3) if joinMe is next
+         * task, run it; (4) omit scan if local queue nonempty (since
+         * it may contain non-descendents of joinMe).
+         */
+        ForkJoinPool p = pool;
+        for (;;) {
+            ForkJoinTask<?>[] q;
+            int s;
+            if (joinMe.status < 0)
+                return running;
+            else if ((runState & TERMINATING) != 0) {
+                joinMe.cancelIgnoringExceptions();
+                return running;
+            }
+            else if ((s = sp) == base || (q = queue) == null)
+                break;                            // queue empty
+            else {
+                int i = (q.length - 1) & --s;
+                long u = (i << qShift) + qBase;   // raw offset
+                ForkJoinTask<?> t = q[i];
+                if (t == null)
+                    break;                        // lost to a stealer
+                else if (t != joinMe && t.status >= 0)
+                    return running;               // cannot safely help
+                else if ((running ||
+                          (running = p.tryIncrementRunningCount())) &&
+                         UNSAFE.compareAndSwapObject(q, u, t, null)) {
+                    sp = s; // putOrderedInt may encourage more timely write
+                    // UNSAFE.putOrderedInt(this, spOffset, s);
+                    t.quietlyExec();
                 }
             }
-            for (;;) { // Try to help v, using specialized form of deqTask
-                if (joinMe.status < 0)
-                    return;
-                int b = v.base;
-                ForkJoinTask<?>[] q = v.queue;
-                if (b == v.sp || q == null)
-                    break;
-                int i = (q.length - 1) & b;
-                long u = (i << qShift) + qBase;
-                ForkJoinTask<?> t = q[i];
-                int pid = poolIndex;
-                ForkJoinTask<?> ps = currentSteal;
-                if (task.status < 0)
-                    return;                   // stale or done
-                if (t != null && v.base == b++ &&
-                    UNSAFE.compareAndSwapObject(q, u, t, null)) {
-                    if (joinMe.status < 0) {
-                        UNSAFE.putObjectVolatile(q, u, t);
-                        return;               // back out on cancel
+        }
+
+        int n;                                    // worker array size
+        ForkJoinWorkerThread[] ws = p.workers;
+        if (ws != null && (n = ws.length) > 1) {  // need at least 2 workers
+            ForkJoinTask<?> task = joinMe;        // base of chain
+            ForkJoinWorkerThread thread = this;   // thread with stolen task
+
+            outer:for (int d = 0; d < MAX_HELP_DEPTH; ++d) { // chain length
+                // Try to find v, the stealer of task, by first using hint
+                ForkJoinWorkerThread v = ws[thread.stealHint & (n - 1)];
+                if (v == null || v.currentSteal != task) {
+                    for (int j = 0; ; ++j) {      // search array
+                        if (j < n) {
+                            ForkJoinTask<?> vs;
+                            if ((v = ws[j]) != null &&
+                                (vs = v.currentSteal) != null) {
+                                if (joinMe.status < 0)
+                                    break outer;
+                                if (vs == task) {
+                                    if (task.status < 0)
+                                        break outer; // stale
+                                    thread.stealHint = j;
+                                    break;        // save hint for next time
+                                }
+                            }
+                        }
+                        else
+                            break outer;          // no stealer
                     }
-                    v.base = b;
-                    v.stealHint = pid;
-                    UNSAFE.putOrderedObject(this, currentStealOffset, t);
-                    t.quietlyExec();
-                    UNSAFE.putOrderedObject(this, currentStealOffset, ps);
                 }
+
+                // Try to help v, using specialized form of deqTask
+                for (;;) {
+                    if (joinMe.status < 0)
+                        break outer;
+                    int b = v.base;
+                    ForkJoinTask<?>[] q = v.queue;
+                    if (b == v.sp || q == null)
+                        break;                    // empty
+                    int i = (q.length - 1) & b;
+                    long u = (i << qShift) + qBase;
+                    ForkJoinTask<?> t = q[i];
+                    if (task.status < 0)
+                        break outer;              // stale
+                    if (t != null &&
+                        (running ||
+                         (running = p.tryIncrementRunningCount())) &&
+                        v.base == b++ &&
+                        UNSAFE.compareAndSwapObject(q, u, t, null)) {
+                        if (t != joinMe && joinMe.status < 0) {
+                            UNSAFE.putObjectVolatile(q, u, t);
+                            break outer;          // joinMe cancelled; back out
+                        }
+                        v.base = b;
+                        if (t.status >= 0) {
+                            ForkJoinTask<?> ps = currentSteal;
+                            int pid = poolIndex;
+                            v.stealHint = pid;
+                            UNSAFE.putOrderedObject(this,
+                                                    currentStealOffset, t);
+                            t.quietlyExec();
+                            UNSAFE.putOrderedObject(this,
+                                                    currentStealOffset, ps);
+                        }
+                    }
+                    else if ((runState & TERMINATING) != 0) {
+                        joinMe.cancelIgnoringExceptions();
+                        break outer;
+                    }
+                }
+
+                // Try to descend to find v's stealer
+                ForkJoinTask<?> next = v.currentJoin;
+                if (task.status < 0 || next == null || next == task ||
+                    joinMe.status < 0)
+                    break;                 // done, stale, dead-end, or cyclic
+                task = next;
+                thread = v;
             }
-            // Try to descend to find v's stealer
-            ForkJoinTask<?> next = v.currentJoin;
-            if (task.status < 0 || next == null || next == task ||
-                joinMe.status < 0)
-                return;
-            task = next;
-            thread = v;
         }
+        return running;
     }
 
     /**
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1029,6 +1029,8 @@
      * elements as they existed upon construction of the iterator, and
      * may (but is not guaranteed to) reflect any modifications
      * subsequent to construction.
+     *
+     * @return an iterator over the elements in this deque in reverse order
      */
     public Iterator<E> descendingIterator() {
         return new DescendingItr();
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -189,14 +189,14 @@
     }
 
     /**
-     * Creates a node and links it at end of queue.
+     * Links node at end of queue.
      *
-     * @param x the item
+     * @param node the node
      */
-    private void enqueue(E x) {
+    private void enqueue(Node<E> node) {
         // assert putLock.isHeldByCurrentThread();
         // assert last.next == null;
-        last = last.next = new Node<E>(x);
+        last = last.next = node;
     }
 
     /**
@@ -282,7 +282,7 @@
                     throw new NullPointerException();
                 if (n == capacity)
                     throw new IllegalStateException("Queue full");
-                enqueue(e);
+                enqueue(new Node<E>(e));
                 ++n;
             }
             count.set(n);
@@ -332,6 +332,7 @@
         // Note: convention in all put/take/etc is to preset local var
         // holding count negative to indicate failure unless set.
         int c = -1;
+        Node<E> node = new Node(e);
         final ReentrantLock putLock = this.putLock;
         final AtomicInteger count = this.count;
         putLock.lockInterruptibly();
@@ -347,7 +348,7 @@
             while (count.get() == capacity) {
                 notFull.await();
             }
-            enqueue(e);
+            enqueue(node);
             c = count.getAndIncrement();
             if (c + 1 < capacity)
                 notFull.signal();
@@ -382,7 +383,7 @@
                     return false;
                 nanos = notFull.awaitNanos(nanos);
             }
-            enqueue(e);
+            enqueue(new Node<E>(e));
             c = count.getAndIncrement();
             if (c + 1 < capacity)
                 notFull.signal();
@@ -411,11 +412,12 @@
         if (count.get() == capacity)
             return false;
         int c = -1;
+        Node<E> node = new Node(e);
         final ReentrantLock putLock = this.putLock;
         putLock.lock();
         try {
             if (count.get() < capacity) {
-                enqueue(e);
+                enqueue(node);
                 c = count.getAndIncrement();
                 if (c + 1 < capacity)
                     notFull.signal();
@@ -560,6 +562,27 @@
     }
 
     /**
+     * Returns {@code true} if this queue contains the specified element.
+     * More formally, returns {@code true} if and only if this queue contains
+     * at least one element {@code e} such that {@code o.equals(e)}.
+     *
+     * @param o object to be checked for containment in this queue
+     * @return {@code true} if this queue contains the specified element
+     */
+    public boolean contains(Object o) {
+        if (o == null) return false;
+        fullyLock();
+        try {
+            for (Node<E> p = head.next; p != null; p = p.next)
+                if (o.equals(p.item))
+                    return true;
+            return false;
+        } finally {
+            fullyUnlock();
+        }
+    }
+
+    /**
      * Returns an array containing all of the elements in this queue, in
      * proper sequence.
      *
@@ -645,7 +668,20 @@
     public String toString() {
         fullyLock();
         try {
-            return super.toString();
+            Node<E> p = head.next;
+            if (p == null)
+                return "[]";
+
+            StringBuilder sb = new StringBuilder();
+            sb.append('[');
+            for (;;) {
+                E e = p.item;
+                sb.append(e == this ? "(this Collection)" : e);
+                p = p.next;
+                if (p == null)
+                    return sb.append(']').toString();
+                sb.append(',').append(' ');
+            }
         } finally {
             fullyUnlock();
         }
@@ -727,12 +763,14 @@
 
     /**
      * Returns an iterator over the elements in this queue in proper sequence.
-     * The returned {@code Iterator} is a "weakly consistent" iterator that
+     * The elements will be returned in order from first (head) to last (tail).
+     *
+     * <p>The returned iterator is a "weakly consistent" iterator that
      * will never throw {@link java.util.ConcurrentModificationException
-     * ConcurrentModificationException},
-     * and guarantees to traverse elements as they existed upon
-     * construction of the iterator, and may (but is not guaranteed to)
-     * reflect any modifications subsequent to construction.
+     * ConcurrentModificationException}, and guarantees to traverse
+     * elements as they existed upon construction of the iterator, and
+     * may (but is not guaranteed to) reflect any modifications
+     * subsequent to construction.
      *
      * @return an iterator over the elements in this queue in proper sequence
      */
--- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -37,10 +37,10 @@
 
 import java.util.AbstractQueue;
 import java.util.Collection;
-import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.Queue;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.LockSupport;
 
 /**
@@ -450,7 +450,7 @@
         }
 
         final boolean casItem(Object cmp, Object val) {
-            //            assert cmp == null || cmp.getClass() != Node.class;
+            // assert cmp == null || cmp.getClass() != Node.class;
             return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
         }
 
@@ -516,7 +516,7 @@
          * Tries to artificially match a data node -- used by remove.
          */
         final boolean tryMatchData() {
-            //            assert isData;
+            // assert isData;
             Object x = item;
             if (x != null && x != this && casItem(x, null)) {
                 LockSupport.unpark(waiter);
@@ -569,7 +569,7 @@
 
     @SuppressWarnings("unchecked")
     static <E> E cast(Object item) {
-        //        assert item == null || item.getClass() != Node.class;
+        // assert item == null || item.getClass() != Node.class;
         return (E) item;
     }
 
@@ -588,7 +588,8 @@
             throw new NullPointerException();
         Node s = null;                        // the node to append, if needed
 
-        retry: for (;;) {                     // restart on append race
+        retry:
+        for (;;) {                            // restart on append race
 
             for (Node h = head, p = h; p != null;) { // find & match first node
                 boolean isData = p.isData;
@@ -599,7 +600,7 @@
                     if (p.casItem(item, e)) { // match
                         for (Node q = p; q != h;) {
                             Node n = q.next;  // update by 2 unless singleton
-                            if (head == h && casHead(h, n == null? q : n)) {
+                            if (head == h && casHead(h, n == null ? q : n)) {
                                 h.forgetNext();
                                 break;
                             }                 // advance and retry
@@ -684,7 +685,7 @@
         for (;;) {
             Object item = s.item;
             if (item != e) {                  // matched
-                //                assert item != s;
+                // assert item != s;
                 s.forgetContents();           // avoid garbage
                 return this.<E>cast(item);
             }
@@ -809,22 +810,61 @@
          * Moves to next node after prev, or first node if prev null.
          */
         private void advance(Node prev) {
-            lastPred = lastRet;
-            lastRet = prev;
-            for (Node p = (prev == null) ? head : succ(prev);
-                 p != null; p = succ(p)) {
-                Object item = p.item;
-                if (p.isData) {
-                    if (item != null && item != p) {
-                        nextItem = LinkedTransferQueue.this.<E>cast(item);
-                        nextNode = p;
+            /*
+             * To track and avoid buildup of deleted nodes in the face
+             * of calls to both Queue.remove and Itr.remove, we must
+             * include variants of unsplice and sweep upon each
+             * advance: Upon Itr.remove, we may need to catch up links
+             * from lastPred, and upon other removes, we might need to
+             * skip ahead from stale nodes and unsplice deleted ones
+             * found while advancing.
+             */
+
+            Node r, b; // reset lastPred upon possible deletion of lastRet
+            if ((r = lastRet) != null && !r.isMatched())
+                lastPred = r;    // next lastPred is old lastRet
+            else if ((b = lastPred) == null || b.isMatched())
+                lastPred = null; // at start of list
+            else {
+                Node s, n;       // help with removal of lastPred.next
+                while ((s = b.next) != null &&
+                       s != b && s.isMatched() &&
+                       (n = s.next) != null && n != s)
+                    b.casNext(s, n);
+            }
+
+            this.lastRet = prev;
+
+            for (Node p = prev, s, n;;) {
+                s = (p == null) ? head : p.next;
+                if (s == null)
+                    break;
+                else if (s == p) {
+                    p = null;
+                    continue;
+                }
+                Object item = s.item;
+                if (s.isData) {
+                    if (item != null && item != s) {
+                        nextItem = LinkedTransferQueue.<E>cast(item);
+                        nextNode = s;
                         return;
                     }
                 }
                 else if (item == null)
                     break;
+                // assert s.isMatched();
+                if (p == null)
+                    p = s;
+                else if ((n = s.next) == null)
+                    break;
+                else if (s == n)
+                    p = null;
+                else
+                    p.casNext(s, n);
             }
             nextNode = null;
+            nextItem = null;
         }
 
         Itr() {
@@ -844,10 +884,12 @@
         }
 
         public final void remove() {
-            Node p = lastRet;
-            if (p == null) throw new IllegalStateException();
-            if (p.tryMatchData())
-                unsplice(lastPred, p);
+            final Node lastRet = this.lastRet;
+            if (lastRet == null)
+                throw new IllegalStateException();
+            this.lastRet = null;
+            if (lastRet.tryMatchData())
+                unsplice(lastPred, lastRet);
         }
     }
 
@@ -997,8 +1039,7 @@
      * Inserts the specified element at the tail of this queue.
      * As the queue is unbounded, this method will never return {@code false}.
      *
-     * @return {@code true} (as specified by
-     *         {@link BlockingQueue#offer(Object) BlockingQueue.offer})
+     * @return {@code true} (as specified by {@link Queue#offer})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offer(E e) {
@@ -1130,15 +1171,15 @@
     }
 
     /**
-     * Returns an iterator over the elements in this queue in proper
-     * sequence, from head to tail.
+     * Returns an iterator over the elements in this queue in proper sequence.
+     * The elements will be returned in order from first (head) to last (tail).
      *
      * <p>The returned iterator is a "weakly consistent" iterator that
-     * will never throw
-     * {@link ConcurrentModificationException ConcurrentModificationException},
-     * and guarantees to traverse elements as they existed upon
-     * construction of the iterator, and may (but is not guaranteed
-     * to) reflect any modifications subsequent to construction.
+     * will never throw {@link java.util.ConcurrentModificationException
+     * ConcurrentModificationException}, and guarantees to traverse
+     * elements as they existed upon construction of the iterator, and
+     * may (but is not guaranteed to) reflect any modifications
+     * subsequent to construction.
      *
      * @return an iterator over the elements in this queue in proper sequence
      */
@@ -1203,6 +1244,28 @@
     }
 
     /**
+     * Returns {@code true} if this queue contains the specified element.
+     * More formally, returns {@code true} if and only if this queue contains
+     * at least one element {@code e} such that {@code o.equals(e)}.
+     *
+     * @param o object to be checked for containment in this queue
+     * @return {@code true} if this queue contains the specified element
+     */
+    public boolean contains(Object o) {
+        if (o == null) return false;
+        for (Node p = head; p != null; p = succ(p)) {
+            Object item = p.item;
+            if (p.isData) {
+                if (item != null && item != p && o.equals(item))
+                    return true;
+            }
+            else if (item == null)
+                break;
+        }
+        return false;
+    }
+
+    /**
      * Always returns {@code Integer.MAX_VALUE} because a
      * {@code LinkedTransferQueue} is not capacity constrained.
      *
--- a/jdk/src/share/classes/java/util/concurrent/Phaser.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java	Fri Feb 04 16:29:41 2011 -0800
@@ -35,6 +35,8 @@
 
 package java.util.concurrent;
 
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.LockSupport;
 
@@ -61,38 +63,38 @@
  * Phaser} may be repeatedly awaited.  Method {@link
  * #arriveAndAwaitAdvance} has effect analogous to {@link
  * java.util.concurrent.CyclicBarrier#await CyclicBarrier.await}. Each
- * generation of a {@code Phaser} has an associated phase number. The
- * phase number starts at zero, and advances when all parties arrive
- * at the barrier, wrapping around to zero after reaching {@code
+ * generation of a phaser has an associated phase number. The phase
+ * number starts at zero, and advances when all parties arrive at the
+ * phaser, wrapping around to zero after reaching {@code
  * Integer.MAX_VALUE}. The use of phase numbers enables independent
- * control of actions upon arrival at a barrier and upon awaiting
+ * control of actions upon arrival at a phaser and upon awaiting
  * others, via two kinds of methods that may be invoked by any
  * registered party:
  *
  * <ul>
  *
  *   <li> <b>Arrival.</b> Methods {@link #arrive} and
- *       {@link #arriveAndDeregister} record arrival at a
- *       barrier. These methods do not block, but return an associated
- *       <em>arrival phase number</em>; that is, the phase number of
- *       the barrier to which the arrival applied. When the final
- *       party for a given phase arrives, an optional barrier action
- *       is performed and the phase advances.  Barrier actions,
- *       performed by the party triggering a phase advance, are
- *       arranged by overriding method {@link #onAdvance(int, int)},
- *       which also controls termination. Overriding this method is
- *       similar to, but more flexible than, providing a barrier
- *       action to a {@code CyclicBarrier}.
+ *       {@link #arriveAndDeregister} record arrival.  These methods
+ *       do not block, but return an associated <em>arrival phase
+ *       number</em>; that is, the phase number of the phaser to which
+ *       the arrival applied. When the final party for a given phase
+ *       arrives, an optional action is performed and the phase
+ *       advances.  These actions are performed by the party
+ *       triggering a phase advance, and are arranged by overriding
+ *       method {@link #onAdvance(int, int)}, which also controls
+ *       termination. Overriding this method is similar to, but more
+ *       flexible than, providing a barrier action to a {@code
+ *       CyclicBarrier}.
  *
  *   <li> <b>Waiting.</b> Method {@link #awaitAdvance} requires an
  *       argument indicating an arrival phase number, and returns when
- *       the barrier advances to (or is already at) a different phase.
+ *       the phaser advances to (or is already at) a different phase.
  *       Unlike similar constructions using {@code CyclicBarrier},
  *       method {@code awaitAdvance} continues to wait even if the
  *       waiting thread is interrupted. Interruptible and timeout
  *       versions are also available, but exceptions encountered while
  *       tasks wait interruptibly or with timeout do not change the
- *       state of the barrier. If necessary, you can perform any
+ *       state of the phaser. If necessary, you can perform any
  *       associated recovery within handlers of those exceptions,
  *       often after invoking {@code forceTermination}.  Phasers may
  *       also be used by tasks executing in a {@link ForkJoinPool},
@@ -101,26 +103,39 @@
  *
  * </ul>
  *
- * <p> <b>Termination.</b> A {@code Phaser} may enter a
- * <em>termination</em> state in which all synchronization methods
- * immediately return without updating phaser state or waiting for
- * advance, and indicating (via a negative phase value) that execution
- * is complete.  Termination is triggered when an invocation of {@code
- * onAdvance} returns {@code true}.  As illustrated below, when
- * phasers control actions with a fixed number of iterations, it is
- * often convenient to override this method to cause termination when
- * the current phase number reaches a threshold. Method {@link
- * #forceTermination} is also available to abruptly release waiting
- * threads and allow them to terminate.
+ * <p> <b>Termination.</b> A phaser may enter a <em>termination</em>
+ * state, that may be checked using method {@link #isTerminated}. Upon
+ * termination, all synchronization methods immediately return without
+ * waiting for advance, as indicated by a negative return value.
+ * Similarly, attempts to register upon termination have no effect.
+ * Termination is triggered when an invocation of {@code onAdvance}
+ * returns {@code true}. The default implementation returns {@code
+ * true} if a deregistration has caused the number of registered
+ * parties to become zero.  As illustrated below, when phasers control
+ * actions with a fixed number of iterations, it is often convenient
+ * to override this method to cause termination when the current phase
+ * number reaches a threshold. Method {@link #forceTermination} is
+ * also available to abruptly release waiting threads and allow them
+ * to terminate.
  *
- * <p> <b>Tiering.</b> Phasers may be <em>tiered</em> (i.e., arranged
- * in tree structures) to reduce contention. Phasers with large
- * numbers of parties that would otherwise experience heavy
+ * <p> <b>Tiering.</b> Phasers may be <em>tiered</em> (i.e.,
+ * constructed in tree structures) to reduce contention. Phasers with
+ * large numbers of parties that would otherwise experience heavy
  * synchronization contention costs may instead be set up so that
  * groups of sub-phasers share a common parent.  This may greatly
  * increase throughput even though it incurs greater per-operation
  * overhead.
  *
+ * <p>In a tree of tiered phasers, registration and deregistration of
+ * child phasers with their parent are managed automatically.
+ * Whenever the number of registered parties of a child phaser becomes
+ * non-zero (as established in the {@link #Phaser(Phaser,int)}
+ * constructor, {@link #register}, or {@link #bulkRegister}), the
+ * child phaser is registered with its parent.  Whenever the number of
+ * registered parties becomes zero as the result of an invocation of
+ * {@link #arriveAndDeregister}, the child phaser is deregistered
+ * from its parent.
+ *
  * <p><b>Monitoring.</b> While synchronization methods may be invoked
  * only by registered parties, the current state of a phaser may be
  * monitored by any caller.  At any given moment there are {@link
@@ -136,9 +151,9 @@
  * <p><b>Sample usages:</b>
  *
  * <p>A {@code Phaser} may be used instead of a {@code CountDownLatch}
- * to control a one-shot action serving a variable number of
- * parties. The typical idiom is for the method setting this up to
- * first register, then start the actions, then deregister, as in:
+ * to control a one-shot action serving a variable number of parties.
+ * The typical idiom is for the method setting this up to first
+ * register, then start the actions, then deregister, as in:
  *
  *  <pre> {@code
  * void runTasks(List<Runnable> tasks) {
@@ -208,34 +223,32 @@
  * }}</pre>
  *
  *
- * <p>To create a set of tasks using a tree of phasers,
- * you could use code of the following form, assuming a
- * Task class with a constructor accepting a phaser that
- * it registers for upon construction:
+ * <p>To create a set of {@code n} tasks using a tree of phasers, you
+ * could use code of the following form, assuming a Task class with a
+ * constructor accepting a {@code Phaser} that it registers with upon
+ * construction. After invocation of {@code build(new Task[n], 0, n,
+ * new Phaser())}, these tasks could then be started, for example by
+ * submitting to a pool:
  *
  *  <pre> {@code
- * void build(Task[] actions, int lo, int hi, Phaser ph) {
+ * void build(Task[] tasks, int lo, int hi, Phaser ph) {
  *   if (hi - lo > TASKS_PER_PHASER) {
  *     for (int i = lo; i < hi; i += TASKS_PER_PHASER) {
  *       int j = Math.min(i + TASKS_PER_PHASER, hi);
- *       build(actions, i, j, new Phaser(ph));
+ *       build(tasks, i, j, new Phaser(ph));
  *     }
  *   } else {
  *     for (int i = lo; i < hi; ++i)
- *       actions[i] = new Task(ph);
+ *       tasks[i] = new Task(ph);
  *       // assumes new Task(ph) performs ph.register()
  *   }
- * }
- * // .. initially called, for n tasks via
- * build(new Task[n], 0, n, new Phaser());}</pre>
+ * }}</pre>
  *
  * The best value of {@code TASKS_PER_PHASER} depends mainly on
- * expected barrier synchronization rates. A value as low as four may
- * be appropriate for extremely small per-barrier task bodies (thus
+ * expected synchronization rates. A value as low as four may
+ * be appropriate for extremely small per-phase task bodies (thus
  * high rates), or up to hundreds for extremely large ones.
  *
- * </pre>
- *
  * <p><b>Implementation notes</b>: This implementation restricts the
  * maximum number of parties to 65535. Attempts to register additional
  * parties result in {@code IllegalStateException}. However, you can and
@@ -253,60 +266,66 @@
      */
 
     /**
-     * Barrier state representation. Conceptually, a barrier contains
-     * four values:
+     * Primary state representation, holding four bit-fields:
      *
-     * * parties -- the number of parties to wait (16 bits)
-     * * unarrived -- the number of parties yet to hit barrier (16 bits)
-     * * phase -- the generation of the barrier (31 bits)
-     * * terminated -- set if barrier is terminated (1 bit)
+     * unarrived  -- the number of parties yet to hit barrier (bits  0-15)
+     * parties    -- the number of parties to wait            (bits 16-31)
+     * phase      -- the generation of the barrier            (bits 32-62)
+     * terminated -- set if barrier is terminated             (bit  63 / sign)
+     *
+     * Except that a phaser with no registered parties is
+     * distinguished by the otherwise illegal state of having zero
+     * parties and one unarrived parties (encoded as EMPTY below).
      *
-     * However, to efficiently maintain atomicity, these values are
-     * packed into a single (atomic) long. Termination uses the sign
-     * bit of 32 bit representation of phase, so phase is set to -1 on
-     * termination. Good performance relies on keeping state decoding
-     * and encoding simple, and keeping race windows short.
+     * To efficiently maintain atomicity, these values are packed into
+     * a single (atomic) long. Good performance relies on keeping
+     * state decoding and encoding simple, and keeping race windows
+     * short.
      *
-     * Note: there are some cheats in arrive() that rely on unarrived
-     * count being lowest 16 bits.
+     * All state updates are performed via CAS except initial
+     * registration of a sub-phaser (i.e., one with a non-null
+     * parent).  In this (relatively rare) case, we use built-in
+     * synchronization to lock while first registering with its
+     * parent.
+     *
+     * The phase of a subphaser is allowed to lag that of its
+     * ancestors until it is actually accessed -- see method
+     * reconcileState.
      */
     private volatile long state;
 
-    private static final int ushortMask = 0xffff;
-    private static final int phaseMask  = 0x7fffffff;
+    private static final int  MAX_PARTIES     = 0xffff;
+    private static final int  MAX_PHASE       = Integer.MAX_VALUE;
+    private static final int  PARTIES_SHIFT   = 16;
+    private static final int  PHASE_SHIFT     = 32;
+    private static final int  UNARRIVED_MASK  = 0xffff;      // to mask ints
+    private static final long PARTIES_MASK    = 0xffff0000L; // to mask longs
+    private static final long TERMINATION_BIT = 1L << 63;
+
+    // some special values
+    private static final int  ONE_ARRIVAL     = 1;
+    private static final int  ONE_PARTY       = 1 << PARTIES_SHIFT;
+    private static final int  EMPTY           = 1;
+
+    // The following unpacking methods are usually manually inlined
 
     private static int unarrivedOf(long s) {
-        return (int) (s & ushortMask);
+        int counts = (int)s;
+        return (counts == EMPTY) ? 0 : counts & UNARRIVED_MASK;
     }
 
     private static int partiesOf(long s) {
-        return ((int) s) >>> 16;
+        return (int)s >>> PARTIES_SHIFT;
     }
 
     private static int phaseOf(long s) {
-        return (int) (s >>> 32);
+        return (int)(s >>> PHASE_SHIFT);
     }
 
     private static int arrivedOf(long s) {
-        return partiesOf(s) - unarrivedOf(s);
-    }
-
-    private static long stateFor(int phase, int parties, int unarrived) {
-        return ((((long) phase) << 32) | (((long) parties) << 16) |
-                (long) unarrived);
-    }
-
-    private static long trippedStateFor(int phase, int parties) {
-        long lp = (long) parties;
-        return (((long) phase) << 32) | (lp << 16) | lp;
-    }
-
-    /**
-     * Returns message string for bad bounds exceptions.
-     */
-    private static String badBounds(int parties, int unarrived) {
-        return ("Attempt to set " + unarrived +
-                " unarrived of " + parties + " parties");
+        int counts = (int)s;
+        return (counts == EMPTY) ? 0 :
+            (counts >>> PARTIES_SHIFT) - (counts & UNARRIVED_MASK);
     }
 
     /**
@@ -315,70 +334,180 @@
     private final Phaser parent;
 
     /**
-     * The root of phaser tree. Equals this if not in a tree.  Used to
-     * support faster state push-down.
+     * The root of phaser tree. Equals this if not in a tree.
      */
     private final Phaser root;
 
-    // Wait queues
-
     /**
      * Heads of Treiber stacks for waiting threads. To eliminate
-     * contention while releasing some threads while adding others, we
+     * contention when releasing some threads while adding others, we
      * use two of them, alternating across even and odd phases.
+     * Subphasers share queues with root to speed up releases.
      */
-    private final AtomicReference<QNode> evenQ = new AtomicReference<QNode>();
-    private final AtomicReference<QNode> oddQ  = new AtomicReference<QNode>();
+    private final AtomicReference<QNode> evenQ;
+    private final AtomicReference<QNode> oddQ;
 
     private AtomicReference<QNode> queueFor(int phase) {
         return ((phase & 1) == 0) ? evenQ : oddQ;
     }
 
     /**
-     * Returns current state, first resolving lagged propagation from
-     * root if necessary.
+     * Returns message string for bounds exceptions on arrival.
+     */
+    private String badArrive(long s) {
+        return "Attempted arrival of unregistered party for " +
+            stateToString(s);
+    }
+
+    /**
+     * Returns message string for bounds exceptions on registration.
+     */
+    private String badRegister(long s) {
+        return "Attempt to register more than " +
+            MAX_PARTIES + " parties for " + stateToString(s);
+    }
+
+    /**
+     * Main implementation for methods arrive and arriveAndDeregister.
+     * Manually tuned to speed up and minimize race windows for the
+     * common case of just decrementing unarrived field.
+     *
+     * @param deregister false for arrive, true for arriveAndDeregister
      */
-    private long getReconciledState() {
-        return (parent == null) ? state : reconcileState();
+    private int doArrive(boolean deregister) {
+        int adj = deregister ? ONE_ARRIVAL|ONE_PARTY : ONE_ARRIVAL;
+        final Phaser root = this.root;
+        for (;;) {
+            long s = (root == this) ? state : reconcileState();
+            int phase = (int)(s >>> PHASE_SHIFT);
+            int counts = (int)s;
+            int unarrived = (counts & UNARRIVED_MASK) - 1;
+            if (phase < 0)
+                return phase;
+            else if (counts == EMPTY || unarrived < 0) {
+                if (root == this || reconcileState() == s)
+                    throw new IllegalStateException(badArrive(s));
+            }
+            else if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s-=adj)) {
+                if (unarrived == 0) {
+                    long n = s & PARTIES_MASK;  // base of next state
+                    int nextUnarrived = (int)n >>> PARTIES_SHIFT;
+                    if (root != this)
+                        return parent.doArrive(nextUnarrived == 0);
+                    if (onAdvance(phase, nextUnarrived))
+                        n |= TERMINATION_BIT;
+                    else if (nextUnarrived == 0)
+                        n |= EMPTY;
+                    else
+                        n |= nextUnarrived;
+                    n |= (long)((phase + 1) & MAX_PHASE) << PHASE_SHIFT;
+                    UNSAFE.compareAndSwapLong(this, stateOffset, s, n);
+                    releaseWaiters(phase);
+                }
+                return phase;
+            }
+        }
     }
 
     /**
-     * Recursively resolves state.
+     * Implementation of register, bulkRegister
+     *
+     * @param registrations number to add to both parties and
+     * unarrived fields. Must be greater than zero.
      */
-    private long reconcileState() {
-        Phaser p = parent;
-        long s = state;
-        if (p != null) {
-            while (unarrivedOf(s) == 0 && phaseOf(s) != phaseOf(root.state)) {
-                long parentState = p.getReconciledState();
-                int parentPhase = phaseOf(parentState);
-                int phase = phaseOf(s = state);
-                if (phase != parentPhase) {
-                    long next = trippedStateFor(parentPhase, partiesOf(s));
-                    if (casState(s, next)) {
-                        releaseWaiters(phase);
-                        s = next;
+    private int doRegister(int registrations) {
+        // adjustment to state
+        long adj = ((long)registrations << PARTIES_SHIFT) | registrations;
+        final Phaser parent = this.parent;
+        int phase;
+        for (;;) {
+            long s = state;
+            int counts = (int)s;
+            int parties = counts >>> PARTIES_SHIFT;
+            int unarrived = counts & UNARRIVED_MASK;
+            if (registrations > MAX_PARTIES - parties)
+                throw new IllegalStateException(badRegister(s));
+            else if ((phase = (int)(s >>> PHASE_SHIFT)) < 0)
+                break;
+            else if (counts != EMPTY) {             // not 1st registration
+                if (parent == null || reconcileState() == s) {
+                    if (unarrived == 0)             // wait out advance
+                        root.internalAwaitAdvance(phase, null);
+                    else if (UNSAFE.compareAndSwapLong(this, stateOffset,
+                                                       s, s + adj))
+                        break;
+                }
+            }
+            else if (parent == null) {              // 1st root registration
+                long next = ((long)phase << PHASE_SHIFT) | adj;
+                if (UNSAFE.compareAndSwapLong(this, stateOffset, s, next))
+                    break;
+            }
+            else {
+                synchronized (this) {               // 1st sub registration
+                    if (state == s) {               // recheck under lock
+                        parent.doRegister(1);
+                        do {                        // force current phase
+                            phase = (int)(root.state >>> PHASE_SHIFT);
+                            // assert phase < 0 || (int)state == EMPTY;
+                        } while (!UNSAFE.compareAndSwapLong
+                                 (this, stateOffset, state,
+                                  ((long)phase << PHASE_SHIFT) | adj));
+                        break;
                     }
                 }
             }
         }
+        return phase;
+    }
+
+    /**
+     * Resolves lagged phase propagation from root if necessary.
+     * Reconciliation normally occurs when root has advanced but
+     * subphasers have not yet done so, in which case they must finish
+     * their own advance by setting unarrived to parties (or if
+     * parties is zero, resetting to unregistered EMPTY state).
+     * However, this method may also be called when "floating"
+     * subphasers with possibly some unarrived parties are merely
+     * catching up to current phase, in which case counts are
+     * unaffected.
+     *
+     * @return reconciled state
+     */
+    private long reconcileState() {
+        final Phaser root = this.root;
+        long s = state;
+        if (root != this) {
+            int phase, u, p;
+            // CAS root phase with current parties; possibly trip unarrived
+            while ((phase = (int)(root.state >>> PHASE_SHIFT)) !=
+                   (int)(s >>> PHASE_SHIFT) &&
+                   !UNSAFE.compareAndSwapLong
+                   (this, stateOffset, s,
+                    s = (((long)phase << PHASE_SHIFT) |
+                         (s & PARTIES_MASK) |
+                         ((p = (int)s >>> PARTIES_SHIFT) == 0 ? EMPTY :
+                          (u = (int)s & UNARRIVED_MASK) == 0 ? p : u))))
+                s = state;
+        }
         return s;
     }
 
     /**
-     * Creates a new phaser without any initially registered parties,
-     * initial phase number 0, and no parent. Any thread using this
+     * Creates a new phaser with no initially registered parties, no
+     * parent, and initial phase number 0. Any thread using this
      * phaser will need to first register for it.
      */
     public Phaser() {
-        this(null);
+        this(null, 0);
     }
 
     /**
-     * Creates a new phaser with the given numbers of registered
-     * unarrived parties, initial phase number 0, and no parent.
+     * Creates a new phaser with the given number of registered
+     * unarrived parties, no parent, and initial phase number 0.
      *
-     * @param parties the number of parties required to trip barrier
+     * @param parties the number of parties required to advance to the
+     * next phase
      * @throws IllegalArgumentException if parties less than zero
      * or greater than the maximum number of parties supported
      */
@@ -387,54 +516,62 @@
     }
 
     /**
-     * Creates a new phaser with the given parent, without any
-     * initially registered parties. If parent is non-null this phaser
-     * is registered with the parent and its initial phase number is
-     * the same as that of parent phaser.
+     * Equivalent to {@link #Phaser(Phaser, int) Phaser(parent, 0)}.
      *
      * @param parent the parent phaser
      */
     public Phaser(Phaser parent) {
-        int phase = 0;
-        this.parent = parent;
-        if (parent != null) {
-            this.root = parent.root;
-            phase = parent.register();
-        }
-        else
-            this.root = this;
-        this.state = trippedStateFor(phase, 0);
+        this(parent, 0);
     }
 
     /**
-     * Creates a new phaser with the given parent and numbers of
-     * registered unarrived parties. If parent is non-null, this phaser
-     * is registered with the parent and its initial phase number is
-     * the same as that of parent phaser.
+     * Creates a new phaser with the given parent and number of
+     * registered unarrived parties.  When the given parent is non-null
+     * and the given number of parties is greater than zero, this
+     * child phaser is registered with its parent.
      *
      * @param parent the parent phaser
-     * @param parties the number of parties required to trip barrier
+     * @param parties the number of parties required to advance to the
+     * next phase
      * @throws IllegalArgumentException if parties less than zero
      * or greater than the maximum number of parties supported
      */
     public Phaser(Phaser parent, int parties) {
-        if (parties < 0 || parties > ushortMask)
+        if (parties >>> PARTIES_SHIFT != 0)
             throw new IllegalArgumentException("Illegal number of parties");
         int phase = 0;
         this.parent = parent;
         if (parent != null) {
-            this.root = parent.root;
-            phase = parent.register();
+            final Phaser root = parent.root;
+            this.root = root;
+            this.evenQ = root.evenQ;
+            this.oddQ = root.oddQ;
+            if (parties != 0)
+                phase = parent.doRegister(1);
         }
-        else
+        else {
             this.root = this;
-        this.state = trippedStateFor(phase, parties);
+            this.evenQ = new AtomicReference<QNode>();
+            this.oddQ = new AtomicReference<QNode>();
+        }
+        this.state = (parties == 0) ? (long)EMPTY :
+            ((long)phase << PHASE_SHIFT) |
+            ((long)parties << PARTIES_SHIFT) |
+            ((long)parties);
     }
 
     /**
-     * Adds a new unarrived party to this phaser.
+     * Adds a new unarrived party to this phaser.  If an ongoing
+     * invocation of {@link #onAdvance} is in progress, this method
+     * may await its completion before returning.  If this phaser has
+     * a parent, and this phaser previously had no registered parties,
+     * this child phaser is also registered with its parent. If
+     * this phaser is terminated, the attempt to register has
+     * no effect, and a negative value is returned.
      *
-     * @return the arrival phase number to which this registration applied
+     * @return the arrival phase number to which this registration
+     * applied.  If this value is negative, then this phaser has
+     * terminated, in which case registration has no effect.
      * @throws IllegalStateException if attempting to register more
      * than the maximum supported number of parties
      */
@@ -444,11 +581,22 @@
 
     /**
      * Adds the given number of new unarrived parties to this phaser.
+     * If an ongoing invocation of {@link #onAdvance} is in progress,
+     * this method may await its completion before returning.  If this
+     * phaser has a parent, and the given number of parties is greater
+     * than zero, and this phaser previously had no registered
+     * parties, this child phaser is also registered with its parent.
+     * If this phaser is terminated, the attempt to register has no
+     * effect, and a negative value is returned.
      *
-     * @param parties the number of parties required to trip barrier
-     * @return the arrival phase number to which this registration applied
+     * @param parties the number of additional parties required to
+     * advance to the next phase
+     * @return the arrival phase number to which this registration
+     * applied.  If this value is negative, then this phaser has
+     * terminated, in which case registration has no effect.
      * @throws IllegalStateException if attempting to register more
      * than the maximum supported number of parties
+     * @throws IllegalArgumentException if {@code parties < 0}
      */
     public int bulkRegister(int parties) {
         if (parties < 0)
@@ -459,258 +607,210 @@
     }
 
     /**
-     * Shared code for register, bulkRegister
-     */
-    private int doRegister(int registrations) {
-        int phase;
-        for (;;) {
-            long s = getReconciledState();
-            phase = phaseOf(s);
-            int unarrived = unarrivedOf(s) + registrations;
-            int parties = partiesOf(s) + registrations;
-            if (phase < 0)
-                break;
-            if (parties > ushortMask || unarrived > ushortMask)
-                throw new IllegalStateException(badBounds(parties, unarrived));
-            if (phase == phaseOf(root.state) &&
-                casState(s, stateFor(phase, parties, unarrived)))
-                break;
-        }
-        return phase;
-    }
-
-    /**
-     * Arrives at the barrier, but does not wait for others.  (You can
-     * in turn wait for others via {@link #awaitAdvance}).  It is an
-     * unenforced usage error for an unregistered party to invoke this
-     * method.
+     * Arrives at this phaser, without waiting for others to arrive.
+     *
+     * <p>It is a usage error for an unregistered party to invoke this
+     * method.  However, this error may result in an {@code
+     * IllegalStateException} only upon some subsequent operation on
+     * this phaser, if ever.
      *
      * @return the arrival phase number, or a negative value if terminated
      * @throws IllegalStateException if not terminated and the number
      * of unarrived parties would become negative
      */
     public int arrive() {
-        int phase;
-        for (;;) {
-            long s = state;
-            phase = phaseOf(s);
-            if (phase < 0)
-                break;
-            int parties = partiesOf(s);
-            int unarrived = unarrivedOf(s) - 1;
-            if (unarrived > 0) {        // Not the last arrival
-                if (casState(s, s - 1)) // s-1 adds one arrival
-                    break;
-            }
-            else if (unarrived == 0) {  // the last arrival
-                Phaser par = parent;
-                if (par == null) {      // directly trip
-                    if (casState
-                        (s,
-                         trippedStateFor(onAdvance(phase, parties) ? -1 :
-                                         ((phase + 1) & phaseMask), parties))) {
-                        releaseWaiters(phase);
-                        break;
-                    }
-                }
-                else {                  // cascade to parent
-                    if (casState(s, s - 1)) { // zeroes unarrived
-                        par.arrive();
-                        reconcileState();
-                        break;
-                    }
-                }
-            }
-            else if (phase != phaseOf(root.state)) // or if unreconciled
-                reconcileState();
-            else
-                throw new IllegalStateException(badBounds(parties, unarrived));
-        }
-        return phase;
+        return doArrive(false);
     }
 
     /**
-     * Arrives at the barrier and deregisters from it without waiting
-     * for others. Deregistration reduces the number of parties
-     * required to trip the barrier in future phases.  If this phaser
+     * Arrives at this phaser and deregisters from it without waiting
+     * for others to arrive. Deregistration reduces the number of
+     * parties required to advance in future phases.  If this phaser
      * has a parent, and deregistration causes this phaser to have
-     * zero parties, this phaser also arrives at and is deregistered
-     * from its parent.  It is an unenforced usage error for an
-     * unregistered party to invoke this method.
+     * zero parties, this phaser is also deregistered from its parent.
+     *
+     * <p>It is a usage error for an unregistered party to invoke this
+     * method.  However, this error may result in an {@code
+     * IllegalStateException} only upon some subsequent operation on
+     * this phaser, if ever.
      *
      * @return the arrival phase number, or a negative value if terminated
      * @throws IllegalStateException if not terminated and the number
      * of registered or unarrived parties would become negative
      */
     public int arriveAndDeregister() {
-        // similar code to arrive, but too different to merge
-        Phaser par = parent;
-        int phase;
-        for (;;) {
-            long s = state;
-            phase = phaseOf(s);
-            if (phase < 0)
-                break;
-            int parties = partiesOf(s) - 1;
-            int unarrived = unarrivedOf(s) - 1;
-            if (parties >= 0) {
-                if (unarrived > 0 || (unarrived == 0 && par != null)) {
-                    if (casState
-                        (s,
-                         stateFor(phase, parties, unarrived))) {
-                        if (unarrived == 0) {
-                            par.arriveAndDeregister();
-                            reconcileState();
-                        }
-                        break;
-                    }
-                    continue;
-                }
-                if (unarrived == 0) {
-                    if (casState
-                        (s,
-                         trippedStateFor(onAdvance(phase, parties) ? -1 :
-                                         ((phase + 1) & phaseMask), parties))) {
-                        releaseWaiters(phase);
-                        break;
-                    }
-                    continue;
-                }
-                if (par != null && phase != phaseOf(root.state)) {
-                    reconcileState();
-                    continue;
-                }
-            }
-            throw new IllegalStateException(badBounds(parties, unarrived));
-        }
-        return phase;
+        return doArrive(true);
     }
 
     /**
-     * Arrives at the barrier and awaits others. Equivalent in effect
+     * Arrives at this phaser and awaits others. Equivalent in effect
      * to {@code awaitAdvance(arrive())}.  If you need to await with
      * interruption or timeout, you can arrange this with an analogous
-     * construction using one of the other forms of the awaitAdvance
-     * method.  If instead you need to deregister upon arrival use
-     * {@code arriveAndDeregister}. It is an unenforced usage error
-     * for an unregistered party to invoke this method.
+     * construction using one of the other forms of the {@code
+     * awaitAdvance} method.  If instead you need to deregister upon
+     * arrival, use {@code awaitAdvance(arriveAndDeregister())}.
      *
-     * @return the arrival phase number, or a negative number if terminated
+     * <p>It is a usage error for an unregistered party to invoke this
+     * method.  However, this error may result in an {@code
+     * IllegalStateException} only upon some subsequent operation on
+     * this phaser, if ever.
+     *
+     * @return the arrival phase number, or the (negative)
+     * {@linkplain #getPhase() current phase} if terminated
      * @throws IllegalStateException if not terminated and the number
      * of unarrived parties would become negative
      */
     public int arriveAndAwaitAdvance() {
-        return awaitAdvance(arrive());
+        // Specialization of doArrive+awaitAdvance eliminating some reads/paths
+        final Phaser root = this.root;
+        for (;;) {
+            long s = (root == this) ? state : reconcileState();
+            int phase = (int)(s >>> PHASE_SHIFT);
+            int counts = (int)s;
+            int unarrived = (counts & UNARRIVED_MASK) - 1;
+            if (phase < 0)
+                return phase;
+            else if (counts == EMPTY || unarrived < 0) {
+                if (reconcileState() == s)
+                    throw new IllegalStateException(badArrive(s));
+            }
+            else if (UNSAFE.compareAndSwapLong(this, stateOffset, s,
+                                               s -= ONE_ARRIVAL)) {
+                if (unarrived != 0)
+                    return root.internalAwaitAdvance(phase, null);
+                if (root != this)
+                    return parent.arriveAndAwaitAdvance();
+                long n = s & PARTIES_MASK;  // base of next state
+                int nextUnarrived = (int)n >>> PARTIES_SHIFT;
+                if (onAdvance(phase, nextUnarrived))
+                    n |= TERMINATION_BIT;
+                else if (nextUnarrived == 0)
+                    n |= EMPTY;
+                else
+                    n |= nextUnarrived;
+                int nextPhase = (phase + 1) & MAX_PHASE;
+                n |= (long)nextPhase << PHASE_SHIFT;
+                if (!UNSAFE.compareAndSwapLong(this, stateOffset, s, n))
+                    return (int)(state >>> PHASE_SHIFT); // terminated
+                releaseWaiters(phase);
+                return nextPhase;
+            }
+        }
     }
 
     /**
-     * Awaits the phase of the barrier to advance from the given phase
-     * value, returning immediately if the current phase of the
-     * barrier is not equal to the given phase value or this barrier
-     * is terminated.  It is an unenforced usage error for an
-     * unregistered party to invoke this method.
+     * Awaits the phase of this phaser to advance from the given phase
+     * value, returning immediately if the current phase is not equal
+     * to the given phase value or this phaser is terminated.
      *
      * @param phase an arrival phase number, or negative value if
      * terminated; this argument is normally the value returned by a
-     * previous call to {@code arrive} or its variants
-     * @return the next arrival phase number, or a negative value
-     * if terminated or argument is negative
+     * previous call to {@code arrive} or {@code arriveAndDeregister}.
+     * @return the next arrival phase number, or the argument if it is
+     * negative, or the (negative) {@linkplain #getPhase() current phase}
+     * if terminated
      */
     public int awaitAdvance(int phase) {
+        final Phaser root = this.root;
+        long s = (root == this) ? state : reconcileState();
+        int p = (int)(s >>> PHASE_SHIFT);
         if (phase < 0)
             return phase;
-        long s = getReconciledState();
-        int p = phaseOf(s);
-        if (p != phase)
-            return p;
-        if (unarrivedOf(s) == 0 && parent != null)
-            parent.awaitAdvance(phase);
-        // Fall here even if parent waited, to reconcile and help release
-        return untimedWait(phase);
+        if (p == phase)
+            return root.internalAwaitAdvance(phase, null);
+        return p;
     }
 
     /**
-     * Awaits the phase of the barrier to advance from the given phase
+     * Awaits the phase of this phaser to advance from the given phase
      * value, throwing {@code InterruptedException} if interrupted
-     * while waiting, or returning immediately if the current phase of
-     * the barrier is not equal to the given phase value or this
-     * barrier is terminated. It is an unenforced usage error for an
-     * unregistered party to invoke this method.
+     * while waiting, or returning immediately if the current phase is
+     * not equal to the given phase value or this phaser is
+     * terminated.
      *
      * @param phase an arrival phase number, or negative value if
      * terminated; this argument is normally the value returned by a
-     * previous call to {@code arrive} or its variants
-     * @return the next arrival phase number, or a negative value
-     * if terminated or argument is negative
+     * previous call to {@code arrive} or {@code arriveAndDeregister}.
+     * @return the next arrival phase number, or the argument if it is
+     * negative, or the (negative) {@linkplain #getPhase() current phase}
+     * if terminated
      * @throws InterruptedException if thread interrupted while waiting
      */
     public int awaitAdvanceInterruptibly(int phase)
         throws InterruptedException {
+        final Phaser root = this.root;
+        long s = (root == this) ? state : reconcileState();
+        int p = (int)(s >>> PHASE_SHIFT);
         if (phase < 0)
             return phase;
-        long s = getReconciledState();
-        int p = phaseOf(s);
-        if (p != phase)
-            return p;
-        if (unarrivedOf(s) == 0 && parent != null)
-            parent.awaitAdvanceInterruptibly(phase);
-        return interruptibleWait(phase);
+        if (p == phase) {
+            QNode node = new QNode(this, phase, true, false, 0L);
+            p = root.internalAwaitAdvance(phase, node);
+            if (node.wasInterrupted)
+                throw new InterruptedException();
+        }
+        return p;
     }
 
     /**
-     * Awaits the phase of the barrier to advance from the given phase
+     * Awaits the phase of this phaser to advance from the given phase
      * value or the given timeout to elapse, throwing {@code
      * InterruptedException} if interrupted while waiting, or
-     * returning immediately if the current phase of the barrier is
-     * not equal to the given phase value or this barrier is
-     * terminated.  It is an unenforced usage error for an
-     * unregistered party to invoke this method.
+     * returning immediately if the current phase is not equal to the
+     * given phase value or this phaser is terminated.
      *
      * @param phase an arrival phase number, or negative value if
      * terminated; this argument is normally the value returned by a
-     * previous call to {@code arrive} or its variants
+     * previous call to {@code arrive} or {@code arriveAndDeregister}.
      * @param timeout how long to wait before giving up, in units of
      *        {@code unit}
      * @param unit a {@code TimeUnit} determining how to interpret the
      *        {@code timeout} parameter
-     * @return the next arrival phase number, or a negative value
-     * if terminated or argument is negative
+     * @return the next arrival phase number, or the argument if it is
+     * negative, or the (negative) {@linkplain #getPhase() current phase}
+     * if terminated
      * @throws InterruptedException if thread interrupted while waiting
      * @throws TimeoutException if timed out while waiting
      */
     public int awaitAdvanceInterruptibly(int phase,
                                          long timeout, TimeUnit unit)
         throws InterruptedException, TimeoutException {
+        long nanos = unit.toNanos(timeout);
+        final Phaser root = this.root;
+        long s = (root == this) ? state : reconcileState();
+        int p = (int)(s >>> PHASE_SHIFT);
         if (phase < 0)
             return phase;
-        long s = getReconciledState();
-        int p = phaseOf(s);
-        if (p != phase)
-            return p;
-        if (unarrivedOf(s) == 0 && parent != null)
-            parent.awaitAdvanceInterruptibly(phase, timeout, unit);
-        return timedWait(phase, unit.toNanos(timeout));
+        if (p == phase) {
+            QNode node = new QNode(this, phase, true, true, nanos);
+            p = root.internalAwaitAdvance(phase, node);
+            if (node.wasInterrupted)
+                throw new InterruptedException();
+            else if (p == phase)
+                throw new TimeoutException();
+        }
+        return p;
     }
 
     /**
-     * Forces this barrier to enter termination state. Counts of
-     * arrived and registered parties are unaffected. If this phaser
-     * has a parent, it too is terminated. This method may be useful
-     * for coordinating recovery after one or more tasks encounter
+     * Forces this phaser to enter termination state.  Counts of
+     * registered parties are unaffected.  If this phaser is a member
+     * of a tiered set of phasers, then all of the phasers in the set
+     * are terminated.  If this phaser is already terminated, this
+     * method has no effect.  This method may be useful for
+     * coordinating recovery after one or more tasks encounter
      * unexpected exceptions.
      */
     public void forceTermination() {
-        for (;;) {
-            long s = getReconciledState();
-            int phase = phaseOf(s);
-            int parties = partiesOf(s);
-            int unarrived = unarrivedOf(s);
-            if (phase < 0 ||
-                casState(s, stateFor(-1, parties, unarrived))) {
+        // Only need to change root state
+        final Phaser root = this.root;
+        long s;
+        while ((s = root.state) >= 0) {
+            if (UNSAFE.compareAndSwapLong(root, stateOffset,
+                                          s, s | TERMINATION_BIT)) {
+                // signal all threads
                 releaseWaiters(0);
                 releaseWaiters(1);
-                if (parent != null)
-                    parent.forceTermination();
                 return;
             }
         }
@@ -719,16 +819,18 @@
     /**
      * Returns the current phase number. The maximum phase number is
      * {@code Integer.MAX_VALUE}, after which it restarts at
-     * zero. Upon termination, the phase number is negative.
+     * zero. Upon termination, the phase number is negative,
+     * in which case the prevailing phase prior to termination
+     * may be obtained via {@code getPhase() + Integer.MIN_VALUE}.
      *
      * @return the phase number, or a negative value if terminated
      */
     public final int getPhase() {
-        return phaseOf(getReconciledState());
+        return (int)(root.state >>> PHASE_SHIFT);
     }
 
     /**
-     * Returns the number of parties registered at this barrier.
+     * Returns the number of parties registered at this phaser.
      *
      * @return the number of parties
      */
@@ -738,22 +840,24 @@
 
     /**
      * Returns the number of registered parties that have arrived at
-     * the current phase of this barrier.
+     * the current phase of this phaser. If this phaser has terminated,
+     * the returned value is meaningless and arbitrary.
      *
      * @return the number of arrived parties
      */
     public int getArrivedParties() {
-        return arrivedOf(state);
+        return arrivedOf(reconcileState());
     }
 
     /**
      * Returns the number of registered parties that have not yet
-     * arrived at the current phase of this barrier.
+     * arrived at the current phase of this phaser. If this phaser has
+     * terminated, the returned value is meaningless and arbitrary.
      *
      * @return the number of unarrived parties
      */
     public int getUnarrivedParties() {
-        return unarrivedOf(state);
+        return unarrivedOf(reconcileState());
     }
 
     /**
@@ -776,52 +880,56 @@
     }
 
     /**
-     * Returns {@code true} if this barrier has been terminated.
+     * Returns {@code true} if this phaser has been terminated.
      *
-     * @return {@code true} if this barrier has been terminated
+     * @return {@code true} if this phaser has been terminated
      */
     public boolean isTerminated() {
-        return getPhase() < 0;
+        return root.state < 0L;
     }
 
     /**
      * Overridable method to perform an action upon impending phase
      * advance, and to control termination. This method is invoked
-     * upon arrival of the party tripping the barrier (when all other
+     * upon arrival of the party advancing this phaser (when all other
      * waiting parties are dormant).  If this method returns {@code
-     * true}, then, rather than advance the phase number, this barrier
-     * will be set to a final termination state, and subsequent calls
-     * to {@link #isTerminated} will return true. Any (unchecked)
-     * Exception or Error thrown by an invocation of this method is
-     * propagated to the party attempting to trip the barrier, in
-     * which case no advance occurs.
+     * true}, this phaser will be set to a final termination state
+     * upon advance, and subsequent calls to {@link #isTerminated}
+     * will return true. Any (unchecked) Exception or Error thrown by
+     * an invocation of this method is propagated to the party
+     * attempting to advance this phaser, in which case no advance
+     * occurs.
      *
      * <p>The arguments to this method provide the state of the phaser
-     * prevailing for the current transition. (When called from within
-     * an implementation of {@code onAdvance} the values returned by
-     * methods such as {@code getPhase} may or may not reliably
-     * indicate the state to which this transition applies.)
+     * prevailing for the current transition.  The effects of invoking
+     * arrival, registration, and waiting methods on this phaser from
+     * within {@code onAdvance} are unspecified and should not be
+     * relied on.
      *
-     * <p>The default version returns {@code true} when the number of
-     * registered parties is zero. Normally, overrides that arrange
-     * termination for other reasons should also preserve this
-     * property.
+     * <p>If this phaser is a member of a tiered set of phasers, then
+     * {@code onAdvance} is invoked only for its root phaser on each
+     * advance.
      *
-     * <p>You may override this method to perform an action with side
-     * effects visible to participating tasks, but it is only sensible
-     * to do so in designs where all parties register before any
-     * arrive, and all {@link #awaitAdvance} at each phase.
-     * Otherwise, you cannot ensure lack of interference from other
-     * parties during the invocation of this method. Additionally,
-     * method {@code onAdvance} may be invoked more than once per
-     * transition if registrations are intermixed with arrivals.
+     * <p>To support the most common use cases, the default
+     * implementation of this method returns {@code true} when the
+     * number of registered parties has become zero as the result of a
+     * party invoking {@code arriveAndDeregister}.  You can disable
+     * this behavior, thus enabling continuation upon future
+     * registrations, by overriding this method to always return
+     * {@code false}:
      *
-     * @param phase the phase number on entering the barrier
+     * <pre> {@code
+     * Phaser phaser = new Phaser() {
+     *   protected boolean onAdvance(int phase, int parties) { return false; }
+     * }}</pre>
+     *
+     * @param phase the current phase number on entry to this method,
+     * before this phaser is advanced
      * @param registeredParties the current number of registered parties
-     * @return {@code true} if this barrier should terminate
+     * @return {@code true} if this phaser should terminate
      */
     protected boolean onAdvance(int phase, int registeredParties) {
-        return registeredParties <= 0;
+        return registeredParties == 0;
     }
 
     /**
@@ -831,17 +939,138 @@
      * followed by the number of registered parties, and {@code
      * "arrived = "} followed by the number of arrived parties.
      *
-     * @return a string identifying this barrier, as well as its state
+     * @return a string identifying this phaser, as well as its state
      */
     public String toString() {
-        long s = getReconciledState();
+        return stateToString(reconcileState());
+    }
+
+    /**
+     * Implementation of toString and string-based error messages
+     */
+    private String stateToString(long s) {
         return super.toString() +
             "[phase = " + phaseOf(s) +
             " parties = " + partiesOf(s) +
             " arrived = " + arrivedOf(s) + "]";
     }
 
-    // methods for waiting
+    // Waiting mechanics
+
+    /**
+     * Removes and signals threads from queue for phase.
+     */
+    private void releaseWaiters(int phase) {
+        QNode q;   // first element of queue
+        Thread t;  // its thread
+        AtomicReference<QNode> head = (phase & 1) == 0 ? evenQ : oddQ;
+        while ((q = head.get()) != null &&
+               q.phase != (int)(root.state >>> PHASE_SHIFT)) {
+            if (head.compareAndSet(q, q.next) &&
+                (t = q.thread) != null) {
+                q.thread = null;
+                LockSupport.unpark(t);
+            }
+        }
+    }
+
+    /**
+     * Variant of releaseWaiters that additionally tries to remove any
+     * nodes no longer waiting for advance due to timeout or
+     * interrupt. Currently, nodes are removed only if they are at
+     * head of queue, which suffices to reduce memory footprint in
+     * most usages.
+     *
+     * @return current phase on exit
+     */
+    private int abortWait(int phase) {
+        AtomicReference<QNode> head = (phase & 1) == 0 ? evenQ : oddQ;
+        for (;;) {
+            Thread t;
+            QNode q = head.get();
+            int p = (int)(root.state >>> PHASE_SHIFT);
+            if (q == null || ((t = q.thread) != null && q.phase == p))
+                return p;
+            if (head.compareAndSet(q, q.next) && t != null) {
+                q.thread = null;
+                LockSupport.unpark(t);
+            }
+        }
+    }
+
+    /** The number of CPUs, for spin control */
+    private static final int NCPU = Runtime.getRuntime().availableProcessors();
+
+    /**
+     * The number of times to spin before blocking while waiting for
+     * advance, per arrival while waiting. On multiprocessors, fully
+     * blocking and waking up a large number of threads all at once is
+     * usually a very slow process, so we use rechargeable spins to
+     * avoid it when threads regularly arrive: When a thread in
+     * internalAwaitAdvance notices another arrival before blocking,
+     * and there appear to be enough CPUs available, it spins
+     * SPINS_PER_ARRIVAL more times before blocking. The value trades
+     * off good-citizenship vs big unnecessary slowdowns.
+     */
+    static final int SPINS_PER_ARRIVAL = (NCPU < 2) ? 1 : 1 << 8;
+
+    /**
+     * Possibly blocks and waits for phase to advance unless aborted.
+     * Call only from root node.
+     *
+     * @param phase current phase
+     * @param node if non-null, the wait node to track interrupt and timeout;
+     * if null, denotes noninterruptible wait
+     * @return current phase
+     */
+    private int internalAwaitAdvance(int phase, QNode node) {
+        releaseWaiters(phase-1);          // ensure old queue clean
+        boolean queued = false;           // true when node is enqueued
+        int lastUnarrived = 0;            // to increase spins upon change
+        int spins = SPINS_PER_ARRIVAL;
+        long s;
+        int p;
+        while ((p = (int)((s = state) >>> PHASE_SHIFT)) == phase) {
+            if (node == null) {           // spinning in noninterruptible mode
+                int unarrived = (int)s & UNARRIVED_MASK;
+                if (unarrived != lastUnarrived &&
+                    (lastUnarrived = unarrived) < NCPU)
+                    spins += SPINS_PER_ARRIVAL;
+                boolean interrupted = Thread.interrupted();
+                if (interrupted || --spins < 0) { // need node to record intr
+                    node = new QNode(this, phase, false, false, 0L);
+                    node.wasInterrupted = interrupted;
+                }
+            }
+            else if (node.isReleasable()) // done or aborted
+                break;
+            else if (!queued) {           // push onto queue
+                AtomicReference<QNode> head = (phase & 1) == 0 ? evenQ : oddQ;
+                QNode q = node.next = head.get();
+                if ((q == null || q.phase == phase) &&
+                    (int)(state >>> PHASE_SHIFT) == phase) // avoid stale enq
+                    queued = head.compareAndSet(q, node);
+            }
+            else {
+                try {
+                    ForkJoinPool.managedBlock(node);
+                } catch (InterruptedException ie) {
+                    node.wasInterrupted = true;
+                }
+            }
+        }
+
+        if (node != null) {
+            if (node.thread != null)
+                node.thread = null;       // avoid need for unpark()
+            if (node.wasInterrupted && !node.interruptible)
+                Thread.currentThread().interrupt();
+            if (p == phase && (p = (int)(state >>> PHASE_SHIFT)) == phase)
+                return abortWait(phase); // possibly clean up on abort
+        }
+        releaseWaiters(phase);
+        return p;
+    }
 
     /**
      * Wait nodes for Treiber stack representing wait queue
@@ -849,174 +1078,61 @@
     static final class QNode implements ForkJoinPool.ManagedBlocker {
         final Phaser phaser;
         final int phase;
-        final long startTime;
-        final long nanos;
+        final boolean interruptible;
         final boolean timed;
-        final boolean interruptible;
-        volatile boolean wasInterrupted = false;
+        boolean wasInterrupted;
+        long nanos;
+        long lastTime;
         volatile Thread thread; // nulled to cancel wait
         QNode next;
+
         QNode(Phaser phaser, int phase, boolean interruptible,
-              boolean timed, long startTime, long nanos) {
+              boolean timed, long nanos) {
             this.phaser = phaser;
             this.phase = phase;
+            this.interruptible = interruptible;
+            this.nanos = nanos;
             this.timed = timed;
-            this.interruptible = interruptible;
-            this.startTime = startTime;
-            this.nanos = nanos;
+            this.lastTime = timed ? System.nanoTime() : 0L;
             thread = Thread.currentThread();
         }
-        public boolean isReleasable() {
-            return (thread == null ||
-                    phaser.getPhase() != phase ||
-                    (interruptible && wasInterrupted) ||
-                    (timed && (nanos - (System.nanoTime() - startTime)) <= 0));
-        }
-        public boolean block() {
-            if (Thread.interrupted()) {
-                wasInterrupted = true;
-                if (interruptible)
-                    return true;
-            }
-            if (!timed)
-                LockSupport.park(this);
-            else {
-                long waitTime = nanos - (System.nanoTime() - startTime);
-                if (waitTime <= 0)
-                    return true;
-                LockSupport.parkNanos(this, waitTime);
-            }
-            return isReleasable();
-        }
-        void signal() {
-            Thread t = thread;
-            if (t != null) {
-                thread = null;
-                LockSupport.unpark(t);
-            }
-        }
-        boolean doWait() {
-            if (thread != null) {
-                try {
-                    ForkJoinPool.managedBlock(this);
-                } catch (InterruptedException ie) {
-                }
-            }
-            return wasInterrupted;
-        }
 
-    }
-
-    /**
-     * Removes and signals waiting threads from wait queue.
-     */
-    private void releaseWaiters(int phase) {
-        AtomicReference<QNode> head = queueFor(phase);
-        QNode q;
-        while ((q = head.get()) != null) {
-            if (head.compareAndSet(q, q.next))
-                q.signal();
+        public boolean isReleasable() {
+            if (thread == null)
+                return true;
+            if (phaser.getPhase() != phase) {
+                thread = null;
+                return true;
+            }
+            if (Thread.interrupted())
+                wasInterrupted = true;
+            if (wasInterrupted && interruptible) {
+                thread = null;
+                return true;
+            }
+            if (timed) {
+                if (nanos > 0L) {
+                    long now = System.nanoTime();
+                    nanos -= now - lastTime;
+                    lastTime = now;
+                }
+                if (nanos <= 0L) {
+                    thread = null;
+                    return true;
+                }
+            }
+            return false;
         }
-    }
-
-    /**
-     * Tries to enqueue given node in the appropriate wait queue.
-     *
-     * @return true if successful
-     */
-    private boolean tryEnqueue(QNode node) {
-        AtomicReference<QNode> head = queueFor(node.phase);
-        return head.compareAndSet(node.next = head.get(), node);
-    }
-
-    /**
-     * Enqueues node and waits unless aborted or signalled.
-     *
-     * @return current phase
-     */
-    private int untimedWait(int phase) {
-        QNode node = null;
-        boolean queued = false;
-        boolean interrupted = false;
-        int p;
-        while ((p = getPhase()) == phase) {
-            if (Thread.interrupted())
-                interrupted = true;
-            else if (node == null)
-                node = new QNode(this, phase, false, false, 0, 0);
-            else if (!queued)
-                queued = tryEnqueue(node);
-            else
-                interrupted = node.doWait();
-        }
-        if (node != null)
-            node.thread = null;
-        releaseWaiters(phase);
-        if (interrupted)
-            Thread.currentThread().interrupt();
-        return p;
-    }
 
-    /**
-     * Interruptible version
-     * @return current phase
-     */
-    private int interruptibleWait(int phase) throws InterruptedException {
-        QNode node = null;
-        boolean queued = false;
-        boolean interrupted = false;
-        int p;
-        while ((p = getPhase()) == phase && !interrupted) {
-            if (Thread.interrupted())
-                interrupted = true;
-            else if (node == null)
-                node = new QNode(this, phase, true, false, 0, 0);
-            else if (!queued)
-                queued = tryEnqueue(node);
-            else
-                interrupted = node.doWait();
+        public boolean block() {
+            if (isReleasable())
+                return true;
+            else if (!timed)
+                LockSupport.park(this);
+            else if (nanos > 0)
+                LockSupport.parkNanos(this, nanos);
+            return isReleasable();
         }
-        if (node != null)
-            node.thread = null;
-        if (p != phase || (p = getPhase()) != phase)
-            releaseWaiters(phase);
-        if (interrupted)
-            throw new InterruptedException();
-        return p;
-    }
-
-    /**
-     * Timeout version.
-     * @return current phase
-     */
-    private int timedWait(int phase, long nanos)
-        throws InterruptedException, TimeoutException {
-        long startTime = System.nanoTime();
-        QNode node = null;
-        boolean queued = false;
-        boolean interrupted = false;
-        int p;
-        while ((p = getPhase()) == phase && !interrupted) {
-            if (Thread.interrupted())
-                interrupted = true;
-            else if (nanos - (System.nanoTime() - startTime) <= 0)
-                break;
-            else if (node == null)
-                node = new QNode(this, phase, true, true, startTime, nanos);
-            else if (!queued)
-                queued = tryEnqueue(node);
-            else
-                interrupted = node.doWait();
-        }
-        if (node != null)
-            node.thread = null;
-        if (p != phase || (p = getPhase()) != phase)
-            releaseWaiters(phase);
-        if (interrupted)
-            throw new InterruptedException();
-        if (p == phase)
-            throw new TimeoutException();
-        return p;
     }
 
     // Unsafe mechanics
@@ -1025,10 +1141,6 @@
     private static final long stateOffset =
         objectFieldOffset("state", Phaser.class);
 
-    private final boolean casState(long cmp, long val) {
-        return UNSAFE.compareAndSwapLong(this, stateOffset, cmp, val);
-    }
-
     private static long objectFieldOffset(String field, Class<?> klazz) {
         try {
             return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
--- a/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -43,11 +43,11 @@
  * the same ordering rules as class {@link PriorityQueue} and supplies
  * blocking retrieval operations.  While this queue is logically
  * unbounded, attempted additions may fail due to resource exhaustion
- * (causing <tt>OutOfMemoryError</tt>). This class does not permit
- * <tt>null</tt> elements.  A priority queue relying on {@linkplain
+ * (causing {@code OutOfMemoryError}). This class does not permit
+ * {@code null} elements.  A priority queue relying on {@linkplain
  * Comparable natural ordering} also does not permit insertion of
  * non-comparable objects (doing so results in
- * <tt>ClassCastException</tt>).
+ * {@code ClassCastException}).
  *
  * <p>This class and its iterator implement all of the
  * <em>optional</em> methods of the {@link Collection} and {@link
@@ -55,7 +55,7 @@
  * #iterator()} is <em>not</em> guaranteed to traverse the elements of
  * the PriorityBlockingQueue in any particular order. If you need
  * ordered traversal, consider using
- * <tt>Arrays.sort(pq.toArray())</tt>.  Also, method <tt>drainTo</tt>
+ * {@code Arrays.sort(pq.toArray())}.  Also, method {@code drainTo}
  * can be used to <em>remove</em> some or all elements in priority
  * order and place them in another collection.
  *
@@ -65,12 +65,12 @@
  * secondary key to break ties in primary priority values.  For
  * example, here is a class that applies first-in-first-out
  * tie-breaking to comparable elements. To use it, you would insert a
- * <tt>new FIFOEntry(anEntry)</tt> instead of a plain entry object.
+ * {@code new FIFOEntry(anEntry)} instead of a plain entry object.
  *
- * <pre>
- * class FIFOEntry&lt;E extends Comparable&lt;? super E&gt;&gt;
- *     implements Comparable&lt;FIFOEntry&lt;E&gt;&gt; {
- *   final static AtomicLong seq = new AtomicLong();
+ *  <pre> {@code
+ * class FIFOEntry<E extends Comparable<? super E>>
+ *     implements Comparable<FIFOEntry<E>> {
+ *   static final AtomicLong seq = new AtomicLong(0);
  *   final long seqNum;
  *   final E entry;
  *   public FIFOEntry(E entry) {
@@ -78,13 +78,13 @@
  *     this.entry = entry;
  *   }
  *   public E getEntry() { return entry; }
- *   public int compareTo(FIFOEntry&lt;E&gt; other) {
+ *   public int compareTo(FIFOEntry<E> other) {
  *     int res = entry.compareTo(other.entry);
- *     if (res == 0 &amp;&amp; other.entry != this.entry)
- *       res = (seqNum &lt; other.seqNum ? -1 : 1);
+ *     if (res == 0 && other.entry != this.entry)
+ *       res = (seqNum < other.seqNum ? -1 : 1);
  *     return res;
  *   }
- * }</pre>
+ * }}</pre>
  *
  * <p>This class is a member of the
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
@@ -98,34 +98,102 @@
     implements BlockingQueue<E>, java.io.Serializable {
     private static final long serialVersionUID = 5595510919245408276L;
 
-    private final PriorityQueue<E> q;
-    private final ReentrantLock lock = new ReentrantLock(true);
-    private final Condition notEmpty = lock.newCondition();
+    /*
+     * The implementation uses an array-based binary heap, with public
+     * operations protected with a single lock. However, allocation
+     * during resizing uses a simple spinlock (used only while not
+     * holding main lock) in order to allow takes to operate
+     * concurrently with allocation.  This avoids repeated
+     * postponement of waiting consumers and consequent element
+     * build-up. The need to back away from lock during allocation
+     * makes it impossible to simply wrap delegated
+     * java.util.PriorityQueue operations within a lock, as was done
+     * in a previous version of this class. To maintain
+     * interoperability, a plain PriorityQueue is still used during
+     * serialization, which maintains compatibility at the espense of
+     * transiently doubling overhead.
+     */
+
+    /**
+     * Default array capacity.
+     */
+    private static final int DEFAULT_INITIAL_CAPACITY = 11;
+
+    /**
+     * The maximum size of array to allocate.
+     * Some VMs reserve some header words in an array.
+     * Attempts to allocate larger arrays may result in
+     * OutOfMemoryError: Requested array size exceeds VM limit
+     */
+    private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
 
     /**
-     * Creates a <tt>PriorityBlockingQueue</tt> with the default
+     * Priority queue represented as a balanced binary heap: the two
+     * children of queue[n] are queue[2*n+1] and queue[2*(n+1)].  The
+     * priority queue is ordered by comparator, or by the elements'
+     * natural ordering, if comparator is null: For each node n in the
+     * heap and each descendant d of n, n <= d.  The element with the
+     * lowest value is in queue[0], assuming the queue is nonempty.
+     */
+    private transient Object[] queue;
+
+    /**
+     * The number of elements in the priority queue.
+     */
+    private transient int size;
+
+    /**
+     * The comparator, or null if priority queue uses elements'
+     * natural ordering.
+     */
+    private transient Comparator<? super E> comparator;
+
+    /**
+     * Lock used for all public operations
+     */
+    private final ReentrantLock lock;
+
+    /**
+     * Condition for blocking when empty
+     */
+    private final Condition notEmpty;
+
+    /**
+     * Spinlock for allocation, acquired via CAS.
+     */
+    private transient volatile int allocationSpinLock;
+
+    /**
+     * A plain PriorityQueue used only for serialization,
+     * to maintain compatibility with previous versions
+     * of this class. Non-null only during serialization/deserialization.
+     */
+    private PriorityQueue q;
+
+    /**
+     * Creates a {@code PriorityBlockingQueue} with the default
      * initial capacity (11) that orders its elements according to
      * their {@linkplain Comparable natural ordering}.
      */
     public PriorityBlockingQueue() {
-        q = new PriorityQueue<E>();
+        this(DEFAULT_INITIAL_CAPACITY, null);
     }
 
     /**
-     * Creates a <tt>PriorityBlockingQueue</tt> with the specified
+     * Creates a {@code PriorityBlockingQueue} with the specified
      * initial capacity that orders its elements according to their
      * {@linkplain Comparable natural ordering}.
      *
      * @param initialCapacity the initial capacity for this priority queue
-     * @throws IllegalArgumentException if <tt>initialCapacity</tt> is less
+     * @throws IllegalArgumentException if {@code initialCapacity} is less
      *         than 1
      */
     public PriorityBlockingQueue(int initialCapacity) {
-        q = new PriorityQueue<E>(initialCapacity, null);
+        this(initialCapacity, null);
     }
 
     /**
-     * Creates a <tt>PriorityBlockingQueue</tt> with the specified initial
+     * Creates a {@code PriorityBlockingQueue} with the specified initial
      * capacity that orders its elements according to the specified
      * comparator.
      *
@@ -133,16 +201,21 @@
      * @param  comparator the comparator that will be used to order this
      *         priority queue.  If {@code null}, the {@linkplain Comparable
      *         natural ordering} of the elements will be used.
-     * @throws IllegalArgumentException if <tt>initialCapacity</tt> is less
+     * @throws IllegalArgumentException if {@code initialCapacity} is less
      *         than 1
      */
     public PriorityBlockingQueue(int initialCapacity,
                                  Comparator<? super E> comparator) {
-        q = new PriorityQueue<E>(initialCapacity, comparator);
+        if (initialCapacity < 1)
+            throw new IllegalArgumentException();
+        this.lock = new ReentrantLock();
+        this.notEmpty = lock.newCondition();
+        this.comparator = comparator;
+        this.queue = new Object[initialCapacity];
     }
 
     /**
-     * Creates a <tt>PriorityBlockingQueue</tt> containing the elements
+     * Creates a {@code PriorityBlockingQueue} containing the elements
      * in the specified collection.  If the specified collection is a
      * {@link SortedSet} or a {@link PriorityQueue},  this
      * priority queue will be ordered according to the same ordering.
@@ -158,14 +231,215 @@
      *         of its elements are null
      */
     public PriorityBlockingQueue(Collection<? extends E> c) {
-        q = new PriorityQueue<E>(c);
+        this.lock = new ReentrantLock();
+        this.notEmpty = lock.newCondition();
+        boolean heapify = true; // true if not known to be in heap order
+        boolean screen = true;  // true if must screen for nulls
+        if (c instanceof SortedSet<?>) {
+            SortedSet<? extends E> ss = (SortedSet<? extends E>) c;
+            this.comparator = (Comparator<? super E>) ss.comparator();
+            heapify = false;
+        }
+        else if (c instanceof PriorityBlockingQueue<?>) {
+            PriorityBlockingQueue<? extends E> pq =
+                (PriorityBlockingQueue<? extends E>) c;
+            this.comparator = (Comparator<? super E>) pq.comparator();
+            screen = false;
+            if (pq.getClass() == PriorityBlockingQueue.class) // exact match
+                heapify = false;
+        }
+        Object[] a = c.toArray();
+        int n = a.length;
+        // If c.toArray incorrectly doesn't return Object[], copy it.
+        if (a.getClass() != Object[].class)
+            a = Arrays.copyOf(a, n, Object[].class);
+        if (screen && (n == 1 || this.comparator != null)) {
+            for (int i = 0; i < n; ++i)
+                if (a[i] == null)
+                    throw new NullPointerException();
+        }
+        this.queue = a;
+        this.size = n;
+        if (heapify)
+            heapify();
+    }
+
+    /**
+     * Tries to grow array to accommodate at least one more element
+     * (but normally expand by about 50%), giving up (allowing retry)
+     * on contention (which we expect to be rare). Call only while
+     * holding lock.
+     *
+     * @param array the heap array
+     * @param oldCap the length of the array
+     */
+    private void tryGrow(Object[] array, int oldCap) {
+        lock.unlock(); // must release and then re-acquire main lock
+        Object[] newArray = null;
+        if (allocationSpinLock == 0 &&
+            UNSAFE.compareAndSwapInt(this, allocationSpinLockOffset,
+                                     0, 1)) {
+            try {
+                int newCap = oldCap + ((oldCap < 64) ?
+                                       (oldCap + 2) : // grow faster if small
+                                       (oldCap >> 1));
+                if (newCap - MAX_ARRAY_SIZE > 0) {    // possible overflow
+                    int minCap = oldCap + 1;
+                    if (minCap < 0 || minCap > MAX_ARRAY_SIZE)
+                        throw new OutOfMemoryError();
+                    newCap = MAX_ARRAY_SIZE;
+                }
+                if (newCap > oldCap && queue == array)
+                    newArray = new Object[newCap];
+            } finally {
+                allocationSpinLock = 0;
+            }
+        }
+        if (newArray == null) // back off if another thread is allocating
+            Thread.yield();
+        lock.lock();
+        if (newArray != null && queue == array) {
+            queue = newArray;
+            System.arraycopy(array, 0, newArray, 0, oldCap);
+        }
+    }
+
+    /**
+     * Mechanics for poll().  Call only while holding lock.
+     */
+    private E extract() {
+        E result;
+        int n = size - 1;
+        if (n < 0)
+            result = null;
+        else {
+            Object[] array = queue;
+            result = (E) array[0];
+            E x = (E) array[n];
+            array[n] = null;
+            Comparator<? super E> cmp = comparator;
+            if (cmp == null)
+                siftDownComparable(0, x, array, n);
+            else
+                siftDownUsingComparator(0, x, array, n, cmp);
+            size = n;
+        }
+        return result;
+    }
+
+    /**
+     * Inserts item x at position k, maintaining heap invariant by
+     * promoting x up the tree until it is greater than or equal to
+     * its parent, or is the root.
+     *
+     * To simplify and speed up coercions and comparisons. the
+     * Comparable and Comparator versions are separated into different
+     * methods that are otherwise identical. (Similarly for siftDown.)
+     * These methods are static, with heap state as arguments, to
+     * simplify use in light of possible comparator exceptions.
+     *
+     * @param k the position to fill
+     * @param x the item to insert
+     * @param array the heap array
+     * @param n heap size
+     */
+    private static <T> void siftUpComparable(int k, T x, Object[] array) {
+        Comparable<? super T> key = (Comparable<? super T>) x;
+        while (k > 0) {
+            int parent = (k - 1) >>> 1;
+            Object e = array[parent];
+            if (key.compareTo((T) e) >= 0)
+                break;
+            array[k] = e;
+            k = parent;
+        }
+        array[k] = key;
+    }
+
+    private static <T> void siftUpUsingComparator(int k, T x, Object[] array,
+                                       Comparator<? super T> cmp) {
+        while (k > 0) {
+            int parent = (k - 1) >>> 1;
+            Object e = array[parent];
+            if (cmp.compare(x, (T) e) >= 0)
+                break;
+            array[k] = e;
+            k = parent;
+        }
+        array[k] = x;
+    }
+
+    /**
+     * Inserts item x at position k, maintaining heap invariant by
+     * demoting x down the tree repeatedly until it is less than or
+     * equal to its children or is a leaf.
+     *
+     * @param k the position to fill
+     * @param x the item to insert
+     * @param array the heap array
+     * @param n heap size
+     */
+    private static <T> void siftDownComparable(int k, T x, Object[] array,
+                                               int n) {
+        Comparable<? super T> key = (Comparable<? super T>)x;
+        int half = n >>> 1;           // loop while a non-leaf
+        while (k < half) {
+            int child = (k << 1) + 1; // assume left child is least
+            Object c = array[child];
+            int right = child + 1;
+            if (right < n &&
+                ((Comparable<? super T>) c).compareTo((T) array[right]) > 0)
+                c = array[child = right];
+            if (key.compareTo((T) c) <= 0)
+                break;
+            array[k] = c;
+            k = child;
+        }
+        array[k] = key;
+    }
+
+    private static <T> void siftDownUsingComparator(int k, T x, Object[] array,
+                                                    int n,
+                                                    Comparator<? super T> cmp) {
+        int half = n >>> 1;
+        while (k < half) {
+            int child = (k << 1) + 1;
+            Object c = array[child];
+            int right = child + 1;
+            if (right < n && cmp.compare((T) c, (T) array[right]) > 0)
+                c = array[child = right];
+            if (cmp.compare(x, (T) c) <= 0)
+                break;
+            array[k] = c;
+            k = child;
+        }
+        array[k] = x;
+    }
+
+    /**
+     * Establishes the heap invariant (described above) in the entire tree,
+     * assuming nothing about the order of the elements prior to the call.
+     */
+    private void heapify() {
+        Object[] array = queue;
+        int n = size;
+        int half = (n >>> 1) - 1;
+        Comparator<? super E> cmp = comparator;
+        if (cmp == null) {
+            for (int i = half; i >= 0; i--)
+                siftDownComparable(i, (E) array[i], array, n);
+        }
+        else {
+            for (int i = half; i >= 0; i--)
+                siftDownUsingComparator(i, (E) array[i], array, n, cmp);
+        }
     }
 
     /**
      * Inserts the specified element into this priority queue.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Collection#add})
+     * @return {@code true} (as specified by {@link Collection#add})
      * @throws ClassCastException if the specified element cannot be compared
      *         with elements currently in the priority queue according to the
      *         priority queue's ordering
@@ -177,30 +451,41 @@
 
     /**
      * Inserts the specified element into this priority queue.
+     * As the queue is unbounded, this method will never return {@code false}.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Queue#offer})
+     * @return {@code true} (as specified by {@link Queue#offer})
      * @throws ClassCastException if the specified element cannot be compared
      *         with elements currently in the priority queue according to the
      *         priority queue's ordering
      * @throws NullPointerException if the specified element is null
      */
     public boolean offer(E e) {
+        if (e == null)
+            throw new NullPointerException();
         final ReentrantLock lock = this.lock;
         lock.lock();
+        int n, cap;
+        Object[] array;
+        while ((n = size) >= (cap = (array = queue).length))
+            tryGrow(array, cap);
         try {
-            boolean ok = q.offer(e);
-            assert ok;
+            Comparator<? super E> cmp = comparator;
+            if (cmp == null)
+                siftUpComparable(n, e, array);
+            else
+                siftUpUsingComparator(n, e, array, cmp);
+            size = n + 1;
             notEmpty.signal();
-            return true;
         } finally {
             lock.unlock();
         }
+        return true;
     }
 
     /**
-     * Inserts the specified element into this priority queue. As the queue is
-     * unbounded this method will never block.
+     * Inserts the specified element into this priority queue.
+     * As the queue is unbounded, this method will never block.
      *
      * @param e the element to add
      * @throws ClassCastException if the specified element cannot be compared
@@ -213,13 +498,15 @@
     }
 
     /**
-     * Inserts the specified element into this priority queue. As the queue is
-     * unbounded this method will never block.
+     * Inserts the specified element into this priority queue.
+     * As the queue is unbounded, this method will never block or
+     * return {@code false}.
      *
      * @param e the element to add
      * @param timeout This parameter is ignored as the method never blocks
      * @param unit This parameter is ignored as the method never blocks
-     * @return <tt>true</tt>
+     * @return {@code true} (as specified by
+     *  {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer})
      * @throws ClassCastException if the specified element cannot be compared
      *         with elements currently in the priority queue according to the
      *         priority queue's ordering
@@ -232,95 +519,121 @@
     public E poll() {
         final ReentrantLock lock = this.lock;
         lock.lock();
+        E result;
         try {
-            return q.poll();
+            result = extract();
         } finally {
             lock.unlock();
         }
+        return result;
     }
 
     public E take() throws InterruptedException {
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
+        E result;
         try {
-            try {
-                while (q.size() == 0)
-                    notEmpty.await();
-            } catch (InterruptedException ie) {
-                notEmpty.signal(); // propagate to non-interrupted thread
-                throw ie;
-            }
-            E x = q.poll();
-            assert x != null;
-            return x;
+            while ( (result = extract()) == null)
+                notEmpty.await();
         } finally {
             lock.unlock();
         }
+        return result;
     }
 
     public E poll(long timeout, TimeUnit unit) throws InterruptedException {
         long nanos = unit.toNanos(timeout);
         final ReentrantLock lock = this.lock;
         lock.lockInterruptibly();
+        E result;
         try {
-            for (;;) {
-                E x = q.poll();
-                if (x != null)
-                    return x;
-                if (nanos <= 0)
-                    return null;
-                try {
-                    nanos = notEmpty.awaitNanos(nanos);
-                } catch (InterruptedException ie) {
-                    notEmpty.signal(); // propagate to non-interrupted thread
-                    throw ie;
-                }
-            }
+            while ( (result = extract()) == null && nanos > 0)
+                nanos = notEmpty.awaitNanos(nanos);
         } finally {
             lock.unlock();
         }
+        return result;
     }
 
     public E peek() {
         final ReentrantLock lock = this.lock;
         lock.lock();
+        E result;
         try {
-            return q.peek();
+            result = size > 0 ? (E) queue[0] : null;
+        } finally {
+            lock.unlock();
+        }
+        return result;
+    }
+
+    /**
+     * Returns the comparator used to order the elements in this queue,
+     * or {@code null} if this queue uses the {@linkplain Comparable
+     * natural ordering} of its elements.
+     *
+     * @return the comparator used to order the elements in this queue,
+     *         or {@code null} if this queue uses the natural
+     *         ordering of its elements
+     */
+    public Comparator<? super E> comparator() {
+        return comparator;
+    }
+
+    public int size() {
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            return size;
         } finally {
             lock.unlock();
         }
     }
 
     /**
-     * Returns the comparator used to order the elements in this queue,
-     * or <tt>null</tt> if this queue uses the {@linkplain Comparable
-     * natural ordering} of its elements.
-     *
-     * @return the comparator used to order the elements in this queue,
-     *         or <tt>null</tt> if this queue uses the natural
-     *         ordering of its elements
+     * Always returns {@code Integer.MAX_VALUE} because
+     * a {@code PriorityBlockingQueue} is not capacity constrained.
+     * @return {@code Integer.MAX_VALUE} always
      */
-    public Comparator<? super E> comparator() {
-        return q.comparator();
+    public int remainingCapacity() {
+        return Integer.MAX_VALUE;
     }
 
-    public int size() {
-        final ReentrantLock lock = this.lock;
-        lock.lock();
-        try {
-            return q.size();
-        } finally {
-            lock.unlock();
+    private int indexOf(Object o) {
+        if (o != null) {
+            Object[] array = queue;
+            int n = size;
+            for (int i = 0; i < n; i++)
+                if (o.equals(array[i]))
+                    return i;
         }
+        return -1;
     }
 
     /**
-     * Always returns <tt>Integer.MAX_VALUE</tt> because
-     * a <tt>PriorityBlockingQueue</tt> is not capacity constrained.
-     * @return <tt>Integer.MAX_VALUE</tt>
+     * Removes the ith element from queue.
      */
-    public int remainingCapacity() {
-        return Integer.MAX_VALUE;
+    private void removeAt(int i) {
+        Object[] array = queue;
+        int n = size - 1;
+        if (n == i) // removed last element
+            array[i] = null;
+        else {
+            E moved = (E) array[n];
+            array[n] = null;
+            Comparator<? super E> cmp = comparator;
+            if (cmp == null)
+                siftDownComparable(i, moved, array, n);
+            else
+                siftDownUsingComparator(i, moved, array, n, cmp);
+            if (array[i] == moved) {
+                if (cmp == null)
+                    siftUpComparable(i, moved, array);
+                else
+                    siftUpUsingComparator(i, moved, array, cmp);
+            }
+        }
+        size = n;
     }
 
     /**
@@ -332,13 +645,40 @@
      * result of the call).
      *
      * @param o element to be removed from this queue, if present
-     * @return <tt>true</tt> if this queue changed as a result of the call
+     * @return {@code true} if this queue changed as a result of the call
      */
     public boolean remove(Object o) {
+        boolean removed = false;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return q.remove(o);
+            int i = indexOf(o);
+            if (i != -1) {
+                removeAt(i);
+                removed = true;
+            }
+        } finally {
+            lock.unlock();
+        }
+        return removed;
+    }
+
+
+    /**
+     * Identity-based version for use in Itr.remove
+     */
+    private void removeEQ(Object o) {
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            Object[] array = queue;
+            int n = size;
+            for (int i = 0; i < n; i++) {
+                if (o == array[i]) {
+                    removeAt(i);
+                    break;
+                }
+            }
         } finally {
             lock.unlock();
         }
@@ -350,16 +690,18 @@
      * at least one element {@code e} such that {@code o.equals(e)}.
      *
      * @param o object to be checked for containment in this queue
-     * @return <tt>true</tt> if this queue contains the specified element
+     * @return {@code true} if this queue contains the specified element
      */
     public boolean contains(Object o) {
+        int index;
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return q.contains(o);
+            index = indexOf(o);
         } finally {
             lock.unlock();
         }
+        return index != -1;
     }
 
     /**
@@ -379,7 +721,7 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return q.toArray();
+            return Arrays.copyOf(queue, size);
         } finally {
             lock.unlock();
         }
@@ -390,7 +732,18 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return q.toString();
+            int n = size;
+            if (n == 0)
+                return "[]";
+            StringBuilder sb = new StringBuilder();
+            sb.append('[');
+            for (int i = 0; i < n; ++i) {
+                E e = (E)queue[i];
+                sb.append(e == this ? "(this Collection)" : e);
+                if (i != n - 1)
+                    sb.append(',').append(' ');
+            }
+            return sb.append(']').toString();
         } finally {
             lock.unlock();
         }
@@ -412,7 +765,7 @@
         try {
             int n = 0;
             E e;
-            while ( (e = q.poll()) != null) {
+            while ( (e = extract()) != null) {
                 c.add(e);
                 ++n;
             }
@@ -440,7 +793,7 @@
         try {
             int n = 0;
             E e;
-            while (n < maxElements && (e = q.poll()) != null) {
+            while (n < maxElements && (e = extract()) != null) {
                 c.add(e);
                 ++n;
             }
@@ -458,7 +811,11 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            q.clear();
+            Object[] array = queue;
+            int n = size;
+            size = 0;
+            for (int i = 0; i < n; i++)
+                array[i] = null;
         } finally {
             lock.unlock();
         }
@@ -475,22 +832,22 @@
      * <p>If this queue fits in the specified array with room to spare
      * (i.e., the array has more elements than this queue), the element in
      * the array immediately following the end of the queue is set to
-     * <tt>null</tt>.
+     * {@code null}.
      *
      * <p>Like the {@link #toArray()} method, this method acts as bridge between
      * array-based and collection-based APIs.  Further, this method allows
      * precise control over the runtime type of the output array, and may,
      * under certain circumstances, be used to save allocation costs.
      *
-     * <p>Suppose <tt>x</tt> is a queue known to contain only strings.
+     * <p>Suppose {@code x} is a queue known to contain only strings.
      * The following code can be used to dump the queue into a newly
-     * allocated array of <tt>String</tt>:
+     * allocated array of {@code String}:
      *
      * <pre>
      *     String[] y = x.toArray(new String[0]);</pre>
      *
-     * Note that <tt>toArray(new Object[0])</tt> is identical in function to
-     * <tt>toArray()</tt>.
+     * Note that {@code toArray(new Object[0])} is identical in function to
+     * {@code toArray()}.
      *
      * @param a the array into which the elements of the queue are to
      *          be stored, if it is big enough; otherwise, a new array of the
@@ -505,7 +862,14 @@
         final ReentrantLock lock = this.lock;
         lock.lock();
         try {
-            return q.toArray(a);
+            int n = size;
+            if (a.length < n)
+                // Make a new array of a's runtime type, but my contents:
+                return (T[]) Arrays.copyOf(queue, size, a.getClass());
+            System.arraycopy(queue, 0, a, 0, n);
+            if (a.length > n)
+                a[n] = null;
+            return a;
         } finally {
             lock.unlock();
         }
@@ -514,8 +878,9 @@
     /**
      * Returns an iterator over the elements in this queue. The
      * iterator does not return the elements in any particular order.
-     * The returned <tt>Iterator</tt> is a "weakly consistent"
-     * iterator that will never throw {@link
+     *
+     * <p>The returned iterator is a "weakly consistent" iterator that
+     * will never throw {@link java.util.ConcurrentModificationException
      * ConcurrentModificationException}, and guarantees to traverse
      * elements as they existed upon construction of the iterator, and
      * may (but is not guaranteed to) reflect any modifications
@@ -530,7 +895,7 @@
     /**
      * Snapshot iterator that works off copy of underlying q array.
      */
-    private class Itr implements Iterator<E> {
+    final class Itr implements Iterator<E> {
         final Object[] array; // Array of all elements
         int cursor;           // index of next element to return;
         int lastRet;          // index of last element, or -1 if no such
@@ -554,39 +919,65 @@
         public void remove() {
             if (lastRet < 0)
                 throw new IllegalStateException();
-            Object x = array[lastRet];
+            removeEQ(array[lastRet]);
             lastRet = -1;
-            // Traverse underlying queue to find == element,
-            // not just a .equals element.
-            lock.lock();
-            try {
-                for (Iterator it = q.iterator(); it.hasNext(); ) {
-                    if (it.next() == x) {
-                        it.remove();
-                        return;
-                    }
-                }
-            } finally {
-                lock.unlock();
-            }
         }
     }
 
     /**
-     * Saves the state to a stream (that is, serializes it).  This
-     * merely wraps default serialization within lock.  The
-     * serialization strategy for items is left to underlying
-     * Queue. Note that locking is not needed on deserialization, so
-     * readObject is not defined, just relying on default.
+     * Saves the state to a stream (that is, serializes it).  For
+     * compatibility with previous version of this class,
+     * elements are first copied to a java.util.PriorityQueue,
+     * which is then serialized.
      */
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException {
         lock.lock();
         try {
+            int n = size; // avoid zero capacity argument
+            q = new PriorityQueue<E>(n == 0 ? 1 : n, comparator);
+            q.addAll(this);
             s.defaultWriteObject();
         } finally {
+            q = null;
             lock.unlock();
         }
     }
 
+    /**
+     * Reconstitutes the {@code PriorityBlockingQueue} instance from a stream
+     * (that is, deserializes it).
+     *
+     * @param s the stream
+     */
+    private void readObject(java.io.ObjectInputStream s)
+        throws java.io.IOException, ClassNotFoundException {
+        try {
+            s.defaultReadObject();
+            this.queue = new Object[q.size()];
+            comparator = q.comparator();
+            addAll(q);
+        } finally {
+            q = null;
+        }
+    }
+
+    // Unsafe mechanics
+    private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+    private static final long allocationSpinLockOffset =
+        objectFieldOffset(UNSAFE, "allocationSpinLock",
+                          PriorityBlockingQueue.class);
+
+    static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
+                                  String field, Class<?> klazz) {
+        try {
+            return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
+        } catch (NoSuchFieldException e) {
+            // Convert Exception to corresponding Error
+            NoSuchFieldError error = new NoSuchFieldError(field);
+            error.initCause(e);
+            throw error;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -360,8 +360,12 @@
             getExecuteExistingDelayedTasksAfterShutdownPolicy();
         boolean keepPeriodic =
             getContinueExistingPeriodicTasksAfterShutdownPolicy();
-        if (!keepDelayed && !keepPeriodic)
+        if (!keepDelayed && !keepPeriodic) {
+            for (Object e : q.toArray())
+                if (e instanceof RunnableScheduledFuture<?>)
+                    ((RunnableScheduledFuture<?>) e).cancel(false);
             q.clear();
+        }
         else {
             // Traverse snapshot to avoid iterator exceptions
             for (Object e : q.toArray()) {
--- a/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Fri Feb 04 16:29:41 2011 -0800
@@ -163,7 +163,7 @@
     /**
      * Shared internal API for dual stacks and queues.
      */
-    static abstract class Transferer {
+    abstract static class Transferer {
         /**
          * Performs a put or take.
          *
@@ -190,7 +190,7 @@
      * seems not to vary with number of CPUs (beyond 2) so is just
      * a constant.
      */
-    static final int maxTimedSpins = (NCPUS < 2)? 0 : 32;
+    static final int maxTimedSpins = (NCPUS < 2) ? 0 : 32;
 
     /**
      * The number of times to spin before blocking in untimed waits.
@@ -241,19 +241,11 @@
                 this.item = item;
             }
 
-            static final AtomicReferenceFieldUpdater<SNode, SNode>
-                nextUpdater = AtomicReferenceFieldUpdater.newUpdater
-                (SNode.class, SNode.class, "next");
-
             boolean casNext(SNode cmp, SNode val) {
-                return (cmp == next &&
-                        nextUpdater.compareAndSet(this, cmp, val));
+                return cmp == next &&
+                    UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val);
             }
 
-            static final AtomicReferenceFieldUpdater<SNode, SNode>
-                matchUpdater = AtomicReferenceFieldUpdater.newUpdater
-                (SNode.class, SNode.class, "match");
-
             /**
              * Tries to match node s to this node, if so, waking up thread.
              * Fulfillers call tryMatch to identify their waiters.
@@ -264,7 +256,7 @@
              */
             boolean tryMatch(SNode s) {
                 if (match == null &&
-                    matchUpdater.compareAndSet(this, null, s)) {
+                    UNSAFE.compareAndSwapObject(this, matchOffset, null, s)) {
                     Thread w = waiter;
                     if (w != null) {    // waiters need at most one unpark
                         waiter = null;
@@ -279,23 +271,28 @@
              * Tries to cancel a wait by matching node to itself.
              */
             void tryCancel() {
-                matchUpdater.compareAndSet(this, null, this);
+                UNSAFE.compareAndSwapObject(this, matchOffset, null, this);
             }
 
             boolean isCancelled() {
                 return match == this;
             }
+
+            // Unsafe mechanics
+            private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+            private static final long nextOffset =
+                objectFieldOffset(UNSAFE, "next", SNode.class);
+            private static final long matchOffset =
+                objectFieldOffset(UNSAFE, "match", SNode.class);
+
         }
 
         /** The head (top) of the stack */
         volatile SNode head;
 
-        static final AtomicReferenceFieldUpdater<TransferStack, SNode>
-            headUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (TransferStack.class,  SNode.class, "head");
-
         boolean casHead(SNode h, SNode nh) {
-            return h == head && headUpdater.compareAndSet(this, h, nh);
+            return h == head &&
+                UNSAFE.compareAndSwapObject(this, headOffset, h, nh);
         }
 
         /**
@@ -338,7 +335,7 @@
              */
 
             SNode s = null; // constructed/reused as needed
-            int mode = (e == null)? REQUEST : DATA;
+            int mode = (e == null) ? REQUEST : DATA;
 
             for (;;) {
                 SNode h = head;
@@ -356,7 +353,7 @@
                         }
                         if ((h = head) != null && h.next == s)
                             casHead(h, s.next);     // help s's fulfiller
-                        return mode == REQUEST? m.item : s.item;
+                        return (mode == REQUEST) ? m.item : s.item;
                     }
                 } else if (!isFulfilling(h.mode)) { // try to fulfill
                     if (h.isCancelled())            // already cancelled
@@ -372,7 +369,7 @@
                             SNode mn = m.next;
                             if (m.tryMatch(s)) {
                                 casHead(s, mn);     // pop both s and m
-                                return (mode == REQUEST)? m.item : s.item;
+                                return (mode == REQUEST) ? m.item : s.item;
                             } else                  // lost match
                                 s.casNext(m, mn);   // help unlink
                         }
@@ -423,11 +420,11 @@
              * and don't wait at all, so are trapped in transfer
              * method rather than calling awaitFulfill.
              */
-            long lastTime = (timed)? System.nanoTime() : 0;
+            long lastTime = timed ? System.nanoTime() : 0;
             Thread w = Thread.currentThread();
             SNode h = head;
-            int spins = (shouldSpin(s)?
-                         (timed? maxTimedSpins : maxUntimedSpins) : 0);
+            int spins = (shouldSpin(s) ?
+                         (timed ? maxTimedSpins : maxUntimedSpins) : 0);
             for (;;) {
                 if (w.isInterrupted())
                     s.tryCancel();
@@ -444,7 +441,7 @@
                     }
                 }
                 if (spins > 0)
-                    spins = shouldSpin(s)? (spins-1) : 0;
+                    spins = shouldSpin(s) ? (spins-1) : 0;
                 else if (s.waiter == null)
                     s.waiter = w; // establish waiter so can park next iter
                 else if (!timed)
@@ -499,6 +496,12 @@
                     p = n;
             }
         }
+
+        // Unsafe mechanics
+        private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+        private static final long headOffset =
+            objectFieldOffset(UNSAFE, "head", TransferStack.class);
+
     }
 
     /** Dual Queue */
@@ -524,29 +527,21 @@
                 this.isData = isData;
             }
 
-            static final AtomicReferenceFieldUpdater<QNode, QNode>
-                nextUpdater = AtomicReferenceFieldUpdater.newUpdater
-                (QNode.class, QNode.class, "next");
-
             boolean casNext(QNode cmp, QNode val) {
-                return (next == cmp &&
-                        nextUpdater.compareAndSet(this, cmp, val));
+                return next == cmp &&
+                    UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val);
             }
 
-            static final AtomicReferenceFieldUpdater<QNode, Object>
-                itemUpdater = AtomicReferenceFieldUpdater.newUpdater
-                (QNode.class, Object.class, "item");
-
             boolean casItem(Object cmp, Object val) {
-                return (item == cmp &&
-                        itemUpdater.compareAndSet(this, cmp, val));
+                return item == cmp &&
+                    UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
             }
 
             /**
              * Tries to cancel by CAS'ing ref to this as item.
              */
             void tryCancel(Object cmp) {
-                itemUpdater.compareAndSet(this, cmp, this);
+                UNSAFE.compareAndSwapObject(this, itemOffset, cmp, this);
             }
 
             boolean isCancelled() {
@@ -561,6 +556,13 @@
             boolean isOffList() {
                 return next == this;
             }
+
+            // Unsafe mechanics
+            private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+            private static final long nextOffset =
+                objectFieldOffset(UNSAFE, "next", QNode.class);
+            private static final long itemOffset =
+                objectFieldOffset(UNSAFE, "item", QNode.class);
         }
 
         /** Head of queue */
@@ -580,41 +582,30 @@
             tail = h;
         }
 
-        static final AtomicReferenceFieldUpdater<TransferQueue, QNode>
-            headUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (TransferQueue.class,  QNode.class, "head");
-
         /**
          * Tries to cas nh as new head; if successful, unlink
          * old head's next node to avoid garbage retention.
          */
         void advanceHead(QNode h, QNode nh) {
-            if (h == head && headUpdater.compareAndSet(this, h, nh))
+            if (h == head &&
+                UNSAFE.compareAndSwapObject(this, headOffset, h, nh))
                 h.next = h; // forget old next
         }
 
-        static final AtomicReferenceFieldUpdater<TransferQueue, QNode>
-            tailUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (TransferQueue.class, QNode.class, "tail");
-
         /**
          * Tries to cas nt as new tail.
          */
         void advanceTail(QNode t, QNode nt) {
             if (tail == t)
-                tailUpdater.compareAndSet(this, t, nt);
+                UNSAFE.compareAndSwapObject(this, tailOffset, t, nt);
         }
 
-        static final AtomicReferenceFieldUpdater<TransferQueue, QNode>
-            cleanMeUpdater = AtomicReferenceFieldUpdater.newUpdater
-            (TransferQueue.class, QNode.class, "cleanMe");
-
         /**
          * Tries to CAS cleanMe slot.
          */
         boolean casCleanMe(QNode cmp, QNode val) {
-            return (cleanMe == cmp &&
-                    cleanMeUpdater.compareAndSet(this, cmp, val));
+            return cleanMe == cmp &&
+                UNSAFE.compareAndSwapObject(this, cleanMeOffset, cmp, val);
         }
 
         /**
@@ -683,7 +674,7 @@
                             s.item = s;
                         s.waiter = null;
                     }
-                    return (x != null)? x : e;
+                    return (x != null) ? x : e;
 
                 } else {                            // complementary-mode
                     QNode m = h.next;               // node to fulfill
@@ -700,7 +691,7 @@
 
                     advanceHead(h, m);              // successfully fulfilled
                     LockSupport.unpark(m.waiter);
-                    return (x != null)? x : e;
+                    return (x != null) ? x : e;
                 }
             }
         }
@@ -716,10 +707,10 @@
          */
         Object awaitFulfill(QNode s, Object e, boolean timed, long nanos) {
             /* Same idea as TransferStack.awaitFulfill */
-            long lastTime = (timed)? System.nanoTime() : 0;
+            long lastTime = timed ? System.nanoTime() : 0;
             Thread w = Thread.currentThread();
             int spins = ((head.next == s) ?
-                         (timed? maxTimedSpins : maxUntimedSpins) : 0);
+                         (timed ? maxTimedSpins : maxUntimedSpins) : 0);
             for (;;) {
                 if (w.isInterrupted())
                     s.tryCancel(e);
@@ -799,6 +790,16 @@
                     return;          // Postpone cleaning s
             }
         }
+
+        // unsafe mechanics
+        private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+        private static final long headOffset =
+            objectFieldOffset(UNSAFE, "head", TransferQueue.class);
+        private static final long tailOffset =
+            objectFieldOffset(UNSAFE, "tail", TransferQueue.class);
+        private static final long cleanMeOffset =
+            objectFieldOffset(UNSAFE, "cleanMe", TransferQueue.class);
+
     }
 
     /**
@@ -824,7 +825,7 @@
      *        access; otherwise the order is unspecified.
      */
     public SynchronousQueue(boolean fair) {
-        transferer = (fair)? new TransferQueue() : new TransferStack();
+        transferer = fair ? new TransferQueue() : new TransferStack();
     }
 
     /**
@@ -1141,4 +1142,17 @@
             transferer = new TransferStack();
     }
 
+    // Unsafe mechanics
+    static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
+                                  String field, Class<?> klazz) {
+        try {
+            return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
+        } catch (NoSuchFieldException e) {
+            // Convert Exception to corresponding Error
+            NoSuchFieldError error = new NoSuchFieldError(field);
+            error.initCause(e);
+            throw error;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1841,6 +1841,43 @@
         }
     }
 
+    /**
+     * Returns a string identifying this pool, as well as its state,
+     * including indications of run state and estimated worker and
+     * task counts.
+     *
+     * @return a string identifying this pool, as well as its state
+     */
+    public String toString() {
+        long ncompleted;
+        int nworkers, nactive;
+        final ReentrantLock mainLock = this.mainLock;
+        mainLock.lock();
+        try {
+            ncompleted = completedTaskCount;
+            nactive = 0;
+            nworkers = workers.size();
+            for (Worker w : workers) {
+                ncompleted += w.completedTasks;
+                if (w.isLocked())
+                    ++nactive;
+            }
+        } finally {
+            mainLock.unlock();
+        }
+        int c = ctl.get();
+        String rs = (runStateLessThan(c, SHUTDOWN) ? "Running" :
+                     (runStateAtLeast(c, TERMINATED) ? "Terminated" :
+                      "Shutting down"));
+        return super.toString() +
+            "[" + rs +
+            ", pool size = " + nworkers +
+            ", active threads = " + nactive +
+            ", queued tasks = " + workQueue.size() +
+            ", completed tasks = " + ncompleted +
+            "]";
+    }
+
     /* Extension hooks */
 
     /**
@@ -1961,7 +1998,9 @@
          * @throws RejectedExecutionException always.
          */
         public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
-            throw new RejectedExecutionException();
+            throw new RejectedExecutionException("Task " + r.toString() +
+                                                 " rejected from " +
+                                                 e.toString());
         }
     }
 
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Fri Feb 04 16:29:41 2011 -0800
@@ -48,28 +48,37 @@
 public class AtomicIntegerArray implements java.io.Serializable {
     private static final long serialVersionUID = 2862133569453604235L;
 
-   // setup to use Unsafe.compareAndSwapInt for updates
     private static final Unsafe unsafe = Unsafe.getUnsafe();
     private static final int base = unsafe.arrayBaseOffset(int[].class);
-    private static final int scale = unsafe.arrayIndexScale(int[].class);
+    private static final int shift;
     private final int[] array;
 
-    private long rawIndex(int i) {
+    static {
+        int scale = unsafe.arrayIndexScale(int[].class);
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("data type scale not a power of two");
+        shift = 31 - Integer.numberOfLeadingZeros(scale);
+    }
+
+    private long checkedByteOffset(int i) {
         if (i < 0 || i >= array.length)
             throw new IndexOutOfBoundsException("index " + i);
-        return base + (long) i * scale;
+
+        return byteOffset(i);
+    }
+
+    private static long byteOffset(int i) {
+        return ((long) i << shift) + base;
     }
 
     /**
-     * Creates a new AtomicIntegerArray of given length.
+     * Creates a new AtomicIntegerArray of the given length, with all
+     * elements initially zero.
      *
      * @param length the length of the array
      */
     public AtomicIntegerArray(int length) {
         array = new int[length];
-        // must perform at least one volatile write to conform to JMM
-        if (length > 0)
-            unsafe.putIntVolatile(array, rawIndex(0), 0);
     }
 
     /**
@@ -80,17 +89,8 @@
      * @throws NullPointerException if array is null
      */
     public AtomicIntegerArray(int[] array) {
-        if (array == null)
-            throw new NullPointerException();
-        int length = array.length;
-        this.array = new int[length];
-        if (length > 0) {
-            int last = length-1;
-            for (int i = 0; i < last; ++i)
-                this.array[i] = array[i];
-            // Do the last write as volatile
-            unsafe.putIntVolatile(this.array, rawIndex(last), array[last]);
-        }
+        // Visibility guaranteed by final field guarantees
+        this.array = array.clone();
     }
 
     /**
@@ -109,7 +109,11 @@
      * @return the current value
      */
     public final int get(int i) {
-        return unsafe.getIntVolatile(array, rawIndex(i));
+        return getRaw(checkedByteOffset(i));
+    }
+
+    private int getRaw(long offset) {
+        return unsafe.getIntVolatile(array, offset);
     }
 
     /**
@@ -119,7 +123,7 @@
      * @param newValue the new value
      */
     public final void set(int i, int newValue) {
-        unsafe.putIntVolatile(array, rawIndex(i), newValue);
+        unsafe.putIntVolatile(array, checkedByteOffset(i), newValue);
     }
 
     /**
@@ -130,7 +134,7 @@
      * @since 1.6
      */
     public final void lazySet(int i, int newValue) {
-        unsafe.putOrderedInt(array, rawIndex(i), newValue);
+        unsafe.putOrderedInt(array, checkedByteOffset(i), newValue);
     }
 
     /**
@@ -142,9 +146,10 @@
      * @return the previous value
      */
     public final int getAndSet(int i, int newValue) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            int current = get(i);
-            if (compareAndSet(i, current, newValue))
+            int current = getRaw(offset);
+            if (compareAndSetRaw(offset, current, newValue))
                 return current;
         }
     }
@@ -160,8 +165,11 @@
      * the actual value was not equal to the expected value.
      */
     public final boolean compareAndSet(int i, int expect, int update) {
-        return unsafe.compareAndSwapInt(array, rawIndex(i),
-                                        expect, update);
+        return compareAndSetRaw(checkedByteOffset(i), expect, update);
+    }
+
+    private boolean compareAndSetRaw(long offset, int expect, int update) {
+        return unsafe.compareAndSwapInt(array, offset, expect, update);
     }
 
     /**
@@ -188,12 +196,7 @@
      * @return the previous value
      */
     public final int getAndIncrement(int i) {
-        while (true) {
-            int current = get(i);
-            int next = current + 1;
-            if (compareAndSet(i, current, next))
-                return current;
-        }
+        return getAndAdd(i, 1);
     }
 
     /**
@@ -203,12 +206,7 @@
      * @return the previous value
      */
     public final int getAndDecrement(int i) {
-        while (true) {
-            int current = get(i);
-            int next = current - 1;
-            if (compareAndSet(i, current, next))
-                return current;
-        }
+        return getAndAdd(i, -1);
     }
 
     /**
@@ -219,10 +217,10 @@
      * @return the previous value
      */
     public final int getAndAdd(int i, int delta) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            int current = get(i);
-            int next = current + delta;
-            if (compareAndSet(i, current, next))
+            int current = getRaw(offset);
+            if (compareAndSetRaw(offset, current, current + delta))
                 return current;
         }
     }
@@ -234,12 +232,7 @@
      * @return the updated value
      */
     public final int incrementAndGet(int i) {
-        while (true) {
-            int current = get(i);
-            int next = current + 1;
-            if (compareAndSet(i, current, next))
-                return next;
-        }
+        return addAndGet(i, 1);
     }
 
     /**
@@ -249,12 +242,7 @@
      * @return the updated value
      */
     public final int decrementAndGet(int i) {
-        while (true) {
-            int current = get(i);
-            int next = current - 1;
-            if (compareAndSet(i, current, next))
-                return next;
-        }
+        return addAndGet(i, -1);
     }
 
     /**
@@ -265,22 +253,32 @@
      * @return the updated value
      */
     public final int addAndGet(int i, int delta) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            int current = get(i);
+            int current = getRaw(offset);
             int next = current + delta;
-            if (compareAndSet(i, current, next))
+            if (compareAndSetRaw(offset, current, next))
                 return next;
         }
     }
 
     /**
      * Returns the String representation of the current values of array.
-     * @return the String representation of the current values of array.
+     * @return the String representation of the current values of array
      */
     public String toString() {
-        if (array.length > 0) // force volatile read
-            get(0);
-        return Arrays.toString(array);
+        int iMax = array.length - 1;
+        if (iMax == -1)
+            return "[]";
+
+        StringBuilder b = new StringBuilder();
+        b.append('[');
+        for (int i = 0; ; i++) {
+            b.append(getRaw(byteOffset(i)));
+            if (i == iMax)
+                return b.append(']').toString();
+            b.append(',').append(' ');
+        }
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Fri Feb 04 16:29:41 2011 -0800
@@ -47,28 +47,37 @@
 public class AtomicLongArray implements java.io.Serializable {
     private static final long serialVersionUID = -2308431214976778248L;
 
-    // setup to use Unsafe.compareAndSwapInt for updates
     private static final Unsafe unsafe = Unsafe.getUnsafe();
     private static final int base = unsafe.arrayBaseOffset(long[].class);
-    private static final int scale = unsafe.arrayIndexScale(long[].class);
+    private static final int shift;
     private final long[] array;
 
-    private long rawIndex(int i) {
+    static {
+        int scale = unsafe.arrayIndexScale(long[].class);
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("data type scale not a power of two");
+        shift = 31 - Integer.numberOfLeadingZeros(scale);
+    }
+
+    private long checkedByteOffset(int i) {
         if (i < 0 || i >= array.length)
             throw new IndexOutOfBoundsException("index " + i);
-        return base + (long) i * scale;
+
+        return byteOffset(i);
+    }
+
+    private static long byteOffset(int i) {
+        return ((long) i << shift) + base;
     }
 
     /**
-     * Creates a new AtomicLongArray of given length.
+     * Creates a new AtomicLongArray of the given length, with all
+     * elements initially zero.
      *
      * @param length the length of the array
      */
     public AtomicLongArray(int length) {
         array = new long[length];
-        // must perform at least one volatile write to conform to JMM
-        if (length > 0)
-            unsafe.putLongVolatile(array, rawIndex(0), 0);
     }
 
     /**
@@ -79,17 +88,8 @@
      * @throws NullPointerException if array is null
      */
     public AtomicLongArray(long[] array) {
-        if (array == null)
-            throw new NullPointerException();
-        int length = array.length;
-        this.array = new long[length];
-        if (length > 0) {
-            int last = length-1;
-            for (int i = 0; i < last; ++i)
-                this.array[i] = array[i];
-            // Do the last write as volatile
-            unsafe.putLongVolatile(this.array, rawIndex(last), array[last]);
-        }
+        // Visibility guaranteed by final field guarantees
+        this.array = array.clone();
     }
 
     /**
@@ -108,7 +108,11 @@
      * @return the current value
      */
     public final long get(int i) {
-        return unsafe.getLongVolatile(array, rawIndex(i));
+        return getRaw(checkedByteOffset(i));
+    }
+
+    private long getRaw(long offset) {
+        return unsafe.getLongVolatile(array, offset);
     }
 
     /**
@@ -118,7 +122,7 @@
      * @param newValue the new value
      */
     public final void set(int i, long newValue) {
-        unsafe.putLongVolatile(array, rawIndex(i), newValue);
+        unsafe.putLongVolatile(array, checkedByteOffset(i), newValue);
     }
 
     /**
@@ -129,7 +133,7 @@
      * @since 1.6
      */
     public final void lazySet(int i, long newValue) {
-        unsafe.putOrderedLong(array, rawIndex(i), newValue);
+        unsafe.putOrderedLong(array, checkedByteOffset(i), newValue);
     }
 
 
@@ -142,16 +146,17 @@
      * @return the previous value
      */
     public final long getAndSet(int i, long newValue) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            long current = get(i);
-            if (compareAndSet(i, current, newValue))
+            long current = getRaw(offset);
+            if (compareAndSetRaw(offset, current, newValue))
                 return current;
         }
     }
 
     /**
-     * Atomically sets the value to the given updated value
-     * if the current value {@code ==} the expected value.
+     * Atomically sets the element at position {@code i} to the given
+     * updated value if the current value {@code ==} the expected value.
      *
      * @param i the index
      * @param expect the expected value
@@ -160,13 +165,16 @@
      * the actual value was not equal to the expected value.
      */
     public final boolean compareAndSet(int i, long expect, long update) {
-        return unsafe.compareAndSwapLong(array, rawIndex(i),
-                                         expect, update);
+        return compareAndSetRaw(checkedByteOffset(i), expect, update);
+    }
+
+    private boolean compareAndSetRaw(long offset, long expect, long update) {
+        return unsafe.compareAndSwapLong(array, offset, expect, update);
     }
 
     /**
-     * Atomically sets the value to the given updated value
-     * if the current value {@code ==} the expected value.
+     * Atomically sets the element at position {@code i} to the given
+     * updated value if the current value {@code ==} the expected value.
      *
      * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
      * and does not provide ordering guarantees, so is only rarely an
@@ -188,12 +196,7 @@
      * @return the previous value
      */
     public final long getAndIncrement(int i) {
-        while (true) {
-            long current = get(i);
-            long next = current + 1;
-            if (compareAndSet(i, current, next))
-                return current;
-        }
+        return getAndAdd(i, 1);
     }
 
     /**
@@ -203,12 +206,7 @@
      * @return the previous value
      */
     public final long getAndDecrement(int i) {
-        while (true) {
-            long current = get(i);
-            long next = current - 1;
-            if (compareAndSet(i, current, next))
-                return current;
-        }
+        return getAndAdd(i, -1);
     }
 
     /**
@@ -219,10 +217,10 @@
      * @return the previous value
      */
     public final long getAndAdd(int i, long delta) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            long current = get(i);
-            long next = current + delta;
-            if (compareAndSet(i, current, next))
+            long current = getRaw(offset);
+            if (compareAndSetRaw(offset, current, current + delta))
                 return current;
         }
     }
@@ -234,12 +232,7 @@
      * @return the updated value
      */
     public final long incrementAndGet(int i) {
-        while (true) {
-            long current = get(i);
-            long next = current + 1;
-            if (compareAndSet(i, current, next))
-                return next;
-        }
+        return addAndGet(i, 1);
     }
 
     /**
@@ -249,12 +242,7 @@
      * @return the updated value
      */
     public final long decrementAndGet(int i) {
-        while (true) {
-            long current = get(i);
-            long next = current - 1;
-            if (compareAndSet(i, current, next))
-                return next;
-        }
+        return addAndGet(i, -1);
     }
 
     /**
@@ -265,22 +253,32 @@
      * @return the updated value
      */
     public long addAndGet(int i, long delta) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            long current = get(i);
+            long current = getRaw(offset);
             long next = current + delta;
-            if (compareAndSet(i, current, next))
+            if (compareAndSetRaw(offset, current, next))
                 return next;
         }
     }
 
     /**
      * Returns the String representation of the current values of array.
-     * @return the String representation of the current values of array.
+     * @return the String representation of the current values of array
      */
     public String toString() {
-        if (array.length > 0) // force volatile read
-            get(0);
-        return Arrays.toString(array);
+        int iMax = array.length - 1;
+        if (iMax == -1)
+            return "[]";
+
+        StringBuilder b = new StringBuilder();
+        b.append('[');
+        for (int i = 0; ; i++) {
+            b.append(getRaw(byteOffset(i)));
+            if (i == iMax)
+                return b.append(']').toString();
+            b.append(',').append(' ');
+        }
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Fri Feb 04 16:29:41 2011 -0800
@@ -38,8 +38,8 @@
 /**
  * An {@code AtomicMarkableReference} maintains an object reference
  * along with a mark bit, that can be updated atomically.
- * <p>
- * <p> Implementation note. This implementation maintains markable
+ *
+ * <p>Implementation note: This implementation maintains markable
  * references by creating internal objects representing "boxed"
  * [reference, boolean] pairs.
  *
@@ -47,17 +47,21 @@
  * @author Doug Lea
  * @param <V> The type of object referred to by this reference
  */
-public class AtomicMarkableReference<V>  {
+public class AtomicMarkableReference<V> {
 
-    private static class ReferenceBooleanPair<T> {
-        private final T reference;
-        private final boolean bit;
-        ReferenceBooleanPair(T r, boolean i) {
-            reference = r; bit = i;
+    private static class Pair<T> {
+        final T reference;
+        final boolean mark;
+        private Pair(T reference, boolean mark) {
+            this.reference = reference;
+            this.mark = mark;
+        }
+        static <T> Pair<T> of(T reference, boolean mark) {
+            return new Pair<T>(reference, mark);
         }
     }
 
-    private final AtomicReference<ReferenceBooleanPair<V>>  atomicRef;
+    private volatile Pair<V> pair;
 
     /**
      * Creates a new {@code AtomicMarkableReference} with the given
@@ -67,7 +71,7 @@
      * @param initialMark the initial mark
      */
     public AtomicMarkableReference(V initialRef, boolean initialMark) {
-        atomicRef = new AtomicReference<ReferenceBooleanPair<V>> (new ReferenceBooleanPair<V>(initialRef, initialMark));
+        pair = Pair.of(initialRef, initialMark);
     }
 
     /**
@@ -76,7 +80,7 @@
      * @return the current value of the reference
      */
     public V getReference() {
-        return atomicRef.get().reference;
+        return pair.reference;
     }
 
     /**
@@ -85,7 +89,7 @@
      * @return the current value of the mark
      */
     public boolean isMarked() {
-        return atomicRef.get().bit;
+        return pair.mark;
     }
 
     /**
@@ -97,9 +101,9 @@
      * @return the current value of the reference
      */
     public V get(boolean[] markHolder) {
-        ReferenceBooleanPair<V> p = atomicRef.get();
-        markHolder[0] = p.bit;
-        return p.reference;
+        Pair<V> pair = this.pair;
+        markHolder[0] = pair.mark;
+        return pair.reference;
     }
 
     /**
@@ -122,13 +126,8 @@
                                      V       newReference,
                                      boolean expectedMark,
                                      boolean newMark) {
-        ReferenceBooleanPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            expectedMark == current.bit &&
-            ((newReference == current.reference && newMark == current.bit) ||
-             atomicRef.weakCompareAndSet(current,
-                                     new ReferenceBooleanPair<V>(newReference,
-                                                              newMark)));
+        return compareAndSet(expectedReference, newReference,
+                             expectedMark, newMark);
     }
 
     /**
@@ -147,13 +146,13 @@
                                  V       newReference,
                                  boolean expectedMark,
                                  boolean newMark) {
-        ReferenceBooleanPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            expectedMark == current.bit &&
-            ((newReference == current.reference && newMark == current.bit) ||
-             atomicRef.compareAndSet(current,
-                                     new ReferenceBooleanPair<V>(newReference,
-                                                              newMark)));
+        Pair<V> current = pair;
+        return
+            expectedReference == current.reference &&
+            expectedMark == current.mark &&
+            ((newReference == current.reference &&
+              newMark == current.mark) ||
+             casPair(current, Pair.of(newReference, newMark)));
     }
 
     /**
@@ -163,9 +162,9 @@
      * @param newMark the new value for the mark
      */
     public void set(V newReference, boolean newMark) {
-        ReferenceBooleanPair<V> current = atomicRef.get();
-        if (newReference != current.reference || newMark != current.bit)
-            atomicRef.set(new ReferenceBooleanPair<V>(newReference, newMark));
+        Pair<V> current = pair;
+        if (newReference != current.reference || newMark != current.mark)
+            this.pair = Pair.of(newReference, newMark);
     }
 
     /**
@@ -182,11 +181,32 @@
      * @return true if successful
      */
     public boolean attemptMark(V expectedReference, boolean newMark) {
-        ReferenceBooleanPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            (newMark == current.bit ||
-             atomicRef.compareAndSet
-             (current, new ReferenceBooleanPair<V>(expectedReference,
-                                                newMark)));
+        Pair<V> current = pair;
+        return
+            expectedReference == current.reference &&
+            (newMark == current.mark ||
+             casPair(current, Pair.of(expectedReference, newMark)));
+    }
+
+    // Unsafe mechanics
+
+    private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+    private static final long pairOffset =
+        objectFieldOffset(UNSAFE, "pair", AtomicMarkableReference.class);
+
+    private boolean casPair(Pair<V> cmp, Pair<V> val) {
+        return UNSAFE.compareAndSwapObject(this, pairOffset, cmp, val);
+    }
+
+    static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
+                                  String field, Class<?> klazz) {
+        try {
+            return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
+        } catch (NoSuchFieldException e) {
+            // Convert Exception to corresponding Error
+            NoSuchFieldError error = new NoSuchFieldError(field);
+            error.initCause(e);
+            throw error;
+        }
     }
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Fri Feb 04 16:29:41 2011 -0800
@@ -51,24 +51,35 @@
 
     private static final Unsafe unsafe = Unsafe.getUnsafe();
     private static final int base = unsafe.arrayBaseOffset(Object[].class);
-    private static final int scale = unsafe.arrayIndexScale(Object[].class);
+    private static final int shift;
     private final Object[] array;
 
-    private long rawIndex(int i) {
+    static {
+        int scale = unsafe.arrayIndexScale(Object[].class);
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("data type scale not a power of two");
+        shift = 31 - Integer.numberOfLeadingZeros(scale);
+    }
+
+    private long checkedByteOffset(int i) {
         if (i < 0 || i >= array.length)
             throw new IndexOutOfBoundsException("index " + i);
-        return base + (long) i * scale;
+
+        return byteOffset(i);
+    }
+
+    private static long byteOffset(int i) {
+        return ((long) i << shift) + base;
     }
 
     /**
-     * Creates a new AtomicReferenceArray of given length.
+     * Creates a new AtomicReferenceArray of the given length, with all
+     * elements initially null.
+     *
      * @param length the length of the array
      */
     public AtomicReferenceArray(int length) {
         array = new Object[length];
-        // must perform at least one volatile write to conform to JMM
-        if (length > 0)
-            unsafe.putObjectVolatile(array, rawIndex(0), null);
     }
 
     /**
@@ -79,18 +90,8 @@
      * @throws NullPointerException if array is null
      */
     public AtomicReferenceArray(E[] array) {
-        if (array == null)
-            throw new NullPointerException();
-        int length = array.length;
-        this.array = new Object[length];
-        if (length > 0) {
-            int last = length-1;
-            for (int i = 0; i < last; ++i)
-                this.array[i] = array[i];
-            // Do the last write as volatile
-            E e = array[last];
-            unsafe.putObjectVolatile(this.array, rawIndex(last), e);
-        }
+        // Visibility guaranteed by final field guarantees
+        this.array = array.clone();
     }
 
     /**
@@ -109,7 +110,11 @@
      * @return the current value
      */
     public final E get(int i) {
-        return (E) unsafe.getObjectVolatile(array, rawIndex(i));
+        return getRaw(checkedByteOffset(i));
+    }
+
+    private E getRaw(long offset) {
+        return (E) unsafe.getObjectVolatile(array, offset);
     }
 
     /**
@@ -119,7 +124,7 @@
      * @param newValue the new value
      */
     public final void set(int i, E newValue) {
-        unsafe.putObjectVolatile(array, rawIndex(i), newValue);
+        unsafe.putObjectVolatile(array, checkedByteOffset(i), newValue);
     }
 
     /**
@@ -130,7 +135,7 @@
      * @since 1.6
      */
     public final void lazySet(int i, E newValue) {
-        unsafe.putOrderedObject(array, rawIndex(i), newValue);
+        unsafe.putOrderedObject(array, checkedByteOffset(i), newValue);
     }
 
 
@@ -143,9 +148,10 @@
      * @return the previous value
      */
     public final E getAndSet(int i, E newValue) {
+        long offset = checkedByteOffset(i);
         while (true) {
-            E current = get(i);
-            if (compareAndSet(i, current, newValue))
+            E current = (E) getRaw(offset);
+            if (compareAndSetRaw(offset, current, newValue))
                 return current;
         }
     }
@@ -153,6 +159,7 @@
     /**
      * Atomically sets the element at position {@code i} to the given
      * updated value if the current value {@code ==} the expected value.
+     *
      * @param i the index
      * @param expect the expected value
      * @param update the new value
@@ -160,8 +167,11 @@
      * the actual value was not equal to the expected value.
      */
     public final boolean compareAndSet(int i, E expect, E update) {
-        return unsafe.compareAndSwapObject(array, rawIndex(i),
-                                         expect, update);
+        return compareAndSetRaw(checkedByteOffset(i), expect, update);
+    }
+
+    private boolean compareAndSetRaw(long offset, E expect, E update) {
+        return unsafe.compareAndSwapObject(array, offset, expect, update);
     }
 
     /**
@@ -183,12 +193,21 @@
 
     /**
      * Returns the String representation of the current values of array.
-     * @return the String representation of the current values of array.
+     * @return the String representation of the current values of array
      */
     public String toString() {
-        if (array.length > 0) // force volatile read
-            get(0);
-        return Arrays.toString(array);
+           int iMax = array.length - 1;
+        if (iMax == -1)
+            return "[]";
+
+        StringBuilder b = new StringBuilder();
+        b.append('[');
+        for (int i = 0; ; i++) {
+            b.append(getRaw(byteOffset(i)));
+            if (i == iMax)
+                return b.append(']').toString();
+            b.append(',').append(' ');
+        }
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Fri Feb 04 16:29:41 2011 -0800
@@ -39,7 +39,7 @@
  * An {@code AtomicStampedReference} maintains an object reference
  * along with an integer "stamp", that can be updated atomically.
  *
- * <p> Implementation note. This implementation maintains stamped
+ * <p>Implementation note: This implementation maintains stamped
  * references by creating internal objects representing "boxed"
  * [reference, integer] pairs.
  *
@@ -47,17 +47,21 @@
  * @author Doug Lea
  * @param <V> The type of object referred to by this reference
  */
-public class AtomicStampedReference<V>  {
+public class AtomicStampedReference<V> {
 
-    private static class ReferenceIntegerPair<T> {
-        private final T reference;
-        private final int integer;
-        ReferenceIntegerPair(T r, int i) {
-            reference = r; integer = i;
+    private static class Pair<T> {
+        final T reference;
+        final int stamp;
+        private Pair(T reference, int stamp) {
+            this.reference = reference;
+            this.stamp = stamp;
+        }
+        static <T> Pair<T> of(T reference, int stamp) {
+            return new Pair<T>(reference, stamp);
         }
     }
 
-    private final AtomicReference<ReferenceIntegerPair<V>>  atomicRef;
+    private volatile Pair<V> pair;
 
     /**
      * Creates a new {@code AtomicStampedReference} with the given
@@ -67,8 +71,7 @@
      * @param initialStamp the initial stamp
      */
     public AtomicStampedReference(V initialRef, int initialStamp) {
-        atomicRef = new AtomicReference<ReferenceIntegerPair<V>>
-            (new ReferenceIntegerPair<V>(initialRef, initialStamp));
+        pair = Pair.of(initialRef, initialStamp);
     }
 
     /**
@@ -77,7 +80,7 @@
      * @return the current value of the reference
      */
     public V getReference() {
-        return atomicRef.get().reference;
+        return pair.reference;
     }
 
     /**
@@ -86,7 +89,7 @@
      * @return the current value of the stamp
      */
     public int getStamp() {
-        return atomicRef.get().integer;
+        return pair.stamp;
     }
 
     /**
@@ -98,9 +101,9 @@
      * @return the current value of the reference
      */
     public V get(int[] stampHolder) {
-        ReferenceIntegerPair<V> p = atomicRef.get();
-        stampHolder[0] = p.integer;
-        return p.reference;
+        Pair<V> pair = this.pair;
+        stampHolder[0] = pair.stamp;
+        return pair.reference;
     }
 
     /**
@@ -119,18 +122,12 @@
      * @param newStamp the new value for the stamp
      * @return true if successful
      */
-    public boolean weakCompareAndSet(V      expectedReference,
-                                     V      newReference,
-                                     int    expectedStamp,
-                                     int    newStamp) {
-        ReferenceIntegerPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            expectedStamp == current.integer &&
-            ((newReference == current.reference &&
-              newStamp == current.integer) ||
-             atomicRef.weakCompareAndSet(current,
-                                     new ReferenceIntegerPair<V>(newReference,
-                                                              newStamp)));
+    public boolean weakCompareAndSet(V   expectedReference,
+                                     V   newReference,
+                                     int expectedStamp,
+                                     int newStamp) {
+        return compareAndSet(expectedReference, newReference,
+                             expectedStamp, newStamp);
     }
 
     /**
@@ -145,18 +142,17 @@
      * @param newStamp the new value for the stamp
      * @return true if successful
      */
-    public boolean compareAndSet(V      expectedReference,
-                                 V      newReference,
-                                 int    expectedStamp,
-                                 int    newStamp) {
-        ReferenceIntegerPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            expectedStamp == current.integer &&
+    public boolean compareAndSet(V   expectedReference,
+                                 V   newReference,
+                                 int expectedStamp,
+                                 int newStamp) {
+        Pair<V> current = pair;
+        return
+            expectedReference == current.reference &&
+            expectedStamp == current.stamp &&
             ((newReference == current.reference &&
-              newStamp == current.integer) ||
-             atomicRef.compareAndSet(current,
-                                     new ReferenceIntegerPair<V>(newReference,
-                                                              newStamp)));
+              newStamp == current.stamp) ||
+             casPair(current, Pair.of(newReference, newStamp)));
     }
 
 
@@ -167,9 +163,9 @@
      * @param newStamp the new value for the stamp
      */
     public void set(V newReference, int newStamp) {
-        ReferenceIntegerPair<V> current = atomicRef.get();
-        if (newReference != current.reference || newStamp != current.integer)
-            atomicRef.set(new ReferenceIntegerPair<V>(newReference, newStamp));
+        Pair<V> current = pair;
+        if (newReference != current.reference || newStamp != current.stamp)
+            this.pair = Pair.of(newReference, newStamp);
     }
 
     /**
@@ -186,11 +182,32 @@
      * @return true if successful
      */
     public boolean attemptStamp(V expectedReference, int newStamp) {
-        ReferenceIntegerPair<V> current = atomicRef.get();
-        return  expectedReference == current.reference &&
-            (newStamp == current.integer ||
-             atomicRef.compareAndSet(current,
-                                     new ReferenceIntegerPair<V>(expectedReference,
-                                                              newStamp)));
+        Pair<V> current = pair;
+        return
+            expectedReference == current.reference &&
+            (newStamp == current.stamp ||
+             casPair(current, Pair.of(expectedReference, newStamp)));
+    }
+
+    // Unsafe mechanics
+
+    private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
+    private static final long pairOffset =
+        objectFieldOffset(UNSAFE, "pair", AtomicStampedReference.class);
+
+    private boolean casPair(Pair<V> cmp, Pair<V> val) {
+        return UNSAFE.compareAndSwapObject(this, pairOffset, cmp, val);
+    }
+
+    static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
+                                  String field, Class<?> klazz) {
+        try {
+            return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
+        } catch (NoSuchFieldException e) {
+            // Convert Exception to corresponding Error
+            NoSuchFieldError error = new NoSuchFieldError(field);
+            error.initCause(e);
+            throw error;
+        }
     }
 }
--- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Fri Feb 04 16:29:41 2011 -0800
@@ -308,18 +308,21 @@
      * condition still does not hold. Typical uses of this method take
      * the following form:
      *
-     * <pre>
-     * synchronized boolean aMethod(long timeout, TimeUnit unit) {
-     *   long nanosTimeout = unit.toNanos(timeout);
-     *   while (!conditionBeingWaitedFor) {
-     *     if (nanosTimeout &gt; 0)
-     *         nanosTimeout = theCondition.awaitNanos(nanosTimeout);
-     *      else
-     *        return false;
+     *  <pre> {@code
+     * boolean aMethod(long timeout, TimeUnit unit) {
+     *   long nanos = unit.toNanos(timeout);
+     *   lock.lock();
+     *   try {
+     *     while (!conditionBeingWaitedFor()) {
+     *       if (nanos <= 0L)
+     *         return false;
+     *       nanos = theCondition.awaitNanos(nanos);
+     *     }
+     *     // ...
+     *   } finally {
+     *     lock.unlock();
      *   }
-     *   // ...
-     * }
-     * </pre>
+     * }}</pre>
      *
      * <p> Design note: This method requires a nanosecond argument so
      * as to avoid truncation errors in reporting remaining times.
@@ -408,18 +411,21 @@
      *
      * <p>The return value indicates whether the deadline has elapsed,
      * which can be used as follows:
-     * <pre>
-     * synchronized boolean aMethod(Date deadline) {
+     *  <pre> {@code
+     * boolean aMethod(Date deadline) {
      *   boolean stillWaiting = true;
-     *   while (!conditionBeingWaitedFor) {
-     *     if (stillWaiting)
-     *         stillWaiting = theCondition.awaitUntil(deadline);
-     *      else
-     *        return false;
+     *   lock.lock();
+     *   try {
+     *     while (!conditionBeingWaitedFor()) {
+     *       if (!stillWaiting)
+     *         return false;
+     *       stillWaiting = theCondition.awaitUntil(deadline);
+     *     }
+     *     // ...
+     *   } finally {
+     *     lock.unlock();
      *   }
-     *   // ...
-     * }
-     * </pre>
+     * }}</pre>
      *
      * <p><b>Implementation Considerations</b>
      *
@@ -450,6 +456,15 @@
      * <p>If any threads are waiting on this condition then one
      * is selected for waking up. That thread must then re-acquire the
      * lock before returning from {@code await}.
+     *
+     * <p><b>Implementation Considerations</b>
+     *
+     * <p>An implementation may (and typically does) require that the
+     * current thread hold the lock associated with this {@code
+     * Condition} when this method is called. Implementations must
+     * document this precondition and any actions taken if the lock is
+     * not held. Typically, an exception such as {@link
+     * IllegalMonitorStateException} will be thrown.
      */
     void signal();
 
@@ -459,6 +474,15 @@
      * <p>If any threads are waiting on this condition then they are
      * all woken up. Each thread must re-acquire the lock before it can
      * return from {@code await}.
+     *
+     * <p><b>Implementation Considerations</b>
+     *
+     * <p>An implementation may (and typically does) require that the
+     * current thread hold the lock associated with this {@code
+     * Condition} when this method is called. Implementations must
+     * document this precondition and any actions taken if the lock is
+     * not held. Typically, an exception such as {@link
+     * IllegalMonitorStateException} will be thrown.
      */
     void signalAll();
 }
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1426,7 +1426,7 @@
                 // we didn't have a previous parent
                 ref = manager.new LoggerWeakRef(this);
             }
-            ref.setParentRef(new WeakReference<>(parent));
+            ref.setParentRef(new WeakReference<Logger>(parent));
             parent.kids.add(ref);
 
             // As a result of the reparenting, the effective level
--- a/jdk/src/share/classes/javax/script/CompiledScript.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/script/CompiledScript.java	Fri Feb 04 16:29:41 2011 -0800
@@ -107,7 +107,7 @@
     }
 
     /**
-     * Returns the <code>ScriptEngine</code> wbose <code>compile</code> method created this <code>CompiledScript</code>.
+     * Returns the <code>ScriptEngine</code> whose <code>compile</code> method created this <code>CompiledScript</code>.
      * The <code>CompiledScript</code> will execute in this engine.
      *
      * @return The <code>ScriptEngine</code> that created this <code>CompiledScript</code>
--- a/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java	Fri Feb 04 16:29:41 2011 -0800
@@ -329,7 +329,7 @@
             throw new IllegalArgumentException("invalid empty name");
         }
 
-        ArrayList<CredOwner> pList = new ArrayList<CredOwner>();
+        ArrayList<CredOwner> pList = new ArrayList<>();
         StringTokenizer tokenizer = new StringTokenizer(name, " ", true);
         String principalClass = null;
         String principalName = null;
--- a/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -48,7 +48,7 @@
 
     private Subject subject;
     private WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs =
-                new WeakKeyValueMap<ProtectionDomain, ProtectionDomain>();
+                new WeakKeyValueMap<>();
     private Set<Principal> principalSet;
     private Principal[] principals;
 
--- a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java	Fri Feb 04 16:29:41 2011 -0800
@@ -361,7 +361,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<Permission> permissions = new Vector<Permission>(perms.size());
+        Vector<Permission> permissions = new Vector<>(perms.size());
 
         synchronized (this) {
             permissions.addAll(perms);
--- a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java	Fri Feb 04 16:29:41 2011 -0800
@@ -569,7 +569,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<Permission> permissions = new Vector<Permission>(perms.size());
+        Vector<Permission> permissions = new Vector<>(perms.size());
 
         synchronized (this) {
             permissions.addAll(perms);
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,9 +25,7 @@
 
 package javax.sql.rowset.serial;
 
-import java.sql.*;
 import java.io.*;
-import java.util.Map;
 import java.lang.reflect.*;
 import javax.sql.rowset.RowSetWarning;
 
@@ -51,7 +49,7 @@
     /**
      * Placeholder for object to be serialized.
      */
-    private Object obj;
+    private final Object obj;
 
 
    /**
@@ -64,8 +62,7 @@
      * <p>
      *
      * @param obj the Java <code>Object</code> to be serialized
-     * @throws SerialException if the object is found
-     * to be unserializable
+     * @throws SerialException if the object is found not to be serializable
      */
     public SerialJavaObject(Object obj) throws SerialException {
 
@@ -74,16 +71,11 @@
 
 
         // get Class. Object instance should always be available
-        Class c = obj.getClass();
+        Class<?> c = obj.getClass();
 
         // determine if object implements Serializable i/f
-        boolean serializableImpl = false;
-        Class[] theIf = c.getInterfaces();
-        for (int i = 0; i < theIf.length; i++) {
-            String ifName = theIf[i].getName();
-            if (ifName == "java.io.Serializable") {
-                serializableImpl = true;
-            }
+        if (!(obj instanceof java.io.Serializable)) {
+            setWarning(new RowSetWarning("Warning, the object passed to the constructor does not implement Serializable"));
         }
 
         // can only determine public fields (obviously). If
@@ -93,21 +85,13 @@
 
         boolean anyStaticFields = false;
         fields = c.getFields();
-        //fields = new Object[field.length];
 
         for (int i = 0; i < fields.length; i++ ) {
             if ( fields[i].getModifiers() == Modifier.STATIC ) {
                 anyStaticFields = true;
             }
-            //fields[i] = field[i].get(obj);
         }
-        try {
-            if (!(serializableImpl)) {
-               throw new RowSetWarning("Test");
-            }
-        } catch (RowSetWarning w) {
-            setWarning(w);
-        }
+
 
         if (anyStaticFields) {
             throw new SerialException("Located static fields in " +
@@ -139,11 +123,8 @@
      */
     public Field[] getFields() throws SerialException {
         if (fields != null) {
-            Class c = this.obj.getClass();
-            //the following has to be commented before mustang integration
-            //return c.getFields();
-            //the following has to be uncommented before mustang integration
-            return sun.reflect.misc.FieldUtil.getFields(c);
+            Class<?> c = this.obj.getClass();
+            return c.getFields();
         } else {
             throw new SerialException("SerialJavaObject does not contain" +
                 " a serialized object instance");
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1335,7 +1335,6 @@
      *
      * @param a the button's action
      * @since 1.3
-     * @see <a href="#actions">Actions</a>
      * @see Action
      * @see #setAction
      */
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java	Fri Feb 04 16:29:41 2011 -0800
@@ -145,8 +145,8 @@
  * <li>
  * One way is to specify the character set as a parameter of the MIME
  * type.  This will be established by a call to the
- * <a href="#setContentType">setContentType</a> method.  If the content
- * is loaded by the <a href="#setPage">setPage</a> method the content
+ * {@link #setContentType setContentType} method.  If the content
+ * is loaded by the {@link #setPage setPage} method the content
  * type will have been set according to the specification of the URL.
  * It the file is loaded directly, the content type would be expected to
  * have been set prior to loading.
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Fri Feb 04 16:29:41 2011 -0800
@@ -256,10 +256,6 @@
 
     private FileView fileView = null;
 
-    // uiFileView is not serialized, as it is initialized
-    // by updateUI() after deserialization
-    private transient FileView uiFileView = null;
-
     private boolean controlsShown = true;
 
     private boolean useFileHiding = true;
@@ -1504,6 +1500,9 @@
             if(getFileView() != null) {
                 filename = getFileView().getName(f);
             }
+
+            FileView uiFileView = getUI().getFileView(this);
+
             if(filename == null && uiFileView != null) {
                 filename = uiFileView.getName(f);
             }
@@ -1524,6 +1523,9 @@
             if(getFileView() != null) {
                 description = getFileView().getDescription(f);
             }
+
+            FileView uiFileView = getUI().getFileView(this);
+
             if(description == null && uiFileView != null) {
                 description = uiFileView.getDescription(f);
             }
@@ -1544,6 +1546,9 @@
             if(getFileView() != null) {
                 typeDescription = getFileView().getTypeDescription(f);
             }
+
+            FileView uiFileView = getUI().getFileView(this);
+
             if(typeDescription == null && uiFileView != null) {
                 typeDescription = uiFileView.getTypeDescription(f);
             }
@@ -1564,6 +1569,9 @@
             if(getFileView() != null) {
                 icon = getFileView().getIcon(f);
             }
+
+            FileView uiFileView = getUI().getFileView(this);
+
             if(icon == null && uiFileView != null) {
                 icon = uiFileView.getIcon(f);
             }
@@ -1584,6 +1592,9 @@
             if (getFileView() != null) {
                 traversable = getFileView().isTraversable(f);
             }
+
+            FileView uiFileView = getUI().getFileView(this);
+
             if (traversable == null && uiFileView != null) {
                 traversable = uiFileView.isTraversable(f);
             }
@@ -1791,7 +1802,6 @@
         }
         setUI(ui);
 
-        uiFileView = getUI().getFileView(this);
         if(isAcceptAllFileFilterUsed()) {
             addChoosableFileFilter(getAcceptAllFileFilter());
         }
--- a/jdk/src/share/classes/javax/swing/SizeSequence.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/SizeSequence.java	Fri Feb 04 16:29:41 2011 -0800
@@ -132,7 +132,7 @@
      * can use <code>insertEntries</code> or <code>setSizes</code>.
      *
      * @see #insertEntries
-     * @see #setSizes
+     * @see #setSizes(int[])
      */
     public SizeSequence() {
         a = emptyArray;
--- a/jdk/src/share/classes/javax/swing/TransferHandler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/TransferHandler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -344,7 +344,7 @@
          *
          * @return the drop location
          * @throws IllegalStateException if this is not a drop
-         * @see #isDrop
+         * @see #isDrop()
          */
         public DropLocation getDropLocation() {
             assureIsDrop();
@@ -380,7 +380,7 @@
          *
          * @param showDropLocation whether or not to indicate the drop location
          * @throws IllegalStateException if this is not a drop
-         * @see #isDrop
+         * @see #isDrop()
          */
         public void setShowDropLocation(boolean showDropLocation) {
             assureIsDrop();
@@ -406,7 +406,7 @@
          * @see #getDropAction
          * @see #getUserDropAction
          * @see #getSourceDropActions
-         * @see #isDrop
+         * @see #isDrop()
          */
         public void setDropAction(int dropAction) {
             assureIsDrop();
@@ -440,7 +440,7 @@
          * @throws IllegalStateException if this is not a drop
          * @see #setDropAction
          * @see #getUserDropAction
-         * @see #isDrop
+         * @see #isDrop()
          */
         public int getDropAction() {
             return dropAction == -1 ? getUserDropAction() : dropAction;
@@ -468,7 +468,7 @@
          * @throws IllegalStateException if this is not a drop
          * @see #setDropAction
          * @see #getDropAction
-         * @see #isDrop
+         * @see #isDrop()
          */
         public int getUserDropAction() {
             assureIsDrop();
@@ -501,7 +501,7 @@
          *
          * @return the drag source's supported drop actions
          * @throws IllegalStateException if this is not a drop
-         * @see #isDrop
+         * @see #isDrop()
          */
         public int getSourceDropActions() {
             assureIsDrop();
--- a/jdk/src/share/classes/javax/swing/event/InternalFrameAdapter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/event/InternalFrameAdapter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -32,8 +32,7 @@
  * equivalent to the WindowAdapter class in the AWT.
  * <p>
  * See <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/internalframelistener.html">How to Write an Internal Frame Listener</a>
- * in <em>The Java Tutorial</em> and
- * <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">The Java Class Libraries (update)</a>
+ * in <em>The Java Tutorial</em>
  *
  * @see InternalFrameEvent
  * @see InternalFrameListener
--- a/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java	Fri Feb 04 16:29:41 2011 -0800
@@ -33,9 +33,7 @@
  * in the AWT.
  * <p>
  * See <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/internalframelistener.html">How to Write an Internal Frame Listener</a>
- * in <em>The Java Tutorial</em> and
- * <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">The Java Class Libraries (update)</a>
- * for further documentation.
+ * in <em>The Java Tutorial</em> for further documentation.
  *
  * @see java.awt.event.WindowListener
  *
--- a/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html	Fri Feb 04 16:29:41 2011 -0800
@@ -66,7 +66,7 @@
 Before reading further, you should be familiar 
 with the concept of pluggable look and feels.
 For basic information, see
-<a href="http://java.sun.com/docs/books/tutorial/uiswing/start/swingTour.html#plaf">Choosing the Look and Feel</a>,
+<a href="http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html">How to Set the Look and Feel</a>,
 a section in 
 <em>The Java Tutorial</em>.
 For architectural details, you can read
--- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html	Fri Feb 04 16:29:41 2011 -0800
@@ -91,7 +91,7 @@
 <div class="dtd-fragment">
 <pre class="dtd-fragment">
 &lt;!ELEMENT <a name="e.style">style</a> (<a href="#e.property">property</a> | <a href="#e.defaultsProperty">defaultsProperty</a> | <a href="#e.state">state</a> | <a href="#e.font">font</a> | <a href="#e.graphicsUtils">graphicsUtils</a> |
-                 <a href="#e.insets">insets</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | <a href="#e.opaque">opaque</a> | (<a href="#beansPersistance">%beansPersistance;</a>) |
+                 <a href="#e.insets">insets</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | <a href="#e.opaque">opaque</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) |
                  <a href="#e.imageIcon">imageIcon</a>)*>
 &lt;!ATTLIST style
           <a href="#style.id">id</a>              ID          #IMPLIED
@@ -250,8 +250,8 @@
     <p>
       Defines the font for the current <a href="#e.state">state</a>,
       or <a href="#e.style">style</a>. You must
-      specify either an <a href="#state.idref">idref</a> or a
-      <a href="#state.name">name</a> and <a href="#state.size">size</a>.
+      specify either an <a href="#font.idref">idref</a> or a
+      <a href="#font.name">name</a> and <a href="#font.size">size</a>.
     </p>
     <p>
       The following example creates a style with a Font of
@@ -797,7 +797,7 @@
           <a href="#imagePainter.path">path</a>                  CDATA          #REQUIRED
           <a href="#imagePainter.sourceInsets">sourceInsets</a>          CDATA          #IMPLIED
           <a href="#imagePainter.destinationInsets">destinationInsets</a>     CDATA          #IMPLIED
-          <a href="#imagePainter.paintCenter">paintCenter</a>           (true|false)   "true"
+          <a href="#imagePainter.painterCenter">paintCenter</a>           (true|false)   "true"
           <a href="#imagePainter.stretch">stretch</a>               (true|false)   "true"
           <a href="#imagePainter.center">center</a>                (true|false)   "false"
 &gt;
--- a/jdk/src/share/classes/javax/swing/text/AsyncBoxView.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/AsyncBoxView.java	Fri Feb 04 16:29:41 2011 -0800
@@ -384,7 +384,7 @@
 
     /**
      * Loads all of the children to initialize the view.
-     * This is called by the <a href="#setParent">setParent</a>
+     * This is called by the {@link #setParent setParent}
      * method.  Subclasses can reimplement this to initialize
      * their child views in a different manner.  The default
      * implementation creates a child view for each
--- a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Fri Feb 04 16:29:41 2011 -0800
@@ -70,7 +70,7 @@
  * will render a solid color as specified in the associated text component
  * in the <code>SelectionColor</code> property.  This can easily be changed
  * by reimplementing the
- * <a href="#getSelectionHighlighter">getSelectionHighlighter</a>
+ * {@link #getSelectionPainter getSelectionPainter}
  * method.
  * <p>
  * A customized caret appearance can be achieved by reimplementing
--- a/jdk/src/share/classes/javax/swing/text/TableView.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/TableView.java	Fri Feb 04 16:29:41 2011 -0800
@@ -315,7 +315,7 @@
      * updated along the minor axis.
      * <p>
      * This is implemented to call the
-     * <a href="#layoutColumns">layoutColumns</a> method, and then
+     * {@link #layoutColumns layoutColumns} method, and then
      * forward to the superclass to actually carry out the layout
      * of the tables rows.
      *
--- a/jdk/src/share/classes/javax/swing/text/View.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/View.java	Fri Feb 04 16:29:41 2011 -0800
@@ -117,7 +117,7 @@
     what it is prepared to deal with.
     <li>The coordinate system is the same as the hosting <code>Component</code>
     (i.e. the <code>Component</code> returned by the
-    <a href="#getContainer">getContainer</a> method).
+    {@link #getContainer getContainer} method).
     This means a child view lives in the same coordinate system as the parent
     view unless the parent has explicitly changed the coordinate system.
     To schedule itself to be repainted a view can call repaint on the hosting
@@ -180,9 +180,9 @@
     starting from the root of the view hierarchy.
     The methods for doing this are:
     <ul>
-    <li><a href="#insertUpdate">insertUpdate</a>
-    <li><a href="#removeUpdate">removeUpdate</a>
-    <li><a href="#changedUpdate">changedUpdate</a>
+    <li>{@link #insertUpdate insertUpdate}
+    <li>{@link #removeUpdate removeUpdate}
+    <li>{@link #changedUpdate changedUpdate}
     </ul>
     <p>
 </dl>
@@ -497,6 +497,10 @@
     public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
                                          int direction, Position.Bias[] biasRet)
       throws BadLocationException {
+        if (pos < -1) {
+            // -1 is a reserved value, see the code below
+            throw new BadLocationException("Invalid position", pos);
+        }
 
         biasRet[0] = Position.Bias.Forward;
         switch (direction) {
@@ -670,15 +674,15 @@
      * spread out into the following calls that subclasses can
      * reimplement:
      * <ol>
-     * <li><a href="#updateChildren">updateChildren</a> is called
+     * <li>{@link #updateChildren updateChildren} is called
      * if there were any changes to the element this view is
      * responsible for.  If this view has child views that are
      * represent the child elements, then this method should do
      * whatever is necessary to make sure the child views correctly
      * represent the model.
-     * <li><a href="#forwardUpdate">forwardUpdate</a> is called
+     * <li>{@link #forwardUpdate forwardUpdate} is called
      * to forward the DocumentEvent to the appropriate child views.
-     * <li><a href="#updateLayout">updateLayout</a> is called to
+     * <li>{@link #updateLayout updateLayout} is called to
      * give the view a chance to either repair its layout, to reschedule
      * layout, or do nothing.
      * </ol>
@@ -711,15 +715,15 @@
      * spread out into the following calls that subclasses can
      * reimplement:
      * <ol>
-     * <li><a href="#updateChildren">updateChildren</a> is called
+     * <li>{@link #updateChildren updateChildren} is called
      * if there were any changes to the element this view is
      * responsible for.  If this view has child views that are
      * represent the child elements, then this method should do
      * whatever is necessary to make sure the child views correctly
      * represent the model.
-     * <li><a href="#forwardUpdate">forwardUpdate</a> is called
+     * <li>{@link #forwardUpdate forwardUpdate} is called
      * to forward the DocumentEvent to the appropriate child views.
-     * <li><a href="#updateLayout">updateLayout</a> is called to
+     * <li>{@link #updateLayout updateLayout} is called to
      * give the view a chance to either repair its layout, to reschedule
      * layout, or do nothing.
      * </ol>
@@ -752,15 +756,15 @@
      * spread out into the following calls that subclasses can
      * reimplement:
      * <ol>
-     * <li><a href="#updateChildren">updateChildren</a> is called
+     * <li>{@link #updateChildren updateChildren} is called
      * if there were any changes to the element this view is
      * responsible for.  If this view has child views that are
      * represent the child elements, then this method should do
      * whatever is necessary to make sure the child views correctly
      * represent the model.
-     * <li><a href="#forwardUpdate">forwardUpdate</a> is called
+     * <li>{@link #forwardUpdate forwardUpdate} is called
      * to forward the DocumentEvent to the appropriate child views.
-     * <li><a href="#updateLayout">updateLayout</a> is called to
+     * <li>{@link #updateLayout updateLayout} is called to
      * give the view a chance to either repair its layout, to reschedule
      * layout, or do nothing.
      * </ol>
@@ -1186,7 +1190,7 @@
      * simply messages the view with a call to <code>insertUpdate</code>,
      * <code>removeUpdate</code>, or <code>changedUpdate</code> depending
      * upon the type of the event.  This is called by
-     * <a href="#forwardUpdate">forwardUpdate</a> to forward
+     * {@link #forwardUpdate forwardUpdate} to forward
      * the event to children that need it.
      *
      * @param v the child view to forward the event to
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Fri Feb 04 16:29:41 2011 -0800
@@ -123,7 +123,7 @@
  * to load.  By default, this kit produces documents that will be
  * loaded asynchronously if loaded using <code>JEditorPane.setPage</code>.
  * This is controlled by a property on the document.  The method
- * <a href="#createDefaultDocument">createDefaultDocument</a> can
+ * {@link #createDefaultDocument createDefaultDocument} can
  * be overriden to change this.  The batching of work is done
  * by the <code>HTMLDocument.HTMLReader</code> class.  The actual
  * work is done by the <code>DefaultStyledDocument</code> and
@@ -558,7 +558,7 @@
      * automatically or only <code>FormSubmitEvent</code> is fired.
      * By default it is set to true.
      *
-     * @see #isAutoFormSubmission
+     * @see #isAutoFormSubmission()
      * @see FormSubmitEvent
      * @since 1.5
      */
--- a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java	Fri Feb 04 16:29:41 2011 -0800
@@ -61,7 +61,7 @@
      * <p>
      * This is implemented
      * to forward to the superclass as well as call the
-     * <a href="#setPropertiesFromAttributes">setPropertiesFromAttributes</a>
+     * {@link #setPropertiesFromAttributes setPropertiesFromAttributes}
      * method to set the paragraph properties from the css
      * attributes.  The call is made at this time to ensure
      * the ability to resolve upward through the parents
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Fri Feb 04 16:29:41 2011 -0800
@@ -51,7 +51,7 @@
  * <p>
  * The primary entry point for HTML View implementations
  * to get their attributes is the
- * <a href="#getViewAttributes">getViewAttributes</a>
+ * {@link #getViewAttributes getViewAttributes}
  * method.  This should be implemented to establish the
  * desired policy used to associate attributes with the view.
  * Each HTMLEditorKit (i.e. and therefore each associated
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java	Fri Feb 04 16:29:41 2011 -0800
@@ -48,7 +48,11 @@
 
     private static final Object DTD_KEY = new Object();
 
-    protected static synchronized void setDefaultDTD() {
+    protected static void setDefaultDTD() {
+        getDefaultDTD();
+    }
+
+    private static synchronized DTD getDefaultDTD() {
         AppContext appContext = AppContext.getAppContext();
 
         DTD dtd = (DTD) appContext.get(DTD_KEY);
@@ -67,6 +71,8 @@
 
             appContext.put(DTD_KEY, dtd);
         }
+
+        return dtd;
     }
 
     protected static DTD createDTD(DTD dtd, String name) {
@@ -92,7 +98,7 @@
     }
 
     public void parse(Reader r, HTMLEditorKit.ParserCallback cb, boolean ignoreCharSet) throws IOException {
-        new DocumentParser((DTD) AppContext.getAppContext().get(DTD_KEY)).parse(r, cb, ignoreCharSet);
+        new DocumentParser(getDefaultDTD()).parse(r, cb, ignoreCharSet);
     }
 
     /**
--- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java	Fri Feb 04 16:29:41 2011 -0800
@@ -663,13 +663,15 @@
                     // set the context class loader to the AppletClassLoader.
                     creatorThread.setContextClassLoader(AppletClassLoader.this);
 
-                    synchronized(creatorThread.syncObject)  {
-                        creatorThread.start();
-                        try {
-                            creatorThread.syncObject.wait();
-                        } catch (InterruptedException e) { }
-                        appContext = creatorThread.appContext;
-                    }
+                    creatorThread.start();
+                    try {
+                        synchronized(creatorThread.syncObject) {
+                            while (!creatorThread.created) {
+                                creatorThread.syncObject.wait();
+                            }
+                        }
+                    } catch (InterruptedException e) { }
+                    appContext = creatorThread.appContext;
                     return null;
                 }
             });
@@ -854,14 +856,16 @@
 class AppContextCreator extends Thread  {
     Object syncObject = new Object();
     AppContext appContext = null;
+    volatile boolean created = false;
 
     AppContextCreator(ThreadGroup group)  {
         super(group, "AppContextCreator");
     }
 
     public void run()  {
-        synchronized(syncObject)  {
-            appContext = SunToolkit.createNewAppContext();
+        appContext = SunToolkit.createNewAppContext();
+        created = true;
+        synchronized(syncObject) {
             syncObject.notifyAll();
         }
     } // run()
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Fri Feb 04 16:29:41 2011 -0800
@@ -696,7 +696,9 @@
 
         synchronized (lock) {
             executeOnEventHandlerThread(event);
-            lock.wait();
+            while(!event.isDispatched()) {
+                lock.wait();
+            }
         }
 
         Throwable eventThrowable = event.getThrowable();
--- a/jdk/src/share/classes/sun/font/FileFontStrike.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/font/FileFontStrike.java	Fri Feb 04 16:29:41 2011 -0800
@@ -151,6 +151,23 @@
             }
         }
 
+        /* Amble fonts are better rendered unhinted although there's the
+         * inevitable fuzziness that accompanies this due to no longer
+         * snapping stems to the pixel grid. The exception is that in B&W
+         * mode they are worse without hinting. The down side to that is that
+         * B&W metrics will differ which normally isn't the case, although
+         * since AA mode is part of the measuring context that should be OK.
+         * We don't expect Amble to be installed in the Windows fonts folder.
+         * If we were to, then we'd also might want to disable using the
+         * native rasteriser path which is used for LCD mode for platform
+         * fonts. since we have no way to disable hinting by GDI.
+         * In the case of Amble, since its 'gasp' table says to disable
+         * hinting, I'd expect GDI to follow that, so likely it should
+         * all be consistent even if GDI used.
+         */
+        boolean disableHinting = desc.aaHint != INTVAL_TEXT_ANTIALIAS_OFF &&
+                                 fileFont.familyName.startsWith("Amble");
+
         /* If any of the values is NaN then substitute the null scaler context.
          * This will return null images, zero advance, and empty outlines
          * as no rendering need take place in this case.
@@ -165,7 +182,7 @@
             pScalerContext = fileFont.getScaler().createScalerContext(matrix,
                                     fileFont instanceof TrueTypeFont,
                                     desc.aaHint, desc.fmHint,
-                                    boldness, italic);
+                                    boldness, italic, disableHinting);
         }
 
         mapper = fileFont.getMapper();
@@ -566,10 +583,44 @@
         if (glyphCode >= INVISIBLE_GLYPHS) {
             return 0f;
         }
+
+        /* Notes on the (getUserAdv == false) case.
+         *
+         * Setting getUserAdv == false is internal to this class.
+         * If there's no graphics transform we can let
+         * getGlyphAdvance take its course, and potentially caching in
+         * advances arrays, except for signalling that
+         * getUserAdv == false means there is no need to create an image.
+         * It is possible that code already calculated the user advance,
+         * and it is desirable to take advantage of that work.
+         * But, if there's a transform and we want device advance, we
+         * can't use any values cached in the advances arrays - unless
+         * first re-transform them into device space using 'desc.devTx'.
+         * invertDevTx is null if the graphics transform is identity,
+         * a translate, or non-invertible. The latter case should
+         * not ever occur in the getUserAdv == false path.
+         * In other words its either null, or the inversion of a
+         * simple uniform scale. If its null, we can populate and
+         * use the advance caches as normal.
+         *
+         * If we don't find a cached value, obtain the device advance and
+         * return it. This will get stashed on the image by the caller and any
+         * subsequent metrics calls will be able to use it as is the case
+         * whenever an image is what is initially requested.
+         *
+         * Don't query if there's a value cached on the image, since this
+         * getUserAdv==false code path is entered solely when none exists.
+         */
         if (horizontalAdvances != null) {
             advance = horizontalAdvances[glyphCode];
             if (advance != Float.MAX_VALUE) {
-                return advance;
+                if (!getUserAdv && invertDevTx != null) {
+                    Point2D.Float metrics = new Point2D.Float(advance, 0f);
+                    desc.devTx.deltaTransform(metrics, metrics);
+                    return metrics.x;
+                } else {
+                    return advance;
+                }
             }
         } else if (segmentedCache && segHorizontalAdvances != null) {
             int segIndex = glyphCode >> SEGSHIFT;
@@ -577,11 +628,23 @@
             if (subArray != null) {
                 advance = subArray[glyphCode % SEGSIZE];
                 if (advance != Float.MAX_VALUE) {
-                    return advance;
+                    if (!getUserAdv && invertDevTx != null) {
+                        Point2D.Float metrics = new Point2D.Float(advance, 0f);
+                        desc.devTx.deltaTransform(metrics, metrics);
+                        return metrics.x;
+                    } else {
+                        return advance;
+                    }
                 }
             }
         }
 
+        if (!getUserAdv && invertDevTx != null) {
+            Point2D.Float metrics = new Point2D.Float();
+            fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);
+            return metrics.x;
+        }
+
         if (invertDevTx != null || !getUserAdv) {
             /* If there is a device transform need x & y advance to
              * transform back into user space.
@@ -725,7 +788,7 @@
         return getGlyphMetrics(glyphCode, true);
     }
 
-    private Point2D.Float getGlyphMetrics(int glyphCode, boolean getUserAdv) {
+    private Point2D.Float getGlyphMetrics(int glyphCode, boolean getImage) {
         Point2D.Float metrics = new Point2D.Float();
 
         // !!! or do we force sgv user glyphs?
@@ -733,7 +796,7 @@
             return metrics;
         }
         long glyphPtr;
-        if (getImageWithAdvance && getUserAdv) {
+        if (getImageWithAdvance && getImage) {
             /* A heuristic optimisation says that for most cases its
              * worthwhile retrieving the image at the same time as the
              * metrics. So here we get the image data even if its not
@@ -750,9 +813,9 @@
             metrics.y = StrikeCache.unsafe.getFloat
                 (glyphPtr + StrikeCache.yAdvanceOffset);
             /* advance is currently in device space, need to convert back
-             * into user space, unless getUserAdv == false.
+             * into user space.
              * This must not include the translation component. */
-            if (invertDevTx != null && getUserAdv) {
+            if (invertDevTx != null) {
                 invertDevTx.deltaTransform(metrics, metrics);
             }
         } else {
@@ -781,9 +844,9 @@
             if (value == null) {
                 fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);
                 /* advance is currently in device space, need to convert back
-                 * into user space, unless getUserAdv == false.
+                 * into user space.
                  */
-                if (invertDevTx != null && getUserAdv) {
+                if (invertDevTx != null) {
                     invertDevTx.deltaTransform(metrics, metrics);
                 }
                 value = new Point2D.Float(metrics.x, metrics.y);
--- a/jdk/src/share/classes/sun/font/FontScaler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/font/FontScaler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -242,9 +242,10 @@
         freed when corresponding strike is being released.
      */
     abstract long createScalerContext(double[] matrix,
-                        boolean fontType,
-                        int aa, int fm,
-                        float boldness, float italic);
+                                      boolean fontType,
+                                      int aa, int fm,
+                                      float boldness, float italic,
+                                      boolean disableHinting);
 
     /* Marks context as invalid because native scaler is invalid.
        Notes:
--- a/jdk/src/share/classes/sun/font/FreetypeFontScaler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/font/FreetypeFontScaler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -211,7 +211,8 @@
     }
 
     long createScalerContext(double[] matrix, boolean fontType,
-            int aa, int fm, float boldness, float italic) {
+            int aa, int fm, float boldness, float italic,
+            boolean disableHinting) {
         if (nativeScaler != 0L) {
             return createScalerContextNative(nativeScaler, matrix,
                       fontType, aa, fm, boldness, italic);
--- a/jdk/src/share/classes/sun/font/NullFontScaler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/font/NullFontScaler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -67,7 +67,7 @@
     long getLayoutTableCache() {return 0L;}
 
     long createScalerContext(double[] matrix, boolean fontType, int aa,
-        int fm, float boldness, float italic) {
+        int fm, float boldness, float italic, boolean disableHinting) {
         return getNullScalerContext();
     }
 
--- a/jdk/src/share/classes/sun/font/SunFontManager.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1576,7 +1576,7 @@
                                    .info("Trying to resolve file " + fullPath);
                 }
                 do {
-                    ttf = new TrueTypeFont(fullPath, null, fn++, true);
+                    ttf = new TrueTypeFont(fullPath, null, fn++, false);
                     //  prefer the font's locale name.
                     String fontName = ttf.getFontName(l).toLowerCase();
                     if (unmappedFonts.contains(fontName)) {
@@ -1595,6 +1595,207 @@
         }
     }
 
+    /* Hardwire the English names and expected file names of fonts
+     * commonly used at start up. Avoiding until later even the small
+     * cost of calling platform APIs to locate these can help.
+     * The code that registers these fonts needs to "bail" if any
+     * of the files do not exist, so it will verify the existence of
+     * all non-null file names first.
+     * They are added in to a map with nominally the first
+     * word in the name of the family as the key. In all the cases
+     * we are using the the family name is a single word, and as is
+     * more or less required the family name is the initial sequence
+     * in a full name. So lookup first finds the matching description,
+     * then registers the whole family, returning the right font.
+     */
+    public static class FamilyDescription {
+        public String familyName;
+        public String plainFullName;
+        public String boldFullName;
+        public String italicFullName;
+        public String boldItalicFullName;
+        public String plainFileName;
+        public String boldFileName;
+        public String italicFileName;
+        public String boldItalicFileName;
+    }
+
+    static HashMap<String, FamilyDescription> platformFontMap;
+
+    /**
+     * default implementation does nothing.
+     */
+    public HashMap<String, FamilyDescription> populateHardcodedFileNameMap() {
+        return new HashMap<String, FamilyDescription>(0);
+    }
+
+    Font2D findFontFromPlatformMap(String lcName, int style) {
+        if (platformFontMap == null) {
+            platformFontMap = populateHardcodedFileNameMap();
+        }
+
+        if (platformFontMap == null || platformFontMap.size() == 0) {
+            return null;
+        }
+
+        int spaceIndex = lcName.indexOf(' ');
+        String firstWord = lcName;
+        if (spaceIndex > 0) {
+            firstWord = lcName.substring(0, spaceIndex);
+        }
+
+        FamilyDescription fd = platformFontMap.get(firstWord);
+        if (fd == null) {
+            return null;
+        }
+        /* Once we've established that its at least the first word,
+         * we need to dig deeper to make sure its a match for either
+         * a full name, or the family name, to make sure its not
+         * a request for some other font that just happens to start
+         * with the same first word.
+         */
+        int styleIndex = -1;
+        if (lcName.equalsIgnoreCase(fd.plainFullName)) {
+            styleIndex = 0;
+        } else if (lcName.equalsIgnoreCase(fd.boldFullName)) {
+            styleIndex = 1;
+        } else if (lcName.equalsIgnoreCase(fd.italicFullName)) {
+            styleIndex = 2;
+        } else if (lcName.equalsIgnoreCase(fd.boldItalicFullName)) {
+            styleIndex = 3;
+        }
+        if (styleIndex == -1 && !lcName.equalsIgnoreCase(fd.familyName)) {
+            return null;
+        }
+
+        String plainFile = null, boldFile = null,
+            italicFile = null, boldItalicFile = null;
+
+        boolean failure = false;
+        /* In a terminal server config, its possible that getPathName()
+         * will return null, if the file doesn't exist, hence the null
+         * checks on return. But in the normal client config we need to
+         * follow this up with a check to see if all the files really
+         * exist for the non-null paths.
+         */
+         getPlatformFontDirs(noType1Font);
+
+        if (fd.plainFileName != null) {
+            plainFile = getPathName(fd.plainFileName);
+            if (plainFile == null) {
+                failure = true;
+            }
+        }
+
+        if (fd.boldFileName != null) {
+            boldFile = getPathName(fd.boldFileName);
+            if (boldFile == null) {
+                failure = true;
+            }
+        }
+
+        if (fd.italicFileName != null) {
+            italicFile = getPathName(fd.italicFileName);
+            if (italicFile == null) {
+                failure = true;
+            }
+        }
+
+        if (fd.boldItalicFileName != null) {
+            boldItalicFile = getPathName(fd.boldItalicFileName);
+            if (boldItalicFile == null) {
+                failure = true;
+            }
+        }
+
+        if (failure) {
+            if (FontUtilities.isLogging()) {
+                FontUtilities.getLogger().
+                    info("Hardcoded file missing looking for " + lcName);
+            }
+            platformFontMap.remove(firstWord);
+            return null;
+        }
+
+        /* Some of these may be null,as not all styles have to exist */
+        final String[] files = {
+            plainFile, boldFile, italicFile, boldItalicFile } ;
+
+        failure = java.security.AccessController.doPrivileged(
+                 new java.security.PrivilegedAction<Boolean>() {
+                     public Boolean run() {
+                         for (int i=0; i<files.length; i++) {
+                             if (files[i] == null) {
+                                 continue;
+                             }
+                             File f = new File(files[i]);
+                             if (!f.exists()) {
+                                 return Boolean.TRUE;
+                             }
+                         }
+                         return Boolean.FALSE;
+                     }
+                 });
+
+        if (failure) {
+            if (FontUtilities.isLogging()) {
+                FontUtilities.getLogger().
+                    info("Hardcoded file missing looking for " + lcName);
+            }
+            platformFontMap.remove(firstWord);
+            return null;
+        }
+
+        /* If we reach here we know that we have all the files we
+         * expect, so all should be fine so long as the contents
+         * are what we'd expect. Now on to registering the fonts.
+         * Currently this code only looks for TrueType fonts, so format
+         * and rank can be specified without looking at the filename.
+         */
+        Font2D font = null;
+        for (int f=0;f<files.length;f++) {
+            if (files[f] == null) {
+                continue;
+            }
+            PhysicalFont pf =
+                registerFontFile(files[f], null,
+                                 FONTFORMAT_TRUETYPE, false, Font2D.TTF_RANK);
+            if (f == styleIndex) {
+                font = pf;
+            }
+        }
+
+
+        /* Two general cases need a bit more work here.
+         * 1) If font is null, then it was perhaps a request for a
+         * non-existent font, such as "Tahoma Italic", or a family name -
+         * where family and full name of the plain font differ.
+         * Fall back to finding the closest one in the family.
+         * This could still fail if a client specified "Segoe" instead of
+         * "Segoe UI".
+         * 2) The request is of the form "MyFont Bold", style=Font.ITALIC,
+         * and so we want to see if there's a Bold Italic font, or
+         * "MyFamily", style=Font.BOLD, and we may have matched the plain,
+         * but now need to revise that to the BOLD font.
+         */
+        FontFamily fontFamily = FontFamily.getFamily(fd.familyName);
+        if (fontFamily != null) {
+            if (font == null) {
+                font = fontFamily.getFont(style);
+                if (font == null) {
+                    font = fontFamily.getClosestStyle(style);
+                }
+            } else if (style > 0 && style != font.style) {
+                style |= font.style;
+                font = fontFamily.getFont(style);
+                if (font == null) {
+                    font = fontFamily.getClosestStyle(style);
+                }
+            }
+        }
+
+        return font;
+    }
     private synchronized HashMap<String,String> getFullNameToFileMap() {
         if (fontToFileMap == null) {
 
@@ -1998,6 +2199,17 @@
         }
 
         if (FontUtilities.isWindows) {
+
+            font = findFontFromPlatformMap(lowerCaseName, style);
+            if (FontUtilities.isLogging()) {
+                FontUtilities.getLogger()
+                    .info("findFontFromPlatformMap returned " + font);
+            }
+            if (font != null) {
+                fontNameCache.put(mapName, font);
+                return font;
+            }
+
             /* Don't want Windows to return a Lucida Sans font from
              * C:\Windows\Fonts
              */
@@ -2221,7 +2433,7 @@
         return FontUtilities.getFont2D(font).supportsEncoding(encoding);
     }
 
-    public abstract String getFontPath(boolean noType1Fonts);
+    protected abstract String getFontPath(boolean noType1Fonts);
 
     private Thread fileCloser = null;
     Vector<File> tmpFontFiles = null;
@@ -2934,8 +3146,15 @@
         }
     }
 
+
     protected String[] getPlatformFontDirs(boolean noType1Fonts) {
-        String path = getFontPath(true);
+
+        /* First check if we already initialised path dirs */
+        if (pathDirs != null) {
+            return pathDirs;
+        }
+
+        String path = getPlatformFontPath(noType1Fonts);
         StringTokenizer parser =
             new StringTokenizer(path, File.pathSeparator);
         ArrayList<String> pathList = new ArrayList<String>();
@@ -2945,7 +3164,8 @@
             }
         } catch (NoSuchElementException e) {
         }
-        return pathList.toArray(new String[0]);
+        pathDirs = pathList.toArray(new String[0]);
+        return pathDirs;
     }
 
     /**
@@ -3047,7 +3267,7 @@
     /* A call to this method should be followed by a call to
      * registerFontDirs(..)
      */
-    protected String getPlatformFontPath(boolean noType1Font) {
+    public String getPlatformFontPath(boolean noType1Font) {
         if (fontPath == null) {
             fontPath = getFontPath(noType1Font);
         }
--- a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Fri Feb 04 16:29:41 2011 -0800
@@ -165,7 +165,7 @@
         return new SunGraphics2D(sd, Color.white, Color.black, defaultFont);
     }
 
-    private static FontManagerForSGE getFontManagerForSGE() {
+    public static FontManagerForSGE getFontManagerForSGE() {
         FontManager fm = FontManagerFactory.getInstance();
         return (FontManagerForSGE) fm;
     }
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Fri Feb 04 16:29:41 2011 -0800
@@ -401,6 +401,14 @@
         }
     }
 
+
+    // From src/share/bin/java.c:
+    //   enum LaunchMode { LM_UNKNOWN = 0, LM_CLASS, LM_JAR };
+
+    private static final int LM_UNKNOWN = 0;
+    private static final int LM_CLASS   = 1;
+    private static final int LM_JAR     = 2;
+
     /**
      * This method does the following:
      * 1. gets the classname from a Jar's manifest, if necessary
@@ -420,24 +428,40 @@
      * @return
      * @throws java.io.IOException
      */
-    public static Object checkAndLoadMain(boolean printToStderr,
-            boolean isJar, String name) throws IOException {
+    public static Class<?> checkAndLoadMain(boolean printToStderr,
+                                            int mode,
+                                            String what) throws IOException
+    {
+
+        ClassLoader ld = ClassLoader.getSystemClassLoader();
+
         // get the class name
-        String classname = (isJar) ? getMainClassFromJar(name) : name;
-        classname = classname.replace('/', '.');
-        ClassLoader loader = ClassLoader.getSystemClassLoader();
-        Class<?> clazz = null;
+        String cn = null;
+        switch (mode) {
+        case LM_CLASS:
+            cn = what;
+            break;
+        case LM_JAR:
+            cn = getMainClassFromJar(what);
+            break;
+        default:
+            throw new InternalError("" + mode + ": Unknown launch mode");
+        }
+        cn = cn.replace('/', '.');
+
         PrintStream ostream = (printToStderr) ? System.err : System.out;
+        Class<?> c = null;
         try {
-            clazz = loader.loadClass(classname);
+            c = ld.loadClass(cn);
         } catch (ClassNotFoundException cnfe) {
-            ostream.println(getLocalizedMessage("java.launcher.cls.error1", classname));
-            NoClassDefFoundError ncdfe = new NoClassDefFoundError(classname);
+            ostream.println(getLocalizedMessage("java.launcher.cls.error1",
+                                                cn));
+            NoClassDefFoundError ncdfe = new NoClassDefFoundError(cn);
             ncdfe.initCause(cnfe);
             throw ncdfe;
         }
-        signatureDiagnostic(ostream, clazz);
-        return clazz;
+        signatureDiagnostic(ostream, c);
+        return c;
     }
 
     static void signatureDiagnostic(PrintStream ostream, Class<?> clazz) {
--- a/jdk/src/share/classes/sun/management/ThreadImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/management/ThreadImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,7 +25,6 @@
 
 package sun.management;
 
-import java.lang.management.ThreadMXBean;
 import java.lang.management.ManagementFactory;
 
 import java.lang.management.ThreadInfo;
@@ -39,13 +38,14 @@
  * ManagementFactory.getThreadMXBean() returns an instance
  * of this class.
  */
-class ThreadImpl implements ThreadMXBean {
+class ThreadImpl implements com.sun.management.ThreadMXBean {
 
     private final VMManagement jvm;
 
     // default for thread contention monitoring is disabled.
     private boolean contentionMonitoringEnabled = false;
     private boolean cpuTimeEnabled;
+    private boolean allocatedMemoryEnabled;
 
     /**
      * Constructor of ThreadImpl class.
@@ -53,6 +53,7 @@
     ThreadImpl(VMManagement vm) {
         this.jvm = vm;
         this.cpuTimeEnabled = jvm.isThreadCpuTimeEnabled();
+        this.allocatedMemoryEnabled = jvm.isThreadAllocatedMemoryEnabled();
     }
 
     public int getThreadCount() {
@@ -91,6 +92,10 @@
         return jvm.isCurrentThreadCpuTimeSupported();
     }
 
+    public boolean isThreadAllocatedMemorySupported() {
+        return jvm.isThreadAllocatedMemorySupported();
+    }
+
     public boolean isThreadCpuTimeEnabled() {
         if (!isThreadCpuTimeSupported() &&
             !isCurrentThreadCpuTimeSupported()) {
@@ -100,6 +105,14 @@
         return cpuTimeEnabled;
     }
 
+    public boolean isThreadAllocatedMemoryEnabled() {
+        if (!isThreadAllocatedMemorySupported()) {
+            throw new UnsupportedOperationException(
+                "Thread allocated memory measurement is not supported");
+        }
+        return allocatedMemoryEnabled;
+    }
+
     public long[] getAllThreadIds() {
         Util.checkMonitorAccess();
 
@@ -114,11 +127,6 @@
     }
 
     public ThreadInfo getThreadInfo(long id) {
-        if (id <= 0) {
-            throw new IllegalArgumentException(
-                "Invalid thread ID parameter: " + id);
-        }
-
         long[] ids = new long[1];
         ids[0] = id;
         final ThreadInfo[] infos = getThreadInfo(ids, 0);
@@ -126,15 +134,6 @@
     }
 
     public ThreadInfo getThreadInfo(long id, int maxDepth) {
-        if (id <= 0) {
-            throw new IllegalArgumentException(
-                "Invalid thread ID parameter: " + id);
-        }
-        if (maxDepth < 0) {
-            throw new IllegalArgumentException(
-                "Invalid maxDepth parameter: " + maxDepth);
-        }
-
         long[] ids = new long[1];
         ids[0] = id;
         final ThreadInfo[] infos = getThreadInfo(ids, maxDepth);
@@ -145,11 +144,22 @@
         return getThreadInfo(ids, 0);
     }
 
-    public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
+    private void verifyThreadIds(long[] ids) {
         if (ids == null) {
             throw new NullPointerException("Null ids parameter.");
         }
 
+        for (int i = 0; i < ids.length; i++) {
+            if (ids[i] <= 0) {
+                throw new IllegalArgumentException(
+                    "Invalid thread ID parameter: " + ids[i]);
+            }
+        }
+    }
+
+    public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
+        verifyThreadIds(ids);
+
         if (maxDepth < 0) {
             throw new IllegalArgumentException(
                 "Invalid maxDepth parameter: " + maxDepth);
@@ -157,17 +167,15 @@
 
         Util.checkMonitorAccess();
 
-        ThreadInfo[] infos = new ThreadInfo[ids.length];
+        ThreadInfo[] infos = new ThreadInfo[ids.length]; // nulls
         if (maxDepth == Integer.MAX_VALUE) {
-            getThreadInfo0(ids, -1, infos);
+            getThreadInfo1(ids, -1, infos);
         } else {
-            getThreadInfo0(ids, maxDepth, infos);
+            getThreadInfo1(ids, maxDepth, infos);
         }
         return infos;
     }
 
-
-
     public void setThreadContentionMonitoringEnabled(boolean enable) {
         if (!isThreadContentionMonitoringSupported()) {
             throw new UnsupportedOperationException(
@@ -192,69 +200,32 @@
         }
     }
 
-    public long getCurrentThreadCpuTime() {
+    private boolean verifyCurrentThreadCpuTime() {
         // check if Thread CPU time measurement is supported.
         if (!isCurrentThreadCpuTimeSupported()) {
             throw new UnsupportedOperationException(
                 "Current thread CPU time measurement is not supported.");
         }
+        return isThreadCpuTimeEnabled();
+    }
 
-        if (!isThreadCpuTimeEnabled()) {
-            return -1;
+    public long getCurrentThreadCpuTime() {
+        if (verifyCurrentThreadCpuTime()) {
+            return getThreadTotalCpuTime0(0);
         }
-
-        return getThreadTotalCpuTime0(0);
+        return -1;
     }
 
     public long getThreadCpuTime(long id) {
-        // check if Thread CPU time measurement is supported.
-        if (!isThreadCpuTimeSupported() &&
-            !isCurrentThreadCpuTimeSupported()) {
-            throw new UnsupportedOperationException(
-                "Thread CPU Time Measurement is not supported.");
-        }
-
-        if (!isThreadCpuTimeSupported()) {
-            // support current thread only
-            if (id != Thread.currentThread().getId()) {
-                throw new UnsupportedOperationException(
-                    "Thread CPU Time Measurement is only supported" +
-                    " for the current thread.");
-            }
-        }
-
-        if (id <= 0) {
-            throw new IllegalArgumentException(
-                "Invalid thread ID parameter: " + id);
-        }
-
-        if (!isThreadCpuTimeEnabled()) {
-            return -1;
-        }
-
-        if (id == Thread.currentThread().getId()) {
-            // current thread
-            return getThreadTotalCpuTime0(0);
-        } else {
-            return getThreadTotalCpuTime0(id);
-        }
+        long[] ids = new long[1];
+        ids[0] = id;
+        final long[] times = getThreadCpuTime(ids);
+        return times[0];
     }
 
-    public long getCurrentThreadUserTime() {
-        // check if Thread CPU time measurement is supported.
-        if (!isCurrentThreadCpuTimeSupported()) {
-            throw new UnsupportedOperationException(
-                "Current thread CPU time measurement is not supported.");
-        }
+    private boolean verifyThreadCpuTime(long[] ids) {
+        verifyThreadIds(ids);
 
-        if (!isThreadCpuTimeEnabled()) {
-            return -1;
-        }
-
-        return getThreadUserCpuTime0(0);
-    }
-
-    public long getThreadUserTime(long id) {
         // check if Thread CPU time measurement is supported.
         if (!isThreadCpuTimeSupported() &&
             !isCurrentThreadCpuTimeSupported()) {
@@ -264,30 +235,73 @@
 
         if (!isThreadCpuTimeSupported()) {
             // support current thread only
-            if (id != Thread.currentThread().getId()) {
-                throw new UnsupportedOperationException(
-                    "Thread CPU time measurement is only supported" +
-                    " for the current thread.");
+            for (int i = 0; i < ids.length; i++) {
+                if (ids[i] != Thread.currentThread().getId()) {
+                    throw new UnsupportedOperationException(
+                        "Thread CPU time measurement is only supported" +
+                        " for the current thread.");
+                }
             }
         }
 
-        if (id <= 0) {
-            throw new IllegalArgumentException(
-                "Invalid thread ID parameter: " + id);
-        }
+        return isThreadCpuTimeEnabled();
+    }
+
+    public long[] getThreadCpuTime(long[] ids) {
+        boolean verified = verifyThreadCpuTime(ids);
+
+        int length = ids.length;
+        long[] times = new long[length];
+        java.util.Arrays.fill(times, -1);
 
-        if (!isThreadCpuTimeEnabled()) {
-            return -1;
+        if (verified) {
+            if (length == 1) {
+                long id = ids[0];
+                if (id == Thread.currentThread().getId()) {
+                    id = 0;
+                }
+                times[0] = getThreadTotalCpuTime0(id);
+            } else {
+                getThreadTotalCpuTime1(ids, times);
+            }
         }
-
-        if (id == Thread.currentThread().getId()) {
-            // current thread
-           return getThreadUserCpuTime0(0);
-        } else {
-           return getThreadUserCpuTime0(id);
-        }
+        return times;
     }
 
+    public long getCurrentThreadUserTime() {
+        if (verifyCurrentThreadCpuTime()) {
+            return getThreadUserCpuTime0(0);
+        }
+        return -1;
+    }
+
+    public long getThreadUserTime(long id) {
+        long[] ids = new long[1];
+        ids[0] = id;
+        final long[] times = getThreadUserTime(ids);
+        return times[0];
+    }
+
+    public long[] getThreadUserTime(long[] ids) {
+        boolean verified = verifyThreadCpuTime(ids);
+
+        int length = ids.length;
+        long[] times = new long[length];
+        java.util.Arrays.fill(times, -1);
+
+        if (verified) {
+            if (length == 1) {
+                long id = ids[0];
+                if (id == Thread.currentThread().getId()) {
+                    id = 0;
+                }
+                times[0] = getThreadUserCpuTime0(id);
+            } else {
+                getThreadUserCpuTime1(ids, times);
+            }
+        }
+        return times;
+    }
 
     public void setThreadCpuTimeEnabled(boolean enable) {
         if (!isThreadCpuTimeSupported() &&
@@ -299,13 +313,60 @@
         Util.checkControlAccess();
         synchronized (this) {
             if (cpuTimeEnabled != enable) {
-                // update VM of the state change
+                // notify VM of the state change
                 setThreadCpuTimeEnabled0(enable);
                 cpuTimeEnabled = enable;
             }
         }
     }
 
+    public long getThreadAllocatedBytes(long id) {
+        long[] ids = new long[1];
+        ids[0] = id;
+        final long[] sizes = getThreadAllocatedBytes(ids);
+        return sizes[0];
+    }
+
+    private boolean verifyThreadAllocatedMemory(long[] ids) {
+        verifyThreadIds(ids);
+
+        // check if Thread allocated memory measurement is supported.
+        if (!isThreadAllocatedMemorySupported()) {
+            throw new UnsupportedOperationException(
+                "Thread allocated memory measurement is not supported.");
+        }
+
+        return isThreadAllocatedMemoryEnabled();
+    }
+
+    public long[] getThreadAllocatedBytes(long[] ids) {
+        boolean verified = verifyThreadAllocatedMemory(ids);
+
+        long[] sizes = new long[ids.length];
+        java.util.Arrays.fill(sizes, -1);
+
+        if (verified) {
+            getThreadAllocatedMemory1(ids, sizes);
+        }
+        return sizes;
+    }
+
+    public void setThreadAllocatedMemoryEnabled(boolean enable) {
+        if (!isThreadAllocatedMemorySupported()) {
+            throw new UnsupportedOperationException(
+                "Thread allocated memory measurement is not supported.");
+        }
+
+        Util.checkControlAccess();
+        synchronized (this) {
+            if (allocatedMemoryEnabled != enable) {
+                // notify VM of the state change
+                setThreadAllocatedMemoryEnabled0(enable);
+                allocatedMemoryEnabled = enable;
+            }
+        }
+    }
+
     public long[] findMonitorDeadlockedThreads() {
         Util.checkMonitorAccess();
 
@@ -356,49 +417,47 @@
         return jvm.isSynchronizerUsageSupported();
     }
 
-    public ThreadInfo[] getThreadInfo(long[] ids,
-                                      boolean lockedMonitors,
-                                      boolean lockedSynchronizers) {
-        if (ids == null) {
-            throw new NullPointerException("Null ids parameter.");
-        }
-
+    private void verifyDumpThreads(boolean lockedMonitors,
+                                   boolean lockedSynchronizers) {
         if (lockedMonitors && !isObjectMonitorUsageSupported()) {
             throw new UnsupportedOperationException(
                 "Monitoring of Object Monitor Usage is not supported.");
         }
+
         if (lockedSynchronizers && !isSynchronizerUsageSupported()) {
             throw new UnsupportedOperationException(
                 "Monitoring of Synchronizer Usage is not supported.");
         }
 
         Util.checkMonitorAccess();
+    }
+
+    public ThreadInfo[] getThreadInfo(long[] ids,
+                                      boolean lockedMonitors,
+                                      boolean lockedSynchronizers) {
+        verifyThreadIds(ids);
+        verifyDumpThreads(lockedMonitors, lockedSynchronizers);
         return dumpThreads0(ids, lockedMonitors, lockedSynchronizers);
     }
 
-
-    public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) {
-        if (lockedMonitors && !isObjectMonitorUsageSupported()) {
-            throw new UnsupportedOperationException(
-                "Monitoring of Object Monitor Usage is not supported.");
-        }
-        if (lockedSynchronizers && !isSynchronizerUsageSupported()) {
-            throw new UnsupportedOperationException(
-                "Monitoring of Synchronizer Usage is not supported.");
-        }
-
-        Util.checkMonitorAccess();
+    public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
+                                       boolean lockedSynchronizers) {
+        verifyDumpThreads(lockedMonitors, lockedSynchronizers);
         return dumpThreads0(null, lockedMonitors, lockedSynchronizers);
     }
 
     // VM support where maxDepth == -1 to request entire stack dump
     private static native Thread[] getThreads();
-    private static native void getThreadInfo0(long[] ids,
+    private static native void getThreadInfo1(long[] ids,
                                               int maxDepth,
                                               ThreadInfo[] result);
     private static native long getThreadTotalCpuTime0(long id);
+    private static native void getThreadTotalCpuTime1(long[] ids, long[] result);
     private static native long getThreadUserCpuTime0(long id);
+    private static native void getThreadUserCpuTime1(long[] ids, long[] result);
+    private static native void getThreadAllocatedMemory1(long[] ids, long[] result);
     private static native void setThreadCpuTimeEnabled0(boolean enable);
+    private static native void setThreadAllocatedMemoryEnabled0(boolean enable);
     private static native void setThreadContentionMonitoringEnabled0(boolean enable);
     private static native Thread[] findMonitorDeadlockedThreads0();
     private static native Thread[] findDeadlockedThreads0();
--- a/jdk/src/share/classes/sun/management/VMManagement.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/management/VMManagement.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -43,6 +43,8 @@
     public boolean isBootClassPathSupported();
     public boolean isObjectMonitorUsageSupported();
     public boolean isSynchronizerUsageSupported();
+    public boolean isThreadAllocatedMemorySupported();
+    public boolean isThreadAllocatedMemoryEnabled();
 
     // Class Loading Subsystem
     public long    getTotalClassCount();
--- a/jdk/src/share/classes/sun/management/VMManagementImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/management/VMManagementImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -55,6 +55,7 @@
     private static boolean bootClassPathSupport;
     private static boolean objectMonitorUsageSupport;
     private static boolean synchronizerUsageSupport;
+    private static boolean threadAllocatedMemorySupport;
 
     static {
         version = getVersion0();
@@ -95,9 +96,13 @@
         return synchronizerUsageSupport;
     }
 
+    public boolean isThreadAllocatedMemorySupported() {
+        return threadAllocatedMemorySupport;
+    }
+
     public native boolean isThreadContentionMonitoringEnabled();
     public native boolean isThreadCpuTimeEnabled();
-
+    public native boolean isThreadAllocatedMemoryEnabled();
 
     // Class Loading Subsystem
     public int    getLoadedClassCount() {
--- a/jdk/src/share/classes/sun/misc/URLClassPath.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/misc/URLClassPath.java	Fri Feb 04 16:29:41 2011 -0800
@@ -466,6 +466,7 @@
      */
     private static class Loader implements Closeable {
         private final URL base;
+        private JarFile jarfile; // if this points to a jar file
 
         /*
          * Creates a new Loader for the specified URL.
@@ -530,6 +531,17 @@
                 }
                 uc = url.openConnection();
                 InputStream in = uc.getInputStream();
+                if (uc instanceof JarURLConnection) {
+                    /* JarURLConnection.getInputStream() returns a separate
+                     * instance on each call. So we have to close this here.
+                     * The jar file cache will keep the file open.
+                     * Also, need to remember the jar file so it can be closed
+                     * in a hurry.
+                     */
+                    JarURLConnection juc = (JarURLConnection)uc;
+                    jarfile = juc.getJarFile();
+                    in.close();
+                }
             } catch (Exception e) {
                 return null;
             }
@@ -559,7 +571,11 @@
          * close this loader and release all resources
          * method overridden in sub-classes
          */
-        public void close () throws IOException {}
+        public void close () throws IOException {
+            if (jarfile != null) {
+                jarfile.close();
+            }
+        }
 
         /*
          * Returns the local class path for this loader, or null if none.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/net/SocksProxy.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 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.  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.net;
+
+import java.net.Proxy;
+import java.net.SocketAddress;
+
+/**
+ * Proxy wrapper class so we can determine the socks protocol version.
+ */
+public final class SocksProxy extends Proxy {
+    private final int version;
+
+    private SocksProxy(SocketAddress addr, int version) {
+        super(Proxy.Type.SOCKS, addr);
+        this.version = version;
+    }
+
+    public static SocksProxy create(SocketAddress addr, int version) {
+        return new SocksProxy(addr, version);
+    }
+
+    public int protocolVersion() {
+        return version;
+    }
+}
--- a/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java	Fri Feb 04 16:29:41 2011 -0800
@@ -25,13 +25,20 @@
 
 package sun.net.spi;
 
-import sun.net.NetProperties;
-import java.net.*;
-import java.util.*;
-import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.io.IOException;
 import sun.misc.RegexpPool;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import sun.net.NetProperties;
+import sun.net.SocksProxy;
 
 /**
  * Supports proxy settings using system properties This proxy selector
@@ -75,6 +82,8 @@
         {"socket", "socksProxy"}
     };
 
+    private static final String SOCKS_PROXY_VERSION = "socksProxyVersion";
+
     private static boolean hasSystemProxies = false;
 
     static {
@@ -287,7 +296,8 @@
                             saddr = InetSocketAddress.createUnresolved(phost, pport);
                             // Socks is *always* the last on the list.
                             if (j == (props[i].length - 1)) {
-                                return new Proxy(Proxy.Type.SOCKS, saddr);
+                                int version = NetProperties.getInteger(SOCKS_PROXY_VERSION, 5).intValue();
+                                return SocksProxy.create(saddr, version);
                             } else {
                                 return new Proxy(Proxy.Type.HTTP, saddr);
                             }
--- a/jdk/src/share/classes/sun/net/www/http/KeepAliveCache.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/net/www/http/KeepAliveCache.java	Fri Feb 04 16:29:41 2011 -0800
@@ -267,7 +267,7 @@
 
     /* return a still valid, unused HttpClient */
     synchronized void put(HttpClient h) {
-        if (size() > KeepAliveCache.getMaxConnections()) {
+        if (size() >= KeepAliveCache.getMaxConnections()) {
             h.closeServer(); // otherwise the connection remains in limbo
         } else {
             push(new KeepAliveEntry(h, System.currentTimeMillis()));
--- a/jdk/src/share/classes/sun/security/acl/AclEntryImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/acl/AclEntryImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -37,7 +37,7 @@
  */
 public class AclEntryImpl implements AclEntry {
     private Principal user = null;
-    private Vector<Permission> permissionSet = new Vector<Permission>(10, 10);
+    private Vector<Permission> permissionSet = new Vector<>(10, 10);
     private boolean negative = false;
 
     /**
--- a/jdk/src/share/classes/sun/security/acl/AclImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/acl/AclImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -41,15 +41,15 @@
     // or principal.
     //
     private Hashtable<Principal, AclEntry> allowedUsersTable =
-                                        new Hashtable<Principal, AclEntry>(23);
+                                        new Hashtable<>(23);
     private Hashtable<Principal, AclEntry> allowedGroupsTable =
-                                        new Hashtable<Principal, AclEntry>(23);
+                                        new Hashtable<>(23);
     private Hashtable<Principal, AclEntry> deniedUsersTable =
-                                        new Hashtable<Principal, AclEntry>(23);
+                                        new Hashtable<>(23);
     private Hashtable<Principal, AclEntry> deniedGroupsTable =
-                                        new Hashtable<Principal, AclEntry>(23);
+                                        new Hashtable<>(23);
     private String aclName = null;
-    private Vector<Permission> zeroSet = new Vector<Permission>(1,1);
+    private Vector<Permission> zeroSet = new Vector<>(1,1);
 
 
     /**
@@ -294,7 +294,7 @@
     //
     private static Enumeration<Permission> union(Enumeration<Permission> e1,
                 Enumeration<Permission> e2) {
-        Vector<Permission> v = new Vector<Permission>(20, 20);
+        Vector<Permission> v = new Vector<>(20, 20);
 
         while (e1.hasMoreElements())
             v.addElement(e1.nextElement());
@@ -313,7 +313,7 @@
     //
     private Enumeration<Permission> subtract(Enumeration<Permission> e1,
                 Enumeration<Permission> e2) {
-        Vector<Permission> v = new Vector<Permission>(20, 20);
+        Vector<Permission> v = new Vector<>(20, 20);
 
         while (e1.hasMoreElements())
             v.addElement(e1.nextElement());
--- a/jdk/src/share/classes/sun/security/acl/GroupImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/acl/GroupImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
  * @author      Satish Dharmaraj
  */
 public class GroupImpl implements Group {
-    private Vector<Principal> groupMembers = new Vector<Principal>(50, 100);
+    private Vector<Principal> groupMembers = new Vector<>(50, 100);
     private String group;
 
     /**
@@ -131,7 +131,7 @@
         if (groupMembers.contains(member)) {
             return true;
         } else {
-            Vector<Group> alreadySeen = new Vector<Group>(10);
+            Vector<Group> alreadySeen = new Vector<>(10);
             return isMemberRecurse(member, alreadySeen);
         }
     }
--- a/jdk/src/share/classes/sun/security/jca/ProviderList.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/jca/ProviderList.java	Fri Feb 04 16:29:41 2011 -0800
@@ -96,7 +96,7 @@
         if (providerList.getProvider(p.getName()) != null) {
             return providerList;
         }
-        List<ProviderConfig> list = new ArrayList<ProviderConfig>
+        List<ProviderConfig> list = new ArrayList<>
                                     (Arrays.asList(providerList.configs));
         int n = list.size();
         if ((position < 0) || (position > n)) {
@@ -160,7 +160,7 @@
      * Return a new ProviderList parsed from the java.security Properties.
      */
     private ProviderList() {
-        List<ProviderConfig> configList = new ArrayList<ProviderConfig>();
+        List<ProviderConfig> configList = new ArrayList<>();
         for (int i = 1; true; i++) {
             String entry = Security.getProperty("security.provider." + i);
             if (entry == null) {
@@ -200,7 +200,7 @@
      * possible recursion and deadlock during verification.
      */
     ProviderList getJarList(String[] jarClassNames) {
-        List<ProviderConfig> newConfigs = new ArrayList<ProviderConfig>();
+        List<ProviderConfig> newConfigs = new ArrayList<>();
         for (String className : jarClassNames) {
             ProviderConfig newConfig = new ProviderConfig(className);
             for (ProviderConfig config : configs) {
@@ -356,7 +356,7 @@
      */
     @Deprecated
     public List<Service> getServices(String type, List<String> algorithms) {
-        List<ServiceId> ids = new ArrayList<ServiceId>();
+        List<ServiceId> ids = new ArrayList<>();
         for (String alg : algorithms) {
             ids.add(new ServiceId(type, alg));
         }
--- a/jdk/src/share/classes/sun/security/jca/Providers.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/jca/Providers.java	Fri Feb 04 16:29:41 2011 -0800
@@ -40,7 +40,7 @@
 public class Providers {
 
     private static final ThreadLocal<ProviderList> threadLists =
-        new InheritableThreadLocal<ProviderList>();
+        new InheritableThreadLocal<>();
 
     // number of threads currently using thread-local provider lists
     // tracked to allow an optimization if == 0
--- a/jdk/src/share/classes/sun/security/krb5/Config.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java	Fri Feb 04 16:29:41 2011 -0800
@@ -528,7 +528,7 @@
                 }
                 })));
                 String Line;
-                Vector<String> v = new Vector<String> ();
+                Vector<String> v = new Vector<>();
                 String previous = null;
                 while ((Line = br.readLine()) != null) {
                     // ignore comments and blank line in the configuration file.
@@ -589,7 +589,7 @@
             throw new KrbException("I/O error while reading" +
                         " configuration file.");
         }
-        Hashtable<String,Object> table = new Hashtable<String,Object> ();
+        Hashtable<String,Object> table = new Hashtable<>();
         for (int i = 0; i < v.size(); i++) {
             String line = v.elementAt(i).trim();
             if (line.equalsIgnoreCase("[realms]")) {
@@ -598,7 +598,7 @@
                     if ((count == v.size()) ||
                         (v.elementAt(count).startsWith("["))) {
                         Hashtable<String,Hashtable<String,Vector<String>>> temp =
-                            new Hashtable<String,Hashtable<String,Vector<String>>>();
+                            new Hashtable<>();
                         temp = parseRealmField(v, i + 1, count);
                         table.put("realms", temp);
                         i = count - 1;
@@ -611,7 +611,7 @@
                     if ((count == v.size()) ||
                         (v.elementAt(count).startsWith("["))) {
                         Hashtable<String,Hashtable<String,Vector<String>>> temp =
-                            new Hashtable<String,Hashtable<String,Vector<String>>>();
+                            new Hashtable<>();
                         temp = parseRealmField(v, i + 1, count);
                         table.put("capaths", temp);
                         i = count - 1;
@@ -729,7 +729,7 @@
      * Parses key-value pairs under a stanza name.
      */
     private Hashtable<String,String>  parseField(Vector<String> v, int start, int end) {
-        Hashtable<String,String> table = new Hashtable<String,String> ();
+        Hashtable<String,String> table = new Hashtable<>();
         String line;
         for (int i = start; i < end; i++) {
             line = v.elementAt(i);
@@ -751,7 +751,7 @@
      * information for the realm given within a pair of braces.
      */
     private Hashtable<String,Hashtable<String,Vector<String>>> parseRealmField(Vector<String> v, int start, int end) {
-        Hashtable<String,Hashtable<String,Vector<String>>> table = new Hashtable<String,Hashtable<String,Vector<String>>> ();
+        Hashtable<String,Hashtable<String,Vector<String>>> table = new Hashtable<>();
         String line;
         for (int i = start; i < end; i++) {
             line = v.elementAt(i).trim();
@@ -791,10 +791,9 @@
      * Parses key-value pairs within each braces under [realms].
      */
     private Hashtable<String,Vector<String>> parseRealmFieldEx(Vector<String> v, int start, int end) {
-        Hashtable<String,Vector<String>> table =
-                new Hashtable<String,Vector<String>> ();
-        Vector<String> keyVector = new Vector<String> ();
-        Vector<String> nameVector = new Vector<String> ();
+        Hashtable<String,Vector<String>> table = new Hashtable<>();
+        Vector<String> keyVector = new Vector<>();
+        Vector<String> nameVector = new Vector<>();
         String line = "";
         String key;
         for (int i = start; i < end; i++) {
@@ -899,7 +898,7 @@
             }
             st = new StringTokenizer(default_enctypes, delim);
             int len = st.countTokens();
-            ArrayList<Integer> ls = new ArrayList<Integer> (len);
+            ArrayList<Integer> ls = new ArrayList<>(len);
             int type;
             for (int i = 0; i < len; i++) {
                 type = getType(st.nextToken());
--- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Fri Feb 04 16:29:41 2011 -0800
@@ -462,7 +462,7 @@
      */
     static class KdcAccessibility {
         // Known bad KDCs
-        private static Set<String> bads = new HashSet<String>();
+        private static Set<String> bads = new HashSet<>();
 
         private static synchronized void addBad(String kdc) {
             if (DEBUG) {
@@ -492,9 +492,9 @@
         // Returns a preferred KDC list by putting the bad ones at the end
         private static synchronized String[] list(String kdcList) {
             StringTokenizer st = new StringTokenizer(kdcList);
-            List<String> list = new ArrayList<String>();
+            List<String> list = new ArrayList<>();
             if (badPolicy == BpType.TRY_LAST) {
-                List<String> badkdcs = new ArrayList<String>();
+                List<String> badkdcs = new ArrayList<>();
                 while (st.hasMoreTokens()) {
                     String t = st.nextToken();
                     if (bads.contains(t)) badkdcs.add(t);
--- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Fri Feb 04 16:29:41 2011 -0800
@@ -244,7 +244,7 @@
             if (subDer.getTag() != DerValue.tag_SequenceOf) {
                 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
             }
-            Vector<String> v = new Vector<String> ();
+            Vector<String> v = new Vector<>();
             DerValue subSubDer;
             while(subDer.getData().available() > 0) {
                 subSubDer = subDer.getData().getDerValue();
@@ -299,7 +299,7 @@
     // Code repetition, realm parsed again by class Realm
     protected static String[] parseName(String name) {
 
-        Vector<String> tempStrings = new Vector<String> ();
+        Vector<String> tempStrings = new Vector<>();
         String temp = name;
         int i = 0;
         int componentStart = 0;
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java	Fri Feb 04 16:29:41 2011 -0800
@@ -359,12 +359,12 @@
         }
 
         String tempTarget = null, tempRealm = null;
-        Stack<String> iStack = new Stack<String> ();
+        Stack<String> iStack = new Stack<>();
 
         /*
          * I don't expect any more than a handful of intermediaries.
          */
-        Vector<String> tempList = new Vector<String> (8, 8);
+        Vector<String> tempList = new Vector<>(8, 8);
 
         /*
          * The initiator at first location.
--- a/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java	Fri Feb 04 16:29:41 2011 -0800
@@ -176,7 +176,7 @@
      * @exception IOException if an I/O error occurs while reading encoded data.
      */
     public byte[] asn1Encode() throws Asn1Exception, IOException {
-        Vector<DerValue> v = new Vector<DerValue>();
+        Vector<DerValue> v = new Vector<>();
         DerOutputStream temp = new DerOutputStream();
         temp.putInteger(BigInteger.valueOf(authenticator_vno));
         v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x00), temp.toByteArray()));
--- a/jdk/src/share/classes/sun/security/krb5/internal/AuthorizationData.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/AuthorizationData.java	Fri Feb 04 16:29:41 2011 -0800
@@ -99,8 +99,7 @@
      * @exception IOException if an I/O error occurs while reading encoded data.
      */
     public AuthorizationData(DerValue der) throws Asn1Exception, IOException {
-        Vector<AuthorizationDataEntry> v =
-                new Vector<AuthorizationDataEntry>();
+        Vector<AuthorizationDataEntry> v = new Vector<>();
         if (der.getTag() != DerValue.tag_Sequence) {
             throw new Asn1Exception(Krb5.ASN1_BAD_ID);
         }
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java	Fri Feb 04 16:29:41 2011 -0800
@@ -133,7 +133,7 @@
      * @exception IOException if an I/O error occurs while reading encoded data.
      */
     public byte[] asn1Encode() throws Asn1Exception, IOException {
-        Vector<DerValue> v = new Vector<DerValue>();
+        Vector<DerValue> v = new Vector<>();
         DerOutputStream temp = new DerOutputStream();
         v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
                 true, (byte) 0x00), ctime.asn1Encode()));
--- a/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/HostAddresses.java	Fri Feb 04 16:29:41 2011 -0800
@@ -179,7 +179,7 @@
     */
     public HostAddresses(DerValue encoding)
         throws  Asn1Exception, IOException {
-        Vector<HostAddress> tempAddresses = new Vector<HostAddress> ();
+        Vector<HostAddress> tempAddresses = new Vector<>();
         DerValue der = null;
         while (encoding.getData().available() > 0) {
             der = encoding.getData().getDerValue();
@@ -265,8 +265,7 @@
         if (addresses == null || addresses.length == 0)
             return null;
 
-        ArrayList<InetAddress> ipAddrs =
-                new ArrayList<InetAddress> (addresses.length);
+        ArrayList<InetAddress> ipAddrs = new ArrayList<>(addresses.length);
 
         for (int i = 0; i < addresses.length; i++) {
             try {
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCReq.java	Fri Feb 04 16:29:41 2011 -0800
@@ -150,7 +150,7 @@
             if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
                 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
             }
-            Vector<PAData> v = new Vector<PAData>();
+            Vector<PAData> v = new Vector<>();
             while (subsubDer.getData().available() > 0) {
                 v.addElement(new PAData(subsubDer.getData().getDerValue()));
             }
--- a/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCReqBody.java	Fri Feb 04 16:29:41 2011 -0800
@@ -158,7 +158,7 @@
             throw new Asn1Exception(Krb5.ASN1_BAD_ID);
         }
         der = encoding.getData().getDerValue();
-        Vector<Integer> v = new Vector<Integer> ();
+        Vector<Integer> v = new Vector<>();
         if ((der.getTag() & (byte)0x1F) == (byte)0x08) {
             subDer = der.getData().getDerValue();
 
@@ -183,7 +183,7 @@
             encAuthorizationData = EncryptedData.parse(encoding.getData(), (byte)0x0A, true);
         }
         if (encoding.getData().available() > 0) {
-            Vector<Ticket> tempTickets = new Vector<Ticket> ();
+            Vector<Ticket> tempTickets = new Vector<>();
             der = encoding.getData().getDerValue();
             if ((der.getTag() & (byte)0x1F) == (byte)0x0B) {
                 subDer = der.getData().getDerValue();
@@ -216,7 +216,7 @@
      *
      */
     public byte[] asn1Encode(int msgType) throws Asn1Exception, IOException {
-        Vector<DerValue> v = new Vector<DerValue> ();
+        Vector<DerValue> v = new Vector<>();
         v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), kdcOptions.asn1Encode()));
         if (msgType == Krb5.KRB_AS_REQ) {
             if (cname != null) {
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBCred.java	Fri Feb 04 16:29:41 2011 -0800
@@ -134,7 +134,7 @@
             if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
                 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
             }
-            Vector<Ticket> v = new Vector<Ticket>();
+            Vector<Ticket> v = new Vector<>();
             while (subsubDer.getData().available() > 0) {
                 v.addElement(new Ticket(subsubDer.getData().getDerValue()));
             }
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java	Fri Feb 04 16:29:41 2011 -0800
@@ -260,7 +260,7 @@
     private void parsePAData(byte[] data)
             throws IOException, Asn1Exception {
         DerValue derPA = new DerValue(data);
-        List<PAData> paList = new ArrayList<PAData>();
+        List<PAData> paList = new ArrayList<>();
         while (derPA.data.available() > 0) {
             // read the PA-DATA
             DerValue tmp = derPA.data.getDerValue();
--- a/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KrbCredInfo.java	Fri Feb 04 16:29:41 2011 -0800
@@ -157,7 +157,7 @@
      * @exception IOException if an I/O error occurs while reading encoded data.
      */
     public byte[] asn1Encode() throws Asn1Exception, IOException {
-        Vector<DerValue> v = new Vector<DerValue> ();
+        Vector<DerValue> v = new Vector<>();
         v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), key.asn1Encode()));
         if (prealm != null)
             v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), prealm.asn1Encode()));
--- a/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/LastReq.java	Fri Feb 04 16:29:41 2011 -0800
@@ -77,7 +77,7 @@
      */
 
     public LastReq(DerValue encoding) throws Asn1Exception, IOException {
-        Vector<LastReqEntry> v= new Vector<LastReqEntry> ();
+        Vector<LastReqEntry> v= new Vector<>();
         if (encoding.getTag() != DerValue.tag_Sequence) {
             throw new Asn1Exception(Krb5.ASN1_BAD_ID);
         }
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Fri Feb 04 16:29:41 2011 -0800
@@ -490,7 +490,7 @@
 
     private static String exec(String c) {
         StringTokenizer st = new StringTokenizer(c);
-        Vector<String> v = new Vector<String> ();
+        Vector<String> v = new Vector<>();
         while (st.hasMoreTokens()) {
             v.addElement(st.nextToken());
         }
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java	Fri Feb 04 16:29:41 2011 -0800
@@ -257,7 +257,7 @@
                 + configName);
         }
 
-        List<Integer> list = new ArrayList<Integer> (answer.length);
+        List<Integer> list = new ArrayList<>(answer.length);
         for (int i = 0; i < answer.length; i++) {
             if (EncryptionKey.findKey(answer[i], keys) != null) {
                 list.add(answer[i]);
--- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Fri Feb 04 16:29:41 2011 -0800
@@ -57,7 +57,7 @@
     private static KeyTab singleton = null;
     private static final boolean DEBUG = Krb5.DEBUG;
     private static String name;
-    private Vector<KeyTabEntry> entries = new Vector<KeyTabEntry> ();
+    private Vector<KeyTabEntry> entries = new Vector<>();
 
     private KeyTab(String filename) throws IOException, RealmException {
         init(filename);
@@ -240,7 +240,7 @@
         KeyTabEntry entry;
         EncryptionKey key;
         int size = entries.size();
-        ArrayList<EncryptionKey> keys = new ArrayList<EncryptionKey> (size);
+        ArrayList<EncryptionKey> keys = new ArrayList<>(size);
 
         for (int i = size-1; i >= 0; i--) {
             entry = entries.elementAt(i);
--- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Fri Feb 04 16:29:41 2011 -0800
@@ -299,8 +299,7 @@
     private static final int DEFAULT_CACHE_SIZE = 1;
 
     // contains the policy grant entries, PD cache, and alias mapping
-    private AtomicReference<PolicyInfo> policyInfo =
-        new AtomicReference<PolicyInfo>();
+    private AtomicReference<PolicyInfo> policyInfo = new AtomicReference<>();
     private boolean constructed = false;
 
     private boolean expandProperties = true;
@@ -1334,8 +1333,7 @@
 
         List<PolicyParser.PrincipalEntry> entryPs = entry.getPrincipals();
         if (debug != null) {
-            ArrayList<PolicyParser.PrincipalEntry> accPs =
-                        new ArrayList<PolicyParser.PrincipalEntry>();
+            ArrayList<PolicyParser.PrincipalEntry> accPs = new ArrayList<>();
             if (principals != null) {
                 for (int i = 0; i < principals.length; i++) {
                     accPs.add(new PolicyParser.PrincipalEntry
@@ -1416,8 +1414,7 @@
                     // check if the PrincipalComparator
                     // implies the current thread's principals
 
-                    Set<Principal> pSet =
-                                new HashSet<Principal>(principals.length);
+                    Set<Principal> pSet = new HashSet<>(principals.length);
                     for (int j = 0; j < principals.length; j++) {
                         pSet.add(principals[j]);
                     }
@@ -1700,7 +1697,7 @@
             // build an info array for every principal
             // in the current domain which has a principal class
             // that is equal to policy entry principal class name
-            List<Principal> plist = new ArrayList<Principal>();
+            List<Principal> plist = new ArrayList<>();
             for (int i = 0; i < pdp.length; i++) {
                 if(pe.principalClass.equals(pdp[i].getClass().getName()))
                     plist.add(pdp[i]);
@@ -1770,7 +1767,7 @@
             // Done
             return certs;
 
-        ArrayList<Certificate> userCertList = new ArrayList<Certificate>();
+        ArrayList<Certificate> userCertList = new ArrayList<>();
         i = 0;
         while (i < certs.length) {
             userCertList.add(certs[i]);
@@ -2234,7 +2231,7 @@
                     if (this.certs == null) {
                         // extract the signer certs
                         ArrayList<Certificate> signerCerts =
-                            new ArrayList<Certificate>();
+                            new ArrayList<>();
                         i = 0;
                         while (i < certs.length) {
                             signerCerts.add(certs[i]);
--- a/jdk/src/share/classes/sun/security/provider/Sun.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/provider/Sun.java	Fri Feb 04 16:29:41 2011 -0800
@@ -55,7 +55,7 @@
             SunEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new LinkedHashMap<Object, Object>();
+            Map<Object, Object> map = new LinkedHashMap<>();
             SunEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
         }
--- a/jdk/src/share/classes/sun/security/provider/VerificationProvider.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/provider/VerificationProvider.java	Fri Feb 04 16:29:41 2011 -0800
@@ -76,7 +76,7 @@
             SunRsaSignEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new LinkedHashMap<Object, Object>();
+            Map<Object, Object> map = new LinkedHashMap<>();
             SunEntries.putEntries(map);
             SunRsaSignEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
--- a/jdk/src/share/classes/sun/security/provider/X509Factory.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/provider/X509Factory.java	Fri Feb 04 16:29:41 2011 -0800
@@ -409,10 +409,10 @@
         parseX509orPKCS7Cert(InputStream is)
         throws CertificateException, IOException
     {
-        Collection<X509CertImpl> coll = new ArrayList<X509CertImpl>();
+        Collection<X509CertImpl> coll = new ArrayList<>();
         byte[] data = readOneBlock(is);
         if (data == null) {
-            return new ArrayList<X509CertImpl>(0);
+            return new ArrayList<>(0);
         }
         try {
             PKCS7 pkcs7 = new PKCS7(data);
@@ -422,7 +422,7 @@
                 return Arrays.asList(certs);
             } else {
                 // no crls provided
-                return new ArrayList<X509Certificate>(0);
+                return new ArrayList<>(0);
             }
         } catch (ParsingException e) {
             while (data != null) {
@@ -442,10 +442,10 @@
         parseX509orPKCS7CRL(InputStream is)
         throws CRLException, IOException
     {
-        Collection<X509CRLImpl> coll = new ArrayList<X509CRLImpl>();
+        Collection<X509CRLImpl> coll = new ArrayList<>();
         byte[] data = readOneBlock(is);
         if (data == null) {
-            return new ArrayList<X509CRL>(0);
+            return new ArrayList<>(0);
         }
         try {
             PKCS7 pkcs7 = new PKCS7(data);
@@ -455,7 +455,7 @@
                 return Arrays.asList(crls);
             } else {
                 // no crls provided
-                return new ArrayList<X509CRL>(0);
+                return new ArrayList<>(0);
             }
         } catch (ParsingException e) {
             while (data != null) {
--- a/jdk/src/share/classes/sun/security/rsa/RSACore.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/rsa/RSACore.java	Fri Feb 04 16:29:41 2011 -0800
@@ -215,11 +215,11 @@
     // value suggested by Paul Kocher (quoted by NSS)
     private final static int BLINDING_MAX_REUSE = 50;
 
-    // cache for blinding parameters. Map<BigInteger,BlindingParameters>
+    // cache for blinding parameters. Map<BigInteger, BlindingParameters>
     // use a weak hashmap so that cached values are automatically cleared
     // when the modulus is GC'ed
-    private final static Map<BigInteger,BlindingParameters> blindingCache =
-                new WeakHashMap<BigInteger,BlindingParameters>();
+    private final static Map<BigInteger, BlindingParameters> blindingCache =
+                new WeakHashMap<>();
 
     /**
      * Set of blinding parameters for a given RSA key.
--- a/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java	Fri Feb 04 16:29:41 2011 -0800
@@ -52,7 +52,7 @@
             SunRsaSignEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new HashMap<Object, Object>();
+            Map<Object, Object> map = new HashMap<>();
             SunRsaSignEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
         }
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuite.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuite.java	Fri Feb 04 16:29:41 2011 -0800
@@ -393,7 +393,7 @@
 
         // Map BulkCipher -> Boolean(available)
         private final static Map<BulkCipher,Boolean> availableCache =
-                                            new HashMap<BulkCipher,Boolean>(8);
+                                            new HashMap<>(8);
 
         // descriptive name including key size, e.g. AES/128
         final String description;
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Fri Feb 04 16:29:41 2011 -0800
@@ -221,7 +221,7 @@
     private static CipherSuiteList buildAvailableCache(int minPriority) {
         // SortedSet automatically arranges ciphersuites in default
         // preference order
-        Set<CipherSuite> cipherSuites = new TreeSet<CipherSuite>();
+        Set<CipherSuite> cipherSuites = new TreeSet<>();
         Collection<CipherSuite> allowedCipherSuites =
                                     CipherSuite.allowedCipherSuites();
         for (CipherSuite c : allowedCipherSuites) {
--- a/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Fri Feb 04 16:29:41 2011 -0800
@@ -655,7 +655,7 @@
         if (certRequest != null) {
             X509ExtendedKeyManager km = sslContext.getX509KeyManager();
 
-            ArrayList<String> keytypesTmp = new ArrayList<String>(4);
+            ArrayList<String> keytypesTmp = new ArrayList<>(4);
 
             for (int i = 0; i < certRequest.types.length; i++) {
                 String typeName;
@@ -1174,8 +1174,7 @@
                         "Can't reuse existing SSL client session");
                 }
 
-                Collection<CipherSuite> cipherList =
-                                                new ArrayList<CipherSuite>(2);
+                Collection<CipherSuite> cipherList = new ArrayList<>(2);
                 cipherList.add(sessionSuite);
                 if (!secureRenegotiation &&
                         cipherSuites.contains(CipherSuite.C_SCSV)) {
@@ -1193,7 +1192,7 @@
         // exclude SCSV for secure renegotiation
         if (secureRenegotiation && cipherSuites.contains(CipherSuite.C_SCSV)) {
             Collection<CipherSuite> cipherList =
-                        new ArrayList<CipherSuite>(cipherSuites.size() - 1);
+                        new ArrayList<>(cipherSuites.size() - 1);
             for (CipherSuite suite : cipherSuites.collection()) {
                 if (suite != CipherSuite.C_SCSV) {
                     cipherList.add(suite);
--- a/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -98,7 +98,7 @@
             return defaultKeyManagers;
         }
 
-        final Map<String,String> props = new HashMap<String,String>();
+        final Map<String,String> props = new HashMap<>();
         AccessController.doPrivileged(
                     new PrivilegedExceptionAction<Object>() {
             public Object run() throws Exception {
--- a/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Fri Feb 04 16:29:41 2011 -0800
@@ -258,7 +258,7 @@
     // add server_name extension
     void addServerNameIndicationExtension(String hostname) {
         // We would have checked that the hostname ia a FQDN.
-        ArrayList<String> hostnames = new ArrayList<String>(1);
+        ArrayList<String> hostnames = new ArrayList<>(1);
         hostnames.add(hostname);
 
         try {
@@ -434,7 +434,7 @@
 
     CertificateMsg(HandshakeInStream input) throws IOException {
         int chainLen = input.getInt24();
-        List<Certificate> v = new ArrayList<Certificate>(4);
+        List<Certificate> v = new ArrayList<>(4);
 
         CertificateFactory cf = null;
         while (chainLen > 0) {
@@ -1328,7 +1328,7 @@
 
         // read the certificate_authorities
         int len = input.getInt16();
-        ArrayList<DistinguishedName> v = new ArrayList<DistinguishedName>();
+        ArrayList<DistinguishedName> v = new ArrayList<>();
         while (len >= 3) {
             DistinguishedName dn = new DistinguishedName(input);
             v.add(dn);
@@ -1719,7 +1719,7 @@
     // Note that this will prevent the Spi classes from being GC'd. We assume
     // that is not a problem.
     private final static Map<Class,Object> methodCache =
-                                        new ConcurrentHashMap<Class,Object>();
+                                        new ConcurrentHashMap<>();
 
     private static void digestKey(MessageDigest md, SecretKey key) {
         try {
--- a/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Fri Feb 04 16:29:41 2011 -0800
@@ -569,7 +569,7 @@
                 activeProtocols = getActiveProtocols();
             }
 
-            ArrayList<CipherSuite> suites = new ArrayList<CipherSuite>();
+            ArrayList<CipherSuite> suites = new ArrayList<>();
             if (!(activeProtocols.collection().isEmpty()) &&
                     activeProtocols.min.v != ProtocolVersion.NONE.v) {
                 for (CipherSuite suite : enabledCipherSuites.collection()) {
@@ -614,8 +614,7 @@
      */
     ProtocolList getActiveProtocols() {
         if (activeProtocols == null) {
-            ArrayList<ProtocolVersion> protocols =
-                                            new ArrayList<ProtocolVersion>(4);
+            ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
             for (ProtocolVersion protocol : enabledProtocols.collection()) {
                 boolean found = false;
                 for (CipherSuite suite : enabledCipherSuites.collection()) {
--- a/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java	Fri Feb 04 16:29:41 2011 -0800
@@ -169,8 +169,7 @@
         return name;
     }
 
-    static List<ExtensionType> knownExtensions =
-                                            new ArrayList<ExtensionType>(9);
+    static List<ExtensionType> knownExtensions = new ArrayList<>(9);
 
     static ExtensionType get(int id) {
         for (ExtensionType ext : knownExtensions) {
@@ -674,7 +673,7 @@
     }
 
     public String toString() {
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
         for (byte format : formats) {
             list.add(toString(format));
         }
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Fri Feb 04 16:29:41 2011 -0800
@@ -83,7 +83,7 @@
             throw new IllegalArgumentException("Protocols may not be null");
         }
 
-        ArrayList<ProtocolVersion> versions = new ArrayList<ProtocolVersion>(3);
+        ArrayList<ProtocolVersion> versions = new ArrayList<>(3);
         for (int i = 0; i < names.length; i++ ) {
             ProtocolVersion version = ProtocolVersion.valueOf(names[i]);
             if (versions.contains(version) == false) {
--- a/jdk/src/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java	Fri Feb 04 16:29:41 2011 -0800
@@ -261,7 +261,7 @@
 
         protected Set<String> decomposes(KeyExchange keyExchange,
                         boolean forCertPathOnly) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
             switch (keyExchange) {
                 case K_NULL:
                     if (!forCertPathOnly) {
@@ -356,7 +356,7 @@
         }
 
         protected Set<String> decomposes(BulkCipher bulkCipher) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
 
             if (bulkCipher.transformation != null) {
                 components.addAll(super.decomposes(bulkCipher.transformation));
@@ -366,7 +366,7 @@
         }
 
         protected Set<String> decomposes(MacAlg macAlg) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
 
             if (macAlg == CipherSuite.M_MD5) {
                 components.add("MD5");
@@ -407,7 +407,7 @@
                 }
 
                 if (cipherSuite != null) {
-                    Set<String> components = new HashSet<String>();
+                    Set<String> components = new HashSet<>();
 
                     if(cipherSuite.keyExchange != null) {
                         components.addAll(
@@ -448,7 +448,7 @@
                 }
 
                 if (cipherSuite != null) {
-                    Set<String> components = new HashSet<String>();
+                    Set<String> components = new HashSet<>();
 
                     if(cipherSuite.keyExchange != null) {
                         components.addAll(
--- a/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -618,8 +618,7 @@
      * key and the calling security context. This is important since
      * sessions can be shared across different protection domains.
      */
-    private Hashtable<SecureKey, Object> table =
-                                new Hashtable<SecureKey, Object>();
+    private Hashtable<SecureKey, Object> table = new Hashtable<>();
 
     /**
      * Assigns a session value.  Session change events are given if
@@ -687,7 +686,7 @@
      */
     public String[] getValueNames() {
         Enumeration<SecureKey> e;
-        Vector<Object> v = new Vector<Object>();
+        Vector<Object> v = new Vector<>();
         SecureKey key;
         Object securityCtx = SecureKey.getCurrentSecurityContext();
 
--- a/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Fri Feb 04 16:29:41 2011 -0800
@@ -153,8 +153,7 @@
     static Collection<SignatureAndHashAlgorithm>
             getSupportedAlgorithms(AlgorithmConstraints constraints) {
 
-        Collection<SignatureAndHashAlgorithm> supported =
-                        new ArrayList<SignatureAndHashAlgorithm>();
+        Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
         synchronized (priorityMap) {
             for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) {
                 if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
@@ -171,8 +170,7 @@
     // Get supported algorithm collection from an untrusted collection
     static Collection<SignatureAndHashAlgorithm> getSupportedAlgorithms(
             Collection<SignatureAndHashAlgorithm> algorithms ) {
-        Collection<SignatureAndHashAlgorithm> supported =
-                        new ArrayList<SignatureAndHashAlgorithm>();
+        Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
         for (SignatureAndHashAlgorithm sigAlg : algorithms) {
             if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
                 supported.add(sigAlg);
@@ -184,7 +182,7 @@
 
     static String[] getAlgorithmNames(
             Collection<SignatureAndHashAlgorithm> algorithms) {
-        ArrayList<String> algorithmNames = new ArrayList<String>();
+        ArrayList<String> algorithmNames = new ArrayList<>();
         if (algorithms != null) {
             for (SignatureAndHashAlgorithm sigAlg : algorithms) {
                 algorithmNames.add(sigAlg.algorithm);
@@ -197,7 +195,7 @@
 
     static Set<String> getHashAlgorithmNames(
             Collection<SignatureAndHashAlgorithm> algorithms) {
-        Set<String> algorithmNames = new HashSet<String>();
+        Set<String> algorithmNames = new HashSet<>();
         if (algorithms != null) {
             for (SignatureAndHashAlgorithm sigAlg : algorithms) {
                 if (sigAlg.hash.value > 0) {
--- a/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -337,7 +337,7 @@
 
         X500Principal[] x500Issuers = (X500Principal[])issuers;
         // the algorithm below does not produce duplicates, so avoid Set
-        List<String> aliases = new ArrayList<String>();
+        List<String> aliases = new ArrayList<>();
 
         for (Map.Entry<String,X509Credentials> entry :
                                                 credentialsMap.entrySet()) {
@@ -397,7 +397,7 @@
      * possible. Principals that cannot be converted are ignored.
      */
     private static X500Principal[] convertPrincipals(Principal[] principals) {
-        List<X500Principal> list = new ArrayList<X500Principal>(principals.length);
+        List<X500Principal> list = new ArrayList<>(principals.length);
         for (int i = 0; i < principals.length; i++) {
             Principal p = principals[i];
             if (p instanceof X500Principal) {
--- a/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -134,7 +134,7 @@
         FileInputStream fis = null;
         String defaultTrustStoreType;
         String defaultTrustStoreProvider;
-        final HashMap<String,String> props = new HashMap<String,String>();
+        final HashMap<String,String> props = new HashMap<>();
         final String sep = File.separator;
         KeyStore ks = null;
 
--- a/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Fri Feb 04 16:29:41 2011 -0800
@@ -307,7 +307,7 @@
                 (keyTypes.length == 0) || (keyTypes[0] == null)) {
             return null;
         }
-        List<KeyType> list = new ArrayList<KeyType>(keyTypes.length);
+        List<KeyType> list = new ArrayList<>(keyTypes.length);
         for (String keyType : keyTypes) {
             list.add(new KeyType(keyType));
         }
@@ -429,7 +429,7 @@
     // make a Set out of the array
     private Set<Principal> getIssuerSet(Principal[] issuers) {
         if ((issuers != null) && (issuers.length != 0)) {
-            return new HashSet<Principal>(Arrays.asList(issuers));
+            return new HashSet<>(Arrays.asList(issuers));
         } else {
             return null;
         }
--- a/jdk/src/share/classes/sun/security/tools/JarSigner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -123,19 +123,19 @@
                                     // or the default keystore, never null
 
     String keystore; // key store file
-    List<String> crlfiles = new ArrayList<String>();  // CRL files to add
+    List<String> crlfiles = new ArrayList<>();  // CRL files to add
     boolean nullStream = false; // null keystore input stream (NONE)
     boolean token = false; // token-based keystore
     String jarfile;  // jar files to sign or verify
     String alias;    // alias to sign jar with
-    List<String> ckaliases = new ArrayList<String>(); // aliases in -verify
+    List<String> ckaliases = new ArrayList<>(); // aliases in -verify
     char[] storepass; // keystore password
     boolean protectedPath; // protected authentication path
     String storetype; // keystore type
     String providerName; // provider name
     Vector<String> providers = null; // list of providers
     // arguments for provider constructors
-    HashMap<String,String> providerArgs = new HashMap<String, String>();
+    HashMap<String,String> providerArgs = new HashMap<>();
     char[] keypass; // private key password
     String sigfile; // name of .SF file
     String sigalg; // name of signature algorithm
@@ -236,7 +236,7 @@
                 if (crlfiles.size() > 0 || autoCRL) {
                     CertificateFactory fac =
                             CertificateFactory.getInstance("X509");
-                    List<CRL> list = new ArrayList<CRL>();
+                    List<CRL> list = new ArrayList<>();
                     for (String file: crlfiles) {
                         Collection<? extends CRL> tmp = KeyTool.loadCRLs(file);
                         for (CRL crl: tmp) {
@@ -606,7 +606,7 @@
 
         try {
             jf = new JarFile(jarName, true);
-            Vector<JarEntry> entriesVec = new Vector<JarEntry>();
+            Vector<JarEntry> entriesVec = new Vector<>();
             byte[] buffer = new byte[8192];
 
             Enumeration<JarEntry> entries = jf.entries();
@@ -633,8 +633,7 @@
             // The map to record display info, only used when -verbose provided
             //      key: signer info string
             //      value: the list of files with common key
-            Map<String,List<String>> output =
-                    new LinkedHashMap<String,List<String>>();
+            Map<String,List<String>> output = new LinkedHashMap<>();
 
             if (man != null) {
                 if (verbose != null) System.out.println();
@@ -1000,8 +999,7 @@
             .append(signTimeForm.format(source)).append("]").toString();
     }
 
-    private Map<CodeSigner,Integer> cacheForInKS =
-            new IdentityHashMap<CodeSigner,Integer>();
+    private Map<CodeSigner,Integer> cacheForInKS = new IdentityHashMap<>();
 
     private int inKeyStoreForOneSigner(CodeSigner signer) {
         if (cacheForInKS.containsKey(signer)) {
@@ -1044,8 +1042,7 @@
         return result;
     }
 
-    Hashtable<Certificate, String> storeHash =
-                                new Hashtable<Certificate, String>();
+    Hashtable<Certificate, String> storeHash = new Hashtable<>();
 
     int inKeyStore(CodeSigner[] signers) {
 
@@ -1175,7 +1172,7 @@
              *   generated one. (This may invalidate existing signatures!)
              */
             BASE64Encoder encoder = new JarBASE64Encoder();
-            Vector<ZipEntry> mfFiles = new Vector<ZipEntry>();
+            Vector<ZipEntry> mfFiles = new Vector<>();
 
             boolean wasSigned = false;
 
@@ -1531,7 +1528,7 @@
         return false;
     }
 
-    Map<CodeSigner,String> cacheForSignerInfo = new IdentityHashMap<CodeSigner,String>();
+    Map<CodeSigner,String> cacheForSignerInfo = new IdentityHashMap<>();
 
     /**
      * Returns a string of singer info, with a newline at the end
@@ -1655,7 +1652,7 @@
                     }
                 }
             }
-            Set<TrustAnchor> tas = new HashSet<TrustAnchor>();
+            Set<TrustAnchor> tas = new HashSet<>();
             try {
                 KeyStore caks = KeyTool.getCacertsKeyStore();
                 if (caks != null) {
--- a/jdk/src/share/classes/sun/security/tools/KeyTool.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java	Fri Feb 04 16:29:41 2011 -0800
@@ -153,11 +153,11 @@
     private KeyStore caks = null; // "cacerts" keystore
     private char[] srcstorePass = null;
     private String srcstoretype = null;
-    private Set<char[]> passwords = new HashSet<char[]> ();
+    private Set<char[]> passwords = new HashSet<>();
     private String startDate = null;
 
-    private List <String> ids = new ArrayList <String> ();   // used in GENCRL
-    private List <String> v3ext = new ArrayList <String> ();
+    private List<String> ids = new ArrayList<>();   // used in GENCRL
+    private List<String> v3ext = new ArrayList<>();
 
     enum Command {
         CERTREQ("Generates.a.certificate.request",
@@ -2091,7 +2091,7 @@
      */
     public static List<CRL> readCRLsFromCert(X509Certificate cert)
             throws Exception {
-        List<CRL> crls = new ArrayList<CRL>();
+        List<CRL> crls = new ArrayList<>();
         CRLDistributionPointsExtension ext =
                 X509CertImpl.toImpl(cert).getCRLDistributionPointsExtension();
         if (ext == null) return crls;
@@ -2258,7 +2258,7 @@
         if (jarfile != null) {
             JarFile jf = new JarFile(jarfile, true);
             Enumeration<JarEntry> entries = jf.entries();
-            Set<CodeSigner> ss = new HashSet<CodeSigner>();
+            Set<CodeSigner> ss = new HashSet<>();
             byte[] buffer = new byte[8192];
             int pos = 0;
             while (entries.hasMoreElements()) {
@@ -3347,7 +3347,7 @@
         }
 
         // start building chain
-        Vector<Certificate> chain = new Vector<Certificate>(2);
+        Vector<Certificate> chain = new Vector<>(2);
         if (buildChain((X509Certificate)certToVerify, chain, certs)) {
             Certificate[] newChain = new Certificate[chain.size()];
             // buildChain() returns chain with self-signed root-cert first and
@@ -3873,8 +3873,7 @@
                         break;
                     case 2:     // EKU
                         if(value != null) {
-                            Vector <ObjectIdentifier> v =
-                                    new Vector <ObjectIdentifier>();
+                            Vector<ObjectIdentifier> v = new Vector<>();
                             for (String s: value.split(",")) {
                                 int p = oneOf(s,
                                         "anyExtendedKeyUsage",
@@ -3944,7 +3943,7 @@
                         }
                         if(value != null) {
                             List<AccessDescription> accessDescriptions =
-                                    new ArrayList<AccessDescription>();
+                                    new ArrayList<>();
                             String[] ps = value.split(",");
                             for(String item: ps) {
                                 colonpos = item.indexOf(':');
@@ -4228,7 +4227,7 @@
     }
 
     public static <A,B> Pair<A,B> of(A a, B b) {
-        return new Pair<A,B>(a,b);
+        return new Pair<>(a,b);
     }
 }
 
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Fri Feb 04 16:29:41 2011 -0800
@@ -643,7 +643,7 @@
         Class<?> pc = Class.forName(type, true,
                 Thread.currentThread().getContextClassLoader());
         Constructor<?> c = null;
-        Vector<String> objects = new Vector<String>(2);
+        Vector<String> objects = new Vector<>(2);
         if (name != null) objects.add(name);
         if (actions != null) objects.add(actions);
         switch (objects.size()) {
@@ -1722,8 +1722,7 @@
                         new PolicyParser.GrantEntry(signedby, codebase);
 
         // get the new Principals
-        LinkedList<PolicyParser.PrincipalEntry> prins =
-                                new LinkedList<PolicyParser.PrincipalEntry>();
+        LinkedList<PolicyParser.PrincipalEntry> prins = new LinkedList<>();
         TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
         for (int i = 0; i < prinList.getItemCount(); i++) {
             prins.add((PolicyParser.PrincipalEntry)prinList.getObject(i));
@@ -1731,8 +1730,7 @@
         ge.principals = prins;
 
         // get the new Permissions
-        Vector<PolicyParser.PermissionEntry> perms =
-                        new Vector<PolicyParser.PermissionEntry>();
+        Vector<PolicyParser.PermissionEntry> perms = new Vector<>();
         TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
         for (int i = 0; i < permList.getItemCount(); i++) {
             perms.addElement((PolicyParser.PermissionEntry)permList.getObject(i));
@@ -3649,7 +3647,7 @@
  * This is a java.awt.List that bind an Object to each String it holds.
  */
 class TaggedList extends List {
-    private java.util.List<Object> data = new LinkedList<Object>();
+    private java.util.List<Object> data = new LinkedList<>();
     public TaggedList(int i, boolean b) {
         super(i, b);
     }
--- a/jdk/src/share/demo/jvmti/index.html	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/demo/jvmti/index.html	Fri Feb 04 16:29:41 2011 -0800
@@ -389,10 +389,9 @@
 <li>
 MS DLL Runtime: Use the <code>/MD /D _STATIC_CPPLIB</code> option.
 <br>
-This causes your dll to become dependent on MSVCRT.DLL and/or 
-the newer C++ runtime MSVCR71.DLL.
+This causes your dll to become dependent on just MSVCR*.DLL.
 The option /D _STATIC_CPPLIB prevents you from becoming dependent on the
-C++ library MSVCP71.DLL.
+C++ library MSVCP*.DLL.
 This is what we use in the JDK, but there are probably many combinations
 that you could safely use, unfortunately there are many combinations
 of runtimes that will not work. 
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Fri Feb 04 16:29:41 2011 -0800
@@ -78,7 +78,6 @@
     // configurable by env map
     private final String  defaultDir;    // default dir for the file system
     private final String  nameEncoding;  // default encoding for name/comment
-    private final boolean buildDirTree;  // build a dir tree for directoryStream ops
     private final boolean useTempFile;   // use a temp file for newOS, default
                                          // is to use BAOS for better performance
     private final boolean createNew;     // create a new zip if not exists
@@ -94,7 +93,6 @@
         this.createNew    = "true".equals(env.get("create"));
         this.nameEncoding = env.containsKey("encoding") ?
                             (String)env.get("encoding") : "UTF-8";
-        this.buildDirTree = TRUE.equals(env.get("buildDirTreea"));
         this.useTempFile  = TRUE.equals(env.get("useTempFile"));
         this.defaultDir   = env.containsKey("default.dir") ?
                             (String)env.get("default.dir") : "/";
@@ -290,28 +288,16 @@
         try {
             ensureOpen();
             e = getEntry0(path);
-        } finally {
-            endRead();
-        }
-        if (e == null) {
-            if (path.length == 0) {
-                e = new Entry(new byte[0]);  // root
-            } else if (buildDirTree) {
-                IndexNode inode = getDirs().get(IndexNode.keyOf(path));
+            if (e == null) {
+                IndexNode inode = getInode(path);
                 if (inode == null)
                     return null;
-                e = new Entry(inode.name);
-            } else {
-                return null;
+                e = new Entry(inode.name);       // pseudo directory
+                e.method = METHOD_STORED;        // STORED for dir
+                e.mtime = e.atime = e.ctime = -1;// -1 for all times
             }
-            e.method = METHOD_STORED;        // STORED for dir
-            BasicFileAttributes bfas = Attributes.readBasicFileAttributes(zfpath);
-            if (bfas.lastModifiedTime() != null)
-                e.mtime = bfas.lastModifiedTime().toMillis();
-            if (bfas.lastAccessTime() != null)
-                e.atime = bfas.lastAccessTime().toMillis();
-            if (bfas.creationTime() != null)
-                e.ctime = bfas.creationTime().toMillis();
+        } finally {
+            endRead();
         }
         return new ZipFileAttributes(e);
     }
@@ -346,7 +332,7 @@
         beginRead();
         try {
             ensureOpen();
-            return getEntry0(path) != null;
+            return getInode(path) != null;
         } finally {
             endRead();
         }
@@ -355,13 +341,10 @@
     boolean isDirectory(byte[] path)
         throws IOException
     {
-        if (buildDirTree)
-            return getDirs().containsKey(IndexNode.keyOf(path));
-
         beginRead();
         try {
-            Entry e = getEntry0(path);
-            return (e != null && e.isDir()) || path.length == 0;
+            IndexNode n = getInode(path);
+            return n != null && n.isDir();
         } finally {
             endRead();
         }
@@ -383,39 +366,16 @@
         beginWrite();    // iteration of inodes needs exclusive lock
         try {
             ensureOpen();
-            if (buildDirTree) {
-                IndexNode inode = getDirs().get(IndexNode.keyOf(path));
-                if (inode == null)
-                    throw new NotDirectoryException(getString(path));
-                List<Path> list = new ArrayList<>();
-                IndexNode child = inode.child;
-                while (child != null) {
-                    ZipPath zp = toZipPath(child.name);
-                    if (filter == null || filter.accept(zp))
-                        list.add(zp);
-                    child = child.sibling;
-                }
-                return list.iterator();
-            }
-
-            if (!isDirectory(path))
+            IndexNode inode = getInode(path);
+            if (inode == null)
                 throw new NotDirectoryException(getString(path));
             List<Path> list = new ArrayList<>();
-            path = toDirectoryPath(path);
-            for (IndexNode key : inodes.keySet()) {
-                if (!isParentOf(path, key.name))  // is "path" the parent of "name"
-                    continue;
-                int off = path.length;
-                while (off < key.name.length) {
-                    if (key.name[off] == '/')
-                        break;
-                    off++;
-                }
-                if (off < (key.name.length - 1))
-                    continue;
-                ZipPath zp = toZipPath(key.name);
+            IndexNode child = inode.child;
+            while (child != null) {
+                ZipPath zp = toZipPath(child.name);
                 if (filter == null || filter.accept(zp))
                     list.add(zp);
+                child = child.sibling;
             }
             return list.iterator();
         } finally {
@@ -433,7 +393,6 @@
             ensureOpen();
             if (dir.length == 0 || exists(dir))  // root dir, or exiting dir
                 throw new FileAlreadyExistsException(getString(dir));
-
             checkParents(dir);
             Entry e = new Entry(dir, Entry.NEW);
             e.method = METHOD_STORED;            // STORED for dir
@@ -476,7 +435,7 @@
                 checkParents(dst);
             }
             Entry u = new Entry(eSrc, Entry.COPY);    // copy eSrc entry
-            u.name = dst;                             // change name
+            u.name(dst);                              // change name
             if (eSrc.type == Entry.NEW || eSrc.type == Entry.FILECH)
             {
                 u.type = eSrc.type;    // make it the same type
@@ -518,7 +477,7 @@
             if (opt == APPEND)
                 hasAppend = true;
         }
-        beginRead();    // only need a readlock, the "update()" will
+        beginRead();                 // only need a readlock, the "update()" will
         try {                        // try to obtain a writelock when the os is
             ensureOpen();            // being closed.
             Entry e = getEntry0(path);
@@ -869,43 +828,27 @@
     private void checkParents(byte[] path) throws IOException {
         beginRead();
         try {
-            while ((path = getParent(path)) != null) {
-                if (!inodes.containsKey(IndexNode.keyOf(path)))
+            while ((path = getParent(path)) != null && path.length != 0) {
+                if (!inodes.containsKey(IndexNode.keyOf(path))) {
                     throw new NoSuchFileException(getString(path));
+                }
             }
         } finally {
             endRead();
         }
     }
 
+    private static byte[] ROOTPATH = new byte[0];
     private static byte[] getParent(byte[] path) {
         int off = path.length - 1;
         if (off > 0 && path[off] == '/')  // isDirectory
             off--;
         while (off > 0 && path[off] != '/') { off--; }
-        if (off == 0)
-            return null;                  // top entry
+        if (off <= 0)
+            return ROOTPATH;
         return Arrays.copyOf(path, off + 1);
     }
 
-    // If "starter" is the parent directory of "path"
-    private static boolean isParentOf(byte[] p, byte[] c) {
-        final int plen = p.length;
-        if (plen == 0)          // root dir
-            return true;
-        if (plen  >= c.length)
-            return false;
-        int n = 0;
-        while (n < plen) {
-            if (p[n] != c[n])
-                return false;
-            n++;
-        }
-        if (p[n - 1] != '/' && (c[n] != '/' || n == c.length - 1))
-            return false;
-        return true;
-    }
-
     private final void beginWrite() {
         rwlock.writeLock().lock();
     }
@@ -926,7 +869,7 @@
 
     private volatile boolean isOpen = true;
     private final SeekableByteChannel ch; // channel to the zipfile
-    final byte[]  cen;           // CEN & ENDHDR
+    final byte[]  cen;     // CEN & ENDHDR
     private END  end;
     private long locpos;   // position of first LOC header (usually 0)
 
@@ -1058,6 +1001,7 @@
         if (end.endpos == 0) {
             inodes = new LinkedHashMap<>(10);
             locpos = 0;
+            buildNodeTree();
             return null;         // only END header present
         }
         if (end.cenlen > end.endpos)
@@ -1101,6 +1045,7 @@
         if (pos + ENDHDR != cen.length) {
             zerror("invalid CEN header (bad header size)");
         }
+        buildNodeTree();
         return cen;
     }
 
@@ -1125,12 +1070,15 @@
 
     private boolean hasUpdate = false;
 
+    // shared key. consumer guarantees the "writeLock" before use it.
+    private final IndexNode LOOKUPKEY = IndexNode.keyOf(null);
+
     private void updateDelete(Entry e) {
         beginWrite();
         try {
-            inodes.remove(IndexNode.keyOf(e.name));  //inodes.remove(e.name);
+            removeFromTree(e);
+            inodes.remove(e);
             hasUpdate = true;
-            dirs = null;
         } finally {
              endWrite();
         }
@@ -1139,9 +1087,16 @@
     private void update(Entry e) {
         beginWrite();
         try {
-            inodes.put(IndexNode.keyOf(e.name), e);  //inodes.put(e, e);
+            IndexNode old = inodes.put(e, e);
+            if (old != null) {
+                removeFromTree(old);
+            }
+            if (e.type == Entry.NEW || e.type == Entry.FILECH) {
+                IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(e.name)));
+                e.sibling = parent.child;
+                parent.child = e;
+            }
             hasUpdate = true;
-            dirs = null;
         } finally {
             endWrite();
         }
@@ -1229,7 +1184,7 @@
                         // ext) without enflating/deflating from the old zip
                         // file LOC entry.
                         written += copyLOCEntry(e, true, os, written, buf);
-                    } else {                          // NEW or FILECH
+                    } else {                          // NEW, FILECH or CEN
                         e.locoff = written;
                         written += e.writeLOC(os);    // write loc header
                         if (e.bytes != null) {        // in-memory, deflated
@@ -1265,7 +1220,10 @@
                 } catch (IOException x) {
                     x.printStackTrace();    // skip any in-accurate entry
                 }
-            } else {    // unchanged inode
+            } else {                        // unchanged inode
+                if (inode.pos == -1) {
+                    continue;               // pseudo directory node
+                }
                 e = Entry.readCEN(this, inode.pos);
                 try {
                     written += copyLOCEntry(e, false, os, written, buf);
@@ -1318,34 +1276,28 @@
         //System.out.printf("->sync(%s) done!%n", toString());
     }
 
-    private Entry getEntry0(byte[] path) throws IOException {
+    private IndexNode getInode(byte[] path) {
         if (path == null)
             throw new NullPointerException("path");
-        if (path.length == 0)
-            return null;
-        IndexNode inode = null;
         IndexNode key = IndexNode.keyOf(path);
-        if ((inode = inodes.get(key)) == null) {
-            if (path[path.length -1] == '/')  // already has a slash
-                return null;
+        IndexNode inode = inodes.get(key);
+        if (inode == null &&
+            (path.length == 0 || path[path.length -1] != '/')) {
+            // if does not ends with a slash
             path = Arrays.copyOf(path, path.length + 1);
             path[path.length - 1] = '/';
-            if ((inode = inodes.get(key.as(path))) == null)
-                return null;
+            inode = inodes.get(key.as(path));
         }
-        if (inode instanceof Entry)
-            return (Entry)inode;
-        return Entry.readCEN(this, inode.pos);
+        return inode;
     }
 
-    // Test if the "name" a parent directory of any entry (dir empty)
-    boolean isAncestor(byte[] name) {
-        for (Map.Entry<IndexNode, IndexNode> entry : inodes.entrySet()) {
-            byte[] ename = entry.getKey().name;
-            if (isParentOf(name, ename))
-                return true;
-        }
-        return false;
+    private Entry getEntry0(byte[] path) throws IOException {
+        IndexNode inode = getInode(path);
+        if (inode instanceof Entry)
+            return (Entry)inode;
+        if (inode == null || inode.pos == -1)
+            return null;
+        return Entry.readCEN(this, inode.pos);
     }
 
     public void deleteFile(byte[] path, boolean failIfNotExists)
@@ -1359,7 +1311,7 @@
             if (failIfNotExists)
                 throw new NoSuchFileException(getString(path));
         } else {
-            if (e.isDir() && isAncestor(path))
+            if (e.isDir() && e.child != null)
                 throw new DirectoryNotEmptyException(getString(path));
             updateDelete(e);
         }
@@ -1539,7 +1491,6 @@
         public int available() {
             return rem > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) rem;
         }
-
         public long size() {
             return size;
         }
@@ -1762,7 +1713,7 @@
         int    pos = -1;  // postion in cen table, -1 menas the
                           // entry does not exists in zip file
         IndexNode(byte[] name, int pos) {
-            as(name);
+            name(name);
             this.pos = pos;
         }
 
@@ -1770,15 +1721,25 @@
             return new IndexNode(name, -1);
         }
 
-        final IndexNode as(byte[] name) {    // reuse the node, mostly
-            this.name = name;                // as a lookup "key"
+        final void name(byte[] name) {
+            this.name = name;
             this.hashcode = Arrays.hashCode(name);
+        }
+
+        final IndexNode as(byte[] name) {           // reuse the node, mostly
+            name(name);                             // as a lookup "key"
             return this;
         }
 
+        boolean isDir() {
+            return name != null &&
+                   (name.length == 0 || name[name.length - 1] == '/');
+        }
+
         public boolean equals(Object other) {
-            if (!(other instanceof IndexNode))
+            if (!(other instanceof IndexNode)) {
                 return false;
+            }
             return Arrays.equals(name, ((IndexNode)other).name);
         }
 
@@ -1798,6 +1759,7 @@
         static final int FILECH = 3;    // fch update in "file"
         static final int COPY   = 4;    // copy of a CEN entry
 
+
         byte[] bytes;      // updated content bytes
         Path   file;       // use tmp file to store bytes;
         int    type = CEN; // default is the entry read from cen
@@ -1825,7 +1787,7 @@
         Entry() {}
 
         Entry(byte[] name) {
-            this.name   = name;
+            name(name);
             this.mtime  = System.currentTimeMillis();
             this.crc    = 0;
             this.size   = 0;
@@ -1839,8 +1801,8 @@
         }
 
         Entry (Entry e, int type) {
+            name(e.name);
             this.version   = e.version;
-            this.name      = e.name;
             this.ctime     = e.ctime;
             this.atime     = e.atime;
             this.mtime     = e.mtime;
@@ -1855,7 +1817,6 @@
             this.attrsEx   = e.attrsEx;
             this.locoff    = e.locoff;
             this.comment   = e.comment;
-
             this.type      = type;
         }
 
@@ -1865,12 +1826,6 @@
             this.method = METHOD_STORED;
         }
 
-        boolean isDir() {
-            return name != null &&
-                   (name.length == 0 ||
-                    name[name.length - 1] == '/');
-        }
-
         int version() throws ZipException {
             if (method == METHOD_DEFLATED)
                 return 20;
@@ -1909,7 +1864,7 @@
             locoff      = CENOFF(cen, pos);
 
             pos += CENHDR;
-            name = Arrays.copyOfRange(cen, pos, pos + nlen);
+            name(Arrays.copyOfRange(cen, pos, pos + nlen));
 
             pos += nlen;
             if (elen > 0) {
@@ -2132,7 +2087,8 @@
                 }
                 writeShort(os, flag);           // general purpose bit flag
                 writeShort(os, method);         // compression method
-                writeInt(os, mtime);            // last modification time
+                                                // last modification time
+                writeInt(os, (int)javaToDosTime(mtime));
                 writeInt(os, crc);              // crc-32
                 if (elen64 != 0) {
                     writeInt(os, ZIP64_MINVAL);
@@ -2318,50 +2274,56 @@
     //     structure.
     // A possible solution is to build the node tree ourself as
     // implemented below.
-    private HashMap<IndexNode, IndexNode> dirs;
     private IndexNode root;
-    private IndexNode addToDir(IndexNode child) {
-        IndexNode cinode = dirs.get(child);
-        if (cinode != null)
-            return cinode;
-
-        byte[] cname = child.name;
-        byte[] pname = getParent(cname);
-        IndexNode pinode;
 
-        if (pname != null)
-            pinode = addToDir(IndexNode.keyOf(pname));
-        else
-            pinode = root;
-        cinode = inodes.get(child);
-        if (cname[cname.length -1] != '/') {  // not a dir
-            cinode.sibling = pinode.child;
-            pinode.child = cinode;
-            return null;
+    private void addToTree(IndexNode inode, HashSet<IndexNode> dirs) {
+        if (dirs.contains(inode)) {
+            return;
         }
-        //cinode = dirs.get(child);
-        if (cinode == null)       // pseudo directry entry
-            cinode = new IndexNode(cname, -1);
-        cinode.sibling = pinode.child;
-        pinode.child = cinode;
-
-        dirs.put(child, cinode);
-        return cinode;
+        IndexNode parent;
+        byte[] name = inode.name;
+        byte[] pname = getParent(name);
+        if (inodes.containsKey(LOOKUPKEY.as(pname))) {
+            parent = inodes.get(LOOKUPKEY);
+        } else {    // pseudo directory entry
+            parent = new IndexNode(pname, -1);
+            inodes.put(parent, parent);
+        }
+        addToTree(parent, dirs);
+        inode.sibling = parent.child;
+        parent.child = inode;
+        if (name[name.length -1] == '/')
+            dirs.add(inode);
     }
 
-    private HashMap<IndexNode, IndexNode> getDirs()
-        throws IOException
-    {
+    private void removeFromTree(IndexNode inode) {
+        IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(inode.name)));
+        IndexNode child = parent.child;
+        if (child == inode) {
+            parent.child = child.sibling;
+        } else {
+            IndexNode last = child;
+            while ((child = child.sibling) != null) {
+                if (child == inode) {
+                    last.sibling = child.sibling;
+                    break;
+                } else {
+                    last = child;
+                }
+            }
+        }
+    }
+
+    private void buildNodeTree() throws IOException {
         beginWrite();
         try {
-            if (dirs != null)
-                return dirs;
-            dirs = new HashMap<>();
-            root = new IndexNode(new byte[0], -1);
-            dirs.put(root, root);
-            for (IndexNode node : inodes.keySet())
-                addToDir(node);
-            return dirs;
+            HashSet<IndexNode> dirs = new HashSet<>();
+            IndexNode root = new IndexNode(ROOTPATH, -1);
+            inodes.put(root, root);
+            dirs.add(root);
+            for (IndexNode node : inodes.keySet().toArray(new IndexNode[0])) {
+                addToTree(node, dirs);
+            }
         } finally {
             endWrite();
         }
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java	Fri Feb 04 16:29:41 2011 -0800
@@ -157,7 +157,7 @@
 
     @Override
     public ZipPath toRealPath(boolean resolveLinks) throws IOException {
-        ZipPath realPath = new ZipPath(zfs, getResolvedPath());
+        ZipPath realPath = new ZipPath(zfs, getResolvedPath()).toAbsolutePath();
         realPath.checkAccess();
         return realPath;
     }
@@ -472,8 +472,11 @@
             int n = offsets[i];
             int len = (i == offsets.length - 1)?
                       (path.length - n):(offsets[i + 1] - n - 1);
-            if (len == 1 && path[n] == (byte)'.')
+            if (len == 1 && path[n] == (byte)'.') {
+                if (m == 0 && path[0] == '/')   // absolute path
+                    to[m++] = '/';
                 continue;
+            }
             if (len == 2 && path[n] == '.' && path[n + 1] == '.') {
                 if (lastMOff >= 0) {
                     m = lastM[lastMOff--];  // retreat
@@ -726,6 +729,8 @@
 
     @Override
     public boolean isSameFile(Path other) throws IOException {
+        if (this.equals(other))
+            return true;
         if (other == null ||
             this.getFileSystem() != other.getFileSystem())
             return false;
--- a/jdk/src/share/hpi/export/bool.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-#ifndef _JAVASOFT_BOOL_H_
-#define _JAVASOFT_BOOL_H_
-
-#undef  TRUE
-#undef  FALSE
-
-typedef enum {
-    FALSE = 0,
-    TRUE = 1
-} bool_t;
-
-#endif /* !_JAVASOFT_BOOL_H_ */
--- a/jdk/src/share/hpi/export/dll.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_DLL_H_
-#define _JAVASOFT_DLL_H_
-
-#include <jni.h>
-
-/* DLL.H: A common interface for helper DLLs loaded by the VM.
- * Each library exports the main entry point "DLL_Initialize". Through
- * that function the programmer can obtain a function pointer which has
- * type "GetInterfaceFunc." Through the function pointer the programmer
- * can obtain other interfaces supported in the DLL.
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef jint (JNICALL * GetInterfaceFunc)
-       (void **intfP, const char *name, jint ver);
-
-jint JNICALL DLL_Initialize(GetInterfaceFunc *, void *args);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_DLL_H_ */
--- a/jdk/src/share/hpi/export/hpi.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Host Porting Interface. This defines the "porting layer" for
- * POSIX.1 compliant operating systems.
- */
-
-#ifndef _JAVASOFT_HPI_H_
-#define _JAVASOFT_HPI_H_
-
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "jni.h"
-#include "bool.h"
-#include "hpi_md.h"
-#include "dll.h"
-
-#ifdef __solaris__
-#define SSIZE_T ssize_t
-#else
-#ifdef _LP64
-#define SSIZE_T ssize_t
-#else
-#define SSIZE_T int
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * memory allocations
- */
-typedef struct {
-    /*
-     * Malloc must return a unique pointer if size == 0.
-     */
-  void *  (*Malloc)(size_t size);
-  void *  (*Realloc)(void *ptr, size_t new_size);
-    /*
-     * Free must allow ptr == NULL to be a no-op.
-     */
-  void    (*Free)(void *ptr);
-    /*
-     * Calloc must return a unique pointer for if
-     * n_item == 0 || item_size == 0.
-     */
-  void *  (*Calloc)(size_t n_item, size_t item_size);
-  char *  (*Strdup)(const char *str);
-
-  void *  (*MapMem)(size_t req_size, size_t *maped_size);
-  void *  (*UnmapMem)(void *req_addr, size_t req_size, size_t *unmap_size);
-  /*
-   * CommitMem should round the ptr down to the nearest page and
-   * round the size up to the nearest page so that the committed
-   * region is at least as large as the requested region.
-   */
-  void *  (*CommitMem)(void *ptr, size_t size, size_t *actual);
-  /*
-   * sysDecommitMem should round the ptr up to the nearest page and
-   * round the size down to the nearest page so that the decommitted
-   * region is no greater than the requested region.
-   */
-  void *  (*DecommitMem)(void *ptr, size_t size, size_t *actual);
-
-#define HPI_PAGE_ALIGNMENT          (64 * 1024)
-
-  void *  (*AllocBlock)(size_t size, void **headP);
-  void    (*FreeBlock)(void *head);
-} HPI_MemoryInterface;
-
-/*
- * dynamic linking libraries
- */
-typedef struct {
-  void   (*BuildLibName)(char *buf, int buf_len, char *path, char *name);
-  int    (*BuildFunName)(char *name, int name_len, int arg_size, int en_idx);
-
-  void * (*LoadLibrary)(const char *name, char *err_buf, int err_buflen);
-  void   (*UnloadLibrary)(void *lib);
-  void * (*FindLibraryEntry)(void *lib, const char *name);
-} HPI_LibraryInterface;
-
-typedef void (*signal_handler_t)(int sig, void *siginfo, void *context);
-
-#define HPI_SIG_DFL (signal_handler_t)0
-#define HPI_SIG_ERR (signal_handler_t)-1
-#define HPI_SIG_IGN (signal_handler_t)1
-
-typedef struct {
-  char *name; /* name such as green/native threads. */
-  int  isMP;
-} HPI_SysInfo;
-
-typedef struct {
-  HPI_SysInfo *    (*GetSysInfo)(void);
-  long             (*GetMilliTicks)(void);
-  jlong            (*TimeMillis)(void);
-
-  signal_handler_t (*Signal)(int sig, signal_handler_t handler);
-  void             (*Raise)(int sig);
-  void             (*SignalNotify)(int sig);
-  int              (*SignalWait)(void);
-
-  int              (*Shutdown)(void);
-
-  int              (*SetLoggingLevel)(int level);
-  bool_t           (*SetMonitoringOn)(bool_t on);
-  int              (*GetLastErrorString)(char *buf, int len);
-} HPI_SystemInterface;
-
-/*
- * threads and monitors
- */
-typedef struct  sys_thread sys_thread_t;
-typedef struct  sys_mon sys_mon_t;
-
-#define HPI_OK          0
-#define HPI_ERR        -1
-#define HPI_INTRPT     -2    /* Operation was interrupted */
-#define HPI_TIMEOUT    -3    /* A timer ran out */
-#define HPI_NOMEM      -5    /* Ran out of memory */
-#define HPI_NORESOURCE -6    /* Ran out of some system resource */
-
-/* There are three basic states: RUNNABLE, MONITOR_WAIT, and CONDVAR_WAIT.
- * When the thread is suspended in any of these states, the
- * HPI_THREAD_SUSPENDED bit will be set
- */
-enum {
-    HPI_THREAD_RUNNABLE = 1,
-    HPI_THREAD_MONITOR_WAIT,
-    HPI_THREAD_CONDVAR_WAIT
-};
-
-#define HPI_MINIMUM_PRIORITY        1
-#define HPI_MAXIMUM_PRIORITY        10
-#define HPI_NORMAL_PRIORITY         5
-
-#define HPI_THREAD_SUSPENDED        0x8000
-#define HPI_THREAD_INTERRUPTED      0x4000
-
-typedef struct {
-    sys_thread_t *owner;
-    long          entry_count;
-    sys_thread_t **monitor_waiters;
-    sys_thread_t **condvar_waiters;
-    int          sz_monitor_waiters;
-    int          sz_condvar_waiters;
-    int          n_monitor_waiters;
-    int          n_condvar_waiters;
-} sys_mon_info;
-
-typedef struct {
-  int            (*ThreadBootstrap)(sys_thread_t **tidP,
-                                    sys_mon_t **qlockP,
-                                    int nReservedBytes);
-  int            (*ThreadCreate)(sys_thread_t **tidP,
-                                 long stk_size,
-                                 void (*func)(void *),
-                                 void *arg);
-  sys_thread_t * (*ThreadSelf)(void);
-  void           (*ThreadYield)(void);
-  int            (*ThreadSuspend)(sys_thread_t *tid);
-  int            (*ThreadResume)(sys_thread_t *tid);
-  int            (*ThreadSetPriority)(sys_thread_t *tid, int prio);
-  int            (*ThreadGetPriority)(sys_thread_t *tid, int *prio);
-  void *         (*ThreadStackPointer)(sys_thread_t *tid);
-  void *         (*ThreadStackTop)(sys_thread_t *tid);
-  long *         (*ThreadRegs)(sys_thread_t *tid, int *regs);
-  int            (*ThreadSingle)(void);
-  void           (*ThreadMulti)(void);
-  int            (*ThreadEnumerateOver)(int (*func)(sys_thread_t *, void *),
-                                        void *arg);
-  int            (*ThreadCheckStack)(void);
-  void           (*ThreadPostException)(sys_thread_t *tid, void *arg);
-  void           (*ThreadInterrupt)(sys_thread_t *tid);
-  int            (*ThreadIsInterrupted)(sys_thread_t *tid, int clear);
-  int            (*ThreadAlloc)(sys_thread_t **tidP);
-  int            (*ThreadFree)(void);
-  jlong          (*ThreadCPUTime)(void);
-  int            (*ThreadGetStatus)(sys_thread_t *tid, sys_mon_t **monitor);
-  void *         (*ThreadInterruptEvent)(void);
-  void *         (*ThreadNativeID)(sys_thread_t *tid);
-
-  /* These three functions are used by the CPU time profiler.
-   * sysThreadIsRunning determines whether the thread is running (not just
-   * runnable). It is only safe to call this function after calling
-   * sysThreadProfSuspend.
-   */
-  bool_t         (*ThreadIsRunning)(sys_thread_t *tid);
-  void           (*ThreadProfSuspend)(sys_thread_t *tid);
-  void           (*ThreadProfResume)(sys_thread_t *tid);
-
-  int            (*AdjustTimeSlice)(int ms);
-
-  size_t         (*MonitorSizeof)(void);
-  int            (*MonitorInit)(sys_mon_t *mid);
-  int            (*MonitorDestroy)(sys_mon_t *mid);
-  int            (*MonitorEnter)(sys_thread_t *self, sys_mon_t *mid);
-  bool_t         (*MonitorEntered)(sys_thread_t *self, sys_mon_t *mid);
-  int            (*MonitorExit)(sys_thread_t *self, sys_mon_t *mid);
-  int            (*MonitorNotify)(sys_thread_t *self, sys_mon_t *mid);
-  int            (*MonitorNotifyAll)(sys_thread_t *self, sys_mon_t *mid);
-  int            (*MonitorWait)(sys_thread_t *self, sys_mon_t *mid, jlong ms);
-  bool_t         (*MonitorInUse)(sys_mon_t *mid);
-  sys_thread_t * (*MonitorOwner)(sys_mon_t *mid);
-  int            (*MonitorGetInfo)(sys_mon_t *mid, sys_mon_info *info);
-
-} HPI_ThreadInterface;
-
-/*
- * files
- */
-
-#define HPI_FILETYPE_REGULAR    (0)
-#define HPI_FILETYPE_DIRECTORY  (1)
-#define HPI_FILETYPE_OTHER      (2)
-
-typedef struct {
-  char *         (*NativePath)(char *path);
-  int            (*FileType)(const char *path);
-  int            (*Open)(const char *name, int openMode, int filePerm);
-  int            (*Close)(int fd);
-  jlong          (*Seek)(int fd, jlong offset, int whence);
-  int            (*SetLength)(int fd, jlong length);
-  int            (*Sync)(int fd);
-  int            (*Available)(int fd, jlong *bytes);
-  size_t         (*Read)(int fd, void *buf, unsigned int nBytes);
-  size_t         (*Write)(int fd, const void *buf, unsigned int nBytes);
-  int            (*FileSizeFD)(int fd, jlong *size);
-} HPI_FileInterface;
-
-/*
- * sockets
- */
-struct sockaddr;
-struct hostent;
-
-typedef struct {
-  int              (*Close)(int fd);
-  long             (*Available)(int fd, jint *pbytes);
-  int              (*Connect)(int fd, struct sockaddr *him, int len);
-  int              (*Accept)(int fd, struct sockaddr *him, int *len);
-  SSIZE_T          (*SendTo)(int fd, char *buf, int len, int flags,
-                             struct sockaddr *to, int tolen);
-  SSIZE_T          (*RecvFrom)(int fd, char *buf, int nbytes, int flags,
-                               struct sockaddr *from, int *fromlen);
-  int              (*Listen)(int fd, int count);
-  SSIZE_T          (*Recv)(int fd, char *buf, int nBytes, int flags);
-  SSIZE_T          (*Send)(int fd, char *buf, int nBytes, int flags);
-  int              (*Timeout)(int fd, long timeout);
-  struct hostent * (*GetHostByName)(char *hostname);
-  int              (*Socket)(int domain, int type, int protocol);
-  int              (*SocketShutdown)(int fd, int howto);
-  int              (*Bind)(int fd, struct sockaddr *him, int len);
-  int              (*GetSocketName)(int fd, struct sockaddr *him, int *len);
-  int              (*GetHostName)(char *hostname, int namelen);
-  struct hostent * (*GetHostByAddr)(const char *hostname, int len, int type);
-  int              (*SocketGetOption)(int fd, int level, int optname, char *optval, int *optlen);
-  int              (*SocketSetOption)(int fd, int level, int optname, const char *optval, int optlen);
-  struct protoent * (*GetProtoByName)(char* name);
-} HPI_SocketInterface;
-
-/*
- * callbacks.
- */
-typedef struct vm_calls {
-    int    (*jio_fprintf)(FILE *fp, const char *fmt, ...);
-    void   (*panic)(const char *fmt, ...);
-    void   (*monitorRegister)(sys_mon_t *mid, char *info_str);
-
-    void   (*monitorContendedEnter)(sys_thread_t *self, sys_mon_t *mid);
-    void   (*monitorContendedEntered)(sys_thread_t *self, sys_mon_t *mid);
-    void   (*monitorContendedExit)(sys_thread_t *self, sys_mon_t *mid);
-} vm_calls_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_HPI_H_ */
--- a/jdk/src/share/hpi/include/hpi_impl.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_HPI_IMPL_H_
-#define _JAVASOFT_HPI_IMPL_H_
-
-#include "hpi.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vm_calls.h"
-
-extern int nReservedBytes;
-sys_thread_t *allocThreadBlock(void);
-void freeThreadBlock(sys_thread_t *tid);
-int threadBootstrapMD(sys_thread_t **tid, sys_mon_t **lockP, int nb);
-
-HPI_SysInfo *sysGetSysInfo(void);
-long    sysGetMilliTicks(void);
-jlong sysTimeMillis(void);
-
-signal_handler_t sysSignal(int sig, signal_handler_t handler);
-void sysRaise(int sig);
-void sysSignalNotify(int sig);
-int sysSignalWait(void);
-int sysShutdown(void);
-int sysSetLoggingLevel(int level);
-bool_t sysSetMonitoringOn(bool_t on);
-int sysGetLastErrorString(char *buf, int len);
-
-void *  sysMalloc(size_t);
-void *  sysRealloc(void*, size_t);
-void    sysFree(void*);
-void *  sysCalloc(size_t, size_t);
-char *  sysStrdup(const char * string);
-void *  sysMapMem(size_t, size_t *);
-void *  sysUnmapMem(void *, size_t, size_t *);
-void *  sysCommitMem(void * ptr, size_t size, size_t * actual);
-void *  sysDecommitMem(void * ptr, size_t size, size_t * actual);
-void *  sysAllocBlock(size_t, void**);
-void    sysFreeBlock(void *);
-
-void    sysBuildLibName(char *, int, char *, char *);
-int     sysBuildFunName(char *, int, int, int);
-void *  sysLoadLibrary(const char *, char *err_buf, int err_buflen);
-void    sysUnloadLibrary(void *);
-void *  sysFindLibraryEntry(void *, const char *);
-
-int     sysThreadBootstrap(sys_thread_t **, sys_mon_t **, int);
-int     sysThreadCreate(sys_thread_t **,
-                        long,
-                        void (*)(void *),
-                        void *arg);
-void    sysThreadExit(void);
-sys_thread_t * sysThreadSelf(void);
-void    sysThreadYield(void);
-int     sysThreadSuspend(sys_thread_t *);
-int     sysThreadResume(sys_thread_t *);
-int     sysThreadSetPriority(sys_thread_t *, int);
-int     sysThreadGetPriority(sys_thread_t *, int *);
-void *  sysThreadStackPointer(sys_thread_t *);
-void *  sysThreadStackTop(sys_thread_t *);
-long *  sysThreadRegs(sys_thread_t *, int *);
-int     sysThreadSingle(void);
-void    sysThreadMulti(void);
-int     sysThreadEnumerateOver(int (*)(sys_thread_t *, void *), void *);
-int     sysThreadCheckStack(void);
-void    sysThreadPostException(sys_thread_t *, void *);
-void    sysThreadInterrupt(sys_thread_t *);
-int     sysThreadIsInterrupted(sys_thread_t *, int);
-int     sysThreadAlloc(sys_thread_t **);
-int     sysThreadFree(void);
-size_t  sysThreadSizeof(void);
-jlong   sysThreadCPUTime(void);
-int     sysThreadGetStatus(sys_thread_t *, sys_mon_t **);
-int     sysAdjustUserThreadCount(int delta);
-bool_t  sysThreadIsRunning(sys_thread_t *);
-void    sysThreadProfSuspend(sys_thread_t *);
-void    sysThreadProfResume(sys_thread_t *);
-int     sysAdjustTimeSlice(int);
-int     sysThreadEnumerateOver(int (*f)(sys_thread_t *, void *), void *arg);
-void *  sysThreadInterruptEvent(void);
-void *  sysThreadNativeID(sys_thread_t *);
-
-size_t  sysMonitorSizeof(void);
-int     sysMonitorInit(sys_mon_t *);
-int     sysMonitorDestroy(sys_mon_t *);
-int     sysMonitorEnter(sys_thread_t *, sys_mon_t *);
-bool_t  sysMonitorEntered(sys_thread_t *, sys_mon_t *);
-int     sysMonitorExit(sys_thread_t *, sys_mon_t *);
-int     sysMonitorNotify(sys_thread_t *, sys_mon_t *);
-int     sysMonitorNotifyAll(sys_thread_t *, sys_mon_t *);
-int     sysMonitorWait(sys_thread_t *, sys_mon_t *, jlong);
-bool_t  sysMonitorInUse(sys_mon_t *);
-sys_thread_t * sysMonitorOwner(sys_mon_t *);
-int     sysMonitorGetInfo(sys_mon_t *, sys_mon_info *);
-
-char *sysNativePath(char *path);
-int sysFileType(const char *path);
-int sysOpen(const char *name, int openMode, int filePerm);
-int sysClose(int fd);
-jlong sysSeek(int fd, jlong offset, int whence);
-int sysSetLength(int fd, jlong length);
-int sysSync(int fd);
-int sysAvailable(int fd, jlong *bytes);
-size_t sysRead(int fd, void *buf, unsigned int nBytes);
-size_t sysWrite(int fd, const void *buf, unsigned int nBytes);
-int sysFileSizeFD(int fd, jlong *size);
-
-int sysSocketClose(int fd);
-int sysSocketShutdown(int fd, int howto);
-long sysSocketAvailable(int fd, jint *pbytes);
-int sysConnect(int fd, struct sockaddr *him, int len);
-int sysBind(int fd, struct sockaddr *him, int len);
-int sysAccept(int fd, struct sockaddr *him, int *len);
-int sysGetSockName(int fd, struct sockaddr *him, int *len);
-#ifdef _LP64
-ssize_t sysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to,
-              int tolen);
-ssize_t sysRecvFrom(int fd, char *buf, int nbytes, int flags,
-                struct sockaddr *from, int *fromlen);
-ssize_t sysRecv(int fd, char *buf, int nBytes, int flags);
-ssize_t sysSend(int fd, char *buf, int nBytes, int flags);
-#else
-int sysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to,
-              int tolen);
-int sysRecvFrom(int fd, char *buf, int nbytes, int flags,
-                struct sockaddr *from, int *fromlen);
-int sysRecv(int fd, char *buf, int nBytes, int flags);
-int sysSend(int fd, char *buf, int nBytes, int flags);
-#endif
-int sysListen(int fd, int count);
-int sysTimeout(int fd, long timeout);
-int sysGetHostName(char* name, int namelen);
-struct hostent *sysGetHostByAddr(const char* name, int len, int type);
-struct hostent *sysGetHostByName(char *hostname);
-int sysSocket(int domain, int type, int protocol);
-int sysGetSockOpt(int fd, int level, int optname, char *optval, int *optlen);
-int sysSetSockOpt(int fd, int level, int optname, const char *optval, int optlen);
-struct protoent * sysGetProtoByName(char* name);
-
-#define SYS_SIG_DFL HPI_SIG_DFL
-#define SYS_SIG_ERR HPI_SIG_ERR
-#define SYS_SIG_IGN HPI_SIG_IGN
-
-#define SYS_OK         HPI_OK
-#define SYS_ERR        HPI_ERR
-#define SYS_INTRPT     HPI_INTRPT
-#define SYS_TIMEOUT    HPI_TIMEOUT
-#define SYS_NOMEM      HPI_NOMEM
-#define SYS_NORESOURCE HPI_NORESOURCE
-
-#define SYS_THREAD_RUNNABLE     HPI_THREAD_RUNNABLE
-#define SYS_THREAD_MONITOR_WAIT HPI_THREAD_MONITOR_WAIT
-#define SYS_THREAD_CONDVAR_WAIT HPI_THREAD_CONDVAR_WAIT
-
-#define MinimumPriority     HPI_MINIMUM_PRIORITY
-#define MaximumPriority     HPI_MAXIMUM_PRIORITY
-#define NormalPriority      HPI_NORMAL_PRIORITY
-
-#define SYS_THREAD_SUSPENDED HPI_THREAD_SUSPENDED
-
-#define PAGE_ALIGNMENT      HPI_PAGE_ALIGNMENT
-
-#define SYS_TIMEOUT_INFINITY HPI_TIMEOUT_INFINITY
-
-#define SYS_FILETYPE_REGULAR      HPI_FILETYPE_REGULAR
-#define SYS_FILETYPE_DIRECTORY    HPI_FILETYPE_DIRECTORY
-#define SYS_FILETYPE_OTHER        HPI_FILETYPE_OTHER
-
-typedef void *stackp_t;
-
-/* global vars */
-
-extern int logging_level;
-extern bool_t profiler_on;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_HPI_IMPL_H_ */
--- a/jdk/src/share/hpi/include/vm_calls.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_VM_CALLS_H_
-#define _JAVASOFT_VM_CALLS_H_
-
-/* This file defines the function table and macros exported from the VM
- * for the implementation of HPI.
- */
-
-extern vm_calls_t *vm_calls;
-
-#define VM_CALLS_READY() vm_calls
-#define VM_CALL(f) (vm_calls->f)
-
-#undef sysAssert
-
-#ifdef DEBUG
-#define sysAssert(expression) {         \
-    if (!(expression)) {                \
-        vm_calls->panic \
-            ("\"%s\", line %d: assertion failure\n", __FILE__, __LINE__); \
-    }                                   \
-}
-#else
-#define sysAssert(expression) ((void) 0)
-#endif
-
-#ifdef LOGGING
-
-#define Log(level, message) {                                           \
-    if (vm_calls && level <= logging_level)                     \
-        vm_calls->jio_fprintf(stderr, message);                         \
-}
-
-#define Log1(level, message, x1) {                                      \
-    if (vm_calls && level <= logging_level)                     \
-        vm_calls->jio_fprintf(stderr, message, (x1));                   \
-}
-
-#define Log2(level, message, x1, x2) {                                  \
-    if (vm_calls && level <= logging_level)                     \
-        vm_calls->jio_fprintf(stderr, message, (x1), (x2));             \
-}
-
-#define Log3(level, message, x1, x2, x3) {                              \
-    if (vm_calls && level <= logging_level)                     \
-        vm_calls->jio_fprintf(stderr, message, (x1), (x2), (x3));       \
-}
-
-#define Log4(level, message, x1, x2, x3, x4) {                          \
-    if (vm_calls && level <= logging_level)                     \
-        vm_calls->jio_fprintf(stderr, message, (x1), (x2), (x3), (x4)); \
-}
-
-#else
-
-#define Log(level, message)                     ((void) 0)
-#define Log1(level, message, x1)                ((void) 0)
-#define Log2(level, message, x1, x2)            ((void) 0)
-#define Log3(level, message, x1, x2, x3)        ((void) 0)
-#define Log4(level, message, x1, x2, x3, x4)    ((void) 0)
-
-#endif /* LOGGING */
-
-#endif /* !_JAVASOFT_VM_CALLS_H_ */
--- a/jdk/src/share/hpi/src/hpi.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
- * 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 "hpi_impl.h"
-#include "threads_md.h"
-
-int logging_level = 0;
-bool_t profiler_on = FALSE;
-
-int sysSetLoggingLevel(int level)
-{
-    int old = logging_level;
-    logging_level = level;
-    return old;
-}
-
-bool_t sysSetMonitoringOn(bool_t s)
-{
-    bool_t old = profiler_on;
-    profiler_on = s;
-    return old;
-}
-
-int nReservedBytes;
-
-sys_thread_t *allocThreadBlock()
-{
-    char *p = sysCalloc(nReservedBytes + sizeof(sys_thread_t), 1);
-    if (p == NULL) {
-        return NULL;
-    }
-    return (sys_thread_t *)(p + nReservedBytes);
-}
-
-void freeThreadBlock(sys_thread_t *tid)
-{
-    sysFree((char *)tid - nReservedBytes);
-}
-
-vm_calls_t *vm_calls = NULL;
-
-static HPI_MemoryInterface hpi_memory_interface = {
-  sysMalloc,
-  sysRealloc,
-  sysFree,
-  sysCalloc,
-  sysStrdup,
-  sysMapMem,
-  sysUnmapMem,
-  sysCommitMem,
-  sysDecommitMem,
-  sysAllocBlock,
-  sysFreeBlock,
-};
-
-static HPI_LibraryInterface hpi_library_interface = {
-  sysBuildLibName,
-  sysBuildFunName,
-  sysLoadLibrary,
-  sysUnloadLibrary,
-  sysFindLibraryEntry,
-};
-
-static HPI_SystemInterface hpi_system_interface = {
-  sysGetSysInfo,
-  sysGetMilliTicks,
-  sysTimeMillis,
-  sysSignal,
-  sysRaise,
-  sysSignalNotify,
-  sysSignalWait,
-  sysShutdown,
-  sysSetLoggingLevel,
-  sysSetMonitoringOn,
-  sysGetLastErrorString
-};
-
-static HPI_ThreadInterface hpi_thread_interface = {
-  sysThreadBootstrap,
-  sysThreadCreate,
-  sysThreadSelf,
-  sysThreadYield,
-  sysThreadSuspend,
-  sysThreadResume,
-  sysThreadSetPriority,
-  sysThreadGetPriority,
-  sysThreadStackPointer,
-  sysThreadStackTop,
-  sysThreadRegs,
-  sysThreadSingle,
-  sysThreadMulti,
-  sysThreadEnumerateOver,
-  sysThreadCheckStack,
-  sysThreadPostException,
-  sysThreadInterrupt,
-  sysThreadIsInterrupted,
-  sysThreadAlloc,
-  sysThreadFree,
-  sysThreadCPUTime,
-  sysThreadGetStatus,
-  sysThreadInterruptEvent,
-  sysThreadNativeID,
-  sysThreadIsRunning,
-  sysThreadProfSuspend,
-  sysThreadProfResume,
-  sysAdjustTimeSlice,
-  sysMonitorSizeof,
-  sysMonitorInit,
-  sysMonitorDestroy,
-  sysMonitorEnter,
-  sysMonitorEntered,
-  sysMonitorExit,
-  sysMonitorNotify,
-  sysMonitorNotifyAll,
-  sysMonitorWait,
-  sysMonitorInUse,
-  sysMonitorOwner,
-  sysMonitorGetInfo,
-};
-
-static HPI_FileInterface hpi_file_interface = {
-  sysNativePath,
-  sysFileType,
-  sysOpen,
-  sysClose,
-  sysSeek,
-  sysSetLength,
-  sysSync,
-  sysAvailable,
-  sysRead,
-  sysWrite,
-  sysFileSizeFD
-};
-
-static HPI_SocketInterface hpi_socket_interface = {
-  sysSocketClose,
-  sysSocketAvailable,
-  sysConnect,
-  sysAccept,
-  sysSendTo,
-  sysRecvFrom,
-  sysListen,
-  sysRecv,
-  sysSend,
-  sysTimeout,
-  sysGetHostByName,
-  sysSocket,
-  sysSocketShutdown,
-  sysBind,
-  sysGetSockName,
-  sysGetHostName,
-  sysGetHostByAddr,
-  sysGetSockOpt,
-  sysSetSockOpt,
-  sysGetProtoByName,
-};
-
-static jint JNICALL
-GetInterface(void **intfP, const char *name, jint version)
-{
-    *intfP = NULL;
-    if (version != 1) {
-        return -1;
-    }
-    if (strcmp(name, "Memory") == 0) {
-        *intfP = &hpi_memory_interface;
-        return 0;
-    }
-    if (strcmp(name, "Library") == 0) {
-        *intfP = &hpi_library_interface;
-        return 0;
-    }
-    if (strcmp(name, "System") == 0) {
-        *intfP = &hpi_system_interface;
-        return 0;
-    }
-    if (strcmp(name, "Thread") == 0) {
-        *intfP = &hpi_thread_interface;
-        return 0;
-    }
-    if (strcmp(name, "File") == 0) {
-        *intfP = &hpi_file_interface;
-        return 0;
-    }
-    if (strcmp(name, "Socket") == 0) {
-        *intfP = &hpi_socket_interface;
-        return 0;
-    }
-    return -2;
-}
-
-jint JNICALL
-DLL_Initialize(GetInterfaceFunc *gi, void *args)
-{
-    vm_calls = args;
-    *gi = GetInterface;
-    return SYS_OK;
-}
--- a/jdk/src/share/instrument/JPLISAgent.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/instrument/JPLISAgent.c	Fri Feb 04 16:29:41 2011 -0800
@@ -209,7 +209,7 @@
     *agent_ptr = NULL;
     jnierror = (*vm)->GetEnv(  vm,
                                (void **) &jvmtienv,
-                               JVMTI_VERSION);
+                               JVMTI_VERSION_1_1);
     if ( jnierror != JNI_OK ) {
         initerror = JPLIS_INIT_ERROR_CANNOT_CREATE_NATIVE_AGENT;
     } else {
@@ -990,7 +990,7 @@
     }
     jnierror = (*agent->mJVM)->GetEnv(  agent->mJVM,
                                (void **) &retransformerEnv,
-                               JVMTI_VERSION);
+                               JVMTI_VERSION_1_1);
     if ( jnierror != JNI_OK ) {
         return NULL;
     }
--- a/jdk/src/share/javavm/export/jmm.h	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/javavm/export/jmm.h	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,8 @@
   unsigned int isBootClassPathSupported : 1;
   unsigned int isObjectMonitorUsageSupported : 1;
   unsigned int isSynchronizerUsageSupported : 1;
-  unsigned int : 24;
+  unsigned int isThreadAllocatedMemorySupported : 1;
+  unsigned int : 23;
 } jmmOptionalSupport;
 
 typedef enum {
@@ -105,7 +106,8 @@
   JMM_VERBOSE_GC                     = 21,
   JMM_VERBOSE_CLASS                  = 22,
   JMM_THREAD_CONTENTION_MONITORING   = 23,
-  JMM_THREAD_CPU_TIME                = 24
+  JMM_THREAD_CPU_TIME                = 24,
+  JMM_THREAD_ALLOCATED_MEMORY        = 25
 } jmmBoolAttribute;
 
 
@@ -213,7 +215,10 @@
   jobject      (JNICALL *GetMemoryPoolUsage)     (JNIEnv* env, jobject pool);
   jobject      (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool);
 
-  void*        reserved4;
+  void         (JNICALL *GetThreadAllocatedMemory)
+                                                 (JNIEnv *env,
+                                                  jlongArray ids,
+                                                  jlongArray sizeArray);
 
   jobject      (JNICALL *GetMemoryUsage)         (JNIEnv* env, jboolean heap);
 
@@ -228,6 +233,8 @@
                                                   jlong* result);
 
   jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env);
+
+  // Not used in JDK 6 or JDK 7
   jlong        (JNICALL *GetThreadCpuTime)       (JNIEnv *env, jlong thread_id);
 
   jobjectArray (JNICALL *GetVMGlobalNames)       (JNIEnv *env);
@@ -262,14 +269,22 @@
   void         (JNICALL *GetLastGCStat)          (JNIEnv *env,
                                                   jobject mgr,
                                                   jmmGCStat *gc_stat);
-  jlong        (JNICALL *GetThreadCpuTimeWithKind) (JNIEnv *env,
-                                                    jlong thread_id,
-                                                    jboolean user_sys_cpu_time);
-  void*        reserved5;
+
+  jlong        (JNICALL *GetThreadCpuTimeWithKind)
+                                                 (JNIEnv *env,
+                                                  jlong thread_id,
+                                                  jboolean user_sys_cpu_time);
+  void         (JNICALL *GetThreadCpuTimesWithKind)
+                                                 (JNIEnv *env,
+                                                  jlongArray ids,
+                                                  jlongArray timeArray,
+                                                  jboolean user_sys_cpu_time);
+
   jint         (JNICALL *DumpHeap0)              (JNIEnv *env,
                                                   jstring outputfile,
                                                   jboolean live);
-  jobjectArray (JNICALL *FindDeadlocks)             (JNIEnv *env, jboolean object_monitors_only);
+  jobjectArray (JNICALL *FindDeadlocks)          (JNIEnv *env,
+                                                  jboolean object_monitors_only);
   void         (JNICALL *SetVMGlobal)            (JNIEnv *env,
                                                   jstring flag_name,
                                                   jvalue  new_value);
--- a/jdk/src/share/javavm/export/jvmti.h	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/javavm/export/jvmti.h	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,9 @@
     JVMTI_VERSION_1   = 0x30010000,
     JVMTI_VERSION_1_0 = 0x30010000,
     JVMTI_VERSION_1_1 = 0x30010100,
-
-    JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (1 * 0x100) + 102  /* version: 1.1.102 */
+    JVMTI_VERSION_1_2 = 0x30010200,
+
+    JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (2 * 0x100) + 1  /* version: 1.2.1 */
 };
 
 JNIEXPORT jint JNICALL
@@ -1774,6 +1775,12 @@
     jobject object,
     jlong* size_ptr);
 
+  /*   155 : Get Local Instance */
+  jvmtiError (JNICALL *GetLocalInstance) (jvmtiEnv* env,
+    jthread thread,
+    jint depth,
+    jobject* value_ptr);
+
 } jvmtiInterface_1;
 
 struct _jvmtiEnv {
@@ -2031,6 +2038,12 @@
     return functions->GetLocalObject(this, thread, depth, slot, value_ptr);
   }
 
+  jvmtiError GetLocalInstance(jthread thread,
+            jint depth,
+            jobject* value_ptr) {
+    return functions->GetLocalInstance(this, thread, depth, value_ptr);
+  }
+
   jvmtiError GetLocalInt(jthread thread,
             jint depth,
             jint slot,
@@ -2518,3 +2531,4 @@
 #endif /* __cplusplus */
 
 #endif /* !_JAVA_JVMTI_H_ */
+
--- a/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h	Fri Feb 04 16:29:41 2011 -0800
@@ -161,11 +161,11 @@
 
 /* INT32 must hold at least signed 32-bit values. */
 
-#ifndef XMD_H                   /* X11/xmd.h correctly defines INT32 */
-#ifndef _LP64
+#ifndef XMD_H                         /* X11/xmd.h correctly defines INT32 */
+#if defined(_LP64) || defined(_WIN32) /* _WIN32 is on all windows platfroms (x86 and x64) */
+typedef int INT32;
+#else
 typedef long INT32;
-#else
-typedef int INT32;
 #endif
 #endif
 
@@ -221,11 +221,14 @@
  * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
  */
 
+
+#ifndef FAR
 #ifdef NEED_FAR_POINTERS
 #define FAR  far
 #else
 #define FAR
 #endif
+#endif
 
 
 /*
--- a/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp	Fri Feb 04 16:29:41 2011 -0800
@@ -224,6 +224,7 @@
     if (pt != NULL) {
         advance.fX = env->GetFloatField(pt, sunFontIDs.xFID);
         advance.fY = env->GetFloatField(pt, sunFontIDs.yFID);
+        env->DeleteLocalRef(pt);
     }
 }
 
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Fri Feb 04 16:29:41 2011 -0800
@@ -137,7 +137,7 @@
     JNU_ThrowByName(env, "java/awt/color/CMMException", errMsg);
 }
 
-JNIEXPORT int JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
     javaVM = jvm;
 
     cmsSetLogErrorHandler(errorHandler);
--- a/jdk/src/share/native/sun/management/ThreadImpl.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/native/sun/management/ThreadImpl.c	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -42,9 +42,15 @@
     jmm_interface->SetBoolAttribute(env, JMM_THREAD_CPU_TIME, flag);
 }
 
+JNIEXPORT void JNICALL
+Java_sun_management_ThreadImpl_setThreadAllocatedMemoryEnabled0
+  (JNIEnv *env, jclass cls, jboolean flag)
+{
+    jmm_interface->SetBoolAttribute(env, JMM_THREAD_ALLOCATED_MEMORY, flag);
+}
 
 JNIEXPORT void JNICALL
-Java_sun_management_ThreadImpl_getThreadInfo0
+Java_sun_management_ThreadImpl_getThreadInfo1
   (JNIEnv *env, jclass cls, jlongArray ids, jint maxDepth,
    jobjectArray infoArray)
 {
@@ -65,6 +71,14 @@
     return jmm_interface->GetThreadCpuTimeWithKind(env, tid, JNI_TRUE /* user+sys */);
 }
 
+JNIEXPORT void JNICALL
+Java_sun_management_ThreadImpl_getThreadTotalCpuTime1
+  (JNIEnv *env, jclass cls, jlongArray ids, jlongArray timeArray)
+{
+    jmm_interface->GetThreadCpuTimesWithKind(env, ids, timeArray,
+                                             JNI_TRUE /* user+sys */);
+}
+
 JNIEXPORT jlong JNICALL
 Java_sun_management_ThreadImpl_getThreadUserCpuTime0
   (JNIEnv *env, jclass cls, jlong tid)
@@ -72,6 +86,21 @@
     return jmm_interface->GetThreadCpuTimeWithKind(env, tid, JNI_FALSE /* user */);
 }
 
+JNIEXPORT void JNICALL
+Java_sun_management_ThreadImpl_getThreadUserCpuTime1
+  (JNIEnv *env, jclass cls, jlongArray ids, jlongArray timeArray)
+{
+    jmm_interface->GetThreadCpuTimesWithKind(env, ids, timeArray,
+                                             JNI_FALSE /* user */);
+}
+
+JNIEXPORT void JNICALL
+Java_sun_management_ThreadImpl_getThreadAllocatedMemory1
+  (JNIEnv *env, jclass cls, jlongArray ids, jlongArray sizeArray)
+{
+    jmm_interface->GetThreadAllocatedMemory(env, ids, sizeArray);
+}
+
 JNIEXPORT jobjectArray JNICALL
 Java_sun_management_ThreadImpl_findMonitorDeadlockedThreads0
   (JNIEnv *env, jclass cls)
--- a/jdk/src/share/native/sun/management/VMManagementImpl.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/share/native/sun/management/VMManagementImpl.c	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -92,6 +92,9 @@
         setStaticBooleanField(env, cls, "objectMonitorUsageSupport", JNI_FALSE);
         setStaticBooleanField(env, cls, "synchronizerUsageSupport", JNI_FALSE);
     }
+
+    value = mos.isThreadAllocatedMemorySupported;
+    setStaticBooleanField(env, cls, "threadAllocatedMemorySupport", value);
 }
 
 JNIEXPORT jobjectArray JNICALL
@@ -201,6 +204,13 @@
     return jmm_interface->GetBoolAttribute(env, JMM_THREAD_CPU_TIME);
 }
 
+JNIEXPORT jboolean JNICALL
+Java_sun_management_VMManagementImpl_isThreadAllocatedMemoryEnabled
+  (JNIEnv *env, jobject dummy)
+{
+    return jmm_interface->GetBoolAttribute(env, JMM_THREAD_ALLOCATED_MEMORY);
+}
+
 JNIEXPORT jint JNICALL
 Java_sun_management_VMManagementImpl_getProcessId
   (JNIEnv *env, jobject dummy)
--- a/jdk/src/solaris/classes/sun/awt/X11FontManager.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/classes/sun/awt/X11FontManager.java	Fri Feb 04 16:29:41 2011 -0800
@@ -718,25 +718,6 @@
         fontdirs = (String[])fontConfigDirs.toArray(new String[0]);
     }
 
-    /* Called by MToolkit to set the X11 font path */
-    public static void setNativeFontPath() {
-        if (fontdirs == null) {
-            return;
-        }
-
-        // need to register these individually rather than by one call
-        // to ensure that one bad directory doesn't cause all to be rejected
-        for (int i=0; i<fontdirs.length; i++) {
-            if (FontUtilities.debugFonts()) {
-                FontUtilities.getLogger().info("Add " + fontdirs[i] + " to X11 fontpath");
-            }
-            setNativeFontPath(fontdirs[i]);
-        }
-    }
-
-    private synchronized static native void setNativeFontPath(String fontPath);
-
-
     // Implements SunGraphicsEnvironment.createFontConfiguration.
     protected FontConfiguration createFontConfiguration() {
         /* The logic here decides whether to use a preconfigured
@@ -780,7 +761,12 @@
                                       preferLocaleFonts, preferPropFonts);
     }
 
-    public synchronized native String getFontPath(boolean noType1Fonts);
+    public synchronized native String getFontPathNative(boolean noType1Fonts);
+
+    protected synchronized String getFontPath(boolean noType1Fonts) {
+        isHeadless(); // make sure GE is inited, as its the X11 lock.
+        return getFontPathNative(noType1Fonts);
+    }
 
     public String[] getDefaultPlatformFont() {
         if (defaultPlatformFont != null) {
--- a/jdk/src/solaris/classes/sun/awt/fontconfigs/solaris.fontconfig.5.8.properties	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,602 +0,0 @@
-#
-# 
-# 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.
-#
-
-# Version
-
-version=1
-
-# Component Font Mappings
-
-allfonts.chinese-gb2312=-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0
-allfonts.chinese-gbk=-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0
-allfonts.chinese-cns11643-1=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1
-allfonts.chinese-cns11643-2=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2
-allfonts.chinese-cns11643-3=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3
-allfonts.chinese-big5=-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1
-allfonts.dingbats=-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
-allfonts.japanese-x0212=-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0
-allfonts.korean=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0
-allfonts.korean-johab=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3
-allfonts.lucida=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
-allfonts.symbol=-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
-
-serif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.plain.cyrillic-iso8859-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.plain.cyrillic-cp1251=-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.plain.cyrillic-koi8-r=-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r
-serif.plain.greek=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.plain.hebrew=-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-serif.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.plain.latin-1=-monotype-times new roman-regular-r---*-%d-*-*-p-*-iso8859-1
-serif.plain.latin-2=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.plain.latin-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-serif.plain.latin-7=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.plain.latin-9=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.plain.thai=-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bold.cyrillic-iso8859-5=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.bold.cyrillic-cp1251=-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.bold.cyrillic-koi8-r=-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r
-serif.bold.greek=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.bold.hebrew=-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8
-serif.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bold.latin-1=-monotype-times new roman-bold-r---*-%d-*-*-p-*-iso8859-1
-serif.bold.latin-2=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.bold.latin-5=-monotype-times-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9
-serif.bold.latin-7=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.bold.latin-9=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.bold.thai=-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.italic.cyrillic-iso8859-5=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.italic.cyrillic-cp1251=-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.italic.cyrillic-koi8-r=-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r
-serif.italic.greek=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.italic.hebrew=-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8
-serif.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.italic.latin-1=-monotype-times new roman-regular-i---*-%d-*-*-p-*-iso8859-1
-serif.italic.latin-2=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.italic.latin-5=-monotype-times-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9
-serif.italic.latin-7=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.italic.latin-9=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.italic.thai=-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bolditalic.cyrillic-iso8859-5=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.bolditalic.cyrillic-cp1251=-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.bolditalic.cyrillic-koi8-r=-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r
-serif.bolditalic.greek=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.bolditalic.hebrew=-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8
-serif.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bolditalic.latin-1=-monotype-times new roman-bold-i---*-%d-*-*-p-*-iso8859-1
-serif.bolditalic.latin-2=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.bolditalic.latin-5=-monotype-times-bold-i-normal-bold italic-*-%d-*-*-p-*-iso8859-9
-serif.bolditalic.latin-7=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.bolditalic.latin-9=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.bolditalic.thai=-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-sansserif.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-sansserif.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bold.latin-5=-monotype-arial-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9
-sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-sansserif.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.italic.latin-5=-monotype-arial-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9
-sansserif.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-sansserif.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal-bold italic-*-%d-*-*-p-*-iso8859-9
-sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.plain.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-monospaced.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-monospaced.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-monospaced.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.bold.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-monospaced.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-monospaced.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bold.latin-5=-monotype-courier-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9
-monospaced.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.italic.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-monospaced.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-monospaced.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.italic.latin-5=-monotype-courier-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9
-monospaced.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.bolditalic.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-monospaced.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-monospaced.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bolditalic.latin-5=-monotype-courier-bold-i-normal-bold italic-*-%d-*-*-p-*-iso8859-9
-monospaced.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-dialog.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-dialog.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-dialog.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bold.latin-5=-monotype-arial-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9
-dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-dialog.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.italic.latin-5=-monotype-arial-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9
-dialog.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-dialog.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal-bold italic-*-%d-*-*-p-*-iso8859-9
-dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-dialoginput.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-dialoginput.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-dialoginput.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bold.latin-5=-monotype-courier-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9
-dialoginput.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-dialoginput.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.italic.latin-5=-monotype-courier-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9
-dialoginput.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-dialoginput.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bolditalic.latin-5=-monotype-courier-bold-i-normal-bold italic-*-%d-*-*-p-*-iso8859-9
-dialoginput.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-# Search Sequences
-
-sequence.allfonts=latin-1,dingbats,symbol
-
-sequence.allfonts.Big5=latin-1,chinese-big5,dingbats,symbol
-
-sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1,dingbats,symbol
-
-sequence.allfonts.GB2312=latin-1,chinese-gb2312,dingbats,symbol
-
-sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
-
-sequence.allfonts.EUC-KR=latin-1,korean,dingbats,symbol
-
-sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3,dingbats,symbol
-
-sequence.allfonts.GBK=latin-1,chinese-gbk,dingbats,symbol
-
-sequence.allfonts.ISO-8859-2=latin-2,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-6=arabic,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-7=latin-1,greek,dingbats,symbol
-
-sequence.allfonts.ISO-8859-8=latin-1,hebrew,dingbats,symbol
-
-sequence.allfonts.ISO-8859-9=latin-5,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-13=latin-7,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-15=latin-9,dingbats,symbol
-
-sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1,dingbats,symbol
-
-sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
-
-sequence.allfonts.TIS-620=latin-1,thai,dingbats,symbol
-
-sequence.allfonts.UTF-8=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
-
-sequence.allfonts.UTF-8.ko=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        korean-johab,japanese-x0201,japanese-x0208,japanese-x0212,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
-
-sequence.allfonts.UTF-8.zh.CN=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-gb2312,chinese-big5,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,dingbats,symbol
-
-sequence.allfonts.UTF-8.zh.TW=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-big5,chinese-gb2312,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,dingbats,symbol
-
-# the fallback sequence omits the following character subsets:
-# - latin-1, latin-2, latin-5, latin-7, latin-9: characters covered by lucida
-# - cyrillic-cp1251, cyrillic-iso8859-5, cyrillic-koi8-r: characters covered by lucida
-# - arabic, greek, hebrew, thai: characters covered by lucida
-# - chinese-cns11643-1, chinese-cns11643-2, chinese-cns11643-3: same file as chinese-big5
-# - japanese-x0208: same files as japanese-x0201
-# - korean: same file as korean-johab
-# - dingbats, symbol: included in all core sequences
-sequence.fallback=lucida,\
-        chinese-big5,chinese-gb2312,chinese-gbk,\
-        japanese-x0201,japanese-x0212,korean-johab
-
-# Exclusion Ranges
-
-exclusion.chinese-cns11643-2=0390-03d6,2200-22ef,2701-27be
-exclusion.chinese-cns11643-3=0390-03d6,2200-22ef,2701-27be
-
-# Font File Names
-
-filename.-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=--symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific
-filename.-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARBD.ttf
-filename.-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARMT.ttf
-filename.-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsa.ttf
-filename.-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsab.ttf
-filename.-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsai.ttf
-filename.-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsaz.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-BoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialbih.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Bold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialb_h.ttf
-filename.-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/ariali_h.ttf
-filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arial__h.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Italic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browa.ttf
-filename.-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browab.ttf
-filename.-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browai.ttf
-filename.-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browaz.ttf
-filename.-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordia.ttf
-filename.-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiab.ttf
-filename.-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiai.ttf
-filename.-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiaz.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier_new-bold-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-BoldItalic.ttf
-filename.-monotype-courier_new-bold-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Bold.ttf
-filename.-monotype-courier_new-regular-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Italic.ttf
-filename.-monotype-courier_new-regular-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew.ttf
-filename.-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courbi_h.ttf
-filename.-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courb__h.ttf
-filename.-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/couri__h.ttf
-filename.-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/cour___h.ttf
-filename.-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHBD.ttf
-filename.-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHMT.ttf
-filename.-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYBD.ttf
-filename.-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYMT.ttf
-filename.-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0=/usr/openwin/lib/locale/zh/X11/fonts/TrueType/msgbl.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times_new_roman-bold-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-BoldItalic.ttf
-filename.-monotype-times_new_roman-bold-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Bold.ttf
-filename.-monotype-times_new_roman-regular-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Italic.ttf
-filename.-monotype-times_new_roman-regular-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman.ttf
-filename.-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesbih.ttf
-filename.-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesb_h.ttf
-filename.-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesi_h.ttf
-filename.-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/times__h.ttf
-filename.-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/HeiseiMin-W3H.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/HG-GothicB.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/HG-GothicB.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/HG-MinchoL.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/HG-MinchoL.ttf
-filename.-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0=/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType/songti.ttf
-filename.-urw-itc_zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=-urw-itc zapfdingbats-medium-r-normal--0-0-0-0-p-0-sun-fontspecific
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal-bold_italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal-bold_italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal-bold_italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-
-# AWT X11 font paths
-awtfontpath.latin-1=/usr/openwin/lib/X11/fonts/TrueType
-awtfontpath.latin-2=/usr/openwin/lib/locale/iso_8859_2/X11/fonts/TrueType
-awtfontpath.latin-5=/usr/openwin/lib/locale/iso_8859_9/X11/fonts/Type1
-awtfontpath.latin-7=/usr/openwin/lib/locale/iso_8859_13/X11/fonts/TrueType
-awtfontpath.latin-9=/usr/openwin/lib/locale/iso_8859_15/X11/fonts/TrueType
-awtfontpath.hebrew=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType
-awtfontpath.arabic=/usr/openwin/lib/locale/ar/X11/fonts/TrueType
-awtfontpath.thai=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType
-awtfontpath.greek=/usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType
-awtfontpath.cyrillic-iso8859-5=/usr/openwin/lib/locale/iso_8859_5/X11/fonts/TrueType
-awtfontpath.cyrillic-cp1251=/usr/openwin/lib/locale/ru.ansi-1251/X11/fonts/TrueType
-awtfontpath.cyrillic-koi8-r=/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueType
-awtfontpath.korean=/usr/openwin/lib/locale/ko/X11/fonts/TrueType
-awtfontpath.korean-johab=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType
-awtfontpath.japanese-x0201=/usr/openwin/lib/locale/ja/X11/fonts/TT:/usr/openwin/lib/locale/ja/X11/fonts/TTbitmaps
-awtfontpath.japanese-x0208=/usr/openwin/lib/locale/ja/X11/fonts/TT:/usr/openwin/lib/locale/ja/X11/fonts/TTbitmaps
-awtfontpath.japanese-x0212=/usr/openwin/lib/locale/ja/X11/fonts/TT:/usr/openwin/lib/locale/ja/X11/fonts/TTbitmaps
-awtfontpath.chinese-gbk=/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-1=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-2=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-3=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-big5=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT
-awtfontpath.chinese-gb2312=/usr/openwin/lib/locale/zh/X11/fonts/TrueType
-
-# Appended Font Path
-
--- a/jdk/src/solaris/classes/sun/awt/fontconfigs/solaris.fontconfig.5.9.properties	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,631 +0,0 @@
-#
-# 
-# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-# Version
-
-version=1
-
-# Component Font Mappings
-
-allfonts.chinese-gb2312=-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0
-allfonts.chinese-gbk=-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0
-allfonts.chinese-gb18030-0=-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-0
-allfonts.chinese-gb18030-1=-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-1
-allfonts.chinese-cns11643-1=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1
-allfonts.chinese-cns11643-2=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2
-allfonts.chinese-cns11643-3=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3
-allfonts.chinese-big5=-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1
-allfonts.chinese-hkscs=-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-hkscs-1
-allfonts.dingbats=-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
-allfonts.japanese-x0212=-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0
-allfonts.korean=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0
-allfonts.korean-johab=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3
-allfonts.lucida=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
-allfonts.symbol=-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
-
-serif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.plain.cyrillic-iso8859-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.plain.cyrillic-cp1251=-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.plain.cyrillic-koi8-r=-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r
-serif.plain.greek=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.plain.hebrew=-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-serif.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.plain.latin-1=-monotype-times new roman-regular-r---*-%d-*-*-p-*-iso8859-1
-serif.plain.latin-2=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.plain.latin-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-serif.plain.latin-7=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.plain.latin-9=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.plain.thai=-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bold.cyrillic-iso8859-5=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.bold.cyrillic-cp1251=-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.bold.cyrillic-koi8-r=-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r
-serif.bold.greek=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.bold.hebrew=-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8
-serif.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bold.latin-1=-monotype-times new roman-bold-r---*-%d-*-*-p-*-iso8859-1
-serif.bold.latin-2=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.bold.latin-5=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-serif.bold.latin-7=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.bold.latin-9=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.bold.thai=-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.italic.cyrillic-iso8859-5=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.italic.cyrillic-cp1251=-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.italic.cyrillic-koi8-r=-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r
-serif.italic.greek=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.italic.hebrew=-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8
-serif.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.italic.latin-1=-monotype-times new roman-regular-i---*-%d-*-*-p-*-iso8859-1
-serif.italic.latin-2=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.italic.latin-5=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-serif.italic.latin-7=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.italic.latin-9=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.italic.thai=-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-serif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bolditalic.cyrillic-iso8859-5=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.bolditalic.cyrillic-cp1251=-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.bolditalic.cyrillic-koi8-r=-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r
-serif.bolditalic.greek=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.bolditalic.hebrew=-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8
-serif.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bolditalic.latin-1=-monotype-times new roman-bold-i---*-%d-*-*-p-*-iso8859-1
-serif.bolditalic.latin-2=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.bolditalic.latin-5=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-serif.bolditalic.latin-7=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.bolditalic.latin-9=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.bolditalic.thai=-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-sansserif.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-sansserif.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-sansserif.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.italic.latin-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-sansserif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-sansserif.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.plain.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-monospaced.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-monospaced.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.bold.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-monospaced.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-monospaced.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bold.latin-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.italic.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-monospaced.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-monospaced.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.italic.latin-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-monospaced.bolditalic.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-monospaced.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-monospaced.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bolditalic.latin-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-dialog.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-dialog.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-dialog.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-dialog.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.italic.latin-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-dialog.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialog.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-dialog.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-dialoginput.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-dialoginput.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bold.latin-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-dialoginput.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.italic.latin-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-dialoginput.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-dialoginput.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bolditalic.latin-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
-
-# Search Sequences
-
-sequence.allfonts=latin-1,dingbats,symbol
-
-sequence.allfonts.Big5=latin-1,chinese-big5,dingbats,symbol
-
-sequence.allfonts.Big5-HKSCS=latin-1,chinese-big5,chinese-hkscs,dingbats,symbol
-
-sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1,dingbats,symbol
-
-sequence.allfonts.GB2312=latin-1,chinese-gb2312,dingbats,symbol
-
-sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
-
-sequence.allfonts.EUC-KR=latin-1,korean,dingbats,symbol
-
-sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3,dingbats,symbol
-
-sequence.allfonts.GBK=latin-1,chinese-gbk,dingbats,symbol
-
-sequence.allfonts.GB18030=latin-1,chinese-gb18030-0,chinese-gb18030-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-2=latin-2,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-6=arabic,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-7=latin-1,greek,dingbats,symbol
-
-sequence.allfonts.ISO-8859-8=latin-1,hebrew,dingbats,symbol
-
-sequence.allfonts.ISO-8859-9=latin-5,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-13=latin-7,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-15=latin-9,dingbats,symbol
-
-sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1,dingbats,symbol
-
-sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
-
-sequence.allfonts.TIS-620=latin-1,thai,dingbats,symbol
-
-sequence.allfonts.UTF-8=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
-
-sequence.allfonts.UTF-8.hi=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,\
-        chinese-gb2312,chinese-big5,thai,dingbats,symbol
-
-sequence.allfonts.UTF-8.ko=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        korean-johab,japanese-x0201,japanese-x0208,japanese-x0212,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
-
-sequence.allfonts.UTF-8.th=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        thai,chinese-gb2312,chinese-big5,japanese-x0201,japanese-x0208,japanese-x0212,\
-        korean-johab,dingbats,symbol
-
-sequence.allfonts.UTF-8.zh.CN=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-gb18030-0,chinese-gb18030-1,chinese-big5,chinese-hkscs,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
-
-sequence.allfonts.UTF-8.zh.HK=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
-
-sequence.allfonts.UTF-8.zh.TW=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
-
-# the fallback sequence omits the following character subsets:
-# - latin-1, latin-2, latin-5, latin-7, latin-9: characters covered by lucida
-# - cyrillic-cp1251, cyrillic-iso8859-5, cyrillic-koi8-r: characters covered by lucida
-# - arabic, devanagari, greek, hebrew, thai: characters covered by lucida
-# - chinese-cns11643-1, chinese-cns11643-2, chinese-cns11643-3, chinese-hkscs: same file as chinese-big5
-# - chinese-gbk, chinese-gb18030-1: same file as chinese-gb18030-0
-# - japanese-x0208: same files as japanese-x0201
-# - japanese-x0212: same files as japanese-x0201
-# - korean: same file as korean-johab
-# - dingbats, symbol: included in all core sequences
-sequence.fallback=lucida,\
-        chinese-big5,chinese-gb2312,chinese-gb18030-0,\
-        japanese-x0201,korean-johab
-
-# Exclusion Ranges
-
-exclusion.chinese-cns11643-2=0390-03d6,2200-22ef,2701-27be
-exclusion.chinese-cns11643-3=0390-03d6,2200-22ef,2701-27be
-
-# Font File Names
-
-filename.-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=/usr/openwin/lib/X11/fonts/TrueType/Symbol.ttf
-filename.-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
-filename.-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-1=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-hkscs-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARBD.ttf
-filename.-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARMT.ttf
-filename.-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsa.ttf
-filename.-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsab.ttf
-filename.-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsai.ttf
-filename.-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsaz.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-BoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialbih.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Bold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialb_h.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/ariali_h.ttf
-filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arial__h.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Italic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browa.ttf
-filename.-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browab.ttf
-filename.-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browai.ttf
-filename.-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browaz.ttf
-filename.-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordia.ttf
-filename.-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiab.ttf
-filename.-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiai.ttf
-filename.-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiaz.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier_new-bold-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-BoldItalic.ttf
-filename.-monotype-courier_new-bold-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Bold.ttf
-filename.-monotype-courier_new-regular-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Italic.ttf
-filename.-monotype-courier_new-regular-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew.ttf
-filename.-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courbi_h.ttf
-filename.-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courb__h.ttf
-filename.-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/couri__h.ttf
-filename.-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/cour___h.ttf
-filename.-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHBD.ttf
-filename.-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHMT.ttf
-filename.-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYBD.ttf
-filename.-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYMT.ttf
-filename.-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0=/usr/openwin/lib/locale/zh/X11/fonts/TrueType/msgbl.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times_new_roman-bold-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-BoldItalic.ttf
-filename.-monotype-times_new_roman-bold-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Bold.ttf
-filename.-monotype-times_new_roman-regular-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Italic.ttf
-filename.-monotype-times_new_roman-regular-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman.ttf
-filename.-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesbih.ttf
-filename.-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesb_h.ttf
-filename.-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesi_h.ttf
-filename.-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/times__h.ttf
-filename.-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hggbsun.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hggbsun.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-urw-itc_zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=-urw-itc zapfdingbats-medium-r-normal--0-0-0-0-p-0-sun-fontspecific
-
-# AWT X11 font paths
-awtfontpath.latin-1=/usr/openwin/lib/X11/fonts/TrueType
-awtfontpath.latin-2=/usr/openwin/lib/locale/iso_8859_2/X11/fonts/TrueType
-awtfontpath.latin-5=/usr/openwin/lib/locale/iso_8859_9/X11/fonts/TrueType
-awtfontpath.latin-7=/usr/openwin/lib/locale/iso_8859_13/X11/fonts/TrueType
-awtfontpath.latin-9=/usr/openwin/lib/locale/iso_8859_15/X11/fonts/TrueType
-awtfontpath.hebrew=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType
-awtfontpath.arabic=/usr/openwin/lib/locale/ar/X11/fonts/TrueType
-awtfontpath.thai=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType
-awtfontpath.greek=/usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType
-awtfontpath.cyrillic-iso8859-5=/usr/openwin/lib/locale/iso_8859_5/X11/fonts/TrueType
-awtfontpath.cyrillic-cp1251=/usr/openwin/lib/locale/ru.ansi-1251/X11/fonts/TrueType
-awtfontpath.cyrillic-koi8-r=/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueType
-awtfontpath.korean=/usr/openwin/lib/locale/ko/X11/fonts/TrueType
-awtfontpath.korean-johab=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType
-awtfontpath.japanese-x0201=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.japanese-x0208=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.japanese-x0212=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.chinese-gbk=/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-1=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-2=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-3=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-big5=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT
-awtfontpath.chinese-gb2312=/usr/openwin/lib/locale/zh/X11/fonts/TrueType
-awtfontpath.chinese-gb18030-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType
-awtfontpath.chinese-gb18030-1=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType
-awtfontpath.chinese-hkscs=/usr/openwin/lib/locale/zh_HK.BIG5HK/X11/fonts/TT
-
-# Appended Font Path
-
-
-
--- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Fri Feb 04 16:29:41 2011 -0800
@@ -166,10 +166,7 @@
         } else if (osName.equals("Linux")) {
             try {
                 File f;
-                if ((f = new File("/etc/sun-release")).canRead()) {
-                    osName = "Sun";
-                    osVersion = getVersionString(f);
-                } else if ((f = new File("/etc/fedora-release")).canRead()) {
+                if ((f = new File("/etc/fedora-release")).canRead()) {
                     osName = "Fedora";
                     osVersion = getVersionString(f);
                 } else if ((f = new File("/etc/redhat-release")).canRead()) {
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java	Fri Feb 04 16:29:41 2011 -0800
@@ -120,13 +120,6 @@
                              getDefaultConfiguration());
         }
 
-        /* Add font properties font directories to the X11 font path.
-         * Its called here *after* the X connection has been initialised
-         * and when we know that MToolkit is the one that will be used,
-         * since XToolkit doesn't need the X11 font path set
-         */
-        X11FontManager.getInstance().setNativeFontPath();
-
         motifdnd = ((Boolean)java.security.AccessController.doPrivileged(
             new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue();
     }
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Fri Feb 04 16:29:41 2011 -0800
@@ -320,9 +320,6 @@
             } else if ((f = new File("/etc/fedora-release")).canRead()) {
                 osName = "Fedora";
                 osVersion = getVersionString(f);
-            } else if ((f = new File("/etc/sun-release")).canRead()) {
-                osName = "Sun";
-                osVersion = getVersionString(f);
             }
         } catch (Exception e) {
             if (FontUtilities.debugFonts()) {
--- a/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Fri Feb 04 16:29:41 2011 -0800
@@ -214,8 +214,9 @@
             if (FontUtilities.isLogging()) {
                 PlatformLogger logger = FontUtilities.getLogger();
                 logger.info("Fontconfig returned no fonts at all.");
-                return;
             }
+            fontConfigFailed = true;
+            return;
         } else if (fontConfigFailed) {
             for (int i = 0; i< fontArr.length; i++) {
                 if (fontArr[i].firstFont == null) {
--- a/jdk/src/solaris/hpi/export/byteorder_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Solaris-dependent byte order include
- */
-
-#ifndef _JAVASOFT_SOLARIS_BYTE_MD_H_
-#define _JAVASOFT_SOLARIS_BYTE_MD_H_
-
-#include <netinet/in.h>
-
-#endif /* !_JAVASOFT_SOLARIS_BYTE_MD_H_ */
--- a/jdk/src/solaris/hpi/export/hpi_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_HPI_MD_H_
-#define _JAVASOFT_HPI_MD_H_
-
-#include "timeval_md.h"
-#include "io_md.h"
-#include "path_md.h"
-#include "byteorder_md.h"
-
-#define HPI_TIMEOUT_INFINITY ((jlong)(-1))
-
-#endif /* !_JAVASOFT_HPI_MD_H_ */
--- a/jdk/src/solaris/hpi/export/io_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Solaris-dependent I/O
- */
-
-#ifndef _JAVASOFT_SOLARIS_IO_MD_H_
-#define _JAVASOFT_SOLARIS_IO_MD_H_
-
-#include <sys/param.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#define LINE_SEPARATOR "\n"
-
-/* file system macros moved to sysmacros_md.h */
-
-#endif /* !_JAVASOFT_SOLARIS_IO_MD_H_ */
--- a/jdk/src/solaris/hpi/export/path_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Solaris-dependent search path definitions and API
- */
-
-#ifndef _JAVASOFT_SOLARIS_PATH_MD_H_
-#define _JAVASOFT_SOLARIS_PATH_MD_H_
-
-#define PATH_SEPARATOR          ":"
-#define PATH_CURDIR             "."
-
-#define DIR_SEPARATOR           '/'
-#define LOCAL_DIR_SEPARATOR     '/'
-
-#endif /* !_JAVASOFT_SOLARIS_PATH_MD_H_ */
--- a/jdk/src/solaris/hpi/export/timeval_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-#ifndef _JAVASOFT_SOLARIS_TIMEVAL_H_
-#define _JAVASOFT_SOLARIS_TIMEVAL_H_
-
-typedef struct {
-        long tv_sec;            /* seconds */
-        long tv_usec;           /* microseconds (NOT milliseconds) */
-} timeval_t;
-
-#endif /* !_JAVASOFT_SOLARIS_TIMEVAL_H_ */
--- a/jdk/src/solaris/hpi/include/hpi_init.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_SOLARIS_HPI_INIT_H_
-#define _JAVASOFT_SOLARIS_HPI_INIT_H_
-
-#ifndef NATIVE
-extern void InitializeSbrk(void);
-extern void InitializeAsyncIO(void);
-extern void InitializeHelperThreads(void);
-#endif /* NATIVE */
-
-extern void InitializeMem(void);
-
-#endif /* _JAVASOFT_SOLARIS_HPI_INIT_H_ */
--- a/jdk/src/solaris/hpi/include/interrupt.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 1994, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Interrupt dispatch interface
- */
-
-#ifndef _JAVASOFT_INTERRUPT_H_
-#define _JAVASOFT_INTERRUPT_H_
-
-/*
- * Type definitions.
- */
-
-/*-
- * A function that handles interrupt dispatch requests is of type
- * intr_handler_t.  This type definition is mostly for convenience.
- * A declaration of a handler function, should look like this:
- *
- *   void myHandler(int interrupt, void *siginfo, void *context, void *arg);
- *
- * An intr_handler_t is constrained:
- *
- *      - It runs on the exception stack.
- *      - It cannot yield.
- *      - It cannot allocate/free memory.
- *      - It can only call interrupt-safe routines.
- *
- * "arg" is set to the "handlerArg" specified in intrRegister().
- */
-typedef void (*intr_handler_t)(int interrupt, void *siginfo,
-                              void *context, void *arg);
-
-/*
- * Routines.
- */
-
-/* Initialize the interrupt system */
-void intrInit(void);
-
-/* Set a handler for a particular interrupt */
-signal_handler_t intrRegister(int interrupt, intr_handler_t handler,
-                              void *handlerArg);
-
-/* Dispatch an interrupt (called from the low-level handlers) */
-void intrDispatch(int interrupt, void *siginfo, void *context);
-
-/*-
- * The target specific header file should define the following
- *
- * Constants
- *
- *      N_INTERRUPTS  - The number of interrupt channels.  These
- *                      are numbered from 0 to (N_INTERRUPTS - 1).
- */
-#ifdef __linux__
-#define       N_INTERRUPTS    NSIG    /* 0 to NSIG - 1*/
-#else
-#define N_INTERRUPTS    32      /* 0 to 31 */
-#endif
-
-/*-
- * Routines/Macros that control whether interrupts are enabled or
- * not.
- *
- *      void intrLock(void)           - Disable all interrupts.
- *      void intrUnlock(void)         - Enable all interrupts.
- *
- *              Note: intrLock()/intrUnlock() pairs can be nested.
- *
- */
-
-void intrLock(void);
-void intrUnlock(void);
-
-/*-
- * intrInitMD() --
- *      Initialize the machine-dependant interrupt software.
- *
- *      This routine should leave the all interrupts disabled as if
- *      one (1) intrLock() had been called.  At the end of the
- *      bootstrap, a single intrUnlock(), will be called to turn
- *      interrupts on.
- */
-
-void intrInitMD(void);
-
-#if defined(__solaris__) && !defined(SA_SIGINFO)
-#error signal.h has not been included?
-#endif
-
-#ifdef SA_SIGINFO
-/* Thread implementation dependent interrupt dispatcher. */
-void intrDispatchMD(int sig, siginfo_t *info, void *uc);
-#else
-void intrDispatchMD(int sig);
-#endif
-
-/* Whether the signal is used by the HPI implementation */
-bool_t intrInUse(int sig);
-
-#endif /* !_JAVASOFT_INTERRUPT_H_ */
--- a/jdk/src/solaris/hpi/include/largefile.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifndef _JAVASOFT_LARGEFILE_SUPPORT_H_
-#define _JAVASOFT_LARGEFILE_SUPPORT_H_
-
-#ifdef __solaris__
-#include "largefile_solaris.h"
-#endif
-
-#ifdef __linux__
-#include "largefile_linux.h"
-#endif
-
-/*
- * Prototypes for wrappers that we define.  These wrapper functions
- * are low-level I/O routines that will use 64 bit versions if
- * available, else revert to the 32 bit ones.
- */
-extern off64_t lseek64_w(int fd, off64_t offset, int whence);
-extern int fstat64_w(int fd, struct stat *buf);
-extern int ftruncate64_w(int fd, off64_t length);
-extern int open64_w(const char *path, int oflag, int mode);
-
-/* This is defined in system_md.c */
-extern int sysFfileMode(int fd, int* mode);
-
-#endif /* _JAVASOFT_LARGEFILE_SUPPORT_H_ */
--- a/jdk/src/solaris/hpi/include/largefile_linux.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifndef _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_
-#define _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_
-
-/*
- * For building on glibc-2.0 we need to define stat64 here.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#endif /* _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_ */
--- a/jdk/src/solaris/hpi/include/largefile_solaris.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifndef _JAVASOFT_SOLARIS_LARGEFILE_SUPPORT_H_
-#define _JAVASOFT_SOLARIS_LARGEFILE_SUPPORT_H_
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/**
- * This file contains the definitions for providing 64 bit File I/O support.
- */
-
-#if !defined(_LFS_LARGEFILE) || !_LFS_LARGEFILE
-
-#ifdef __GLIBC__
-typedef jlong longlong_t;
-#endif
-
-/*
- * This definition is from Solaris 2.6; it is required by systems that do not
- * support large files (e.g., Solaris 2.5.1).
- */
-
-typedef longlong_t      off64_t;        /* offsets within files */
-
-
-#ifdef __GLIBC__
-/* Doesn't matter what these are, there is no 64 bit support. */
-typedef int u_longlong_t;
-typedef int timestruc_t;
-#define _ST_FSTYPSZ 1
-#endif /* __GLIBC__ */
-
-/*
- * The stat64 structure must be provided on systems without large file
- * support (e.g., Solaris 2.5.1).  These definitions are from Solaris 2.6
- * sys/stat.h and sys/types.h.
- */
-
-typedef u_longlong_t    ino64_t;        /* expanded inode type  */
-typedef longlong_t      blkcnt64_t;     /* count of file blocks */
-
-struct  stat64 {
-        dev_t   st_dev;
-        long    st_pad1[3];
-        ino64_t st_ino;
-        mode_t  st_mode;
-        nlink_t st_nlink;
-        uid_t   st_uid;
-        gid_t   st_gid;
-        dev_t   st_rdev;
-        long    st_pad2[2];
-        off64_t st_size;
-        timestruc_t st_atim;
-        timestruc_t st_mtim;
-        timestruc_t st_ctim;
-        long    st_blksize;
-        blkcnt64_t st_blocks;
-        char    st_fstype[_ST_FSTYPSZ];
-        long    st_pad4[8];
-};
-
-#define O_LARGEFILE     0x2000  /* Solaris 2.6 sys/fcntl.h */
-#endif  /* !_LFS_LARGEFILE */
-
-#endif /* !_JAVASOFT_SOLARIS_LARGEFILE_SUPPORT_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/condvar_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Interface to condition variable HPI implementation for Solaris
- */
-
-#ifndef _JAVASOFT_CONDVAR_MD_H_
-#define _JAVASOFT_CONDVAR_MD_H_
-
-#include "threads_md.h"
-
-typedef struct condvar {
-    cond_t  cond;           /* Manual-reset event for notifications */
-    unsigned int counter;   /* Current number of notifications */
-} condvar_t;
-
-int condvarInit(condvar_t *);
-int condvarDestroy(condvar_t *);
-int condvarWait(condvar_t *, mutex_t *, thread_state_t wtype);
-int condvarTimedWait(condvar_t *, mutex_t *, jlong millis, thread_state_t wtype);
-int condvarSignal(condvar_t *);
-int condvarBroadcast(condvar_t *);
-
-#endif /* !_JAVASOFT_CONDVAR_MD_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/monitor_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Monitor interface    10/25/94
- *
- * Private data structures and interfaces used in the monitor code.
- * This file is used to share declarations and such between the different
- * files implementing monitors.  It does not contain exported API.
- */
-
-#ifndef _JAVASOFT_SOLARIS_MONITOR_MD_H_
-#define _JAVASOFT_SOLARIS_MONITOR_MD_H_
-
-#include <mutex_md.h>
-#include <condvar_md.h>
-#include <threads_md.h>
-
-/*
- * Type definitions.
- */
-
-typedef struct monitor_waiter monitor_waiter_t;
-typedef struct monitor_wait_queue monitor_wait_queue_t;
-
-/* Element of the MonitorWaitQ - representing thread doing a monitor wait */
-/*
- * The only reason we do the queueing is for sysMonitorDumpInfo.
- * The counting, though, is used to avoid extraneous calls to
- * condvarBroadcast and condvarSignal, for instance.
- */
-struct monitor_waiter {
-    monitor_waiter_t   *next;
-    monitor_waiter_t  **prev;
-    sys_thread_t       *waiting_thread;
-};
-
-struct monitor_wait_queue {
-    monitor_waiter_t   *head;           /* linked list of waiting threads */
-    short               count;          /* number of waiters on the list */
-};
-
-#define ANY_WAITING(mwq) ((mwq).count > 0)
-#define INIT_MONITOR_WAIT_QUEUE(mwq) { (mwq).head = NULL; (mwq).count = 0; }
-
-/* The system-level monitor data structure */
-struct sys_mon {
-    mutex_t             mutex;          /* The monitor's mutex */
-    condvar_t           cv_monitor;     /* Notify those doing monitorWait on
-                                           the monitor */
-    /*
-     * Threads waiting on either of the above condvars put themselves
-     * on one of these lists.
-     */
-    monitor_wait_queue_t mwait_queue;   /* Head of MonitorWaitQ */
-
-    /* Thread currently executing in this monitor */
-    sys_thread_t        *monitor_owner;
-    long                entry_count;    /* Recursion depth */
-    int                 contention_count;
-};
-
-void initializeContentionCountMutex();
-
-typedef enum {
-        ASYNC_REGISTER,
-        ASYNC_UNREGISTER
-} async_action_t;
-
-/*
- * Macros
- */
-
-#define SYS_MID_NULL ((sys_mon_t *) 0)
-
-typedef enum {
-        SYS_ASYNC_MON_ALARM = 1,
-        SYS_ASYNC_MON_IO,
-        SYS_ASYNC_MON_EVENT,
-        SYS_ASYNC_MON_CHILD,
-        SYS_ASYNC_MON_MAX
-} async_mon_key_t;
-
-#define SYS_ASYNC_MON_INPUT SYS_ASYNC_MON_IO
-#define SYS_ASYNC_MON_OUTPUT SYS_ASYNC_MON_IO
-
-sys_mon_t *asyncMon(async_mon_key_t);
-
-#endif /* !_JAVASOFT_SOLARIS_MONITOR_MD_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/mutex_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Interface to mutex HPI implementation for Solaris
- */
-
-#ifndef _JAVASOFT_MUTEX_MD_H_
-#define _JAVASOFT_MUTEX_MD_H_
-
-#include "porting.h"
-
-/*
- * Generally, we would typedef mutex_t to be whatever the system
- * supplies.  But Solaris gives us mutex_t directly.
- */
-
-#ifdef USE_PTHREADS
-#define mutexInit(m) pthread_mutex_init(m, 0)
-#else
-#define mutexInit(m) mutex_init(m, USYNC_THREAD, 0)
-#endif
-#define mutexDestroy(m) mutex_destroy(m)
-#define mutexLock(m) mutex_lock(m)
-#define mutexUnlock(m) mutex_unlock(m)
-bool_t mutexLocked(mutex_t *);
-
-#endif /* !_JAVASOFT_MUTEX_MD_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/np.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *  Non-posix parts of the threads HPI.
- */
-
-#ifndef _JAVASOFT_NP_H_
-#define _JAVASOFT_NP_H_
-
-extern int      np_suspend(sys_thread_t *tid);
-extern int      np_continue(sys_thread_t *tid);
-
-extern int      np_single(void);
-extern void     np_multi(void);
-extern int      np_stackinfo(void **addr, long *size);
-extern int      np_initialize(void);
-extern void     np_initialize_thread(sys_thread_t *tid);
-#ifdef __linux__
-extern int      np_initial_suspend(sys_thread_t *tid);
-extern void   np_free_thread(sys_thread_t *tid);
-#endif
-
-extern void     np_profiler_init(sys_thread_t *tid);
-extern int      np_profiler_suspend(sys_thread_t *tid);
-extern int      np_profiler_continue(sys_thread_t *tid);
-extern bool_t   np_profiler_thread_is_running(sys_thread_t *tid);
-
-#endif /* !_JAVASOFT_NP_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/porting.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifndef _JAVASOFT_PORTING_H_
-#define _JAVASOFT_PORTING_H_
-
-#ifndef USE_PTHREADS
-
-#include <thread.h>
-#include <sys/lwp.h>
-#include <synch.h>
-
-#else  /* USE_PTHREADS */
-
-#include <pthread.h>
-
-/* There is a handshake between a newly created thread and its creator
- * at thread startup because the creator thread needs to suspend the
- * new thread.  Currently there are two ways to do this -- with
- * semaphores and with mutexes.  The semaphore based implementation is
- * cleaner and hence is the default.  We wish the mutex based one will
- * go away, but turns out the implementation of semaphores on
- * Linux/ppc etc is flaky, so the mutex based solution lives for now.
- */
-#ifndef USE_MUTEX_HANDSHAKE
-#include <semaphore.h>
-#endif
-
-#undef BOUND_THREADS
-
-#define thread_t                pthread_t
-
-#define mutex_t                 pthread_mutex_t
-#define mutex_lock              pthread_mutex_lock
-#define mutex_trylock           pthread_mutex_trylock
-#define mutex_unlock            pthread_mutex_unlock
-#define mutex_destroy           pthread_mutex_destroy
-
-#define cond_t                  pthread_cond_t
-#define cond_destroy            pthread_cond_destroy
-#define cond_wait               pthread_cond_wait
-#define cond_timedwait          pthread_cond_timedwait
-#define cond_signal             pthread_cond_signal
-#define cond_broadcast          pthread_cond_broadcast
-
-#define thread_key_t            pthread_key_t
-#define thr_setspecific         pthread_setspecific
-#define thr_keycreate           pthread_key_create
-
-#define thr_sigsetmask          pthread_sigmask
-#define thr_self                pthread_self
-#define thr_yield               sched_yield
-#define thr_kill                pthread_kill
-#define thr_exit                pthread_exit
-#ifdef __linux__
-void intrHandler(void*);
-#endif
-#endif /* USE_PTHREADS  */
-
-#endif /* !_JAVASOFT_PORTING_H_ */
--- a/jdk/src/solaris/hpi/native_threads/include/threads_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Implementation of the Java threads HPI on top of Solaris threads
- */
-
-#ifndef _JAVASOFT_SOLARIS_THREADS_MD_H_
-#define _JAVASOFT_SOLARIS_THREADS_MD_H_
-
-#include "porting.h"
-
-#ifdef sparc
-#define N_TRACED_REGS 12
-#elif i386
-#define N_TRACED_REGS 7
-#elif amd64
-#define N_TRACED_REGS 15
-#elif ppc
-#define N_TRACED_REGS 1
-#elif m68k
-#define N_TRACED_REGS 8
-#elif ia64
-/* [RGV] I don't think this is referenced in the linux code */
-#define N_TRACED_REGS 32
-#else
-// TODO: delete this file - threads_md.[ch] is obsolete. struct sys_thread is
-// never used. Define a value just to keep compiler happy.
-#define N_TRACED_REGS 32
-#endif
-
-/* Turn on if we want all java threads to be bound tolwps */
-/* #define BOUND_THREADS */
-/* Use /proc soln to stop lwps in place of siglwp soln */
-#define PROCLWP
-
-/*
- * Thread C stack overflow check
-#define sysThreadCheckStack(redzone, var)                               \
-    ((var = sysThreadSelf()) &&                                         \
-      (unsigned int)((char *)&(var) - (char *)(var)->stack_base)\
-                < (redzone))
-*/
-/*
- * Forward definition of machine dependent monitor struct
- */
-struct sys_mon;
-
-/*
- * The following thread states are really hints since there is no
- * interface to get at a native thread's true state. The states
- * are maintained by updating the states where ever possible
- * such as a transition to CONDVAR_WAIT occurs in the definition of
- * the routine condvarWait().
- * This state maintenance should disappear once we have a threads interface
- * to obtain a thread's state.
- */
-typedef enum {
-    FIRST_THREAD_STATE,
-    RUNNABLE = FIRST_THREAD_STATE,
-    SUSPENDED,
-    CONDVAR_WAIT,
-    NUM_THREAD_STATES
-} thread_state_t;
-
-#if defined( USE_PTHREADS) && !defined(__linux__)
-/*
- * Mechanism for starting a new thread suspended.
- */
-typedef enum {
-    NEW_THREAD_MUST_REQUEST_SUSPEND,
-    NEW_THREAD_REQUESTED_SUSPEND,
-    NEW_THREAD_SUSPENDED
-} new_thr_state_t;
-
-typedef struct {
-    pthread_mutex_t     m;
-    pthread_cond_t      c;
-    new_thr_state_t     state;
-} new_thr_cond_t;
-#endif /* USE_PTHREADS */
-
-/*
- * Machine dependent info in a sys_thread_t
- */
-struct sys_thread {
-    /*
-     * Fields below this point may change on a per-architecture basis
-     * depending on how much work is needed to present the sysThread
-     * model on any given thread implementation.
-     */
-    mutex_t mutex;              /* per thread lock to protect thread fields */
-    thread_t sys_thread;                /* The native thread id */
-    struct sys_thread *next;            /* Pointer to next thread in the */
-                                        /* queue of all threads. */
-    thread_state_t state;
-
-    /* Thread status flags */
-    unsigned int primordial_thread:1;
-    unsigned int system_thread:1;
-    unsigned int cpending_suspend:1;
-#ifdef __linux__
-    unsigned int pending_interrupt:1;
-#endif
-    unsigned int interrupted:1;
-    unsigned int onproc:1; /* set if thread is on an LWP */
-    unsigned int :0;
-
-#ifdef BOUND_THREADS
-    lwpid_t lwpid;
-#endif
-
-#ifdef __linux__
-    void *sp;
-#else
-    unsigned long  sp;   /* sp at time of last (native) thread switch */
-#endif
-    void * stack_bottom; /* The real bottom (high address) of stack */
-    void * stack_top;    /* should be equal to stack_bottom - stack_size */
-    long   stack_size;   /* The stack size for a native thread */
-
-    long regs[N_TRACED_REGS]; /* stores registers as GC roots. */
-
-    /* Monitor specific.
-
-       Every monitor keeps track of the number of times it is
-       entered.  When that count goes to 0, the monitor can be
-       freed up.  But each thread has its own entry count on a
-       particular monitor, because multiple threads can be using a
-       single monitor (as one does a wait, another enters, etc.).
-       Each thread can only be waiting in exactly one monitor.
-       That monitor waited on is saved in mon_wait, and the value
-       of the monitor's entry_count when the wait was performed is
-       saved in monitor_entry_count.  That is restored into the
-       monitor when this waiting thread is notified. */
-
-    long monitor_entry_count;           /* For recursive monitor entry */
-    struct sys_mon *mon_wait;           /* CONDVAR_WAIT'ing */
-
-    struct sys_mon *mon_enter;          /* blocked waiting to enter */
-
-    void (*start_proc)(void *);
-    void *start_parm;
-    int lwp_id;
-    long last_sum;
-
-    struct sys_thread *prevBlocked;     /* Used by nonblocking close semantics */
-    struct sys_thread *nextBlocked;
-#ifdef USE_PTHREADS
-    int suspend_count;
-#ifdef __linux__
-    sem_t sem_suspended;
-    sem_t sem_ready_to_suspend;
-    sem_t sem_selfsuspend;
-    int selfsuspended;
-#endif
-#ifdef USE_MUTEX_HANDSHAKE
-    new_thr_cond_t ntcond;
-#else
-    sem_t sem;
-#endif /* USE_MUTEX_HANDSHAKE */
-#endif /* USE_PTHREADS */
-};
-
-#define SYS_THREAD_NULL         ((sys_thread_t *) 0)
-
-/*
- * following macro copied from sys/signal.h since inside #ifdef _KERNEL there.
- */
-#ifndef sigmask
-#define sigmask(n)      ((unsigned int)1 << (((n) - 1) & (32 - 1)))
-#endif
-
-#ifdef __linux__
-extern thread_key_t intrJmpbufkey;
-#else
-extern thread_key_t sigusr1Jmpbufkey;
-extern sigset_t sigusr1Mask;
-#endif
-
-extern sys_mon_t *_sys_queue_lock;
-
-#define SYS_QUEUE_LOCK(self)    sysMonitorEnter(self, _sys_queue_lock)
-#define SYS_QUEUE_LOCKED(self)  sysMonitorEntered(self, _sys_queue_lock)
-#define SYS_QUEUE_UNLOCK(self)  sysMonitorExit(self, _sys_queue_lock)
-#define SYS_QUEUE_NOTIFYALL(self)  sysMonitorNotifyAll(self, _sys_queue_lock)
-#define SYS_QUEUE_WAIT(self) sysMonitorWait(self, _sys_queue_lock, \
-                                        SYS_TIMEOUT_INFINITY)
-
-extern void setFPMode(void);
-
-extern sys_thread_t *ThreadQueue;
-
-extern int ActiveThreadCount;           /* All threads */
-
-#endif /* !_JAVASOFT_SOLARIS_THREADS_MD_H_ */
--- a/jdk/src/solaris/hpi/native_threads/src/condvar_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 1994, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Condition variable HPI implementation for Solaris
- */
-
-#include <errno.h>
-#include <time.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <limits.h>
-
-#include "hpi_impl.h"
-
-#include "condvar_md.h"
-#include "mutex_md.h"
-#include "threads_md.h"
-
-int
-condvarInit(condvar_t *condvar)
-{
-    int err;
-
-#ifdef USE_PTHREADS
-    err = pthread_cond_init(&condvar->cond, NULL);
-#else
-    err = cond_init(&condvar->cond, USYNC_THREAD, 0 /* ignored */);
-#endif
-    condvar->counter = 0;
-    return (err == 0 ? SYS_OK : SYS_ERR);
-}
-
-int
-condvarDestroy(condvar_t *condvar)
-{
-    int err;
-
-#ifdef __linux__
-    err = pthread_cond_destroy((cond_t *) &condvar->cond);
-#else
-    err = cond_destroy((cond_t *) condvar);
-#endif
-    return (err == 0 ? SYS_OK : SYS_ERR);
-}
-
-int
-condvarWait(condvar_t *condvar, mutex_t *mutex, thread_state_t wtype)
-{
-    sigjmp_buf jmpbuf;
-    int err;
-
-    sys_thread_t *self = sysThreadSelf();
-    /*
-     * There is no threads interface to get a thread's state. So, instead,
-     * we use this hack so that the debugger agent can get at this thread's
-     * state. Of course, this is not very reliable, but when a thread goes
-     * to sleep, it *will* be reported as sleeping. During the transition
-     * from running to sleep, it may be incorrectly reported, since the
-     * setting of the state here is not atomic with the voluntary sleep.
-     * The better fix is to extend the Solaris threads interface and have
-     * the debugger agent call this interface OR to use libthread_db for
-     * intra-process state reporting.
-     *
-     * Now, condition variables are used either for waiting to enter a
-     * monitor (MONITOR_WAIT) or to execute a "wait()" method when already
-     * holding a monitor (CONDVAR_WAIT). So, when condvarWait() is called
-     * it could be to wait for a monitor or for a condition within a
-     * monitor.  This is indicated by the "wtype" argument to condvarWait().
-     * This type is set in the thread state before going to sleep.
-     */
-    self->state = wtype;
-
-#ifdef __linux__
-     /*
-      * Register our intrHandler as a cleanup handler.  If we get
-      * interrupted (i.e. canceled), we longjmp out of this handler.
-      */
-     pthread_cleanup_push(intrHandler, NULL);
-     if (setjmp(jmpbuf) == 0) {
-         /*
-          * Set the jmp buf and enable cancellation.
-          */
-         thr_setspecific(intrJmpbufkey, &jmpbuf);
-         pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-
-         /*
-          * Note: pthread_cond_wait is _not_ interruptible on Linux
-          */
-#else
-    thr_setspecific(sigusr1Jmpbufkey, &jmpbuf);
-    if (sigsetjmp(jmpbuf, 1) == 0) {
-        sigset_t osigset;
-
-        thr_sigsetmask(SIG_UNBLOCK, &sigusr1Mask, &osigset);
-again:
-#endif
-        err = cond_wait((cond_t *) condvar, (mutex_t *) mutex);
-        switch(err) {
-        case 0:
-            err = SYS_OK;
-            break;
-#ifndef __linux__
-        case EINTR: /* Signals other than USR1 were received. */
-            goto again;
-#endif
-        default:
-            err = SYS_ERR;
-        }
-#ifdef __linux__
-       /*
-        * Disable cancellation and clear the jump buf.
-        */
-        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-        thr_setspecific(intrJmpbufkey, NULL);
-#else
-        thr_sigsetmask(SIG_SETMASK, &osigset, NULL);
-#endif
-    } else {
-        /*
-         * we've received a SIGUSR1 to interrupt our wait. We just return
-         * and something above use notices the change.
-         * clear the jump buf just to be paranoid.
-         */
-#ifndef __linux__
-         thr_setspecific(sigusr1Jmpbufkey, NULL);
-#endif
-         err = SYS_INTRPT;
-    }
-#ifdef __linux__
-    pthread_cleanup_pop(0);
-#endif
-    /*
-     * After having woken up, change the thread state to RUNNABLE, since
-     * it is now runnable.
-     */
-    self->state = RUNNABLE;
-
-    return err;
-}
-
-/*
- * Returns 0 if condition variable became true before timeout expired.
- * Returns 1 if timeout expired first.
- * Returns <0 if wait fails for any other reason.
- */
-int
-condvarTimedWait(condvar_t *condvar, mutex_t *mutex,
-    jlong millis, thread_state_t wtype)
-{
-#ifdef __linux__
-    jmp_buf jmpbuf;
-#else
-    sigjmp_buf jmpbuf;
-#endif
-    int err;
-    struct timespec timeout;
-    sys_thread_t *self;
-    jlong end_time;
-
-    if (millis < 0)
-        return SYS_ERR;
-
-    if (millis > (jlong)INT_MAX) {
-        return condvarWait(condvar, mutex, wtype);
-    }
-
-    end_time = sysTimeMillis() + millis;
-
-    self = sysThreadSelf();
-    self->state = wtype;
-
-#ifdef __linux__
-     /*
-      * Register our intrHandler as a cleanup handler.  If we get
-      * interrupted (i.e. canceled), we longjmp out of this handler.
-      */
-     pthread_cleanup_push(intrHandler, NULL);
-     if (setjmp(jmpbuf) == 0) {
-         /*
-          * Set the jmp buf and enable cancellation.
-          */
-         thr_setspecific(intrJmpbufkey, &jmpbuf);
-         pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-
-         /*
-          * Calculate an absolute timeout value.
-          */
-       timeout.tv_sec = end_time / 1000;
-       timeout.tv_nsec = (end_time % 1000) * 1000000;
-
-      again:
-#else
-    thr_setspecific(sigusr1Jmpbufkey, &jmpbuf);
-    if (sigsetjmp(jmpbuf, 1) == 0) {
-        sigset_t osigset;
-
-        thr_sigsetmask(SIG_UNBLOCK, &sigusr1Mask, &osigset);
-
-    again:
-        timeout.tv_sec = end_time / 1000;
-        timeout.tv_nsec = (end_time % 1000) * 1000000;
-#endif
-        err = cond_timedwait((cond_t *)condvar, (mutex_t *)mutex, &timeout);
-        switch(err) {
-        case 0:
-            err = SYS_OK;
-            break;
-        case EINTR: /* Signals other than USR1 were received. */
-            if (sysTimeMillis() < end_time) {
-                goto again;
-            }
-            /*FALLTHRU*/
-#ifdef USE_PTHREADS
-        case ETIMEDOUT:
-#else
-        case ETIME:
-#endif
-            err = SYS_TIMEOUT;
-            break;
-        default:
-            err = SYS_ERR;
-        }
-#ifdef __linux__
-        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-        thr_setspecific(intrJmpbufkey, NULL);
-#else
-        thr_sigsetmask(SIG_SETMASK, &osigset, NULL);
-#endif
-    } else {
-        /*
-         * we've received a SIGUSR1 to interrupt our wait. We just return
-         * and something above use notices the change.
-         * clear the jump buf just to be paranoid.
-         */
-#ifndef __linux__
-         thr_setspecific(sigusr1Jmpbufkey, NULL);
-#endif
-         err = SYS_INTRPT;
-    }
-#ifdef __linux__
-     /* Remove intrHandler without calling it. */
-     pthread_cleanup_pop(0);
-
-     sysAssert(pthread_mutex_trylock(mutex) == EBUSY);
-
-     /*
-      * After having woken up, change the thread state to RUNNABLE, since
-      * it is now runnable.
-      */
-#endif
-    self->state = RUNNABLE;
-    return err;
-}
-
-int
-condvarSignal(condvar_t *condvar)
-{
-    int err;
-
-    err = cond_signal((cond_t *) condvar);
-    condvar->counter++;
-    return (err == 0 ? SYS_OK : SYS_ERR);
-}
-
-int
-condvarBroadcast(condvar_t *condvar)
-{
-    int err;
-
-    err = cond_broadcast((cond_t *) condvar);
-    condvar->counter++;
-    return (err == 0 ? SYS_OK : SYS_ERR);
-}
--- a/jdk/src/solaris/hpi/native_threads/src/interrupt_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-/*
- * Solaris 2.X dependant interrupt handling code.
- */
-
-/*
- * Header files.
- */
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "hpi_impl.h"
-
-#include "mutex_md.h"
-#include "condvar_md.h"
-#include "monitor_md.h"
-#include "threads_md.h"
-#include "interrupt.h"
-
-static int pending_signals[N_INTERRUPTS];
-
-/* Stubs used from interrupt.c: they are nontrivial on Green */
-void intrLock() {}
-void intrUnlock() {}
-#ifdef __linux__
-extern int sr_sigsusp;
-extern int sr_sigresu;
-#endif
-
-/* We need a special monitor implementation for signals because
- * signal handlers are not necessarily called in a Java thread.
- */
-struct {
-    thread_t owner;
-    unsigned int count;
-    mutex_t mutex;
-    condvar_t condvar;
-} userSigMon;
-
-static void sigMonitorInit()
-{
-    userSigMon.owner = 0;
-    userSigMon.count = 0;
-    mutexInit(&userSigMon.mutex);
-    condvarInit(&userSigMon.condvar);
-}
-
-static void sigMonitorEnter()
-{
-    thread_t self = thr_self();
-
-    if (userSigMon.owner == self) {
-        userSigMon.count++;
-    } else {
-        mutex_lock(&userSigMon.mutex);
-        userSigMon.owner = self;
-        userSigMon.count = 1;
-    }
-}
-
-static void sigMonitorExit()
-{
-    thread_t self = thr_self();
-
-    sysAssert(userSigMon.owner == self);
-    sysAssert(userSigMon.count > 0);
-    if (--userSigMon.count == 0) {
-        userSigMon.owner = 0;
-        mutex_unlock(&userSigMon.mutex);
-    }
-}
-
-static void sigMonitorNotify()
-{
-    thread_t self = thr_self();
-
-    sysAssert(userSigMon.owner == self);
-    sysAssert(userSigMon.count > 0);
-    condvarSignal(&userSigMon.condvar);
-}
-
-static void sigMonitorWait()
-{
-    thread_t self = thr_self();
-
-    unsigned int saved_count = userSigMon.count;
-
-    sysAssert(userSigMon.owner == self);
-    sysAssert(userSigMon.count > 0);
-
-    userSigMon.count = 0;
-    userSigMon.owner = 0;
-
-    condvarWait(&userSigMon.condvar, &userSigMon.mutex, CONDVAR_WAIT);
-
-    sysAssert(userSigMon.owner == 0);
-    sysAssert(userSigMon.count == 0);
-
-    userSigMon.count = saved_count;
-    userSigMon.owner = self;
-}
-
-static int
-my_sigignore(int sig)
-{
-#ifndef HAVE_SIGIGNORE
-    struct sigaction action;
-    sigset_t set;
-
-    action.sa_handler = SIG_IGN;
-    action.sa_flags = 0;
-    sigemptyset(&action.sa_mask);
-
-    if (sigaction(sig, &action, (struct sigaction *)0) < 0)
-        return -1;
-    sigemptyset(&set);
-    if (sigaddset(&set, sig) < 0)
-        return -1;
-    return sigprocmask(SIG_UNBLOCK, &set, (sigset_t *)0);
-#else
-    return sigignore(sig);
-#endif /* HAVE_SIGIGNORE */
-}
-
-
-/*
- * intrInitMD() -- Target-specific initialization.
- */
-extern void
-intrInitMD()
-{
-    memset(pending_signals, 0, sizeof(pending_signals));
-    (void)my_sigignore(SIGPIPE);
-    sigMonitorInit();
-}
-
-/*-
- * intrDispatchMD() -- Turn our signal into an intrDispatch().
- */
-void
-#ifdef SA_SIGINFO
-intrDispatchMD(int sig, siginfo_t *info, void *uc)
-#else
-intrDispatchMD(int sig)
-#endif /* SA_SIGINFO */
-{
-    Log1(1, "signalHandlerDispatch(sig=%d)\n", sig);
-
-    sigMonitorEnter();
-#ifdef SA_SIGINFO
-#if defined(__linux__) && defined(__sparc__)
-    uc = (((char *)&sig) + 4 + 0x20);
-    info = (siginfo_t *)(((char *)uc) + 0x60);
-#endif
-    intrDispatch(sig, info, uc);
-#else
-    intrDispatch(sig, 0, 0);
-#endif /* SA_SIGINFO */
-
-    sigMonitorExit();
-}
-
-bool_t intrInUse(int sig)
-{
-    /* Signals used in native threads implementation. */
-#ifdef __linux__
-    return sig == SIGPIPE || sig == sr_sigsusp || sig == sr_sigresu;
-#else
-    return sig == SIGPIPE || sig == SIGUSR1;
-#endif
-}
-
-void sysSignalNotify(int sig)
-{
-    sigMonitorEnter();
-    pending_signals[sig]++;
-    sigMonitorNotify();
-    sigMonitorExit();
-}
-
-static int lookupSignal()
-{
-    int i;
-    for (i = 0; i < N_INTERRUPTS; i++) {
-        if (pending_signals[i]) {
-            pending_signals[i]--;
-            return i;
-        }
-    }
-    return -1;
-}
-
-int sysSignalWait()
-{
-    int sig;
-    sigMonitorEnter();
-    while ((sig = lookupSignal()) == -1) {
-        sigMonitorWait();
-    }
-    sigMonitorExit();
-    return sig;
-}
--- a/jdk/src/solaris/hpi/native_threads/src/monitor_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,365 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Monitor implementation for Native Solaris threads
- *
- * Java Monitors are implemented using one solaris mutex and two
- * condition variables. Because solaris mutex is not re-entrant we
- * cannot simply have a monitor map to a mutex as re-entering a monitor
- * would deadlock an application.
- *
- * Monitor is implemented using:
- *   mutex_t             mutex;
- *   condvar_t           cv_monitor;
- *   condvar_t           cv_waiters;
- *
- * mutex protects the monitor state.
- * cv_monitor is the condtion variable used along with mutex for
- *     supporting wait and notify on the monitor.
- * cv_waiters is used for all the threads waiting to acquire the monitor
- *     lock.
- *
- * All of the sysMonitorXXX() functions that are passed a sys_mon_t
- * assume that they get something nonnull, and only check when debugging.
- */
-
-#include "hpi_impl.h"
-
-#include "threads_md.h"
-#include "monitor_md.h"
-
-#include <errno.h>
-#include <limits.h>
-
-static mutex_t contention_count_mutex;
-
-void initializeContentionCountMutex()
-{
-    mutexInit(&contention_count_mutex);
-}
-
-/*
- * Operations on monitors
- */
-/*
- * Return the size of the lib-dependent portion of monitors.  This
- * is done this way so that monitors can be all of one piece,
- * without paying the penalty of an extra level of indirection on
- * each sys_mon reference.  This is not how it is done for threads
- * and it might be a good idea to use a pointer the same way that
- * threads do.
- */
-size_t
-sysMonitorSizeof()
-{
-    return sizeof(struct sys_mon);
-}
-
-int
-sysMonitorInit(sys_mon_t *mid)
-{
-    int ret;
-
-    sysAssert(mid != SYS_MID_NULL);
-    ret = mutexInit(&mid->mutex);
-    ret = (ret == SYS_OK ? condvarInit(&mid->cv_monitor) : ret);
-
-    mid->entry_count = 0;
-    mid->monitor_owner = SYS_THREAD_NULL;
-    mid->contention_count = 0;
-    INIT_MONITOR_WAIT_QUEUE( mid->mwait_queue );
-
-    return ret;
-}
-
-/*
- * Free any system-dependent resources held by monitors.  There is
- * nothing to be done for native Solaris mutexes or condition variables.
- */
-int
-sysMonitorDestroy(sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    return SYS_OK;
-}
-
-static void
-enqueue_me(monitor_waiter_t *mp, monitor_wait_queue_t *queue,
-           sys_thread_t *self)
-{
-    /*
-     * Order does not matter here. It is more convenient to
-     * enqueue ourselves at the head of the list, so we do so.
-     */
-    mp->waiting_thread = self;
-    mp->next = queue->head;
-    mp->prev = &(queue->head);
-    if ( queue->head != NULL ){
-        queue->head->prev = &(mp->next);
-    }
-    queue->head = mp;
-    queue->count++;
-}
-
-static void
-dequeue_me(monitor_waiter_t *mp, monitor_wait_queue_t *queue)
-{
-    queue->count--;
-    *(mp->prev) = mp->next;
-    if (mp->next != NULL ){
-        mp->next->prev = mp->prev;
-    }
-    mp->next = NULL;
-}
-
-int
-sysMonitorEnter(sys_thread_t *self, sys_mon_t *mid)
-{
-    int err;
-
-    sysAssert(mid != SYS_MID_NULL);
-    err = mutex_trylock(&mid->mutex);
-    if (err == 0) { /* no one owns it */
-        mid->monitor_owner = self;
-        mid->entry_count = 1;
-        return SYS_OK;
-    } else if (err == EBUSY) { /* it's already locked */
-        if (mid->monitor_owner == self) {
-            mid->entry_count++;
-            return SYS_OK;
-        } else {
-            self->mon_enter = mid;
-            /* block on it */
-            if (profiler_on) {
-                VM_CALL(monitorContendedEnter)(self, mid);
-                mutexLock(&contention_count_mutex);
-                mid->contention_count++;
-                mutexUnlock(&contention_count_mutex);
-            }
-            mutex_lock(&mid->mutex);
-            mid->monitor_owner = self;
-            mid->entry_count = 1;
-            self->mon_enter = NULL;
-            if (profiler_on) {
-                mutexLock(&contention_count_mutex);
-                mid->contention_count--;
-                mutexUnlock(&contention_count_mutex);
-                VM_CALL(monitorContendedEntered)(self, mid);
-            }
-            return SYS_OK;
-        }
-    } else {
-        sysAssert(err == 0);
-        return SYS_ERR;
-    }
-}
-
-/*
- * Return true if we currently own this monitor (and threads have been
- * initialized.
- */
-bool_t
-sysMonitorEntered(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    /* We can only have locked monitors if threads have been initialized */
-    return (mid->monitor_owner == self);
-}
-
-int
-sysMonitorExit(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (mid->monitor_owner == self) {
-        sysAssert(mid->entry_count > 0);
-        if (--mid->entry_count == 0) {
-            mid->monitor_owner = SYS_THREAD_NULL;
-            if (!mid->contention_count || !profiler_on) {
-                mutex_unlock(&mid->mutex);
-            } else {
-                mutex_unlock(&mid->mutex);
-                VM_CALL(monitorContendedExit)(self, mid);
-            }
-        }
-        return SYS_OK;
-    } else {
-        return SYS_ERR;
-    }
-}
-
-int
-sysMonitorNotify(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-    if (self == mid->monitor_owner) {
-        if (ANY_WAITING(mid->mwait_queue)) {
-            /* If there is someone doing a monitor wait */
-            condvarSignal(&(mid->cv_monitor));
-        }
-        return SYS_OK;
-    } else
-        return SYS_ERR;
-}
-
-int
-sysMonitorNotifyAll(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-    if (self == mid->monitor_owner) {
-        if (ANY_WAITING(mid->mwait_queue)) {
-            /* If there is someone doing a monitor wait */
-            condvarBroadcast(&(mid->cv_monitor));
-        }
-        return SYS_OK;
-    } else
-        return SYS_ERR;
-}
-
-int
-sysMonitorWait(sys_thread_t *self, sys_mon_t *mid, jlong millis)
-{
-    int ret = SYS_OK;
-    monitor_waiter_t me;
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (self != mid->monitor_owner) {
-        return SYS_ERR;
-    }
-    if (sysThreadIsInterrupted(self, TRUE)) {
-        return SYS_INTRPT;
-    }
-
-    /* Prepare to wait: drop mutex ownership */
-    sysAssert(self->monitor_entry_count == 0);
-    sysAssert(self->mon_wait == 0);
-    self->mon_wait = (sys_mon_t *) mid;
-    self->monitor_entry_count = mid->entry_count;
-    mid->entry_count = 0;
-    mid->monitor_owner = SYS_THREAD_NULL;
-
-    /* Add myself to the monitor waitq */
-    enqueue_me(&me, &mid->mwait_queue, self);
-    if (millis == SYS_TIMEOUT_INFINITY) {
-        ret = condvarWait(&mid->cv_monitor, &mid->mutex, CONDVAR_WAIT);
-    } else {
-        ret = condvarTimedWait(&mid->cv_monitor, &mid->mutex, millis,
-                               CONDVAR_WAIT);
-    }
-    dequeue_me(&me, &mid->mwait_queue);
-
-    sysAssert(mid->monitor_owner == NULL);
-    sysAssert(mid->entry_count == 0);
-    mid->monitor_owner = self;
-    mid->entry_count = self->monitor_entry_count;
-    self->monitor_entry_count = 0;
-    self->mon_wait = 0;
-
-    /* Did we get interrupted in mid-wait?  (IS THIS THE RIGHT PLACE?) */
-    if (sysThreadIsInterrupted(self, TRUE)) {
-        return SYS_INTRPT;
-    }
-
-    return ret;
-}
-
-static int
-dumpWaitingQueue(monitor_wait_queue_t *queue, sys_thread_t **waiters, int sz)
-{
-    int n;
-    monitor_waiter_t * waiter;
-    if (queue == NULL || ( waiter = queue->head ) == NULL ) {
-        return 0;
-    }
-    for (n = 0; waiter != 0; waiter = waiter->next, n++, sz--) {
-        if (sz > 0) {
-            waiters[n] = waiter->waiting_thread;
-        }
-    }
-    return n;
-}
-
-typedef struct {
-    sys_mon_t *mid;
-    sys_thread_t **waiters;
-    int sz;
-    int nwaiters;
-} wait_info;
-
-static int
-findWaitersHelper(sys_thread_t *t, void *arg)
-{
-    wait_info * winfo = (wait_info *) arg;
-    if (t->mon_enter == winfo->mid) {
-        if (winfo->sz > 0) {
-            winfo->waiters[winfo->nwaiters] = t;
-        }
-        winfo->sz--;
-        winfo->nwaiters++;
-    }
-    return SYS_OK;
-}
-
-int
-sysMonitorGetInfo(sys_mon_t *mid, sys_mon_info *info)
-{
-    wait_info winfo;
-
-    sysAssert(mid != SYS_MID_NULL);
-    info->owner = mid->monitor_owner;
-    if (mid->monitor_owner) {
-        info->entry_count = mid->entry_count;
-    }
-
-    winfo.mid = mid;
-    winfo.nwaiters = 0;
-    winfo.waiters = info->monitor_waiters;
-    winfo.sz = info->sz_monitor_waiters;
-    sysThreadEnumerateOver(findWaitersHelper, (void *) &winfo);
-    info->n_monitor_waiters = winfo.nwaiters;
-
-    info->n_condvar_waiters = dumpWaitingQueue(&mid->mwait_queue,
-                                               info->condvar_waiters,
-                                               info->sz_condvar_waiters);
-
-    return SYS_OK;
-}
-
-
-bool_t
-sysMonitorInUse(sys_mon_t * mon)
-{
-    return mon->monitor_owner != 0 ||
-        mon->mwait_queue.count != 0;
-}
-
-sys_thread_t *
-sysMonitorOwner(sys_mon_t *mon)
-{
-    return mon->monitor_owner;
-}
--- a/jdk/src/solaris/hpi/native_threads/src/mutex_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Mutex HPI implementation for Solaris
- *
- * Mutexes are used both by the system-independent monitor implementation and
- * to implement critical regions elsewhere within the runtime.
- */
-
-#include <errno.h>
-
-#include "hpi_impl.h"
-
-#include "mutex_md.h"
-#include "threads_md.h"
-
-/*
- * Return true of the mutex in question is already locked.  note:
- * this does not tell if the mutex is already locked by *this*
- * thread, only that is is locked by *some* thread.
- */
-bool_t
-mutexLocked(mutex_t *mutex)
-{
-    if (mutex_trylock(mutex) == 0) {
-        mutex_unlock(mutex);
-        return FALSE;
-    }
-    return TRUE;
-}
--- a/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,599 +0,0 @@
-/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Solaris-dependent I/O Note: Routines here are just place holders -
- * eventually we need to put in a solution that involves using
- * setjmp/longjmp to avoid io races.  Look at green_threads/io_md.c for
- * more detailed comments on the architechture of the io modules.
- */
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_FILIOH
-#include <sys/filio.h>
-#else
-#include <sys/ioctl.h>
-#endif
-
-#include <sys/socket.h>
-#include <setjmp.h>
-#include <signal.h>
-#ifndef USE_SELECT
-#include <poll.h>
-#endif
-
-#include "hpi_impl.h"
-
-#include "threads_md.h"
-#include "io_md.h"
-#include "largefile.h"
-#include "mutex_md.h"
-
-#if defined(__solaris__) && defined(NO_INTERRUPTIBLE_IO)
-#error If there was no policy change, this could be a makefile error.
-#endif
-
-#ifdef NO_INTERRUPTIBLE_IO
-#undef CLOSEIO
-#else
-#define CLOSEIO
-#endif /* NO_INTERRUPTIBLE_IO */
-
-/* Get typedef for rlim_t */
-#include <sys/resource.h>
-
-#ifdef CLOSEIO
-
-/*
- * Structure for file control block, used by closable IO.
- * We should NOT add more field into the data structure.
- * Otherwise, the sysRead() will only work with sysOpen,
- * and may NOT work with a fd return by open()
- */
-typedef struct
-{
-    mutex_t       lock;   /* lock against the entry */
-    sys_thread_t* list;   /* blocking list on the fd */
-} file_t;
-
-/*
- * Global data structure for interruptable io.
- * It must be initialized before any IO access.
- */
-static file_t * fd_table = 0;
-static int      fd_limit = 0;
-
-/*
- * Initialize global data structure for non-blocking
- * close semantics for Solaris 2.6 and ealier.
- */
-int InitializeIO(rlim_t limit)
-{
-    int i;
-
-    fd_limit = (int) limit;
-
-    fd_table = (file_t *) sysCalloc(fd_limit, sizeof(file_t));
-    if (fd_table == 0) {
-        return SYS_ERR;
-    }
-
-    for (i = 0; i < fd_limit; i++) {
-        mutexInit(&(fd_table[i].lock));
-    }
-
-    return SYS_OK;
-}
-
-/*
- * Cleanup the data structure allocated as above.
- * For JDK 1.2, this function is not called ...
- */
-void FinalizeIO() {
-    int i;
-    for (i = 0; i < fd_limit; i++) {
-        mutexDestroy(&fd_table[i].lock);
-    }
-    sysFree(fd_table);
-    fd_table = 0;
-}
-
-/*
- * Non-blocking close semantics on Solaris native thread.
- */
-int sysClose(int fd)
-{
-    int ret;
-
-    /* Check if it is valid fd. */
-    if (fd >= 0 && fd < fd_limit) {
-        file_t* file = &fd_table[fd];
-        sys_thread_t *thread;
-        sys_thread_t *next;
-
-        /* Lock the corresponding fd. */
-        mutexLock(&file->lock);
-
-        /* Read the blocking list. */
-        thread = file->list;
-
-        /* Iterates the list and interrupt every thread in there. */
-        while (thread) {
-            /* This is the classic double-linked list operation. */
-            if (thread->nextBlocked != thread) {
-                next = thread->nextBlocked;
-
-                next->prevBlocked = thread->prevBlocked;
-                thread->prevBlocked->nextBlocked = next;
-            } else {
-                next = 0;
-            }
-
-            thread->nextBlocked = 0;
-            thread->prevBlocked = 0;
-
-            /*
-             * Use current interruptable IO mechanism to
-             * implement non-blocking closable IO.
-             */
-            sysThreadInterrupt(thread);
-
-            thread = next;
-        }
-
-        file->list = 0;
-
-        ret = close(fd);
-
-        mutexUnlock(&file->lock);
-    } else {
-        /* It is not a valid fd. */
-        errno = EBADF;
-        ret = SYS_ERR;
-    }
-
-    return ret;
-}
-
-/*
- * Called before entering blocking IO. Enqueue the current
- * thread to the fd blocking list. Need fd lock.
- */
-static void BeginIO(sys_thread_t* self, file_t* file) {
-    mutexLock(&file->lock);
-
-    if (!file->list) {
-        file->list = self->nextBlocked = self->prevBlocked = self;
-    } else {
-        sys_thread_t* head = file->list;
-
-        self->prevBlocked = head->prevBlocked;
-        self->nextBlocked = head;
-        head->prevBlocked->nextBlocked = self;
-        head->prevBlocked = self;
-    }
-    mutexUnlock(&file->lock);
-}
-
-/*
- * Called after finishing blocking IO. Dequeue the current
- * thread from the blocking list. Note: It may be waken up
- * by thread interrupt or fd close operation.
- */
-static ssize_t EndIO(sys_thread_t* self, file_t* file, ssize_t ret) {
-    mutexLock(&file->lock);
-
-    /*
-     * Dequeue the current thread. It is classic double
-     * linked list operation.
-     */
-#ifdef __linux__
-    if (!sysThreadIsInterrupted(self, 1) && self->prevBlocked) {
-#else
-    if (self->prevBlocked) {
-#endif
-        if (self->nextBlocked != self) {
-            self->prevBlocked->nextBlocked = self->nextBlocked;
-            self->nextBlocked->prevBlocked = self->prevBlocked;
-            file->list = self->nextBlocked;
-        } else {
-            file->list = 0;
-        }
-        self->nextBlocked = 0;
-        self->prevBlocked = 0;
-    } else {
-#ifdef __linux__
-        if (self->nextBlocked && self->prevBlocked) {
-            if (self->nextBlocked != self) {
-                self->prevBlocked->nextBlocked = self->nextBlocked;
-                self->nextBlocked->prevBlocked = self->prevBlocked;
-                file->list = self->nextBlocked;
-            } else {
-                file->list = 0;
-            }
-        }
-        self->nextBlocked = 0;
-        self->prevBlocked = 0;
-#endif
-        /* file got closed during blocking call */
-        errno = EBADF;
-        ret = SYS_ERR;
-    }
-
-    mutexUnlock(&file->lock);
-
-    return ret;
-}
-
-/*
- * The following is a big macro used to implement the closable IO.
- * Note: It is also used by interruptable IO. If later we need to
- * deprecate interruptable IO, all we need to change the return
- * value and errno to EBADF instead of EINTR. The high level
- * routine will interpret it as IOException instead of
- * InterruptedIOException. No other change is needed.
- * The underlying mechanism is using the SIGUSR1 signal to wake up the
- * blocking thread.  This may cause severe conflicts with any other
- * libraries that also use SIGUSR1.
- */
-#ifdef __linux__
-#define INTERRUPT_IO(cmd) \
-{\
-    ssize_t ret = 0;\
-    file_t* file;\
-    sys_thread_t* self = sysThreadSelf();\
-\
-    if (fd < 0 || fd >= fd_limit) {\
-        errno = EBADF;\
-        return SYS_ERR;\
-    }\
-\
-    file = &fd_table[fd];\
-    BeginIO(self, file);\
-\
-    {\
-        jmp_buf jmpbuf;\
-\
-        /*\
-         * Register our intrHandler as a cleanup handler.  If we get\
-         * interrupted (i.e. canceled), we longjmp out of this handler.\
-         */\
-        pthread_cleanup_push(intrHandler, NULL);\
-        if (setjmp(jmpbuf) == 0) {\
-            thr_setspecific(intrJmpbufkey, &jmpbuf);\
-            pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\
-            ret = cmd;\
-            pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\
-            thr_setspecific(intrJmpbufkey, NULL);\
-        } else {\
-           /* [jk] should/can we call sysThreadIsInterrupted(self, 1) here */
-
-            self->interrupted = FALSE;\
-            errno = EINTR;\
-            ret = SYS_INTRPT;\
-        }\
-        /* Remove intrHandler without calling it. */\
-        pthread_cleanup_pop(0);\
-    }\
-\
-    return EndIO(self, file, ret);\
-}
-#else
-#define INTERRUPT_IO(cmd) \
-{\
-    int ret = 0;\
-    file_t* file;\
-    sys_thread_t* self = sysThreadSelf();\
-\
-    if (fd < 0 || fd >= fd_limit) {\
-        errno = EBADF;\
-        return SYS_ERR;\
-    }\
-\
-    file = &fd_table[fd];\
-    BeginIO(self, file);\
-\
-    {\
-        sigjmp_buf jmpbuf;\
-        sigset_t omask;\
-\
-        thr_setspecific(sigusr1Jmpbufkey, &jmpbuf);\
-        if (sigsetjmp(jmpbuf, 1) == 0) {\
-            thr_sigsetmask(SIG_UNBLOCK, &sigusr1Mask, &omask);\
-            ret = cmd;\
-            thr_sigsetmask(SIG_SETMASK, &omask, NULL);\
-        } else {\
-            sysThreadIsInterrupted(self, TRUE);\
-            errno = EINTR;\
-            ret = SYS_INTRPT;\
-        }\
-    }\
-\
-    return EndIO(self, file, ret);\
-}
-#endif
-
-#else /* CLOSEIO */
-
-#define INTERRUPT_IO(cmd) \
-    return cmd;
-
-int sysClose(int fd) {
-    return close(fd);
-}
-
-int InitializeIO(rlim_t limit)
-{
-    return SYS_OK;
-}
-#endif /* CLOSEIO */
-
-/*
- * sys API for I/O
- */
-
-size_t
-sysRead(int fd, void *buf, unsigned int nBytes) {
-    INTERRUPT_IO(read(fd, buf, nBytes))
-}
-
-size_t
-sysWrite(int fd, const void *buf, unsigned int nBytes) {
-    INTERRUPT_IO(write(fd, buf, nBytes))
-}
-
-int
-sysSocket(int domain, int type, int protocol) {
-    return socket(domain, type, protocol);
-}
-
-ssize_t
-sysRecv(int fd, char *buf, int nBytes, int flags) {
-    INTERRUPT_IO(recv(fd, buf, nBytes, flags))
-}
-
-ssize_t
-sysSend(int fd, char *buf, int nBytes, int flags) {
-    INTERRUPT_IO(send(fd, buf, nBytes, flags))
-}
-/*
-int
-sysClose(int fd) {
-    INTERRUPT_IO(close(fd))
-}
-*/
-jlong
-sysSeek(int fd, jlong offset, int whence) {
-    return lseek64_w(fd, offset, whence);
-}
-
-int
-sysSetLength(int fd, jlong length) {
-    return ftruncate64_w(fd, length);
-}
-
-int
-sysSync(int fd) {
-    /*
-     * XXX: Is fsync() interruptible by the interrupt method?
-     * Is so, add the TSD, sigsetjmp()/longjmp() code here.
-     *
-     * This probably shouldn't be throwing an error and should
-     * be a macro.
-     */
-    int ret;
-    if ((ret = fsync(fd)) == -1) {
-    }
-    return ret;
-}
-
-int
-sysAvailable(int fd, jlong *pbytes) {
-    jlong cur, end;
-    int mode;
-
-    if (sysFfileMode(fd, &mode) >= 0) {
-        if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
-            /*
-             * XXX: is the following call interruptible? If so, this might
-             * need to go through the INTERRUPT_IO() wrapper as for other
-             * blocking, interruptible calls in this file.
-             */
-            int n;
-            if (ioctl(fd, FIONREAD, &n) >= 0) {
-                *pbytes = n;
-                return 1;
-            }
-        }
-    }
-    if ((cur = lseek64_w(fd, 0L, SEEK_CUR)) == -1) {
-        return 0;
-    } else if ((end = lseek64_w(fd, 0L, SEEK_END)) == -1) {
-        return 0;
-    } else if (lseek64_w(fd, cur, SEEK_SET) == -1) {
-        return 0;
-    }
-    *pbytes = end - cur;
-    return 1;
-}
-
-/* IO routines that take in a FD object */
-
-int
-sysTimeout(int fd, long timeout) {
-#ifndef USE_SELECT
-    struct pollfd pfd;
-
-#ifdef __linux__
-    jlong end_time = sysTimeMillis() + (jlong) timeout;
-    volatile jlong to = (jlong) timeout;
-#endif
-
-    pfd.fd = fd;
-    pfd.events = POLLIN;
-
-#ifdef __linux__
-    INTERRUPT_IO(__extension__ ({
-        int __result;
-        do {
-            pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-            __result = poll(&pfd, 1, ((int)to));
-            pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
-        } while (__result == -1 && errno == EINTR &&
-                 (to = end_time - sysTimeMillis()) > 0 &&
-                 ((pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) == 0));
-        if (pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
-            __result = -1;
-            errno = EBADF;
-        }
-        (__result == -1 && errno == EINTR) ? 0 : __result;
-    }))
-#else
-    INTERRUPT_IO(poll(&pfd, 1, (int)timeout))
-#endif
-#else
-    fd_set tbl;
-    struct timeval t;
-
-    t.tv_sec = timeout / 1000;
-    t.tv_usec = (timeout % 1000) * 1000;
-
-    FD_ZERO(&tbl);
-    FD_SET(fd, &tbl);
-
-#ifdef __linux__
-    INTERRUPT_IO(TEMP_FAILURE_RETRY(select(fd + 1, &tbl, 0, 0, &t)))
-#else
-    INTERRUPT_IO(select(fd + 1, &tbl, 0, 0, &t))
-#endif
-#endif
-}
-
-
-/*
- * sys API for networking
- */
-
-long
-sysSocketAvailable(int fd, jint *pbytes) {
-    long ret = 1;
-    /*
-     * An ILP64 port of this code should pass the address of a local int
-     * to the ioctl and then convert that to jint with any error handling
-     * required for overflows, if overflow is possible.
-     */
-
-    /*
-     * XXX: is the following call interruptible? If so, this might
-     * need to go through the INTERRUPT_IO() wrapper as for other
-     * blocking, interruptible calls in this file.
-     */
-    if (fd < 0 || ioctl(fd, FIONREAD, pbytes) < 0) {
-        ret = 0;
-    }
-    return ret;
-}
-
-int
-sysListen(int fd, int count) {
-   return listen(fd, count);
-}
-
-int
-sysConnect(int fd, struct sockaddr *addr, int size)  {
-    INTERRUPT_IO(connect(fd, addr, size))
-}
-
-int
-sysBind(int fd, struct sockaddr *addr, int size)  {
-    INTERRUPT_IO(bind(fd, addr, size))
-}
-
-int
-sysAccept(int fd, struct sockaddr *him, int *len) {
-    INTERRUPT_IO(accept(fd, him, (uint *)len))
-}
-
-int
-sysGetSockName(int fd, struct sockaddr *him, int *len) {
-    return getsockname(fd, him, (uint *)len);
-}
-
-int
-sysSocketClose(int fd) {
-    return sysClose(fd);
-}
-
-int
-sysSocketShutdown(int fd, int howto) {
-    return shutdown(fd, howto);
-}
-
-int
-sysGetSockOpt(int fd, int level, int optname, char *optval, int *optlen) {
-    return getsockopt(fd, level, optname, optval, optlen);
-}
-
-int
-sysSetSockOpt(int fd, int level, int optname, const char *optval, int optlen) {
-    return setsockopt(fd, level, optname, optval, optlen);
-}
-
-int
-sysGetHostName(char *hostname, int namelen) {
-  return gethostname(hostname, namelen);
-}
-
-struct hostent *
-sysGetHostByAddr(const char *hostname, int len, int type) {
-  return gethostbyaddr(hostname, len, type);
-}
-
-struct hostent *
-sysGetHostByName(char *hostname) {
-  return gethostbyname(hostname);
-}
-
-struct protoent *
-sysGetProtoByName(char* name) {
-    return getprotobyname(name);
-}
-
-/*
- * Routines to do datagrams
- */
-ssize_t
-sysSendTo(int fd, char *buf, int len,
-          int flags, struct sockaddr *to, int tolen) {
-    INTERRUPT_IO(sendto(fd, buf, len, flags, to, tolen))
-}
-
-ssize_t
-sysRecvFrom(int fd, char *buf, int nBytes,
-            int flags, struct sockaddr *from, int *fromlen) {
-    INTERRUPT_IO(recvfrom(fd, buf, nBytes, flags, from, (uint *)fromlen))
-}
--- a/jdk/src/solaris/hpi/native_threads/src/threads_linux.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,411 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Implementation of notposix.h on Linux.
- */
-
-#include <pthread.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <time.h>
-
-#include "hpi_impl.h"
-#include "monitor_md.h"
-#include "threads_md.h"
-#include "np.h"
-
-#undef LOG_THREADS
-
-/* Global lock used when calling np_suspend and np_resume */
-static pthread_mutex_t sr_lock;
-
-/* Semaphore used to acknowledge when the handler has received HANDLER_SIG */
-static sem_t sr_sem;
-
-/* The tid of the thread being suspended/resumed */
-static sys_thread_t *sr_tid;
-
-int sr_sigsusp;
-int sr_sigresu;
-
-static void prtsigset(char *s, sigset_t *set)
-{
-    int sig;
-    dprintf(2, "%s:", s);
-    for (sig = 1; sig < _NSIG; sig++) {
-        if (sigismember(set, sig)) {
-            dprintf(2, " %d", sig);
-        }
-    }
-    dprintf(2, "\n");
-}
-
-/*
- * Handler function invoked when a thread's execution is suspended
- * We have to be careful that only async-safe functions are
- * called here. I'm not even sure if calling sysThreadSelf is safe so
- * we temporarily stash SP in a global variable instead.
- */
-static void
-#ifdef SA_SIGINFO
-susp_handler(int sig, siginfo_t* info, void* arg)
-#else
-susp_handler(int sig)
-#endif
-{
-    sys_thread_t *tid = sr_tid;
-    sigset_t set;
-    /* Save the current SP */
-    tid->sp = &tid;
-    sem_post(&sr_sem);
-    sigfillset(&set);
-    sigdelset(&set,(sr_sigresu));
-    /* block until we receive resume signal. */
-    sigsuspend(&set);
-}
-
-static void
-#ifdef SA_SIGINFO
-resu_handler(int sig, siginfo_t* info, void* arg)
-#else
-resu_handler(int sig)
-#endif
-{
-    return;
-}
-
-/*
- * Initialize signal handlers for suspend and resume}.
- */
-int
-np_initialize()
-{
-    struct sigaction act;
-    char *s;
-    int err;
-
-    /* Signal numbers used to suspend and resume */
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
-#ifdef SIGUNUSED
-    sr_sigsusp = SIGUNUSED;
-#else
-    sr_sigsusp = SIGLOST;
-#endif
-#ifdef SIGPWR
-    sr_sigresu = SIGPWR;
-#else
-    sr_sigresu = SIGXFSZ;
-#endif
-#else
-    /* use real time signals */
-    /* currently __SIGRTMIN, +1, +2 are all used by LinuxThreads */
-    sr_sigsusp = SIGRTMIN + 3;
-    sr_sigresu = SIGRTMIN + 4;
-#endif
-
-    /* Set up signal handler for suspend and resume */
-#if defined(SA_SIGINFO) && !defined(__sparc__)
-    act.sa_handler = 0;
-    act.sa_sigaction = susp_handler;
-#else
-    act.sa_handler = (__sighandler_t) susp_handler;
-#endif
-#ifdef SA_SIGINFO
-    act.sa_flags = SA_RESTART | SA_SIGINFO;
-#else
-    act.sa_flags = SA_RESTART;
-#endif
-    sigfillset(&act.sa_mask);
-    if (sigaction(sr_sigsusp, &act, 0) == -1) {
-        return -1;
-    }
-#if defined(SA_SIGINFO) && !defined(__sparc__)
-    act.sa_handler = 0;
-    act.sa_sigaction = resu_handler;
-#else
-    act.sa_handler = (__sighandler_t) resu_handler;
-#endif
-#ifdef SA_SIGINFO
-    act.sa_flags = SA_SIGINFO;
-#else
-    act.sa_flags = 0;
-#endif
-    sigfillset(&act.sa_mask);
-    if (sigaction(sr_sigresu, &act, 0) == -1) {
-        return -1;
-    }
-
-    /* Initialize semaphore used by np_{suspend/resume} */
-    if (sem_init(&sr_sem, 0, 0) == -1) {
-        return SYS_ERR;
-    }
-
-    /* Initialize mutex used by np_{suspend/resume} */
-    err = mutexInit(&sr_lock);
-    sysAssert(err == 0);
-
-    return SYS_OK;
-}
-
-int
-np_initial_suspend(sys_thread_t* tid)
-{
-    int count;
-
-    tid->selfsuspended = (tid == sysThreadSelf());
-    sysAssert(tid->selfsuspended);
-
-    count = tid->suspend_count++;
-    sysAssert(count == 0);
-
-#ifdef LOG_THREADS
-    dprintf(2,
-            "[Initial self-suspend [tid = %ld, sys_thread = %ld]\n",
-            pthread_self(), tid->sys_thread);
-#endif
-
-    /* Order should not matter but doing the post first should be faster */
-    sem_post(&tid->sem_suspended);
-    do {
-        sem_wait(&tid->sem_selfsuspend);
-    } while (tid->selfsuspended); /* paranoid */
-    return 0;
-}
-
-
-int
-np_suspend(sys_thread_t *tid)
-{
-    int count, ret = 0;
-
-    int err = mutexLock(&sr_lock);
-    sysAssert(err == 0);
-
-    tid->selfsuspended = (tid == sysThreadSelf());
-
-    count = tid->suspend_count++;
-#ifdef LOG_THREADS
-    dprintf(2, "[Suspending fromtid = %ld, tid = %ld, pid = %d, count = %d]\n",
-            pthread_self(), tid->sys_thread, tid->lwp_id, count);
-#endif
-    if (count == 0) {
-        if (tid->selfsuspended) {
-#ifdef LOG_THREADS
-            dprintf(2,
-                    "[Self-suspending [tid = %ld, sys_thread = %ld]\n",
-                    pthread_self(), tid->sys_thread);
-#endif
-            mutexUnlock(&sr_lock);
-            do {
-                sem_wait(&tid->sem_selfsuspend);
-            } while (tid->selfsuspended);
-            /* [jk] What is the correct return value here?
-               There was no error, but when we return the thread
-               has already been resumed. */
-            return SYS_OK;
-
-        } else {
-            sr_tid = tid;
-            ret = pthread_kill(tid->sys_thread, sr_sigsusp);
-            if (ret == 0) {
-                sem_wait(&sr_sem);
-            }
-#ifdef LOG_THREADS
-            dprintf(2,
-                    "[Suspended fromtid = %ld, pthread_kill(%ld, %d) = %d]\n",
-                    pthread_self(), tid->sys_thread, sr_sigsusp, ret);
-#endif
-        }
-    }
-
-    err = mutexUnlock(&sr_lock);
-    sysAssert(err == 0);
-
-    return ret == 0 ? SYS_OK : SYS_ERR;
-}
-
-int
-np_continue(sys_thread_t *tid)
-{
-    int count, ret = 0;
-
-    int err = mutexLock(&sr_lock);
-    sysAssert(err == 0);
-
-    count = --tid->suspend_count;
-#ifdef LOG_THREADS
-    dprintf(2, "[Resuming fromtid = %ld, tid = %ld, pid = %d, count = %d]\n",
-            pthread_self(), tid->sys_thread, tid->lwp_id, count);
-#endif
-    if (count == 0) {
-        if (tid->selfsuspended) {
-            tid->selfsuspended = 0;
-            sem_post(&tid->sem_selfsuspend);
-        } else {
-            sr_tid = tid;
-            ret = pthread_kill(tid->sys_thread, sr_sigresu);
-        }
-#ifdef LOG_THREADS
-        dprintf(2, "[Resumed fromtid = %ld, pthread_kill(%ld, %d) = %d]\n",
-                pthread_self(), tid->sys_thread, sr_sigresu, ret);
-#endif
-    } else if (count < 0) {
-        /* Ignore attempts to resume a thread that has not been suspended */
-        tid->suspend_count = 0;
-    }
-
-     err = mutexUnlock(&sr_lock);
-     sysAssert(err == 0);
-
-     return ret == 0 ? SYS_OK : SYS_ERR;
-}
-
-/*
- * Get the stack base and size.
- */
-int
-np_stackinfo(void **addr, long *size)
-{
-    /* For now assume stack is 2 meg, from internals.h. */
-#define STACK_SIZE (2 * 1024 * 1024)
-    void *p;
-    char *sp = (char *)&p;  /* rougly %esp */
-
-    *addr = (void *)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1;
-    *size = STACK_SIZE;
-
-    return SYS_OK;
-}
-
-typedef unsigned long ulong_t;
-#define VALID_SP(sp, bottom, top) \
-       (((ulong_t)(sp)) < ((ulong_t)(bottom)) && ((ulong_t)(sp)) > ((ulong_t)(top)))
-
-/*
- * Go into single threaded mode for GC.
- */
-int
-np_single()
-{
-    sys_thread_t *tid;
-    pthread_t me = pthread_self();
-    int i;
-
-#ifdef LOG_THREADS
-    dprintf(2, "[Entering np_single: thread count = %d]\n", ActiveThreadCount);
-#endif
-    /* Stop all other threads. */
-    tid = ThreadQueue;
-    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-        if ((tid->sys_thread != me) && (tid->state != SUSPENDED)) {
-            np_suspend(tid);
-            sysAssert(VALID_SP(tid->sp, tid->stack_bottom, tid->stack_top));
-            tid->onproc = FALSE; /* REMIND: Might not need this */
-        }
-        tid = tid->next;
-    }
-#ifdef LOG_THREADS
-    dprintf(2, "[Leaving np_single]\n");
-#endif
-    return SYS_OK;
-}
-
-/*
- * Per thread initialization.
- */
-void
-np_initialize_thread(sys_thread_t *tid)
-{
-    sigset_t set;
-
-    /* Block SIGQUIT so that it can be handled by the SIGQUIT handler thread */
-    sigemptyset(&set);
-    sigaddset(&set, SIGQUIT);
-    pthread_sigmask(SIG_BLOCK, &set, 0);
-    /* Set process id */
-    tid->lwp_id = getpid();
-    tid->suspend_count = 0;
-
-    /* Semaphore used for self-suspension */
-    sem_init(&tid->sem_selfsuspend, 0, 0);
-    tid->selfsuspended = 0;
-
-#ifdef LOG_THREADS
-    dprintf(2, "[Init thread, tid = %ld, pid = %d, base = %p, size = %lu]\n",
-            pthread_self(), tid->lwp_id, tid->stack_bottom, tid->stack_size);
-#endif
-}
-
-void
-np_free_thread(sys_thread_t *tid)
-{
-    sem_destroy(&tid->sem_selfsuspend);
-}
-
-/*
- * Recover from single threaded mode after GC.
- */
-void
-np_multi()
-{
-    int i;
-    sys_thread_t *tid;
-    pthread_t me = pthread_self();
-
-    tid = ThreadQueue;
-    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-        if ((tid->sys_thread != me) && (tid->state != SUSPENDED)) {
-            np_continue(tid);
-        }
-        tid = tid->next;
-    }
-}
-
-void
-np_profiler_init(sys_thread_t *tid)
-{
-}
-
-int
-np_profiler_suspend(sys_thread_t *tid)
-{
-    return np_suspend(tid);
-}
-
-int
-np_profiler_continue(sys_thread_t *tid)
-{
-    return np_continue(tid);
-}
-
-bool_t
-np_profiler_thread_is_running(sys_thread_t *tid)
-{
-    return TRUE;
-}
--- a/jdk/src/solaris/hpi/native_threads/src/threads_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1133 +0,0 @@
-/*
- * Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Implementation of Java threads HPI on top of native Solaris threads
- *
- * [Sheng 1/18/97] Do not include any JVM-specific header file (such
- * as interpreter.h) here! This file implements the thread-related
- * APIs sys_api.h.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <sys/resource.h>
-
-#include "hpi_impl.h"
-
-#include "threads_md.h"
-#include "monitor_md.h"
-
-#include "np.h"
-
-extern int InitializeIO(rlim_t limit);
-
-#if defined(__solaris__) && !defined(SA_SIGINFO)
-#error That can NOT possibly be right.
-#endif
-
-#ifdef SA_SIGINFO
-static void sigusr1Handler(int sig, siginfo_t *info, void *uc);
-#else
-static void sigusr1Handler(int sig);
-#endif /* SA_SIGINFO */
-
-static void removeFromActiveQ(sys_thread_t *p);
-static void clear_onproc_flags(void);
-
-sys_thread_t *ThreadQueue;
-int ActiveThreadCount = 0;              /* All threads */
-sys_mon_t *_sys_queue_lock;
-
-/* This is explained in linker_md.c. */
-#ifdef __GLIBC__
-#define NEED_DL_LOCK
-#endif /* __GLIBC__ */
-
-#ifdef NEED_DL_LOCK
-extern sys_mon_t _dl_lock;
-#endif /* NEED_DL_LOCK */
-
-/*
- * threads_initialized simplifies the check that has to be done in
- * sysThreadCheckStack().  Otherwise, before sysThreadInit() is called
- * on the primordial thread, we need to handle there being no current
- * thread at all, and there being one with a 0 stack_base.
- */
-static int threads_initialized = 0;
-
-/* The tid_key is a global key to *native* thread-specific data.  That is,
- * each native thread has a back pointer to the Java TID associated with it.
- */
-static thread_key_t tid_key = (thread_key_t) -1;
-
-/*
- * The sigusr1Jmpbufkey is used to get at the jmp buffer to longjmp to in a
- * SIGUSR1 handler - used to implement stop(). The jmp buffer
- * should have been allocated off the thread's stack.
- */
-#ifdef __linux__
-thread_key_t intrJmpbufkey;
-static sigset_t squm = {{sigmask(SIGUSR1), 0, 0, 0}};
-#else
-thread_key_t sigusr1Jmpbufkey;
-sigset_t sigusr1Mask = {{sigmask(SIGUSR1), 0, 0, 0}};
-#endif
-
-/*
- * Thread C stack overflow check
- *
- * sysThreadCheckStack() being a function call is unfortunate, as it
- * takes stack space to do, but that is weakly accounted for by the
- * previous stack redzone.  In general, where we can't predict stack
- * use by C, thread stack overflow checking doesn't really work.
- */
-
-#define STACK_REDZONE 4096
-
-#ifdef __linux__
-int jdk_waitpid(pid_t pid, int* status, int options);
-int fork1(void);
-int jdk_sem_init(sem_t*, int, unsigned int);
-int jdk_sem_post(sem_t*);
-int jdk_sem_wait(sem_t*);
-int jdk_pthread_sigmask(int, const sigset_t*, sigset_t*);
-pid_t waitpid(pid_t, int*, int);
-
-int jdk_waitpid(pid_t pid, int* status, int options) {
-    return waitpid(pid, status, options);
-}
-
-int fork1() {
-    return fork();
-}
-
-int
-jdk_sem_init(sem_t *sem, int pshared, unsigned int value) {
-    return sem_init(sem, pshared, value);
-}
-
-int
-jdk_sem_post(sem_t *sem) {
-    return sem_post(sem);
-}
-
-int
-jdk_sem_wait(sem_t *sem) {
-    return sem_wait(sem);
-}
-
-int
-jdk_pthread_sigmask(int how , const sigset_t* newmask, sigset_t* oldmask) {
-    return pthread_sigmask(how , newmask, oldmask);
-}
-
-#endif
-
-/* REMIND: port _CurrentThread changes to make process
-   of getting the tid more efficient */
-
-int
-sysThreadCheckStack()
-{
-    sys_thread_t *tid = sysThreadSelf();
-
-    /* Stacks grow toward lower addresses on Solaris... */
-    if (!threads_initialized ||
-        (char *)(tid)->stack_bottom - (char *)&(tid) + STACK_REDZONE <
-            tid->stack_size) {
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-#ifndef __linux__
-static sigset_t squm = {{sigmask(SIGUSR1), 0, 0, 0}};
-#endif
-
-
-/*
- * Allocate and initialize the sys_thread_t structure for an arbitary
- * native thread.
- */
-int
-sysThreadAlloc(sys_thread_t **tidP)
-{
-    int err;
-    sys_thread_t *tid = allocThreadBlock();
-    if (tid == NULL) {
-        return SYS_NOMEM;
-    }
-#ifdef __linux__
-    memset((char *)tid, 0, sizeof(sys_thread_t));
-#endif
-
-    if (profiler_on) {
-        np_profiler_init(tid);
-    }
-
-    if (np_stackinfo(&tid->stack_bottom, &tid->stack_size) == SYS_ERR) {
-        return SYS_ERR;
-    }
-#ifdef __linux__
-    tid->stack_top = tid->stack_bottom - tid->stack_size;
-#else
-    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
-#endif
-
-    tid->primordial_thread = 0;
-#ifdef __linux__
-    tid->interrupted = tid->pending_interrupt = FALSE;
-#else
-    tid->interrupted = FALSE;
-#endif
-    tid->onproc = FALSE;
-    tid->sys_thread = thr_self();
-#ifdef __linux__
-    /*
-     * Disable cancellation.  The default cancel type is
-     * PTHREAD_CANCEL_DEFERRED, so if we set the cancel state to
-     * PTHREAD_CANCEL_ENABLE again, we'll get deferred cancellation.
-     */
-     pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
-    np_initialize_thread(tid);
-
-    /*
-     * For the Invocation API:
-     * We update the thread-specific storage before locking the
-     * queue because sysMonitorEnter will access sysThreadSelf.
-     */
-    err = thr_setspecific(tid_key, tid);
-                                /* sys_thread_t * back pointer from native */
-#ifdef __linux__
-    thr_setspecific(intrJmpbufkey, NULL); /* paranoid */
-#endif
-    assert (err == 0);
-
-    if (threads_initialized)
-        SYS_QUEUE_LOCK(sysThreadSelf());
-    ActiveThreadCount++;        /* Count the thread */
-    tid->next = ThreadQueue;    /* Chain all threads */
-    ThreadQueue = tid;
-    if (threads_initialized)
-        SYS_QUEUE_UNLOCK(sysThreadSelf());
-    else
-        threads_initialized = TRUE;
-
-    /*
-     * Ensure that SIGUSR1 is masked for interruptable IO
-     * Signal mask inheritance ensures all child threads are masked too.
-     */
-#ifndef __linux__
-    thr_sigsetmask(SIG_BLOCK, &squm, NULL);
-#endif
-
-    setFPMode();
-
-    *tidP = tid;
-    return SYS_OK;
-}
-
-/*
- * threadBootstrapMD() bootstraps the UNIX process running from main()
- * into a first primordial thread.  This thread is distinguishable because
- * it uniquely has the primordial_thread flag on in its private data.
- * However, so that we have to special-case it as little as possible, we
- * set it up to look as closely as possible to a thread that we created.
- * One difference is that its stack is *not* known to us.
- */
-int
-threadBootstrapMD(sys_thread_t **tidP, sys_mon_t **lockP, int nb)
-{
-    /* We are running out of file descriptors in fonts.  As a temporary
-     * fix, bump up the number of open file descriptors to OPEN_MAX.
-     */
-    struct rlimit nbr_files;
-
-    getrlimit(RLIMIT_NOFILE, &nbr_files);
-    nbr_files.rlim_cur = nbr_files.rlim_max;
-    setrlimit(RLIMIT_NOFILE, &nbr_files);
-
-    /*
-     * Use the above setting for initialize (closable) IO package.
-     */
-    if (InitializeIO(nbr_files.rlim_cur) != SYS_OK) {
-        return SYS_ERR;
-    }
-
-    /* Create a thread-private key for a pointer back to the sys_thread_t *.
-     * Note that we don't need to worry about the destructor, as that's taken
-     * care of elsewhere.
-     */
-    thr_keycreate(&tid_key, NULL);
-
-#ifdef __linux__
-    thr_keycreate(&intrJmpbufkey, NULL);
-#else
-    thr_keycreate(&sigusr1Jmpbufkey, NULL);
-#endif
-
-#ifndef NO_INTERRUPTIBLE_IO
-    {
-        /* initialize SIGUSR1 handler for interruptable IO */
-        struct sigaction sigAct;
-
-#ifdef SA_SIGINFO
-        sigAct.sa_handler = NULL;
-        sigAct.sa_sigaction = sigusr1Handler;
-#else
-        sigAct.sa_handler = sigusr1Handler;
-#endif /* SA_SIGINFO */
-        memset((char *)&(sigAct.sa_mask), 0, sizeof (sigset_t));
-        /* we do not want the restart flag for SIGUSR1 */
-        sigAct.sa_flags = 0;
-        sigaction(SIGUSR1, &sigAct, (struct sigaction *)0);
-    }
-#endif /* NO_INTERRUPTIBLE_IO */
-
-    nReservedBytes = (nb + 7) & (~7);
-    if (sysThreadAlloc(tidP) < 0) {
-        return SYS_NOMEM;
-    }
-
-    /* profiler_on may have not been setup yet. */
-    np_profiler_init(*tidP);
-
-#ifdef NEED_DL_LOCK
-    VM_CALL(monitorRegister)(&_dl_lock, "Dynamic loading lock");
-#endif /* NEED_DL_LOCK */
-
-    /* Initialize the queue lock monitor */
-    _sys_queue_lock = (sys_mon_t *)sysMalloc(sysMonitorSizeof());
-    if (_sys_queue_lock == NULL) {
-        return SYS_ERR;
-    }
-    VM_CALL(monitorRegister)(_sys_queue_lock, "Thread queue lock");
-    *lockP = _sys_queue_lock;
-
-    (*tidP)->primordial_thread = 1;
-
-    if (np_initialize() == SYS_ERR) {
-        return SYS_ERR;
-    }
-
-    return SYS_OK;
-}
-
-/*
- * Access to the thread stack pointer of an arbitrary thread (for GC).
- * This information should be legitimately available in Solaris 2.5.
- */
-void *
-sysThreadStackPointer(sys_thread_t * tid)
-{
-    char *thread_info;
-
-    if (tid == sysThreadSelf()) {
-        /*
-         * doing this assigment gets around a warning about returning
-         * the address of a local variable
-         */
-        void *aStackAddress = &thread_info;
-        return aStackAddress;
-    } else {
-        return (void *) tid->sp;
-    }
-}
-
-/*
- * Get the end of stack (if you step beyond (above or below depending
- * on your architecture) you can die.  We refer to the logical top of
- * stack.
- *
- * NOTE!  There are restrictions about when you can call this method.  If
- * you did a sysThreadAlloc, then you can call this method as soon as
- * sysThreadAlloc returns.  If you called sysThreadCreate(start_function),
- * then you must call sysThreadStackTop only inside start_function and not
- * as soon as sysThreadCreate returns.
- */
-void *
-sysThreadStackTop(sys_thread_t *tid)
-{
-    return tid->stack_top;
-}
-
-long *
-sysThreadRegs(sys_thread_t * tid, int *nregs)
-{
-    *nregs = N_TRACED_REGS;
-    return tid->regs;
-}
-
-static void *
-_start(void *tid_)
-{
-    sys_thread_t *tid = (sys_thread_t *)tid_;
-
-    np_initialize_thread(tid);
-
-#ifdef __linux__
-    /*
-     * Disable cancellation.  The default cancel type is
-     * PTHREAD_CANCEL_DEFERRED, so if we set the cancel state to
-     * PTHREAD_CANCEL_ENABLE again, we'll get deferred cancellation.
-     */
-    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-
-    tid->sp = 0;
-    thr_setspecific(tid_key, tid);
-    thr_setspecific(intrJmpbufkey, NULL); /* paranoid */
-    np_stackinfo(&tid->stack_bottom, &tid->stack_size);
-    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
-
-    /* Wait for resume signal */
-    np_initial_suspend(tid);
-#else
-#ifdef  USE_PTHREADS
-#ifndef USE_MUTEX_HANDSHAKE
-    /* Wait for semaphore to be posted once thread has been suspended */
-    sem_wait(&tid->sem);
-    sem_destroy(&tid->sem);
-#else
-    /* I'm a new thread, and I must co-operate so I can be suspended. */
-    pthread_mutex_lock(&tid->ntcond.m);
-    tid->ntcond.state = NEW_THREAD_REQUESTED_SUSPEND;
-    pthread_cond_signal(&tid->ntcond.c);
-    while (tid->ntcond.state != NEW_THREAD_SUSPENDED)
-        pthread_cond_wait(&tid->ntcond.c, &tid->ntcond.m);
-    pthread_mutex_unlock(&tid->ntcond.m);
-#endif /* USE_MUTEX_HANDSHAKE */
-#endif /* USE_PTHREADS */
-#endif /* !linux */
-    if (profiler_on) {
-        np_profiler_init(tid);
-    }
-
-#ifndef __linux__
-    tid->sp = 0;
-    thr_setspecific(tid_key, tid);
-#endif
-
-    tid->state = RUNNABLE;
-
-#ifndef __linux__
-    np_stackinfo(&tid->stack_bottom, &tid->stack_size);
-    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
-#endif
-
-    setFPMode();
-    tid->start_proc(tid->start_parm);
-#ifdef __linux__
-    /* Paranoid: We don't want to be canceled now, it would have
-       unpredictable consequences */
-    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-#endif
-
-    sysThreadFree();
-    thr_exit(0);
-    /* NOT REACHED */
-    return 0;
-}
-
-int
-sysThreadCreate(sys_thread_t **tidP, long ss, void (*start)(void *), void *arg)
-{
-    size_t stack_size = ss;
-    int err;
-    sys_thread_t *tid = allocThreadBlock();
-#ifdef USE_PTHREADS
-    pthread_attr_t attr;
-#endif
-
-    if (tid == NULL) {
-        return SYS_NOMEM;
-    }
-    *tidP = tid;
-
-#ifdef __linux__
-    memset((char *)tid, 0, sizeof(sys_thread_t));
-#endif
-    /* Install the backpointer to the Thread object */
-
-#ifdef __linux__
-    tid->interrupted = tid->pending_interrupt = FALSE;
-#else
-    tid->interrupted = FALSE;
-#endif
-    tid->onproc = FALSE;
-
-#ifndef __linux__
-    SYS_QUEUE_LOCK(sysThreadSelf());
-    ActiveThreadCount++;        /* Global thread count */
-    tid->next = ThreadQueue;    /* Chain all threads */
-    ThreadQueue = tid;
-    SYS_QUEUE_UNLOCK(sysThreadSelf());
-#endif
-
-    tid->start_proc = start;
-    tid->start_parm = arg;
-#ifdef __linux__
-    tid->state = SUSPENDED;
-#endif
-
-#ifdef __linux__
-    tid->primordial_thread = 0;
-
-    /* Semaphore used to block thread until np_suspend() is called */
-    err = sem_init(&tid->sem_suspended, 0, 0);
-    sysAssert(err == 0);
-    /* Thread attributes */
-    pthread_attr_init(&attr);
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
-    pthread_attr_setstacksize(&attr, stack_size);
-#endif
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    if (profiler_on) {
-      pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-    }
-    /* Create the thread. The thread will block waiting to be suspended */
-    err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid);
-    sysAssert(err == 0);
-    if (err == 0) {
-        err = sem_wait(&tid->sem_suspended);
-        if (err == 0) {
-            sem_destroy(&tid->sem_suspended);
-        }
-    }
-    sysAssert(err == 0);
-
-    SYS_QUEUE_LOCK(sysThreadSelf());
-    ActiveThreadCount++;        /* Global thread count */
-    tid->next = ThreadQueue;    /* Chain all threads */
-    ThreadQueue = tid;
-    SYS_QUEUE_UNLOCK(sysThreadSelf());
-#else
-#ifdef USE_PTHREADS
-
-#ifndef USE_MUTEX_HANDSHAKE
-    /* Semaphore used to block thread until np_suspend() is called */
-    err = sem_init(&tid->sem, 0, 0);
-    sysAssert(err == 0);
-    /* Thread attributes */
-#else
-    /* Setup condition required to suspend the newly created thread. */
-    pthread_mutex_init(&tid->ntcond.m, NULL);
-    pthread_cond_init(&tid->ntcond.c, NULL);
-    tid->ntcond.state = NEW_THREAD_MUST_REQUEST_SUSPEND;
-    pthread_mutex_lock(&tid->ntcond.m);
-#endif /* USE_MUTEX_HANDSHAKE */
-
-    /* Create the new thread. */
-    pthread_attr_init(&attr);
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
-    pthread_attr_setstacksize(&attr, stack_size);
-#endif
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    if (profiler_on)
-        pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-    err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid);
-
-#ifndef USE_MUTEX_HANDSHAKE
-    if (err == 0) {
-       /* Suspend the thread */
-       err = np_suspend(tid);
-       if (err == SYS_OK) {
-           /* Unblock the thread now that it has been suspended */
-           err = sem_post(&tid->sem);
-           sysAssert(err == 0);
-       }
-    }
-#else
-    /* Wait for the newly created thread to block. */
-    while (tid->ntcond.state != NEW_THREAD_REQUESTED_SUSPEND)
-        pthread_cond_wait(&tid->ntcond.c, &tid->ntcond.m);
-
-    /* So it blocked.  Now suspend it and _then_ get it out of the block. */
-    np_suspend(tid->sys_thread);
-    tid->ntcond.state = NEW_THREAD_SUSPENDED;
-    pthread_cond_signal(&tid->ntcond.c);
-    pthread_mutex_unlock(&tid->ntcond.m);
-#endif /* USE_MUTEX_HANDSHAKE */
-
-#else
-    /* Create the thread */
-    err = thr_create(NULL, stack_size, _start, (void *)tid,
-                     THR_SUSPENDED|THR_DETACHED|
-                     (profiler_on ? THR_BOUND : 0),
-                     &tid->sys_thread);
-#endif /* USE_PTHREADS */
-#endif /* !linux */
-
-    tid->state = SUSPENDED;
-    sysAssert(err != EINVAL);   /* Invalid argument: shouldn't happen */
-    if (err == EAGAIN) {
-        err = SYS_NORESOURCE;   /* Will be treated as though SYS_NOMEM */
-    } else if (err == ENOMEM) {
-        err = SYS_NOMEM;
-    } else {
-        err = SYS_OK;
-    }
-
-    return err;
-}
-
-/*
- * Free a system thread block.
- * Remove from the thread queue.
- */
-int
-sysThreadFree()
-{
-    sys_thread_t *tid = sysThreadSelf();
-    /*
-     * remove ourselves from the thread queue.  This must be done after
-     * the notify above since monitor operations aren't really safe if
-     * your thread isn't on the thread queue.  (This isn't true of
-     * the sysMonitor* functions, only monitor*)
-     */
-    SYS_QUEUE_LOCK(tid);
-    removeFromActiveQ(tid);
-    SYS_QUEUE_UNLOCK(tid);
-
-    /* For invocation API: later sysThreadSelf() calls will return 0 */
-    thr_setspecific(tid_key, 0);
-
-#ifdef __linux__
-    np_free_thread(tid);
-#endif
-
-    freeThreadBlock(tid);
-    return SYS_OK;
-}
-
-/*
- * Current thread yield control
- *
- * Green threads originally supported forcing another thread to yield...
- */
-void
-sysThreadYield()
-{
-#ifndef __linux__
-    thr_yield();
-#endif
-}
-
-#ifdef USE_PTHREADS
-/*
- * For POSIX threads, we don't want to use real-time policies SCHED_FIFO or
- * SCHED_RR.  That leaves SCHED_OTHER which is implementation defined.  We
- * assume Solaris-pthreads like behavior for SCHED_OTHER, and if it doesn't
- * work on your platform, then maybe you want to do turn off thread
- * priorities by setting -DMOOT_PRIORITIES.
- */
-#ifndef MOOT_PRIORITIES
-#define USE_SCHED_OTHER
-#endif /* MOOT_PRIORITIES */
-#endif /* USE_PTHREADS */
-
-/*
- * Get the scheduling priority of a specified thread
- */
-int
-sysThreadGetPriority(sys_thread_t * tid, int *pri)
-{
-#ifdef USE_PTHREADS
-#ifdef USE_SCHED_OTHER
-    struct sched_param param;
-    int policy = SCHED_OTHER;
-    param.sched_priority = *pri;
-    return pthread_getschedparam(tid->sys_thread, &policy, &param);
-#else
-    return 0;
-#endif /* USE_SCHED_OTHER */
-#else
-    return thr_getprio(tid->sys_thread, pri);
-#endif /* USE_PTHREADS */
-}
-
-
-/*
- * Set the scheduling priority of a specified thread
- */
-int
-sysThreadSetPriority(sys_thread_t * tid, int pri)
-{
-    int err;
-#ifdef USE_PTHREADS
-#ifdef USE_SCHED_OTHER
-    struct sched_param param;
-    param.sched_priority = pri;
-    err = pthread_setschedparam(tid->sys_thread, SCHED_OTHER, &param);
-#else
-    err = 0;
-#endif /* USE_SCHED_OTHER */
-#else
-    err = thr_setprio(tid->sys_thread, pri);
-#endif /* USE_PTHREADS */
-    sysAssert(err != ESRCH);        /* No such thread: shouldn't happen */
-    sysAssert(err != EINVAL);       /* Invalid arguments: shouldn't happen */
-    return SYS_OK;
-}
-
-/*
- * Suspend execution of the specified thread
- */
-int
-sysThreadSuspend(sys_thread_t * tid)
-{
-    int err1 = 0;
-    int err2 = 0;
-    sys_thread_t *self = sysThreadSelf();
-
-    if (tid == self) {
-        self->state = SUSPENDED;
-    } else {
-#ifndef __linux__
-        mutexLock(&tid->mutex);
-#endif
-        switch(tid->state) {
-            case RUNNABLE:
-                tid->state = SUSPENDED;
-                break;
-            case CONDVAR_WAIT:
-                tid->state = SUSPENDED;
-                tid->cpending_suspend = 1;
-                break;
-            case SUSPENDED:
-            default:
-                err1 = -1;              /* Thread in inconsistent state */
-                break;
-        }
-#ifndef __linux__
-        mutexUnlock(&tid->mutex);
-#endif
-    }
-    if (err1 == 0) {
-        err2 = np_suspend(tid);
-    }
-
-    return ((err1 == 0 && err2 == 0) ? SYS_OK : SYS_ERR);
-}
-
-/*
- * Resume execution of the specified thread
- */
-int
-sysThreadResume(sys_thread_t * tid)
-{
-    int err1 = 0;
-    int err2 = 0;
-
-#ifndef __linux__
-    mutexLock(&tid->mutex);
-#endif
-    if (tid->cpending_suspend) {
-        tid->cpending_suspend = 0;
-        tid->state = CONDVAR_WAIT;
-    } else {
-        switch(tid->state) {
-            case SUSPENDED:
-                tid->state = RUNNABLE;
-                break;
-            case RUNNABLE:
-            case CONDVAR_WAIT:
-            default:
-                err1 = -1;              /* Thread in inconsistent state */
-                break;
-        }
-    }
-#ifndef __linux__
-    mutexUnlock(&tid->mutex);
-#endif
-    if (err1 == 0) {
-        err2 = np_continue(tid);
-    }
-
-    return ((err1 == 0 && err2 == 0) ? SYS_OK : SYS_ERR);
-}
-
-/*
- * Return the sys_thread_t * of the calling thread
- */
-sys_thread_t *
-sysThreadSelf()
-{
-#ifdef USE_PTHREADS
-    return pthread_getspecific(tid_key);
-#else
-    sys_thread_t * tid=NULL;
-    int err = thr_getspecific(tid_key, (void *) &tid);
-
-    if (err == 0) {
-        return tid;
-    }
-
-    sysAssert(tid_key == -1 || err != 0);
-
-    return NULL;
-#endif
-}
-
-/*
- * Enumerate over all threads, calling a function for each one.  A
- * paranoid helper function would be prepared to deal with threads
- * that have not been created by Java.
- */
-
-int
-sysThreadEnumerateOver(int (*func)(sys_thread_t *, void *), void *arg)
-{
-    sys_thread_t *tid;
-    int err = SYS_OK;
-    int i;
-
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-
-    tid = ThreadQueue;
-    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-        if ((err = (*func)(tid, arg)) != SYS_OK) {
-            break;
-        }
-        tid = tid->next;
-    }
-
-    return err;
-}
-
-void *
-sysThreadNativeID(sys_thread_t *tid)
-{
-    return (void *) tid->sys_thread;
-}
-
-/*
- * Remove this thread from the list of Active threads.
- */
-static void
-removeFromActiveQ(sys_thread_t * t)
-{
-    sys_thread_t *prev;
-    sys_thread_t *tid;
-
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-
-    ActiveThreadCount--;
-
-    prev = 0;
-    tid = ThreadQueue;
-    while (tid) {
-        if (tid == t) {
-            if (prev) {
-                prev->next = tid->next;
-            } else {
-                ThreadQueue = tid->next;
-            }
-            tid->next = 0;
-            break;
-        }
-        prev = tid;
-        tid = tid->next;
-    }
-}
-
-/*
- * The mechanics of actually signalling an exception (in the future,
- * and Alarm or Interrupt) depend upon what thread implementation you
- * are using.
- */
-void
-sysThreadPostException(sys_thread_t *tid, void *exc)
-{
-    /* Thread.stop is deprecated */
-    /* No longer wake up the thread if it is sleeping */
-    /* thr_kill(tid->sys_thread, SIGUSR1); */
-}
-
-/*
- * Support for (Java-level) interrupts.
- */
-void
-sysThreadInterrupt(sys_thread_t *tid)
-{
-#ifdef __linux__
-    tid->pending_interrupt = TRUE;
-    pthread_cancel(tid->sys_thread);
-#else
-    mutexLock(&tid->mutex);
-    tid->interrupted = TRUE;
-    mutexUnlock(&tid->mutex);
-    thr_kill(tid->sys_thread, SIGUSR1);
-#endif
-}
-
-/* This doesn't need to aquire any locks */
-int
-sysThreadIsInterrupted(sys_thread_t *tid, int ClearInterrupted)
-{
-    bool_t interrupted;
-
-#ifndef __linux__
-    mutexLock(&tid->mutex);
-#endif
-#ifdef __linux__
-    interrupted = tid->pending_interrupt || tid->interrupted;
-
-    if (ClearInterrupted == 1 && tid->pending_interrupt) {
-        sys_thread_t* self = sysThreadSelf();
-
-        if (self == tid && pthread_getspecific(intrJmpbufkey) == NULL) {
-            jmp_buf jmpbuf;
-
-            /*
-             * Register our intrHandler as a cleanup handler.  If we get
-             * interrupted (i.e. canceled), we longjmp out of this handler.
-             */
-            pthread_cleanup_push(intrHandler, NULL);
-            if (setjmp(jmpbuf) == 0) {
-                thr_setspecific(intrJmpbufkey, &jmpbuf);
-                pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-                while (1) { pthread_testcancel(); }
-            }
-            /* Remove intrHandler without calling it. */
-            pthread_cleanup_pop(0);
-        }
-    }
-
-    if (ClearInterrupted == 1 && interrupted) {
-        /* we have do to this last, otherwise we really would cancel the
-         thread */
-      tid->interrupted = FALSE;
-    }
-#else
-    interrupted = tid->interrupted;
-    if (ClearInterrupted == 1) {
-        tid->interrupted = FALSE;
-        mutexUnlock(&tid->mutex);
-         if (interrupted) {
-             sigset_t osigset;
-             /*
-              * we were interrupted so we may have a signal pending that
-              * we need to clear.  We can just temporarily unmask SIGUSR1
-              * and the sigusr1Handler to catch and notice that the
-              * interrupted flag is not set.
-              */
-
-             thr_setspecific(sigusr1Jmpbufkey, NULL); /* paranoid */
-             thr_sigsetmask(SIG_UNBLOCK, &sigusr1Mask, &osigset);
-             thr_sigsetmask(SIG_SETMASK, &osigset, NULL);
-         }
-     } else {   /* Otherwise leave it alone */
-       mutexUnlock(&tid->mutex);
-     }
-#endif
-    return interrupted;
-}
-
-
-
-/*
- * Stop all threads other than the current one.  The stopped threads
- * may be restarted with sysThreadMulti(); the operation of this
- * routine is atomic; it either stops all java threads or it stops
- * none of them.  Upon success (all threads stopped) this routine
- * returns SYS_OK, otherwise SYS_ERR.
- *
- * In general, sysThreadSingle() should take care of anything below
- * the HPI that needs to be done to safely run single-threaded.
- */
-int
-sysThreadSingle()
-{
-    return np_single();
-}
-
-/*
- * Allow multi threaded execution to resume after a
- * sysThreadSingle() call.
- *
- * Note: When this routine is called the scheduler should already
- * have been locked by sysThreadSingle().
- */
-void
-sysThreadMulti()
-{
-    np_multi();
-}
-
-#ifdef __linux__
-/*
- * We abuse thread cancellation to interrupt the threads, i.e when an
- * exception is posted against the thread, pthread_cancel(3) is sent to the
- * thread and the canceled thread executes the following cleanup handler
- */
-void
-intrHandler(void* arg)
-{
-    jmp_buf* jmpbufp = pthread_getspecific(intrJmpbufkey);
-    if (jmpbufp != NULL) {
-        volatile sys_thread_t* self = sysThreadSelf();
-        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
-        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
-        self->interrupted = TRUE;
-        self->pending_interrupt = FALSE;
-        thr_setspecific(intrJmpbufkey, NULL);
-        longjmp(*jmpbufp, 1);
-    } else {
-#ifdef PARANOID_DEBUG
-        sysAssert(0);
-#endif
-    }
-}
-
-#else
-/*
- * SIGUSR1 is used to interrupt the threads, i.e when an exception
- * is posted against the thread, SIGUSR1 is sent to the thread and the
- * thread gets the signal, executes the following handler
- */
-
-static void
-#ifdef SA_SIGINFO
-sigusr1Handler(int sig, siginfo_t *info, void *uc)
-#else
-sigusr1Handler(int sig)
-#endif
-{
-    sys_thread_t *tid = sysThreadSelf();
-
-    if (tid->interrupted) {
-        sigjmp_buf *jmpbufp;
-#ifdef USE_PTHREADS
-        jmpbufp = pthread_getspecific(sigusr1Jmpbufkey);
-#else
-        thr_getspecific(sigusr1Jmpbufkey, (void **)&jmpbufp);
-#endif
-        if (jmpbufp != NULL)
-            siglongjmp(*jmpbufp, 1);
-    }
-}
-#endif
-
-HPI_SysInfo *
-sysGetSysInfo()
-{
-    static HPI_SysInfo info = {0, 0};
-
-    if (info.name == NULL) {
-        /*
-         * we want the number of processors configured not the number online
-         * since processors may be turned on and off dynamically.
-         */
-        int cpus = (int) sysconf(_SC_NPROCESSORS_CONF);
-
-        info.isMP = (cpus < 0) ? 1 : (cpus > 1);
-        info.name = "native threads";
-    }
-    return &info;
-}
-
-
-jlong
-sysThreadCPUTime()
-{
-#ifdef HAVE_GETHRVTIME
-   return gethrvtime();
-#else
-   return 0;
-#endif
-}
-
-int
-sysThreadGetStatus(sys_thread_t *tid, sys_mon_t **monitorPtr)
-{
-    int status;
-    switch (tid->state) {
-      case RUNNABLE:
-          if (tid->mon_enter) {
-              status = SYS_THREAD_MONITOR_WAIT;
-          } else {
-              status = SYS_THREAD_RUNNABLE;
-          }
-          break;
-      case SUSPENDED:
-          if (tid->mon_enter)
-              status = SYS_THREAD_SUSPENDED | SYS_THREAD_MONITOR_WAIT;
-          else if (tid->cpending_suspend)
-              status = SYS_THREAD_SUSPENDED | SYS_THREAD_CONDVAR_WAIT;
-          else
-              status = SYS_THREAD_SUSPENDED;
-          break;
-      case CONDVAR_WAIT:
-          status = SYS_THREAD_CONDVAR_WAIT;
-          break;
-      default:
-        return SYS_ERR;
-    }
-    if (monitorPtr) {
-        if (status & SYS_THREAD_MONITOR_WAIT) {
-            *monitorPtr = tid->mon_enter;
-        } else if (status & SYS_THREAD_CONDVAR_WAIT) {
-            *monitorPtr = tid->mon_wait;
-        } else {
-            *monitorPtr = NULL;
-        }
-    }
-    return status;
-}
-
-int sysAdjustTimeSlice(int new)
-{
-    return SYS_ERR;
-}
-
-void sysThreadProfSuspend(sys_thread_t *tid)
-{
-    np_profiler_suspend(tid);
-}
-
-void sysThreadProfResume(sys_thread_t *tid)
-{
-    np_profiler_continue(tid);
-}
-
-bool_t sysThreadIsRunning(sys_thread_t *tid)
-{
-    return np_profiler_thread_is_running(tid);
-}
-
-void *
-sysThreadInterruptEvent()
-{
-    return NULL;
-}
--- a/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,666 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Implementation of HPI that can not be expressed with POSIX threads.
- * Note that even if you are building with USE_PTHREADS, we have to
- * explicitly undef it here because pthread.h and thread.h can not be
- * included in the same file, and this file needs only thread.h.
- */
-#undef USE_PTHREADS
-
-#include "hpi_impl.h"
-#include "monitor_md.h"
-#include "threads_md.h"
-#include "np.h"
-
-#include <thread.h>
-#include <sys/lwp.h>
-#include <signal.h>
-#include <sys/signal.h>
-#include <sys/resource.h>
-#include <sys/procfs.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <sys/syscall.h>
-extern int syscall(int, ...);
-
-
-/*
- * Forward declarations.
- */
-static int  procfd;
-static void stop_lwps();
-static void clear_onproc_flags();
-static void restart_lwps();
-static void MakeProcName(register char *procname, register pid_t pid);
-static void GC_msec_sleep(int n);
-
-
-/*
- * Make sure that we link against a verion of libthread that has at least
- * the bug fixes and the interface for getting the stack from threads that
- * aren't on LWPs.  Otherwise we should exit with some informative message.
- */
-extern ulong_t __gettsp(thread_t);
-
-static const char * gettspMessage =
-"You must install a Solaris patch to run the native threads version of the\n"
-"Java runtime.  The green threads version will work without this patch.\n"
-"Please check the native threads release notes for more information.\n"
-"\n"
-"If you are embedding the VM in a native application, please make sure that\n"
-"the native application is linked with libthread.so (-lthread).\n"
-"\n"
-"Exiting.\n";
-
-static void
-checkForCorrectLibthread()
-{
-    if (&__gettsp == 0) {
-        fprintf(stderr, gettspMessage);
-        exit(1);
-    }
-}
-#ifdef __GNUC__
-static void checkForCorrectLibthread() __attribute__((constructor));
-#else
-#pragma init(checkForCorrectLibthread)
-#endif
-
-#pragma weak __gettsp
-
-
-/*
- * Suspend said thread.  Used to implement java.lang.Thread.suspend(),
- * which is deprecated.
- */
-int
-np_suspend(sys_thread_t *tid)
-{
-    return thr_suspend(tid->sys_thread);
-}
-
-
-/*
- * Resume a suspended thread.  Used to implement java.lang.Thread.resume(),
- * which is deprecated.
- */
-int
-np_continue(sys_thread_t *tid)
-{
-    return thr_continue(tid->sys_thread);
-}
-
-/*
- * If there is any initialization is required by the non-POSIX parts.
- */
-void np_initialize_thread(sys_thread_t *tid)
-{
-    return;
-}
-
-
-/*
- * Get the stack start address, and max stack size for the current thread.
- */
-int
-np_stackinfo(void **addr, long *size)
-{
-    stack_t stkseg;
-
-    if (thr_stksegment(&stkseg) == 0) {
-        *addr = (void *)(stkseg.ss_sp);
-        if (thr_main()) {
-            struct rlimit r;
-            getrlimit(RLIMIT_STACK, &r);
-            *size = (long)r.rlim_cur;
-        } else {
-            *size = (long)(stkseg.ss_size);
-        }
-        return SYS_OK;
-    } else {
-        return SYS_ERR; /* thr_stksegment failed. */
-    }
-}
-
-/*
- * On Solaris when doing CPU profiling, the threads are bound.
- */
-void
-np_profiler_init(sys_thread_t *tid)
-{
-    tid->lwp_id = _lwp_self();
-}
-
-int
-np_profiler_suspend(sys_thread_t *tid)
-{
-    return _lwp_suspend(tid->lwp_id);
-}
-
-int
-np_profiler_continue(sys_thread_t *tid)
-{
-    return _lwp_continue(tid->lwp_id);
-}
-
-bool_t
-np_profiler_thread_is_running(sys_thread_t *tid)
-{
-    unsigned long sum = 0;
-    int i;
-    prstatus_t lwpstatus;
-    int lwpfd;
-    int res;
-
-    lwpfd = syscall(SYS_ioctl, procfd, PIOCOPENLWP, &(tid->lwp_id));
-    sysAssert(lwpfd >= 0);
-
- retry:
-    res = syscall(SYS_ioctl, lwpfd, PIOCSTATUS, &lwpstatus);
-    sysAssert(res >= 0);
-
-    if (!(lwpstatus.pr_flags & PR_STOPPED)) {
-        GC_msec_sleep(1);
-        goto retry;
-    }
-
-    close(lwpfd);
-
-#if   defined(sparc)
-    sum += lwpstatus.pr_reg[R_SP];
-    sum += lwpstatus.pr_reg[R_PC];
-
-    sum += lwpstatus.pr_reg[R_G1];
-    sum += lwpstatus.pr_reg[R_G2];
-    sum += lwpstatus.pr_reg[R_G3];
-    sum += lwpstatus.pr_reg[R_G4];
-
-    sum += lwpstatus.pr_reg[R_O0];
-    sum += lwpstatus.pr_reg[R_O1];
-    sum += lwpstatus.pr_reg[R_O2];
-    sum += lwpstatus.pr_reg[R_O3];
-    sum += lwpstatus.pr_reg[R_O4];
-    sum += lwpstatus.pr_reg[R_O5];
-
-    sum += lwpstatus.pr_reg[R_I0];
-    sum += lwpstatus.pr_reg[R_I1];
-    sum += lwpstatus.pr_reg[R_I2];
-    sum += lwpstatus.pr_reg[R_I3];
-    sum += lwpstatus.pr_reg[R_I4];
-    sum += lwpstatus.pr_reg[R_I5];
-    sum += lwpstatus.pr_reg[R_I6];
-    sum += lwpstatus.pr_reg[R_I7];
-
-    sum += lwpstatus.pr_reg[R_L0];
-    sum += lwpstatus.pr_reg[R_L1];
-    sum += lwpstatus.pr_reg[R_L2];
-    sum += lwpstatus.pr_reg[R_L3];
-    sum += lwpstatus.pr_reg[R_L4];
-    sum += lwpstatus.pr_reg[R_L5];
-    sum += lwpstatus.pr_reg[R_L6];
-    sum += lwpstatus.pr_reg[R_L7];
-#elif defined(amd64)
-    sum += lwpstatus.pr_reg[REG_RIP];
-    sum += lwpstatus.pr_reg[REG_RSP];
-
-    sum += lwpstatus.pr_reg[REG_RAX];
-    sum += lwpstatus.pr_reg[REG_RCX];
-    sum += lwpstatus.pr_reg[REG_RDX];
-    sum += lwpstatus.pr_reg[REG_RBX];
-    sum += lwpstatus.pr_reg[REG_RBP];
-    sum += lwpstatus.pr_reg[REG_RSI];
-    sum += lwpstatus.pr_reg[REG_RDI];
-
-    sum += lwpstatus.pr_reg[REG_R8];
-    sum += lwpstatus.pr_reg[REG_R9];
-    sum += lwpstatus.pr_reg[REG_R10];
-    sum += lwpstatus.pr_reg[REG_R11];
-    sum += lwpstatus.pr_reg[REG_R12];
-    sum += lwpstatus.pr_reg[REG_R13];
-    sum += lwpstatus.pr_reg[REG_R14];
-    sum += lwpstatus.pr_reg[REG_R15];
-#elif defined(i386)
-    sum += lwpstatus.pr_reg[EIP];
-    sum += lwpstatus.pr_reg[UESP];
-
-    sum += lwpstatus.pr_reg[EAX];
-    sum += lwpstatus.pr_reg[ECX];
-    sum += lwpstatus.pr_reg[EDX];
-    sum += lwpstatus.pr_reg[EBX];
-    sum += lwpstatus.pr_reg[EBP];
-    sum += lwpstatus.pr_reg[ESI];
-    sum += lwpstatus.pr_reg[EDI];
-#endif
-
-    if (tid->last_sum == sum) {
-        return FALSE;
-    }
-    tid->last_sum = sum;
-
-    return TRUE;
-}
-
-
-/*
- * If building for Solaris native threads, open up the /proc file
- * descriptor to be used when doing GC. The open is done at JVM start-up so
- * as to reserve this fd, to prevent GC stall due to exhausted fds. This fd
- * will never be closed, and will alwyas be present.
- */
-int
-np_initialize()
-{
-    char procname[32];
-    MakeProcName(procname, getpid());
-    if ((procfd = open(procname, O_RDONLY, 0)) < 0) {
-        VM_CALL(jio_fprintf)(stderr, "Cannot open %s for GC", procname);
-        return SYS_ERR;
-    }
-    return SYS_OK;
-}
-
-static void
-MakeProcName(register char *procname, register pid_t pid)
-{
-    register char * s;
-
-    (void) strcpy(procname, "/proc/00000");
-    s = procname + strlen(procname);
-    while (pid) {
-        *--s = pid%10 + '0';
-        pid /= 10;
-    }
-}
-
-/*
- * Suspend all other threads, and record their contexts (register
- * set or stack pointer) into the sys_thread structure, so that a
- * garbage collect can be run.
- */
-int
-np_single(void)
-{
-    int ret;
-
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-
-    stop_lwps();
-    ret = SYS_OK;
-    return ret;
-}
-
-/*
- * Continue threads suspended earlier.  But clear their context
- * recorded in sys_thread structure first.
- */
-void
-np_multi(void)
-{
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-    clear_onproc_flags();
-    restart_lwps();
-}
-
-/* /proc solution to stop and restrt lwps */
-/* make sure gc is run as a bound thread */
-/* make sure signals are turned off for gc thread */
-/* what about new lwps getting created in the meantime? */
-
-#define MAX_LWPS 1024
-
-static prstatus_t Mystatus;
-static id_t lwpid_list_buf[MAX_LWPS];
-static id_t oldlwpid_list_buf[MAX_LWPS];
-static sys_thread_t *onproct_list_buf[MAX_LWPS];
-static id_t *lwpid_list = lwpid_list_buf;
-static id_t *oldlwpid_list = oldlwpid_list_buf;
-static sys_thread_t **onproct_list = onproct_list_buf;
-static int lwpid_list_len;
-static int oldlwpid_list_len;
-static int onproct_ix = 0;
-static int gcprio;
-static sigset_t gcmask;
-
-static void
-clear_onproc_flags()
-{
-    int i;
-
-    for (i = 0; i < onproct_ix; i++) {
-        ((sys_thread_t *)(onproct_list[i]))->onproc = FALSE;
-    }
-    onproct_ix = 0;
-}
-
-
-/* Sleep for n milliseconds, n < 1000   */
-static void
-GC_msec_sleep(int n)
-{
-    struct timespec ts;
-
-    ts.tv_sec = 0;
-    ts.tv_nsec = 1000000*n;
-    if (syscall(SYS_nanosleep, &ts, 0) < 0) {
-        VM_CALL(jio_fprintf)(stderr, "%d\n", errno);
-    }
-}
-
-/*
- * Assumes stacks grow down from high to low memory. True on sparc and Intel.
- */
-#define VALID_SP(sp, bottom, top) \
-       (((uintptr_t)(sp)) < ((uintptr_t)(bottom)) && ((uintptr_t)(sp)) > ((uintptr_t)(top)))
-
-static void
-record_lwp_regs(prstatus_t lwpstatus)
-{
-    sys_thread_t *tid;
-    int i;
-#if   defined(sparc)
-    register uintptr_t sp = lwpstatus.pr_reg[R_SP];
-#elif defined(amd64)
-    register uintptr_t sp = lwpstatus.pr_reg[REG_RSP];
-#elif defined(i386)
-    register uintptr_t sp = lwpstatus.pr_reg[UESP];
-#endif
-
-    tid = ThreadQueue;
-    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-        if (VALID_SP(sp, tid->stack_bottom, tid->stack_top)) {
-            long *regs = tid->regs;
-            tid->sp = sp;
-            /*
-             * The code below relies on N_TRACED_REGS being set
-             * correctly for each platform.  If you change the
-             * number of registers being watched, you should update
-             * the define for N_TRACED_REGS
-             */
-#if   defined(sparc)
-            regs[0] = lwpstatus.pr_reg[R_G1];
-            regs[1] = lwpstatus.pr_reg[R_G2];
-            regs[2] = lwpstatus.pr_reg[R_G3];
-            regs[3] = lwpstatus.pr_reg[R_G4];
-
-            regs[4] = lwpstatus.pr_reg[R_O0];
-            regs[5] = lwpstatus.pr_reg[R_O1];
-            regs[6] = lwpstatus.pr_reg[R_O2];
-            regs[7] = lwpstatus.pr_reg[R_O3];
-            regs[8] = lwpstatus.pr_reg[R_O4];
-            regs[9] = lwpstatus.pr_reg[R_O5];
-            regs[10] = lwpstatus.pr_reg[R_O6];
-            regs[11] = lwpstatus.pr_reg[R_O7];
-#elif defined(amd64)
-            regs[0] = lwpstatus.pr_reg[REG_RAX];
-            regs[1] = lwpstatus.pr_reg[REG_RCX];
-            regs[2] = lwpstatus.pr_reg[REG_RDX];
-            regs[3] = lwpstatus.pr_reg[REG_RBX];
-            regs[4] = lwpstatus.pr_reg[REG_RBP];
-            regs[5] = lwpstatus.pr_reg[REG_RSI];
-            regs[6] = lwpstatus.pr_reg[REG_RDI];
-            regs[7] = lwpstatus.pr_reg[REG_R8];
-            regs[8] = lwpstatus.pr_reg[REG_R9];
-            regs[9] = lwpstatus.pr_reg[REG_R10];
-            regs[10]= lwpstatus.pr_reg[REG_R11];
-            regs[11]= lwpstatus.pr_reg[REG_R12];
-            regs[12]= lwpstatus.pr_reg[REG_R13];
-            regs[13]= lwpstatus.pr_reg[REG_R14];
-            regs[14]= lwpstatus.pr_reg[REG_R15];
-#elif defined(i386)
-            regs[0] = lwpstatus.pr_reg[EAX];
-            regs[1] = lwpstatus.pr_reg[ECX];
-            regs[2] = lwpstatus.pr_reg[EDX];
-            regs[3] = lwpstatus.pr_reg[EBX];
-            regs[4] = lwpstatus.pr_reg[EBP];
-            regs[5] = lwpstatus.pr_reg[ESI];
-            regs[6] = lwpstatus.pr_reg[EDI];
-#endif
-
-            if (tid->onproc != TRUE) {
-                tid->onproc = TRUE;
-                onproct_list[onproct_ix++] = tid;
-            }
-            break;
-        }
-        tid = tid->next;
-    }
-}
-
-static void
-record_thread_regs()
-{
-    sys_thread_t *tid;
-    int i;
-
-    tid = ThreadQueue;
-    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-        if (tid->onproc != TRUE) {
-            int i;
-
-            if (tid->sys_thread != 0) {
-                /* if thread has already been initialized */
-                tid->sp = __gettsp(tid->sys_thread);
-            } else {
-                /*
-                 * thread is still in the process of being initalized.
-                 * So GC should not care about this thread. Just
-                 * set its sp to 0, and this will force GC to ignore it.
-                 */
-                tid->sp = 0;
-            }
-
-            /*
-             * Clear out the registers since they are no longer live
-             * and we don't want to garbage collector to think they are.
-             */
-
-            for (i = 0; i < N_TRACED_REGS; i++)
-                tid->regs[i] = 0;
-        }
-        tid = tid->next;
-    }
-}
-
-static void
-wait_stopped_lwps(void)
-{
-    int i, lwpfd;
-    prstatus_t lwpstatus;
-
-    for (i = 0; i < (int) Mystatus.pr_nlwp; i++) {
-        /* if its  not me */
-        if (lwpid_list[i] != _lwp_self()) {
-
-            /* open the lwp and check the status */
-            if ((lwpfd = syscall(SYS_ioctl, procfd, PIOCOPENLWP,
-                &lwpid_list[i])) < 0) {
-#ifdef MY_DEBUG
-                VM_CALL(jio_fprintf)(stderr, "lwpid %d was not found in process\n",
-                            lwpid_list[i]);
-#endif
-                continue;
-            }
-            memset(&lwpstatus, 0, sizeof(lwpstatus));
-            while (1) {
-                if (syscall(SYS_ioctl,lwpfd, PIOCSTATUS, &lwpstatus)<0) {
-                    sysAssert(0);
-#ifdef MY_DEBUG
-                    VM_CALL(jio_fprintf)(stderr, "PIOCSTATUS failed for lwp %d",
-                                lwpid_list[i]);
-#endif
-                    break;
-                }
-                if (lwpstatus.pr_flags & PR_STOPPED) {
-                    record_lwp_regs(lwpstatus);
-                    break;
-                }
-                GC_msec_sleep(1);
-            }
-
-            close (lwpfd);
-        } /* end of if-me */
-    } /* end of for */
-}
-
-static void
-suspend_lwps()
-{
-    int i;
-    /* pioopen all the lwps and stop them - except the one I am running on */
-    for (i = 0; i < (int) Mystatus.pr_nlwp; i++) {
-
-        /* open and stop the lwp if its not me */
-        if (lwpid_list[i] != _lwp_self()) {
-
-            /* PIOCSTOP doesn't work without a writable         */
-            /* descriptor.  And that makes the process          */
-            /* undebuggable.                                    */
-            if (_lwp_suspend(lwpid_list[i]) < 0) {
-                        /* Could happen if the lwp exited */
-                lwpid_list[i] = _lwp_self();
-                continue;
-            }
-        }
-    }
-}
-
-static void
-print_lwps()
-{
-#ifdef MY_DEBUG
-    /* print all the lwps in the process */
-    VM_CALL(jio_fprintf)(stdout, "lwpids ");
-    for (i = 0; i < (int) Mystatus.pr_nlwp; i++) {
-        if (i == 0) {
-            VM_CALL(jio_fprintf)(stdout, "%d", lwpid_list[0]);
-        } else if (i != Mystatus.pr_nlwp - 1) {
-            VM_CALL(jio_fprintf)(stdout, ", %d", lwpid_list[i]);
-        } else {
-            VM_CALL(jio_fprintf)(stdout, " and %d", lwpid_list[i]);
-        }
-    }
-#endif
-}
-
-/* routine to iteratively stop all lwps */
-static void
-stop_lwps()
-{
-    int i;
-    sigset_t set;
-    boolean_t changed;
-
-    /* mask all signals */
-    (void) sigfillset(&set);
-    syscall(SYS_sigprocmask, SIG_SETMASK, &set, &gcmask);
-
-    /* run at highest prio so I cannot be preempted */
-    thr_getprio(thr_self(), &gcprio);
-    thr_setprio(thr_self(), 2147483647);  /* #define INT_MAX 2147483647 */
-
-    oldlwpid_list_len = 0;
-
-    while(1) {
-        changed = B_FALSE;
-
-        /* Get the # of lwps in the process */
-        memset(&Mystatus, 0, sizeof(Mystatus));
-        syscall(SYS_ioctl, procfd, PIOCSTATUS, &Mystatus);
-
-#ifdef MY_DEBUG
-        VM_CALL(jio_fprintf)(stdout, "Number of lwps in the process is %d\n",
-                    Mystatus.pr_nlwp);
-        VM_CALL(jio_fprintf)(stdout, "My lwp id is %d\n", _lwp_self());
-#endif
-        lwpid_list_len = Mystatus.pr_nlwp;
-        if (syscall(SYS_ioctl, procfd, PIOCLWPIDS, lwpid_list) == -1) {
-#ifdef MY_DEBUG
-            VM_CALL(jio_fprintf)(stderr, "Can't read proc's lwpid list");
-#endif
-            return;
-        }
-
-        print_lwps();
-
-        /* suspend all the lwps */
-        suspend_lwps();
-
-        /* make sure all the lwps have actually stopped */
-        wait_stopped_lwps();
-
-        /* make sure the list has not changed while you were not looking
-           else start all over again */
-        if (lwpid_list_len != oldlwpid_list_len) changed = B_TRUE;
-        else  {
-            for (i=0; i<lwpid_list_len; ++i) {
-                if (lwpid_list[i] != oldlwpid_list[i]) {
-                    changed = B_TRUE; break;
-                }
-            }
-        }
-        if (!changed) break;
-
-        {
-            id_t *tmplwpid_list = oldlwpid_list;
-            oldlwpid_list = lwpid_list; oldlwpid_list_len = lwpid_list_len;
-            lwpid_list = 0; lwpid_list_len = 0;
-            lwpid_list = tmplwpid_list;
-        }
-    }
-
-    /* record regs for threads that were not on LWPs */
-    record_thread_regs();
-
-    return;
-}
-
-
-/* Restart all lwps in process.  */
-static void
-restart_lwps()
-{
-    int i;
-
-    for (i = 0; i < Mystatus.pr_nlwp; i++) {
-        if (lwpid_list[i] == _lwp_self()) continue;
-        if (_lwp_continue(lwpid_list[i]) < 0) {
-#ifdef MY_DEBUG
-            VM_CALL(jio_fprintf)(stderr, "Failed to restart lwp %d\n",lwpid_list[i]);
-#endif
-        }
-    }
-
-    /* restore the old priority of the thread */
-    thr_setprio(thr_self(), gcprio);
-    /* restore the oldmask */
-    syscall(SYS_sigprocmask, SIG_SETMASK, &gcmask, NULL);
-
-    print_lwps();
-}
--- a/jdk/src/solaris/hpi/src/interrupt.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 1994, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Threads interrupt dispatch
- */
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include "hpi_impl.h"
-
-#include "interrupt.h"
-
-/* handler_entry_t is used to keep track of the registered handlers. */
-typedef struct handler_entry {
-    intr_handler_t handler;
-    void          *handlerArg;
-} handler_entry_t;
-
-static handler_entry_t handlerList[N_INTERRUPTS];
-
-/* Initialize the interrupt system */
-void
-intrInit()
-{
-    memset(handlerList, 0, sizeof(handlerList));
-    /*
-     * Target-dependent initialization.
-     */
-    intrInitMD();
-}
-
-/* Add/Remove a handler for a particular interrupt */
-
-signal_handler_t
-intrRegister(int interrupt, intr_handler_t handler, void *handlerArg)
-{
-    struct sigaction sigAct, sigActOld;
-
-    intrLock();
-
-    if (handler == (intr_handler_t)SYS_SIG_IGN ||
-        handler == (intr_handler_t)SYS_SIG_DFL) {
-        /* If we get IGN or DFL, register that as the process signal handler,
-         * and clear the handlerList entry.
-         */
-        sigAct.sa_handler = (void (*)(int))handler;
-        sigAct.sa_flags = 0;
-        sigaction(interrupt, &sigAct, &sigActOld);
-        handlerList[interrupt].handler = NULL;
-    } else {
-        /* Otherwise, we register intrDispatchMD as the common signal handler,
-         * and set the real handler in handlerList[interrupt].handler.
-         */
-#ifdef SA_SIGINFO
-        sigAct.sa_handler = 0;
-        sigAct.sa_sigaction = intrDispatchMD;
-        sigAct.sa_flags = SA_SIGINFO | SA_RESTART;
-#else
-        sigAct.sa_handler = intrDispatchMD;
-        sigAct.sa_flags = SA_RESTART;
-#endif
-        sigfillset(&sigAct.sa_mask);
-        sigaction(interrupt, &sigAct, &sigActOld);
-        handlerList[interrupt].handler = handler;
-        handlerList[interrupt].handlerArg = handlerArg;
-    }
-
-    intrUnlock();
-
-    /* If SA_SIGINFO is set, sa_sigaction is valid, otherwise sa_handler is. */
-#ifdef SA_SIGINFO
-    return (sigActOld.sa_flags & SA_SIGINFO) ?
-        (signal_handler_t)sigActOld.sa_sigaction :
-        (signal_handler_t)sigActOld.sa_handler;
-#else
-    return (signal_handler_t)sigActOld.sa_handler;
-#endif
-}
-
-/*
- * intrDispatch -- Dispatch an interrupt.
- *
- *                 This routine is called from the low-level handlers
- *                 at interrupt time.
- */
-void
-intrDispatch(int interrupt, void *siginfo, void *context)
-{
-    /*
-     * Assumptions:
-     *  - Each interrupt only has one priority level associated with
-     *    it.
-     *  - Each handler will do enough work so that when it returns
-     *    the source of the interrupt is masked.
-     */
-    handler_entry_t *entry = &handlerList[interrupt];
-    intr_handler_t handler = entry->handler;
-
-    if (handler) {
-        (*handler)(interrupt, siginfo, context, entry->handlerArg);
-        return;
-    }
-
-    /* No handler for this interrupt, log the error */
-    Log1(0, "spurious interrupt %d\n", interrupt);
-    return;
-}
-
-static void userSignalHandler(int sig, void *info, void *uc, void *arg)
-{
-    signal_handler_t handler = (signal_handler_t)arg;
-    /* for now we don't change the disposition of the signal in this case */
-    /* sysSignal(sig, SYS_SIG_DFL); */
-    handler(sig, info, uc);
-}
-
-signal_handler_t sysSignal(int sig, signal_handler_t newHandler)
-{
-    handler_entry_t *entry = &handlerList[sig];
-    void *oldHandlerArg = entry->handlerArg;
-    signal_handler_t oldHandler;
-
-    if (intrInUse(sig)) {
-        return SYS_SIG_ERR;
-    }
-
-#ifdef __linux__
-    oldHandler = intrRegister(sig, (intr_handler_t)userSignalHandler, (void *)newHandler);
-#else
-    oldHandler = intrRegister(sig, userSignalHandler, (void *)newHandler);
-#endif
-    /* If the old handler is intrDispatchMD, we get the real handler from
-     * entry->handlerArg.
-     */
-    if (oldHandler == (signal_handler_t)intrDispatchMD) {
-        oldHandler = (signal_handler_t)oldHandlerArg;
-    }
-
-    return oldHandler;
-}
-
-void sysRaise(int sig)
-{
-    raise(sig);
-}
--- a/jdk/src/solaris/hpi/src/linker_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Machine Dependent implementation of the dynamic linking support
- * for java.  This routine is Solaris specific.
- */
-
-#include "hpi_impl.h"
-
-#include <stdio.h>
-#include <dlfcn.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "path_md.h"
-#include "monitor_md.h"
-
-#ifndef NATIVE
-#include "iomgr.h"
-#include "threads_md.h"
-#endif
-
-/*
- * This lock protects the dl wrappers, assuring that two threads aren't
- * in libdl at the same time.
- */
-sys_mon_t _dl_lock;
-
-/*
- * Solaris green threads needs to lock around libdl.so.
- */
-#if defined(__solaris__) && !defined(NATIVE)
-    #define NEED_DL_LOCK
-#endif
-
-/*
- * create a string for the JNI native function name by adding the
- * appropriate decorations.
- */
-int
-sysBuildFunName(char *name, int nameLen, int args_size, int encodingIndex)
-{
-  /* On Solaris, there is only one encoding method. */
-    if (encodingIndex == 0)
-        return 1;
-    return 0;
-}
-
-/*
- * create a string for the dynamic lib open call by adding the
- * appropriate pre and extensions to a filename and the path
- */
-void
-sysBuildLibName(char *holder, int holderlen, char *pname, char *fname)
-{
-    const size_t pnamelen = pname ? strlen(pname) : 0;
-
-    /* Quietly truncate on buffer overflow.  Should be an error. */
-    if (pnamelen + strlen(fname) + 10 > (size_t) holderlen) {
-        *holder = '\0';
-        return;
-    }
-
-    if (pnamelen == 0) {
-        sprintf(holder, "lib%s.so", fname);
-    } else {
-        sprintf(holder, "%s/lib%s.so", pname, fname);
-    }
-}
-
-
-#ifdef __linux__
-    static int thr_main(void)
-    {
-        return -1;
-    }
-#else
-   #ifndef NATIVE
-   extern int thr_main(void);
-   #endif
-#endif
-
-void *
-sysLoadLibrary(const char *name, char *err_buf, int err_buflen)
-{
-    void * result;
-
-#ifdef NEED_DL_LOCK
-    sysMonitorEnter(sysThreadSelf(), &_dl_lock);
-    result = dlopen(name, RTLD_NOW);
-    sysMonitorExit(sysThreadSelf(), &_dl_lock);
-#else
-    result = dlopen(name, RTLD_LAZY);
-#endif
-    /*
-     * This is a bit of bulletproofing to catch the commonly occurring
-     * problem of people loading a library which depends on libthread into
-     * the VM.  thr_main() should always return -1 which means that libthread
-     * isn't loaded.
-     */
-#ifndef NATIVE
-    if (thr_main() != -1) {
-         VM_CALL(panic)("libthread loaded into green threads");
-    }
-#endif
-    if (result == NULL) {
-        strncpy(err_buf, dlerror(), err_buflen-2);
-        err_buf[err_buflen-1] = '\0';
-    }
-    return result;
-}
-
-void
-sysUnloadLibrary(void *handle)
-{
-#ifdef NEED_DL_LOCK
-    sysMonitorEnter(sysThreadSelf(), &_dl_lock);
-    dlclose(handle);
-    sysMonitorExit(sysThreadSelf(), &_dl_lock);
-#else
-    dlclose(handle);
-#endif
-}
-
-void *
-sysFindLibraryEntry(void *handle, const char *name)
-{
-    void *sym;
-#ifdef NEED_DL_LOCK
-    sysMonitorEnter(sysThreadSelf(), &_dl_lock);
-    sym = dlsym(handle, name);
-    sysMonitorExit(sysThreadSelf(), &_dl_lock);
-#else
-    sym = dlsym(handle, name);
-#endif
-    return sym;
-}
--- a/jdk/src/solaris/hpi/src/memory_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,439 +0,0 @@
-/*
- * Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Implementation of primitive memory allocation.
- *
- * The only thing machine dependent about this allocator is how it
- * initially finds all of the possible memory, and how it implements
- * mapChunk() and unmapChunk().
- *
- * This is all pretty simple stuff.  It is not likely to be banged on
- * frequently enough to be a performance issue, unless the underlying
- * primitives are.  Implementing things:
- *
- * HPI function      Solaris   "malloc"    Win32
- * --------------------------------------------------------------------
- * sysMapMem()       mmap()     malloc()   VirtualAlloc(...MEM_RESERVE...)
- * sysUnMapMem()     munmap()   free()     VirtualFree(...MEM_RESERVE...)
- * sysCommitMem()    no-op      no-op      VirtualAlloc(...MEM_COMMIT...)
- * sysDecommitMem()  no-op      no-op      VirtualFree(...MEM_COMMIT...)
- *
- * Memory mapping is the default, but compiling with -DUSE_MALLOC gives
- * a system based on malloc().
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>      /* For perror() */
-#include <string.h>
-#include <malloc.h>
-
-#include "hpi_impl.h"
-
-#ifndef USE_MALLOC
-
-#include <sys/mman.h>
-#include <fcntl.h>
-#ifdef __linux__
-#ifndef MAP_ANONYMOUS
-static int devZeroFD;
-#endif
-#else
-static int devZeroFD;
-#endif
-
-#endif /* !USE_MALLOC */
-
-#ifdef __linux__
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-static size_t memGrainSize;     /* A page for Linux */
-#else
-static unsigned int memGrainSize;       /* A page for Solaris */
-#endif
-
-/*
- * Mem size rounding is done at this level.  The calling code asks
- * these routines for literally what it thinks it wants.  The size is
- * rounded up to the first multiple of memGrainSize that contains
- * requestedSize bytes.
- */
-
-static long
-roundUpToGrain(long value)
-{
-    return (value + memGrainSize - 1) & ~(memGrainSize - 1);
-}
-
-static long
-roundDownToGrain(long value)
-{
-    return value & ~(memGrainSize - 1);
-}
-
-void
-InitializeMem(void)
-{
-    static int init = 0;
-
-    if (init) {
-        return;         /* Subsequent calls are no-ops */
-    }
-
-    /*
-     * Set system-specific variables used by mem allocator
-     */
-    if (memGrainSize == 0) {
-        memGrainSize = (int) sysconf(_SC_PAGESIZE);
-    }
-
-#ifdef __linux__
-#if !defined(USE_MALLOC) && !defined(MAP_ANONYMOUS)
-    devZeroFD = open("/dev/zero", O_RDWR);
-    if (devZeroFD == -1) {
-        perror("devzero");
-        exit(1);
-    }
-#endif /* !USE_MALLOC MAP_ANONYMOUS*/
-#else
-#ifndef USE_MALLOC
-    devZeroFD = open("/dev/zero", O_RDWR);
-    if (devZeroFD == -1) {
-        perror("devzero");
-        exit(1);
-    }
-#endif /* !USE_MALLOC */
-#endif
-
-    init = 1;           /* We're initialized now */
-}
-
-
-#ifndef USE_MALLOC
-
-#define PROT_ALL (PROT_READ|PROT_WRITE|PROT_EXEC)
-
-#ifndef MAP_NORESERVE
-#define MAP_NORESERVE 0
-#endif
-
-/*
- * Map a chunk of memory.  Return the address of the base if successful,
- * 0 otherwise.  We do not care where the mapped memory is, and can't
- * even express a preference in the current HPI.  If any platforms
- * require us to manage addresses of mapped chunks explicitly, that
- * must be done below the HPI.
- */
-static char *
-mapChunk(long length)
-{
-    char *ret;
-
-#if defined(__linux__) && defined(MAP_ANONYMOUS)
-     ret = (char *) mmap(0, length, PROT_ALL,
-                         MAP_NORESERVE | MAP_PRIVATE | MAP_ANONYMOUS,
-                         -1, (off_t) 0);
-#else
-    ret = (char *) mmap(0, length, PROT_ALL, MAP_NORESERVE|MAP_PRIVATE,
-                   devZeroFD, (off_t) 0);
-#endif
-    return (ret == MAP_FAILED ? 0 : ret);
-}
-
-/*
- * Map a chunk of memory at a specific address and reserve swap space
- * for it.  This is currently only used to remap space previously mapped
- * MAP_NORESERVE, reserving swap and getting native error handling.  We
- * assume that all alignment and rounding has been done by the caller.
- * Return 1 if successful and 0 otherwise.
- */
-static char *
-mapChunkReserve(char *addr, long length)
-{
-    char *ret;
-#if defined(__linux__) && defined(MAP_ANONYMOUS)
-     ret = (char *) mmap(addr, length, PROT_ALL,
-                         MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
-                         -1, (off_t) 0);
-#else
-    ret = (char *) mmap(addr, length, PROT_ALL, MAP_FIXED|MAP_PRIVATE,
-                        devZeroFD, (off_t) 0);
-#endif
-    return (ret == MAP_FAILED ? 0 : ret);
-}
-
-/*
- * Map a chunk of memory at a specific address and reserve swap space
- * for it.  This is currently only used to remap space previously mapped
- * MAP_RESERVE, unreserving swap and getting native error handling.  We
- * assume that all alignment and rounding has been done by the caller.
- * Return 1 if successful and 0 otherwise.
- */
-static char *
-mapChunkNoreserve(char *addr, long length)
-{
-    char *ret;
-
-#if defined(__linux__) && defined(MAP_ANONYMOUS)
-     ret = (char *) mmap(addr, length, PROT_ALL,
-                       MAP_FIXED | MAP_PRIVATE |
-                         MAP_NORESERVE | MAP_ANONYMOUS,
-                         -1, (off_t) 0);
-#else
-    ret = (char *) mmap(addr, length, PROT_ALL,
-                        MAP_FIXED|MAP_PRIVATE|MAP_NORESERVE,
-                        devZeroFD, (off_t) 0);
-#endif
-    return (ret == MAP_FAILED ? 0 : ret);
-}
-
-/*
- * Unmap a chunk of memory.  Return 1 if successful, 0 otherwise.  We
- * currently don't do any alignment or rounding, assuming that we only
- * will unmap chunks that have previously been returned by mapChunk().
- */
-static int
-unmapChunk(void *addr, long length)
-{
-    return (munmap(addr, length) == 0);
-}
-
-#endif /* !USE_MALLOC */
-
-
-/* HPI Functions: */
-
-/*
- * Map a range of virtual memory.  Note that the size asked for here
- * is literally what the upper level has asked for.  We need to do
- * any rounding, etc. here.  If mapping fails return 0, otherwise
- * return the address of the base of the mapped memory.
- */
-void *
-sysMapMem(size_t requestedSize, size_t *mappedSize)
-{
-    void *mappedAddr;
-
-    *mappedSize = roundUpToGrain(requestedSize);
-#ifdef USE_MALLOC
-    mappedAddr = (void *) sysMalloc(*mappedSize); /* Returns 0 on failure */
-#ifdef __linux__
-     if (mappedAddr) {
-       memset(mappedAddr, 0, *mappedSize);
-       mappedAddr = (void *) roundUpToGrain(mappedAddr);
-     }
-#endif
-#else
-    mappedAddr = mapChunk(*mappedSize);           /* Returns 0 on failure */
-#endif /* USE_MALLOC */
-    if (mappedAddr) {
-        Log3(2, "sysMapMem: 0x%x bytes at 0x%x (request: 0x%x bytes)\n",
-             *mappedSize, mappedAddr, requestedSize);
-    } else {
-        Log1(2, "sysMapMem failed: (request: 0x%x bytes)\n", requestedSize);
-    }
-    return mappedAddr;
-}
-
-/*
- * Unmap a range of virtual memory.  Note that the size asked for here
- * is literally what the upper level has asked for.  We need to do any
- * rounding, etc. here.  If unmapping fails return 0, otherwise return
- * the address of the base of the unmapped memory.
- */
-void *
-sysUnmapMem(void *requestedAddr, size_t requestedSize, size_t *unmappedSize)
-{
-    void *unmappedAddr;
-    int ret;
-
-    *unmappedSize = roundUpToGrain(requestedSize);
-#ifdef USE_MALLOC
-    sysFree(requestedAddr);
-    ret = 1;
-#else
-    ret = unmapChunk(requestedAddr, *unmappedSize);
-#endif /* USE_MALLOC */
-    if (ret) {
-        unmappedAddr = requestedAddr;
-        Log4(2,
-             "sysUnmapMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *unmappedSize, unmappedAddr, requestedSize, requestedAddr);
-    } else {
-        unmappedAddr = 0;
-        Log2(2, "sysUnmapMem failed: (request: 0x%x bytes at 0x%x)\n",
-             requestedSize, requestedAddr);
-    }
-    return unmappedAddr;
-}
-
-/*
- * Commit/decommit backing store to a range of virtual memory.  This range
- * needs not be identical to a mapped range, but must be a subset of one.
- * On Solaris, we remap the range to reserve swap for the space on
- * commit.  We don't strictly need to do this, as Solaris will demand
- * page pages that we've mapped when we want to access them.  But by
- * reserving swap we get reasonable error handling for free where we'd
- * otherwise end up getting a SIGBUS on a random write when we run out
- * of swap.  It also emphasizes the general need for shared code to
- * postpone committing to mapped memory for as long as is feasible.
- * When Java really needs space (the thread stacks excepted), it will
- * soon write over it (heap, markbits), so we don't really get much from
- * demand paging.
- *
- * We do not validate that commitment requests cover already-mapped
- * memory, although in principle we could.  The size asked for here
- * is what the upper level has asked for.  We need to do any platform-
- * dependent rounding here.
- *
- * When you commit, you commit to the entire page (or whatever quantum
- * your O/S requires) containing the pointer, and return the beginning of
- * that page.  When you decommit, you decommit starting at the next page
- * *up* from that containing the pointer, except that decommitting from
- * a pointer to the beginning of the page operates on that page.
- */
-
-/*
- * Return the address of the base of the newly committed memory, or 0
- * if committing failed.
- */
-void *
-sysCommitMem(void *requestedAddr, size_t requestedSize, size_t *committedSize)
-{
-    void *committedAddr;
-    char *ret;
-
-    *committedSize = roundUpToGrain(requestedSize);
-    committedAddr = (void *) roundDownToGrain((long) requestedAddr);
-#ifdef USE_MALLOC
-#ifdef __linux__
-    ret = committedAddr;
-#else
-    ret = requestedAddr;
-#endif
-#else
-    ret = mapChunkReserve(committedAddr, *committedSize);
-#endif
-    if (ret) {
-        committedAddr = ret;
-        Log4(2,
-    "sysCommitMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *committedSize, committedAddr, requestedSize, requestedAddr);
-    } else {
-        committedAddr = 0;
-        Log2(2, "sysCommitMem failed: (request: 0x%x bytes at 0x%x)\n",
-             requestedSize, requestedAddr);
-    }
-
-    return committedAddr;
-}
-
-/*
- * Return the address of the base of the newly decommitted memory, or 0
- * if decommitting failed.
- */
-void *
-sysDecommitMem(void *requestedAddr, size_t requestedSize,
-               size_t *decommittedSize)
-{
-    void *decommittedAddr;
-    char *ret;
-
-    *decommittedSize = roundDownToGrain(requestedSize);
-    decommittedAddr = (void *) roundUpToGrain((long) requestedAddr);
-#ifdef USE_MALLOC
-    ret = 0;
-#else
-    ret = mapChunkNoreserve(decommittedAddr, *decommittedSize);
-#endif
-    Log4(2,
-         "sysDecommitMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-         *decommittedSize, decommittedAddr, requestedSize, requestedAddr);
-
-    return ret;
-}
-
-/*
- * Allocate memory on an alignment boundary.  Returns aligned
- * pointer to new memory.  Use sysFreeBlock to free the block.
- *
- * sysAllocBlock() is similar to memalign(), except that it also
- * returns a pointer to the beginning of the block returned by the
- * OS, which must be used to deallocate the block.  (On some OSes,
- * these two won't be the same.)  sysAllocBlock() is also more
- * limited than memalign in that it can only be used to allocate
- * on particular alignments (PAGE_ALIGNMENT) and should be assumed
- * to round the sizes of allocated blocks up to multiples of the
- * alignment value (PAGE_ALIGNMENT*n bytes).
- */
-void *
-sysAllocBlock(size_t size, void** allocHead)
-{
-    void* alignedPtr = memalign(PAGE_ALIGNMENT, size);
-    *allocHead = alignedPtr;
-    return alignedPtr;
-}
-
-/*
- * Wrapper to free block allocated by sysMemAlign.
- */
-void
-sysFreeBlock(void *allocHead)
-{
-    free(allocHead);
-}
-
-void * sysMalloc(size_t s)
-{
-    if (s == 0)
-        return malloc(1);
-    return malloc(s);
-}
-
-void * sysRealloc(void *p, size_t s)
-{
-    return realloc(p, s);
-}
-
-void sysFree(void *p)
-{
-    if (p != NULL)
-        free(p);
-}
-
-void * sysCalloc(size_t s1, size_t s2)
-{
-    if (s1 == 0 || s2 == 0)
-        return calloc(1, 1);
-    return calloc(s1, s2);
-}
-
-char * sysStrdup(const char * string)
-{
-    return strdup(string);
-}
--- a/jdk/src/solaris/hpi/src/system_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "hpi_impl.h"
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h> /* timeval */
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
-#include <netdb.h>
-#include <limits.h>
-#include <errno.h>
-
-#include <dlfcn.h>
-
-#include "jni_md.h"
-#include "mutex_md.h"
-
-#include "hpi_init.h"
-
-#include "interrupt.h"
-#include "threads_md.h"
-#include "monitor_md.h"
-#include "largefile.h"
-
-
-#define O_DELETE 0x10000
-
-int sysThreadBootstrap(sys_thread_t **tidP, sys_mon_t **lockP, int nb)
-{
-    threadBootstrapMD(tidP, lockP, nb);
-
-    intrInit();
-
-#ifndef NATIVE
-    /* Initialize the special case for sbrk on Solaris (see synch.c) */
-    InitializeSbrk();
-    /* Initialize the async io */
-    InitializeAsyncIO();
-    InitializeMem();
-    /* Initialize Clock and Idle threads */
-    InitializeHelperThreads();
-#else /* if NATIVE */
-    initializeContentionCountMutex();
-    InitializeMem();
-#endif /* NATIVE */
-
-    return SYS_OK;
-}
-
-int sysShutdown()
-{
-    return SYS_OK;
-}
-
-long
-sysGetMilliTicks()
-{
-    struct timeval tv;
-
-    (void) gettimeofday(&tv, (void *) 0);
-    return((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
-}
-
-jlong
-sysTimeMillis()
-{
-    struct timeval t;
-    gettimeofday(&t, 0);
-    return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000);
-}
-
-int
-sysGetLastErrorString(char *buf, int len)
-{
-    if (errno == 0) {
-        return 0;
-    } else {
-        const char *s = strerror(errno);
-        int n = strlen(s);
-        if (n >= len) n = len - 1;
-        strncpy(buf, s, n);
-        buf[n] = '\0';
-        return n;
-    }
-}
-
-/*
- * File system
- *
- * These are all the sys API which implement the straight POSIX
- * API. Those that do not are defined by thread-specific files
- * (i.e. io_md.c)
- */
-
-/*
- * Open a file. Unlink the file immediately after open returns
- * if the specified oflag has the O_DELETE flag set.
- */
-int sysOpen(const char *path, int oflag, int mode)
-{
-    int fd;
-    int delete = (oflag & O_DELETE);
-    oflag = oflag & ~O_DELETE;
-    fd = open64_w(path, oflag, mode);
-    if (delete != 0) {
-        unlink(path);
-    }
-    return fd;
-}
-
-char *sysNativePath(char *path)
-{
-    return path;
-}
-
-int
-sysFileSizeFD(int fd, jlong *size)
-{
-    struct stat64 buf64;
-    int ret = fstat64(fd, &buf64);
-    *size = buf64.st_size;
-    return ret;
-}
-
-int
-sysFfileMode(int fd, int *mode)
-{
-    struct stat64 buf64;
-    int ret = fstat64(fd, &buf64);
-    (*mode) = buf64.st_mode;
-    return ret;
-}
-
-int
-sysFileType(const char *path)
-{
-    int ret;
-    struct stat buf;
-
-    if ((ret = stat(path, &buf)) == 0) {
-      mode_t mode = buf.st_mode & S_IFMT;
-      if (mode == S_IFREG) return SYS_FILETYPE_REGULAR;
-      if (mode == S_IFDIR) return SYS_FILETYPE_DIRECTORY;
-      return SYS_FILETYPE_OTHER;
-    }
-    return ret;
-}
-
-/*
- * Wrapper functions for low-level I/O routines - use the 64 bit
- * version if available, else revert to the 32 bit versions.
- */
-
-off64_t
-lseek64_w(int fd, off64_t offset, int whence)
-{
-    return lseek64(fd, offset, whence);
-}
-
-int
-ftruncate64_w(int fd, off64_t length)
-{
-    return ftruncate64(fd, length);
-}
-
-int
-open64_w(const char *path, int oflag, int mode)
-{
-    int fd = open64(path, oflag, mode);
-    if (fd == -1) return -1;
-
-    /* If the open succeeded, the file might still be a directory */
-    {
-        int st_mode;
-        if (sysFfileMode(fd, &st_mode) != -1) {
-            if ((st_mode & S_IFMT) == S_IFDIR) {
-                errno = EISDIR;
-                close(fd);
-                return -1;
-            }
-        } else {
-            close(fd);
-            return -1;
-        }
-    }
-
-    /*
-     * 32-bit Solaris systems suffer from:
-     *
-     * - an historical default soft limit of 256 per-process file
-     *   descriptors that is too low for many Java programs.
-     *
-     * - a design flaw where file descriptors created using stdio
-     *   fopen must be less than 256, _even_ when the first limit above
-     *   has been raised.  This can cause calls to fopen (but not calls to
-     *   open, for example) to fail mysteriously, perhaps in 3rd party
-     *   native code (although the JDK itself uses fopen).  One can hardly
-     *   criticize them for using this most standard of all functions.
-     *
-     * We attempt to make everything work anyways by:
-     *
-     * - raising the soft limit on per-process file descriptors beyond
-     *   256 (done by hotspot)
-     *
-     * - As of Solaris 10u4, we can request that Solaris raise the 256
-     *   stdio fopen limit by calling function enable_extended_FILE_stdio,
-     *   (also done by hotspot).  We check for its availability.
-     *
-     * - If we are stuck on an old (pre 10u4) Solaris system, we can
-     *   workaround the bug by remapping non-stdio file descriptors below
-     *   256 to ones beyond 256, which is done below.
-     *
-     * See:
-     * 1085341: 32-bit stdio routines should support file descriptors >255
-     * 6533291: Work around 32-bit Solaris stdio limit of 256 open files
-     * 6431278: Netbeans crash on 32 bit Solaris: need to call
-     *          enable_extended_FILE_stdio() in VM initialisation
-     * Giri Mandalika's blog
-     * http://technopark02.blogspot.com/2005_05_01_archive.html
-     */
-#if defined(__solaris__) && defined(_ILP32)
-    {
-        static int needToWorkAroundBug1085341 = -1;
-        if (needToWorkAroundBug1085341) {
-            if (needToWorkAroundBug1085341 == -1)
-                needToWorkAroundBug1085341 =
-                    (dlsym(RTLD_DEFAULT, "enable_extended_FILE_stdio") == NULL);
-            if (needToWorkAroundBug1085341 && fd < 256) {
-                int newfd = fcntl(fd, F_DUPFD, 256);
-                if (newfd != -1) {
-                    close(fd);
-                    fd = newfd;
-                }
-            }
-        }
-    }
-#endif /* 32-bit Solaris */
-
-    /*
-     * All file descriptors that are opened in the JVM and not
-     * specifically destined for a subprocess should have the
-     * close-on-exec flag set.  If we don't set it, then careless 3rd
-     * party native code might fork and exec without closing all
-     * appropriate file descriptors (e.g. as we do in closeDescriptors in
-     * UNIXProcess.c), and this in turn might:
-     *
-     * - cause end-of-file to fail to be detected on some file
-     *   descriptors, resulting in mysterious hangs, or
-     *
-     * - might cause an fopen in the subprocess to fail on a system
-     *   suffering from bug 1085341.
-     *
-     * (Yes, the default setting of the close-on-exec flag is a Unix
-     * design flaw)
-     *
-     * See:
-     * 1085341: 32-bit stdio routines should support file descriptors >255
-     * 4843136: (process) pipe file descriptor from Runtime.exec not being closed
-     * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
-     */
-#ifdef FD_CLOEXEC
-    {
-        int flags = fcntl(fd, F_GETFD);
-        if (flags != -1)
-            fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
-    }
-#endif
-    return fd;
-}
-
-void setFPMode(void)
-{
-#if    defined(__amd64)
-    asm("        pushq   $0x1F80");
-    /* ldmxcsr (%rsp) */
-    asm("        .byte   0x0f,0xae,0x14,0x24");
-    asm("        popq    %rax");
-#elif  defined(i386)
-    asm("        pushl $575");
-    asm("        fldcw (%esp)");
-    asm("        popl %eax");
-#endif
-#if defined(__linux__) && defined(__mc68000__)
-    asm("        fmovel #0x80,%fpcr");
-#endif
-}
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Fri Feb 04 16:29:41 2011 -0800
@@ -502,6 +502,13 @@
 #ifdef __linux__        /* There's no headless build on linux ... */
     if (!AWTIsHeadless()) { /* .. so need to call a function to check */
 #endif
+      /* Using the X11 font path to locate font files is now a fallback
+       * useful only if fontconfig failed, or is incomplete. So we could
+       * remove this code completely and the consequences should be rare
+       * and non-fatal. If this happens, then the calling Java code can
+       * be modified to no longer require that the AWT lock (the X11GE)
+       * be initialised prior to calling this code.
+       */
     AWT_LOCK();
     if (isDisplayLocal(env)) {
         x11dirs = getX11FontPath();
@@ -527,7 +534,7 @@
     return path;
 }
 
-JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
+JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPathNative
 (JNIEnv *env, jobject thiz, jboolean noType1) {
     jstring ret;
     static char *ptr = NULL; /* retain result across calls */
@@ -539,71 +546,6 @@
     return ret;
 }
 
-/*
- * In general setting the font path in a remote display situation is
- * problematic. But for Solaris->Solaris the paths needed by the JRE should
- * also be available to the server, although we have no way to check this
- * for sure.
- * So set the font path if we think its safe to do so:
- * All Solaris X servers at least back to 2.6 and up to Solaris 10
- * define the exact same vendor string.
- * The version number for Solaris 2.6 is 3600, for 2.7 is 3610 and
- * for Solaris 8 6410
- * we want to set the font path only for 2.8 and onwards. Earlier releases
- * are unlikely to have the right fonts and can't install "all locales"
- * as needed to be sure. Also Solaris 8 is the earliest release supported
- * by 1.5.
- */
-#ifndef HEADLESS
-static int isSunXServer() {
-#ifdef __solaris__
-  return ((strncmp(ServerVendor(awt_display), "Sun Microsystems, Inc.", 22) == 0) ||
-          (strncmp(ServerVendor(awt_display), "Oracle Corporation", 18) == 0) &&
-          VendorRelease(awt_display) >= 6410);
-#else
-  return 0;
-#endif /* __solaris__ */
-}
-
-/* Avoid re-doing work for every call to setNativeFontPath */
-static int doSetFontPath = -1;
-static int shouldSetXFontPath(JNIEnv *env) {
-  if (doSetFontPath == -1) {
-     doSetFontPath =
-       awt_display != NULL && (isDisplayLocal(env) || isSunXServer());
-  }
-  return doSetFontPath;
-}
-#endif /* !HEADLESS */
-
-JNIEXPORT void JNICALL Java_sun_font_X11FontManager_setNativeFontPath
-(JNIEnv *env, jclass obj, jstring theString) {
-#ifdef HEADLESS
-    return;
-#else
-    fDirRecord fDir;
-    const char *theChars;
-
-    if (awt_display == NULL) {
-        return;
-    }
-    AWT_LOCK();
-    if (shouldSetXFontPath(env)) {
-        theChars = (*env)->GetStringUTFChars (env, theString, 0);
-        fDir.num = 1;
-        fDir.name[0] = theChars;
-        /* printf ("Registering the font path here %s \n", theChars ); */
-        AddFontsToX11FontPath ( &fDir );
-        if (theChars) {
-            (*env)->ReleaseStringUTFChars (env,
-                                           theString, (const char*)theChars);
-        }
-    }
-    AWT_UNLOCK();
-
-#endif
-}
-
 #include <dlfcn.h>
 #ifndef __linux__ /* i.e. is solaris */
 #include <link.h>
@@ -1178,6 +1120,7 @@
         }
         pattern = (*FcNameParse)((FcChar8 *)fcName);
         if (pattern == NULL) {
+            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1194,6 +1137,8 @@
         (*FcDefaultSubstitute)(pattern);
         fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
         if (fontset == NULL) {
+            (*FcPatternDestroy)(pattern);
+            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1211,6 +1156,21 @@
         file     = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
         if (family == NULL || styleStr == NULL ||
             fullname == NULL || file == NULL) {
+            if (family != NULL) {
+                free(family);
+            }
+            if (styleStr != NULL) {
+                free(styleStr);
+            }
+            if (fullname != NULL) {
+                free(fullname);
+            }
+            if (file != NULL) {
+                free(file);
+            }
+            (*FcPatternDestroy)(pattern);
+            (*FcFontSetDestroy)(fontset);
+            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1237,6 +1197,14 @@
             result = (*FcPatternGetCharSet)(fontPattern,
                                             FC_CHARSET, 0, &charset);
             if (result != FcResultMatch) {
+                free(family);
+                free(family);
+                free(styleStr);
+                free(file);
+                (*FcPatternDestroy)(pattern);
+                (*FcFontSetDestroy)(fontset);
+                (*env)->ReleaseStringUTFChars(env,
+                                              fcNameStr, (const char*)fcName);
                 closeFontConfig(libfontconfig, JNI_FALSE);
                 return;
             }
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Fri Feb 04 16:29:41 2011 -0800
@@ -31,6 +31,21 @@
 
 #include <X11/extensions/Xrender.h>
 
+/* On Solaris 10 updates 8, 9, the render.h file defines these
+ * protocol values but does not define the structs in Xrender.h.
+ * Thus in order to get these always defined on Solaris 10
+ * we will undefine the symbols if we have determined via the
+ * makefiles that Xrender.h is lacking the structs. This will
+ * trigger providing our own definitions as on earlier updates.
+ * We could assume that *all* Solaris 10 update versions will lack the updated
+ * Xrender.h and do this based solely on O/S being any 5.10 version, but this
+ * could still change and we'd be broken again as we'd be re-defining them.
+ */
+#ifdef SOLARIS10_NO_XRENDER_STRUCTS
+#undef X_RenderCreateLinearGradient
+#undef X_RenderCreateRadialGradient
+#endif
+
 #ifndef X_RenderCreateLinearGradient
 typedef struct _XLinearGradient {
     XPointFixed p1;
--- a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Fri Feb 04 16:29:41 2011 -0800
@@ -35,48 +35,17 @@
 #include "nio_util.h"
 #include <dlfcn.h>
 
-static jfieldID chan_fd;        /* jobject 'fd' in sun.io.FileChannelImpl */
-
-#ifdef __solaris__
-typedef struct sendfilevec64 {
-    int     sfv_fd;         /* input fd */
-    uint_t  sfv_flag;       /* Flags. see below */
-    off64_t sfv_off;        /* offset to start reading from */
-    size_t  sfv_len;        /* amount of data */
-} sendfilevec_t;
-
-/* Function pointer for sendfilev on Solaris 8+ */
-typedef ssize_t sendfile_func(int fildes, const struct sendfilevec64 *vec,
-                              int sfvcnt, size_t *xferred);
-
-sendfile_func* my_sendfile_func = NULL;
+#if defined(__linux__) || defined(__solaris__)
+#include <sys/sendfile.h>
 #endif
 
-#ifdef __linux__
-#include <sys/sendfile.h>
-
-/* Function pointer for sendfile64 on Linux 2.6 (and newer 2.4 kernels) */
-typedef ssize_t sendfile64_func(int out_fd, int in_fd, off64_t *offset, size_t count);
-
-sendfile64_func* my_sendfile64_func = NULL;
-#endif
+static jfieldID chan_fd;        /* jobject 'fd' in sun.io.FileChannelImpl */
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_initIDs(JNIEnv *env, jclass clazz)
 {
     jlong pageSize = sysconf(_SC_PAGESIZE);
     chan_fd = (*env)->GetFieldID(env, clazz, "fd", "Ljava/io/FileDescriptor;");
-
-#ifdef __solaris__
-    if (dlopen("/usr/lib/libsendfile.so.1", RTLD_GLOBAL | RTLD_LAZY) != NULL) {
-        my_sendfile_func = (sendfile_func*) dlsym(RTLD_DEFAULT, "sendfilev64");
-    }
-#endif
-
-#ifdef __linux__
-    my_sendfile64_func = (sendfile64_func*) dlsym(RTLD_DEFAULT, "sendfile64");
-#endif
-
     return pageSize;
 }
 
@@ -178,22 +147,9 @@
                                             jlong position, jlong count,
                                             jint dstFD)
 {
-#ifdef __linux__
-    jlong max = (jlong)java_lang_Integer_MAX_VALUE;
-    jlong n;
-
-    if (my_sendfile64_func == NULL) {
-        off_t offset;
-        if (position > max)
-            return IOS_UNSUPPORTED_CASE;
-        if (count > max)
-            count = max;
-        offset = (off_t)position;
-        n = sendfile(dstFD, srcFD, &offset, (size_t)count);
-    } else {
-        off64_t offset = (off64_t)position;
-        n = (*my_sendfile64_func)(dstFD, srcFD, &offset, (size_t)count);
-    }
+#if defined(__linux__)
+    off64_t offset = (off64_t)position;
+    jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
     if (n < 0) {
         if (errno == EAGAIN)
             return IOS_UNAVAILABLE;
@@ -206,41 +162,37 @@
         return IOS_THROWN;
     }
     return n;
-#endif
+#elif defined (__solaris__)
+    sendfilevec64_t sfv;
+    size_t numBytes = 0;
+    jlong result;
 
-#ifdef __solaris__
-    if (my_sendfile_func == NULL) {
-        return IOS_UNSUPPORTED;
-    } else {
-        sendfilevec_t sfv;
-        size_t numBytes = 0;
-        jlong result;
+    sfv.sfv_fd = srcFD;
+    sfv.sfv_flag = 0;
+    sfv.sfv_off = (off64_t)position;
+    sfv.sfv_len = count;
 
-        sfv.sfv_fd = srcFD;
-        sfv.sfv_flag = 0;
-        sfv.sfv_off = (off64_t)position;
-        sfv.sfv_len = count;
-
-        result = (*my_sendfile_func)(dstFD, &sfv, 1, &numBytes);
+    result = sendfilev64(dstFD, &sfv, 1, &numBytes);
 
-        /* Solaris sendfilev() will return -1 even if some bytes have been
-         * transferred, so we check numBytes first.
-         */
-        if (numBytes > 0)
-            return numBytes;
-        if (result < 0) {
-            if (errno == EAGAIN)
-                return IOS_UNAVAILABLE;
-            if (errno == EOPNOTSUPP)
-                return IOS_UNSUPPORTED_CASE;
-            if ((errno == EINVAL) && ((ssize_t)count >= 0))
-                return IOS_UNSUPPORTED_CASE;
-            if (errno == EINTR)
-                return IOS_INTERRUPTED;
-            JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
-            return IOS_THROWN;
-        }
-        return result;
+    /* Solaris sendfilev() will return -1 even if some bytes have been
+     * transferred, so we check numBytes first.
+     */
+    if (numBytes > 0)
+        return numBytes;
+    if (result < 0) {
+        if (errno == EAGAIN)
+            return IOS_UNAVAILABLE;
+        if (errno == EOPNOTSUPP)
+            return IOS_UNSUPPORTED_CASE;
+        if ((errno == EINVAL) && ((ssize_t)count >= 0))
+            return IOS_UNSUPPORTED_CASE;
+        if (errno == EINTR)
+            return IOS_INTERRUPTED;
+        JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+        return IOS_THROWN;
     }
+    return result;
+#else
+    return IOS_UNSUPPORTED_CASE;
 #endif
 }
--- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java	Fri Feb 04 16:29:41 2011 -0800
@@ -63,7 +63,7 @@
                     if (eudcFile != null) {
                         try {
                             eudcFont = new TrueTypeFont(eudcFile, null, 0,
-                                                        true);
+                                                        false);
                         } catch (FontFormatException e) {
                         }
                     }
@@ -81,6 +81,10 @@
      */
     private static native String getEUDCFontFile();
 
+    public TrueTypeFont getEUDCFont() {
+        return eudcFont;
+    }
+
     public Win32FontManager() {
         super();
         AccessController.doPrivileged(new PrivilegedAction() {
@@ -137,6 +141,7 @@
         try {
             while (!found && parser.hasMoreTokens()) {
                 String newPath = parser.nextToken();
+                boolean isJREFont = newPath.equals(jreFontDirName);
                 File theFile = new File(newPath, fontFileName);
                 if (theFile.canRead()) {
                     found = true;
@@ -144,11 +149,11 @@
                     if (defer) {
                         registerDeferredFont(fontFileName, path,
                                              nativeNames,
-                                             fontFormat, true,
+                                             fontFormat, isJREFont,
                                              fontRank);
                     } else {
                         registerFontFile(path, nativeNames,
-                                         fontFormat, true,
+                                         fontFormat, isJREFont,
                                          fontRank);
                     }
                     break;
@@ -197,7 +202,7 @@
                                      familyToFontListMap,
                                  Locale locale);
 
-    public synchronized native String getFontPath(boolean noType1Fonts);
+    protected synchronized native String getFontPath(boolean noType1Fonts);
 
     public String[] getDefaultPlatformFont() {
 
@@ -277,4 +282,79 @@
 
     protected static native void deRegisterFontWithPlatform(String fontName);
 
+    /**
+     * populate the map with the most common windows fonts.
+     */
+    @Override
+    public HashMap<String, FamilyDescription> populateHardcodedFileNameMap() {
+        HashMap<String, FamilyDescription> platformFontMap
+            = new HashMap<String, FamilyDescription>();
+        FamilyDescription fd;
+
+        /* Segoe UI is the default UI font for Vista and later, and
+         * is used by the Win L&F which is used by FX too.
+         * Tahoma is used for the Win L&F on XP.
+         * Verdana is used in some FX UI controls.
+         */
+        fd = new FamilyDescription();
+        fd.familyName = "Segoe UI";
+        fd.plainFullName = "Segoe UI";
+        fd.plainFileName = "segoeui.ttf";
+        fd.boldFullName = "Segoe UI Bold";
+        fd.boldFileName = "segoeuib.ttf";
+        fd.italicFullName = "Segoe UI Italic";
+        fd.italicFileName = "segoeuii.ttf";
+        fd.boldItalicFullName = "Segoe UI Bold Italic";
+        fd.boldItalicFileName = "segoeuiz.ttf";
+        platformFontMap.put("segoe", fd);
+
+        fd = new FamilyDescription();
+        fd.familyName = "Tahoma";
+        fd.plainFullName = "Tahoma";
+        fd.plainFileName = "tahoma.ttf";
+        fd.boldFullName = "Tahoma Bold";
+        fd.boldFileName = "tahomabd.ttf";
+        platformFontMap.put("tahoma", fd);
+
+        fd = new FamilyDescription();
+        fd.familyName = "Verdana";
+        fd.plainFullName = "Verdana";
+        fd.plainFileName = "verdana.TTF";
+        fd.boldFullName = "Verdana Bold";
+        fd.boldFileName = "verdanab.TTF";
+        fd.italicFullName = "Verdana Italic";
+        fd.italicFileName = "verdanai.TTF";
+        fd.boldItalicFullName = "Verdana Bold Italic";
+        fd.boldItalicFileName = "verdanaz.TTF";
+        platformFontMap.put("verdana", fd);
+
+        /* The following are important because they are the core
+         * members of the default "Dialog" font.
+         */
+        fd = new FamilyDescription();
+        fd.familyName = "Arial";
+        fd.plainFullName = "Arial";
+        fd.plainFileName = "ARIAL.TTF";
+        fd.boldFullName = "Arial Bold";
+        fd.boldFileName = "ARIALBD.TTF";
+        fd.italicFullName = "Arial Italic";
+        fd.italicFileName = "ARIALI.TTF";
+        fd.boldItalicFullName = "Arial Bold Italic";
+        fd.boldItalicFileName = "ARIALBI.TTF";
+        platformFontMap.put("arial", fd);
+
+        fd = new FamilyDescription();
+        fd.familyName = "Symbol";
+        fd.plainFullName = "Symbol";
+        fd.plainFileName = "Symbol.TTF";
+        platformFontMap.put("symbol", fd);
+
+        fd = new FamilyDescription();
+        fd.familyName = "WingDings";
+        fd.plainFullName = "WingDings";
+        fd.plainFileName = "WINGDING.TTF";
+        platformFontMap.put("wingdings", fd);
+
+        return platformFontMap;
+    }
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Fri Feb 04 16:29:41 2011 -0800
@@ -228,31 +228,29 @@
 
         sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
 
-        synchronized (this) {
-            // Fix for bug #4046430 -- Race condition
-            // where notifyAll can be called before
-            // the "AWT-Windows" thread's parent thread is
-            // waiting, resulting in a deadlock on startup.
-
-            /*
-             * Fix for 4701990.
-             * AWTAutoShutdown state must be changed before the toolkit thread
-             * starts to avoid race condition.
-             */
-            AWTAutoShutdown.notifyToolkitThreadBusy();
+        /*
+         * Fix for 4701990.
+         * AWTAutoShutdown state must be changed before the toolkit thread
+         * starts to avoid race condition.
+         */
+        AWTAutoShutdown.notifyToolkitThreadBusy();
 
-            if (!startToolkitThread(this)) {
-                Thread toolkitThread = new Thread(this, "AWT-Windows");
-                toolkitThread.setDaemon(true);
-                toolkitThread.start();
-            }
+        if (!startToolkitThread(this)) {
+            Thread toolkitThread = new Thread(this, "AWT-Windows");
+            toolkitThread.setDaemon(true);
+            toolkitThread.start();
+        }
 
-            try {
-                wait();
+        try {
+            synchronized(this) {
+                while(!inited) {
+                    wait();
+                }
             }
-            catch (InterruptedException x) {
-            }
+        } catch (InterruptedException x) {
+            // swallow the exception
         }
+
         SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
 
         // Enabled "live resizing" by default.  It remains controlled
@@ -265,33 +263,38 @@
         setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
     }
 
+    private final void registerShutdownHook() {
+        AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                ThreadGroup currentTG =
+                    Thread.currentThread().getThreadGroup();
+                ThreadGroup parentTG = currentTG.getParent();
+                while (parentTG != null) {
+                    currentTG = parentTG;
+                    parentTG = currentTG.getParent();
+                }
+                Thread shutdown = new Thread(currentTG, new Runnable() {
+                    public void run() {
+                        shutdown();
+                    }
+                });
+                shutdown.setContextClassLoader(null);
+                Runtime.getRuntime().addShutdownHook(shutdown);
+                return null;
+            }
+        });
+     }
+
     public void run() {
         Thread.currentThread().setPriority(Thread.NORM_PRIORITY+1);
         boolean startPump = init();
 
         if (startPump) {
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    ThreadGroup currentTG =
-                        Thread.currentThread().getThreadGroup();
-                    ThreadGroup parentTG = currentTG.getParent();
-                    while (parentTG != null) {
-                        currentTG = parentTG;
-                        parentTG = currentTG.getParent();
-                    }
-                    Thread shutdown = new Thread(currentTG, new Runnable() {
-                            public void run() {
-                                shutdown();
-                            }
-                        });
-                    shutdown.setContextClassLoader(null);
-                    Runtime.getRuntime().addShutdownHook(shutdown);
-                    return null;
-                }
-            });
+            registerShutdownHook();
         }
 
         synchronized(this) {
+            inited = true;
             notifyAll();
         }
 
@@ -309,6 +312,8 @@
      * eventLoop() should Dispose the toolkit and exit.
      */
     private native boolean init();
+    private boolean inited = false;
+
     private native void eventLoop();
     private native void shutdown();
 
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java	Fri Feb 04 16:29:41 2011 -0800
@@ -439,7 +439,14 @@
 
         MediaTray[] arr = new MediaTray[nTray];
         int dmBin;
-        for (int i = 0, j=0; i < mediaTr.length; i++) {
+
+        /* Some drivers in Win 7 don't have the same length for DC_BINS and
+         * DC_BINNAMES so there is no guarantee that lengths of mediaTr and
+         * winMediaTrayNames are equal. To avoid getting ArrayIndexOutOfBounds,
+         * we need to make sure we get the minimum of the two.
+         */
+
+        for (int i = 0, j=0; i < Math.min(mediaTr.length, winMediaTrayNames.length); i++) {
             dmBin = mediaTr[i];
             if (dmBin > 0) {
                 // check for unsupported DMBINs and create new Win32MediaTray
--- a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c	Fri Feb 04 16:29:41 2011 -0800
@@ -29,12 +29,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// To ensure winsock2.h is used, it has to be included ahead of
+// windows.h, which includes winsock.h by default.
+#include <winsock2.h>
 #include <windows.h>
 #include <io.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <mmsystem.h>
-#include <winsock2.h>
 #include <fcntl.h>
 #include <process.h>
 
@@ -147,7 +149,7 @@
 void
 md_close(int filedes)
 {
-    (void)close(filedes);
+    (void)closesocket(filedes);
 }
 
 int
--- a/jdk/src/windows/hpi/export/byteorder_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*-
- * Win32 dependent machine byte ordering (actually intel ordering)
- */
-
-#ifndef _JAVASOFT_WIN32_BYTEORDER_MD_H_
-#define _JAVASOFT_WIN32_BYTEORDER_MD_H_
-
-#ifdef  x86
-#define ntohl(x)        ((x << 24) |                            \
-                          ((x & 0x0000ff00) << 8) |             \
-                          ((x & 0x00ff0000) >> 8) |             \
-                          (((unsigned long)(x & 0xff000000)) >> 24))
-#define ntohs(x)        (((x & 0xff) << 8) | ((x >> 8) & (0xff)))
-#define htonl(x)        ntohl(x)
-#define htons(x)        ntohs(x)
-#else   /* x86 */
-#define ntohl(x)        (x)
-#define ntohs(x)        (x)
-#define htonl(x)        (x)
-#define htons(x)        (x)
-#endif  /* x86 */
-
-#endif /* !_JAVASOFT_WIN32_BYTEORDER_MD_H_ */
--- a/jdk/src/windows/hpi/export/hpi_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _JAVASOFT_HPI_MD_H_
-#define _JAVASOFT_HPI_MD_H_
-
-#include "timeval_md.h"
-#include "io_md.h"
-#include "path_md.h"
-#include "byteorder_md.h"
-
-#define HPI_TIMEOUT_INFINITY ((jlong)(-1))
-
-#endif /* !_JAVASOFT_HPI_MD_H_ */
--- a/jdk/src/windows/hpi/export/io_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Win32 system dependent low level io definitions
- */
-
-#ifndef _JAVASOFT_WIN32_IO_MD_H_
-#define _JAVASOFT_WIN32_IO_MD_H_
-
-#include <stdio.h>
-#include <io.h>                 /* For read(), lseek() etc. */
-#include <direct.h>             /* For mkdir() */
-#include <windows.h>
-#include <winsock.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "jvm_md.h"
-
-#define R_OK    4
-#define W_OK    2
-#define X_OK    1
-#define F_OK    0
-
-#define MAXPATHLEN _MAX_PATH
-
-#define S_ISFIFO(mode)  (((mode) & _S_IFIFO) == _S_IFIFO)
-#define S_ISCHR(mode)   (((mode) & _S_IFCHR) == _S_IFCHR)
-#define S_ISDIR(mode)   (((mode) & _S_IFDIR) == _S_IFDIR)
-#define S_ISREG(mode)   (((mode) & _S_IFREG) == _S_IFREG)
-
-#define LINE_SEPARATOR "\r\n"
-
-#endif /* !_JAVASOFT_WIN32_IO_MD_H_ */
--- a/jdk/src/windows/hpi/export/path_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*-
- * Win32 dependent search path definitions and API
- */
-
-#ifndef _JAVASOFT_WIN32_PATH_MD_H_
-#define _JAVASOFT_WIN32_PATH_MD_H_
-
-#define PATH_SEPARATOR          ";"
-#define PATH_CURDIR             "."
-
-#define DIR_SEPARATOR           '/'
-#define LOCAL_DIR_SEPARATOR     '\\'
-
-#endif /* !_JAVASOFT_WIN32_PATH_MD_H_ */
--- a/jdk/src/windows/hpi/export/timeval_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-#ifndef _JAVASOFT_WIN32_TIMEVAL_H_
-#define _JAVASOFT_WIN32_TIMEVAL_H_
-
-typedef struct {
-        long tv_sec;
-        long tv_usec;
-} timeval_t;
-
-/*
- * Operations on timevals.
- *
- * NB: timercmp does not work for >=, <= or ==.
- */
-#define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
-#define timercmp(tvp, uvp, cmp) \
-        ((tvp)->tv_sec cmp (uvp)->tv_sec || \
-         (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
-#define timereq(tvp, uvp) \
-         ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec == (uvp)->tv_usec)
-#define timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0
-
-void timeradd(timeval_t*, timeval_t*);
-void timersub(timeval_t*, timeval_t*);
-
-#endif /* !_JAVASOFT_WIN32_TIMEVAL_H_ */
--- a/jdk/src/windows/hpi/include/monitor_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Win32 implementation of Java monitors
- */
-
-#ifndef _JAVASOFT_WIN32_MONITOR_MD_H_
-#define _JAVASOFT_WIN32_MONITOR_MD_H_
-
-#include <windows.h>
-
-#include "threads_md.h"
-#include "mutex_md.h"
-
-#define SYS_MID_NULL ((sys_mon_t *) 0)
-
-typedef struct sys_mon {
-    long            atomic_count;   /* Variable for atomic compare swap */
-    HANDLE          semaphore;      /* Semaphore used for the contention */
-    sys_thread_t   *monitor_owner;  /* Current owner of this monitor */
-    long            entry_count;    /* Recursion depth */
-    sys_thread_t   *monitor_waiter; /* Monitor waiting queue head */
-    long            waiter_count;   /* For debugging purpose */
-} sys_mon_t;
-
-#endif /* !_JAVASOFT_WIN32_MONITOR_MD_H_ */
--- a/jdk/src/windows/hpi/include/mutex_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Win32 implementation of mutexes. Here we use critical sections as
- * our mutexes. We could have used mutexes, but mutexes are heavier
- * weight than critical sections. Mutexes and critical sections are
- * semantically identical, the only difference being that mutexes
- * can operate between processes (i.e. address spaces).
- *
- * It's worth noting that the Win32 functions supporting critical
- * sections do not provide any error information whatsoever (i.e.
- * all critical section routines return (void)).
- */
-
-#ifndef _JAVASOFT_WIN32_MUTEX_MD_H_
-#define _JAVASOFT_WIN32_MUTEX_MD_H_
-
-#include <windows.h>
-
-typedef CRITICAL_SECTION mutex_t;
-
-#define mutexInit(m)    InitializeCriticalSection(m)
-#define mutexDestroy(m) DeleteCriticalSection(m)
-#define mutexLock(m)    EnterCriticalSection(m)
-#define mutexUnlock(m)  LeaveCriticalSection(m)
-
-#endif /* !_JAVASOFT_WIN32_MUTEX_MD_H_ */
--- a/jdk/src/windows/hpi/include/threads_md.h	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1994, 1999, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Win32 implementation of Java threads
- */
-
-#ifndef _JAVASOFT_WIN32_THREADS_MD_H_
-#define _JAVASOFT_WIN32_THREADS_MD_H_
-
-#include <windows.h>
-
-#define N_TRACED_REGS 7
-
-#define SYS_THREAD_NULL         ((sys_thread_t *) 0)
-
-/*
- * Machine dependent info in a sys_thread_t: Keep these values in
- * sync with the string array used by sysThreadDumpInfo() in threads_md.c!
- */
-typedef enum {
-    FIRST_THREAD_STATE,
-    RUNNABLE = FIRST_THREAD_STATE,
-    SUSPENDED,
-    MONITOR_WAIT,
-    CONDVAR_WAIT,
-    MONITOR_SUSPENDED,
-    NUM_THREAD_STATES
-} thread_state_t;
-
-struct sys_mon;
-
-/*
- * Machine dependent thread data structure
- */
-typedef struct sys_thread {
-    HANDLE handle;                  /* Win32 thread handle */
-    unsigned long id;               /* Win32 thread id */
-    long regs[N_TRACED_REGS];       /* Registers */
-    thread_state_t state;           /* Current thread state */
-    bool_t system_thread;           /* TRUE if this is a system thread */
-    bool_t interrupted;             /* Shadow thread interruption */
-    short  suspend_flags;
-    HANDLE interrupt_event;         /* Event signaled on thread interrupt */
-    struct sys_mon *wait_monitor;   /* Monitor the thread is waiting for */
-    struct sys_thread *next_waiter; /* Next thread in the waiting queue */
-    struct sys_mon *enter_monitor;  /* Monitor thread is waiting to enter */
-    void (*start_proc)(void *);    /* Thread start routine address */
-    void *start_parm;               /* Thread start routine parameter */
-    struct sys_thread *next;        /* Next thread in active thread queue */
-    void *stack_ptr;                /* Pointer into the stack segment */
-    unsigned int last_sum;
-    PNT_TIB nt_tib;                 /* Pointer to NT thread-local block */
-} sys_thread_t;
-
-#define MONITOR_WAIT_SUSPENDED 0x0001
-#define CONDVAR_WAIT_SUSPENDED 0x0002
-
-extern bool_t ThreadsInitialized;
-
-extern sys_mon_t *_sys_queue_lock;
-
-#define SYS_QUEUE_LOCK(self)    sysMonitorEnter(self, _sys_queue_lock)
-#define SYS_QUEUE_LOCKED(self)  sysMonitorEntered(self, _sys_queue_lock)
-#define SYS_QUEUE_UNLOCK(self)  sysMonitorExit(self, _sys_queue_lock)
-#define SYS_QUEUE_NOTIFYALL(self)  sysMonitorNotifyAll(self, _sys_queue_lock)
-#define SYS_QUEUE_WAIT(self) sysMonitorWait(self, _sys_queue_lock, \
-                                        SYS_TIMEOUT_INFINITY)
-
-#endif /* !_JAVASOFT_WIN32_THREADS_MD_H_ */
--- a/jdk/src/windows/hpi/src/linker_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 1994, 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.
- */
-
-/*
- * Maintains a list of currently loaded DLLs (Dynamic Link Libraries)
- * and their associated handles. Library names are case-insensitive.
- */
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "hpi_impl.h"
-
-#include "path_md.h"
-
-/*
- * create a string for the JNI native function name by adding the
- * appropriate decorations.
- *
- * On Win32, "__stdcall" functions are exported differently, depending
- * on the compiler. In MSVC 4.0, they are decorated with a "_" in the
- * beginning, and @nnn in the end, where nnn is the number of bytes in
- * the arguments (in decimal). Borland C++ exports undecorated names.
- *
- * sysBuildFunName handles different encodings depending on the value
- * of encodingIndex. It returns 0 when handed an out-of-range
- * encodingIndex.
- */
-int
-sysBuildFunName(char *name, int nameMax, int args_size, int encodingIndex)
-{
-  if (encodingIndex == 0) {
-    /* For Microsoft MSVC 4.0 */
-    char suffix[6];    /* This is enough since Java never has more than
-                           256 words of arguments. */
-    int nameLen;
-    int i;
-
-    sprintf(suffix, "@%d", args_size * 4);
-
-    nameLen = strlen(name);
-    if (nameLen >= nameMax - 7)
-        return 1;
-    for(i = nameLen; i > 0; i--)
-        name[i] = name[i-1];
-    name[0] = '_';
-
-    sprintf(name + nameLen + 1, "%s", suffix);
-    return 1;
-  } else if (encodingIndex == 1)
-    /* For Borland, etc. */
-    return 1;
-  else
-    return 0;
-}
-
-/*
- * Build a machine dependent library name out of a path and file name.
- */
-void
-sysBuildLibName(char *holder, int holderlen, char *pname, char *fname)
-{
-    const int pnamelen = pname ? strlen(pname) : 0;
-    const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
-
-    /* Quietly truncates on buffer overflow. Should be an error. */
-    if (pnamelen + strlen(fname) + 10 > holderlen) {
-        *holder = '\0';
-        return;
-    }
-
-    if (pnamelen == 0) {
-        sprintf(holder, "%s.dll", fname);
-    } else if (c == ':' || c == '\\') {
-        sprintf(holder, "%s%s.dll", pname, fname);
-    } else {
-        sprintf(holder, "%s\\%s.dll", pname, fname);
-    }
-}
-
-void *
-sysLoadLibrary(const char * name, char *err_buf, int err_buflen)
-{
-    void *result = LoadLibrary(name);
-    if (result == NULL) {
-        /* Error message is pretty lame, try to make a better guess. */
-        long errcode = GetLastError();
-        if (errcode == ERROR_MOD_NOT_FOUND) {
-            strncpy(err_buf, "Can't find dependent libraries", err_buflen-2);
-            err_buf[err_buflen-1] = '\0';
-        } else {
-            sysGetLastErrorString(err_buf, err_buflen);
-        }
-    }
-    return result;
-}
-
-void sysUnloadLibrary(void *handle)
-{
-    FreeLibrary(handle);
-}
-
-void * sysFindLibraryEntry(void *handle, const char *name)
-{
-    return GetProcAddress(handle, name);
-}
--- a/jdk/src/windows/hpi/src/memory_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 1995, 2002, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Implementation of primitive memory allocation.
- *
- * The only thing machine dependent about this allocator is how it
- * initially finds all of the possible memory, and how it implements
- * mapChunk() and unmapChunk().
- *
- * This is all pretty simple stuff.  It is not likely to be banged on
- * frequently enough to be a performance issue, unless the underlying
- * primitives are.  Implementing things:
- *
- * HPI function      Solaris   "malloc"    Win32
- * --------------------------------------------------------------------
- * sysMapMem()       mmap()     malloc()   VirtualAlloc(...MEM_RESERVE...)
- * sysUnMapMem()     munmap()   free()     VirtualFree(...MEM_RESERVE...)
- * sysCommitMem()    no-op      no-op      VirtualAlloc(...MEM_COMMIT...)
- * sysDecommitMem()  no-op      no-op      VirtualFree(...MEM_COMMIT...)
- *
- * Memory mapping is the default, but compiling with -DUSE_MALLOC gives
- * a system based on malloc().
- */
-
-#include <windows.h>
-#include <sys/types.h>
-
-#include "hpi_impl.h"
-
-static size_t
-roundUp(size_t n, size_t m)
-{
-    return (n + m - 1) & ~(m - 1);
-}
-
-static size_t
-roundDown(size_t n, size_t m)
-{
-    return n & ~(m - 1);
-}
-
-#define RESERVE_SIZE 65536      /* Memory is reserved in 64KB chunks */
-
-static size_t pageSize;         /* Machine page size */
-
-void
-InitializeMem()
-{
-    SYSTEM_INFO si;
-
-    GetSystemInfo(&si);
-    pageSize = si.dwPageSize;
-}
-
-/* HPI Functions: */
-
-/*
- * Map a range of virtual memory.  Note that the size asked for here
- * is literally what the upper level has asked for.  We need to do
- * any rounding, etc. here.  If mapping fails return 0, otherwise
- * return the address of the base of the mapped memory.
- */
-void *
-sysMapMem(size_t requestedSize, size_t *mappedSize)
-{
-    void *mappedAddr;
-
-#ifdef USE_MALLOC
-    *mappedSize = roundUp(requestedSize, pageSize);
-    mappedAddr = (void *)malloc(*mappedSize);
-#else
-    *mappedSize = roundUp(requestedSize, RESERVE_SIZE);
-    mappedAddr = VirtualAlloc(NULL, *mappedSize, MEM_RESERVE, PAGE_READWRITE);
-#endif
-    if (mappedAddr != NULL) {
-        Log3(2, "sysMapMem: 0x%x bytes at 0x%x (request: 0x%x bytes)\n",
-             *mappedSize, mappedAddr, requestedSize);
-    } else {
-        Log1(2, "sysMapMem failed: (request: 0x%x bytes)\n", requestedSize);
-    }
-    return mappedAddr;
-}
-
-/*
- * Unmap a range of virtual memory.  Note that the size asked for here
- * is literally what the upper level has asked for.  We need to do any
- * rounding, etc. here.  If unmapping fails return 0, otherwise return
- * the address of the base of the unmapped memory.
- */
-void *
-sysUnmapMem(void *requestedAddr, size_t requestedSize, size_t *unmappedSize)
-{
-    void *unmappedAddr;
-    int ret;
-
-#ifdef USE_MALLOC
-    *unmappedSize = roundUp(requestedSize, pageSize);
-    free(requestedAddr);
-    ret = TRUE;
-#else
-    *unmappedSize = roundUp(requestedSize, RESERVE_SIZE);
-    ret = VirtualFree(requestedAddr, 0, MEM_RELEASE);
-#endif
-    if (ret) {
-        unmappedAddr = requestedAddr;
-        Log4(2,
-             "sysUnmapMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *unmappedSize, unmappedAddr, requestedSize, requestedAddr);
-    } else {
-        unmappedAddr = NULL;
-        Log2(2, "sysUnmapMem failed: (request: 0x%x bytes at 0x%x)\n",
-             requestedSize, requestedAddr);
-    }
-    return unmappedAddr;
-}
-
-/*
- * Commit/decommit backing store to a range of virtual memory.  This range
- * needs not be identical to a mapped range, but must be a subset of one.
- * On Solaris, we remap the range to reserve swap for the space on
- * commit.  We don't strictly need to do this, as Solaris will demand
- * page pages that we've mapped when we want to access them.  But by
- * reserving swap we get reasonable error handling for free where we'd
- * otherwise end up getting a SIGBUS on a random write when we run out
- * of swap.  It also emphasizes the general need for shared code to
- * postpone committing to mapped memory for as long as is feasible.
- * When Java really needs space (the thread stacks excepted), it will
- * soon write over it (heap, markbits), so we don't really get much from
- * demand paging.
- *
- * We do not validate that commitment requests cover already-mapped
- * memory, although in principle we could.  The size asked for here
- * is what the upper level has asked for.  We need to do any platform-
- * dependent rounding here.
- *
- * When you commit, you commit to the entire page (or whatever quantum
- * your O/S requires) containing the pointer, and return the beginning of
- * that page.  When you decommit, you decommit starting at the next page
- * *up* from that containing the pointer, except that decommitting from
- * a pointer to the beginning of the page operates on that page.
- */
-
-/*
- * Return the address of the base of the newly committed memory, or 0
- * if committing failed.
- */
-void *
-sysCommitMem(void *requestedAddr, size_t requestedSize, size_t *committedSize)
-{
-    void *committedAddr;
-
-    *committedSize = roundUp(requestedSize, pageSize);
-    committedAddr = VirtualAlloc(requestedAddr, *committedSize, MEM_COMMIT,
-                                 PAGE_READWRITE);
-    if (committedAddr != NULL) {
-        Log4(2,
-             "sysCommitMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *committedSize, committedAddr, requestedSize, requestedAddr);
-    } else {
-        Log2(2, "sysCommitMem failed: (request: 0x%x bytes at 0x%x)\n",
-             requestedSize, requestedAddr);
-    }
-    return committedAddr;
-}
-
-/*
- * Return the address of the base of the newly decommitted memory, or 0
- * if decommitting failed.
- */
-void *
-sysDecommitMem(void *requestedAddr, size_t requestedSize,
-               size_t *decommittedSize)
-{
-    void *decommittedAddr;
-
-    /*
-     * We round the size down to a multiple of the page size and
-     * round the address up.  This ensures that we never decommit
-     * more that we intend to.
-     */
-    *decommittedSize = roundDown(requestedSize, pageSize);
-    decommittedAddr = (void *)roundUp((size_t)requestedAddr, pageSize);
-
-    /*
-     * If the rounded size is equal to zero we simply fail.  Passing
-     * 0 to VirtualFree seems to cause the entire region to be released,
-     * which is definitely not what we want, since that probably means
-     * that decommittedAddr is at the end of the current mapping which
-     * may be the beginning of the next mapping.
-     */
-    if (*decommittedSize != 0 &&
-        VirtualFree(decommittedAddr, *decommittedSize, MEM_DECOMMIT)) {
-        Log4(2,
-             "sysDecommitMem: 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *decommittedSize, decommittedAddr, requestedSize, requestedAddr);
-    } else {
-        Log4(2,
-             "sysDecommitMem: failed 0x%x bytes at 0x%x (request: 0x%x bytes at 0x%x)\n",
-             *decommittedSize, decommittedAddr, requestedSize, requestedAddr);
-        decommittedAddr = NULL;
-    }
-    return decommittedAddr;
-}
-
-#define PAGED_HEAPS
-
-#ifdef PAGED_HEAPS
-
-/*
- * Allocate memory on an alignment boundary.  Returns aligned
- * pointer to new memory.  Use sysFreeBlock to free the block.
- *
- * sysAllocBlock() is similar to memalign(), except that it also
- * returns a pointer to the beginning of the block returned by the
- * OS, which must be used to deallocate the block.  (On some OSes,
- * these two won't be the same.)  sysAllocBlock() is also more
- * limited than memalign in that it can only be used to allocate
- * on particular alignments (PAGE_ALIGNMENT) and should be assumed
- * to round the sizes of allocated blocks up to multiples of the
- * alignment value (PAGE_ALIGNMENT*n bytes).
- *
- * Note that the use of VirtualAlloc on Win32 is closely tied in to
- * the decision for paged heap pages on Win32 to be 64K (that is,
- * PAGE_ALIGNMENT is 64K), a reasonable choice in any case.
- */
-void *
-sysAllocBlock(size_t size, void** allocHead)
-{
-    void* alignedPtr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
-    *allocHead = alignedPtr;
-    return alignedPtr;
-}
-
-/*
- * Wrapper to free block allocated by sysMemAlign.
- */
-void
-sysFreeBlock(void *allocHead)
-{
-    VirtualFree(allocHead, 0, MEM_RELEASE);
-}
-
-#endif /* PAGED_HEAPS */
-
-void * sysMalloc(size_t s)
-{
-    if (s == 0)
-        return malloc(1);
-    return malloc(s);
-}
-
-void * sysRealloc(void *p, size_t s)
-{
-    return realloc(p, s);
-}
-
-void sysFree(void *p)
-{
-    if (p != NULL)
-        free(p);
-}
-
-void * sysCalloc(size_t s1, size_t s2)
-{
-    if (s1 == 0 || s2 == 0)
-        return calloc(1, 1);
-    return calloc(s1, s2);
-}
-
-char * sysStrdup(const char * string)
-{
-    return strdup(string);
-}
--- a/jdk/src/windows/hpi/src/monitor_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,517 +0,0 @@
-/*
- * Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Win32 implementation of Java monitors
- */
-
-#include <windows.h>
-
-#include "hpi_impl.h"
-
-#include "threads_md.h"
-#include "monitor_md.h"
-
-/*
- * Use this information to improve performance for single CPU machine.
- */
-static int systemIsMP;
-
-static mutex_t semaphore_init_mutex;
-static mutex_t *semaphore_init_mutex_p = NULL;
-/*
- * Create and initialize monitor. This can be called before threads have
- * been initialized.
- */
-int
-sysMonitorInit(sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (semaphore_init_mutex_p == NULL) {
-        systemIsMP = sysGetSysInfo()->isMP;
-        mutexInit(&semaphore_init_mutex);
-        semaphore_init_mutex_p = &semaphore_init_mutex;
-    }
-
-    mid->atomic_count = -1;     /* -1 for no thread, 0 means 1 thread */
-    mid->semaphore = NULL;      /* No semaphore until needed */
-    mid->monitor_owner  = SYS_THREAD_NULL;
-    mid->entry_count    = 0;    /* Recursion count */
-    mid->monitor_waiter = 0;    /* First waiting thread */
-    mid->waiter_count   = 0;    /* Count of waiting and wake-up thread */
-
-    return SYS_OK;
-}
-
-/*
- * Free any system-dependent resources held by monitors.  On Win32 this
- * means releasing the critical section (mutex) and condition variable
- * that are part of each monitor.
- */
-int
-sysMonitorDestroy(sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    CloseHandle(mid->semaphore);
-
-    return SYS_OK;
-}
-
-static void initializeSemaphore(HANDLE *pSema)
-{
-    mutexLock(semaphore_init_mutex_p);
-    if (*pSema == NULL) {
-        *pSema = CreateSemaphore(0,0,1,0);
-    }
-    mutexUnlock(semaphore_init_mutex_p);
-}
-
-/*
- * Take ownership of monitor. This can be called before threads have
- * been initialized, in which case we do nothing since locked monitors
- * are not yet needed.
-
- * The actual code is split into two functions, the assembler routine
- * handles the fast path, while the C routine handle the slow path,
- * including the lazy initialization of monitor semaphore.
- *
- * REMIND: It is EXTREMELY RISKY to change any of the code without
- * thorough understanding of the system, compiler and call convention.
- */
-
-static int __fastcall sysMonitorEnter2(sys_thread_t *self, sys_mon_t *mid)
-{
-    if (mid->semaphore == NULL) {
-        initializeSemaphore(&(mid->semaphore));
-        if (mid->semaphore == NULL) {
-            return SYS_NORESOURCE;
-        }
-    }
-
-    self->enter_monitor = mid;
-    if (profiler_on) {
-        VM_CALL(monitorContendedEnter)(self, mid);
-    }
-    WaitForSingleObject(mid->semaphore, INFINITE);
-    self->enter_monitor = NULL;
-
-    mid->monitor_owner = self;
-    mid->entry_count = 1;
-
-    if (profiler_on) {
-        VM_CALL(monitorContendedEntered)(self, mid);
-    }
-    return SYS_OK;
-}
-
-/*
- * The following assembler routine is highly compiler specific.
- * Because of the complexity, there is no debug error check.
- */
-
-#ifndef _WIN64
-int __cdecl
-sysMonitorEnter(sys_thread_t *self, sys_mon_t *mid)
-{
-    __asm
-    {
-        mov edx, dword ptr [esp+8]; // load mid
-        mov ecx, dword ptr [esp+4]; // load self
-        mov eax, dword ptr [edx+8]; // load mid->monitor_owner
-
-        cmp eax, ecx;               // if ( self == mid->monitor_owner )
-        je RECURSION;               // goto RECURSION;
-
-        mov eax, dword ptr [systemIsMP];
-        test eax, eax;
-        jne MPM;
-
-        inc dword ptr [edx];        /* atomic increment mid->atomic_count */
-        jne ACQUIRE_SEMAPHORE;      /* if there is an owner already */
-
-        mov dword ptr [edx+8], ecx; /* mid->monitor_owner = self */
-        mov dword ptr [edx+12], 1;  /* mid->entry_count = 1 */
-        xor eax, eax;               /* return SYS_OK */
-        ret;
-
-MPM:
-        lock inc dword ptr [edx];   /* atomic increment mid->atomic_count */
-        jne ACQUIRE_SEMAPHORE;      /* if there is an owner already */
-
-        mov dword ptr [edx+8], ecx; /* mid->monitor_owner = self */
-        mov dword ptr [edx+12], 1;  /* mid->entry_count = 1 */
-        xor eax, eax;               /* return SYS_OK */
-        ret;
-
-RECURSION:
-        inc dword ptr [edx+12];     /* Increment mid->entry_count */
-        xor eax, eax;               /* return SYS_OK */
-        ret;
-
-ACQUIRE_SEMAPHORE:
-        /* The self is passed by ECX, mid is passed by EDX */
-        jmp  sysMonitorEnter2;
-    }
-}
-#else
-int __cdecl
-sysMonitorEnter(sys_thread_t *self, sys_mon_t *mid)
-{
-return (SYS_NORESOURCE);
-}
-#endif
-
-/*
- * Return TRUE if this thread currently owns the monitor. This can be
- * called before threads have been initialized, in which case we always
- * return TRUE.
- */
-bool_t
-sysMonitorEntered(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-    sysAssert(self != 0);
-    sysAssert(ThreadsInitialized);
-
-    return (mid->monitor_owner == self);
-}
-
-/*
- * Release ownership of monitor. This can be called before threads have
- * been initialized, in which case we do nothing as locked monitors are
- * not yet needed.
- *
- * The actual code is split into two functions, the assembler routine
- * handles the fast path, while the C routine handle the slow path.
- *
- * REMIND: It is EXTREMELY RISKY to change any of the code without
- * thorough understanding of the system, compiler and call convention.
- */
-
-static int __fastcall
-sysMonitorExit2(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid->entry_count == 0);
-    sysAssert(mid->atomic_count >= 0);
-    sysAssert(mid->monitor_owner == 0);
-
-    if (mid->semaphore == NULL) {
-        initializeSemaphore(&(mid->semaphore));
-        if (mid->semaphore == NULL) {
-            return SYS_NORESOURCE;
-        }
-    }
-
-    ReleaseSemaphore(mid->semaphore, 1, 0);
-
-    if (profiler_on) {
-        VM_CALL(monitorContendedExit)(self, mid);
-    }
-
-    return SYS_OK;
-}
-
-#ifndef _WIN64
-__declspec(naked) int __cdecl
-sysMonitorExit(sys_thread_t *self, sys_mon_t *mid)
-{
-    __asm
-    {
-        mov edx, dword ptr [esp+8]; /* load mid */
-        mov ecx, dword ptr [esp+4]; /* load self */
-        mov eax, dword ptr [edx+8]; /* load mid->monitor_owner */
-
-        cmp eax, ecx;               /* if ( self != mid->monitor_owner ) */
-        jne ERR_RET;                /* goto ERROR_RET */
-
-        dec dword ptr [edx+12];     /* dec mid->entry_count */
-        jne OK_RET;                 /* entry_count != 0 */
-
-        mov dword ptr [edx+8], 0;   /* mid->monitor_owner = 0 */
-
-        mov eax, dword ptr [systemIsMP];
-        test eax, eax;
-        jne MPM;
-
-        dec dword ptr [edx];        /* atomic decrement mid->atomic_count */
-        jge RELEASE_SEMAPHORE;      /* if ( atomic_variable < 0 ) */
-        xor eax, eax;               /* return SYS_OK */
-        ret;
-
-MPM:
-        lock dec dword ptr [edx];   /* atomic decrement mid->atomic_count */
-        jge RELEASE_SEMAPHORE;      /* if ( atomic_variable < 0 ) */
-OK_RET:
-        xor eax, eax;
-        ret;
-
-ERR_RET:
-        mov eax, 0FFFFFFFFH;
-        ret;
-
-RELEASE_SEMAPHORE:
-        jmp sysMonitorExit2;        /* forwading call */
-    }
-}
-#else
-int __cdecl
-sysMonitorExit(sys_thread_t *self, sys_mon_t *mid)
-{
-return (-1);
-}
-#endif
-
-/*
- * Notify single thread waiting on condition variable.
- */
-int
-sysMonitorNotify(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (mid->monitor_owner != self) {
-        return SYS_ERR;
-    }
-
-    if (mid->monitor_waiter != SYS_THREAD_NULL)
-    {
-        sys_thread_t *thread = mid->monitor_waiter;
-        mid->monitor_waiter = thread->next_waiter;
-
-        thread->next_waiter = SYS_THREAD_NULL;
-        thread->wait_monitor = SYS_MID_NULL;
-
-        SetEvent(thread->interrupt_event);
-    }
-
-    return SYS_OK;
-}
-
-/*
- * Notify all threads waiting on condition variable.
- */
-int
-sysMonitorNotifyAll(sys_thread_t *self, sys_mon_t *mid)
-{
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (mid->monitor_owner != self) {
-        return SYS_ERR;
-    }
-
-    while (mid->monitor_waiter != SYS_THREAD_NULL)
-    {
-        sys_thread_t *thread = mid->monitor_waiter;
-        mid->monitor_waiter = thread->next_waiter;
-
-        thread->next_waiter = SYS_THREAD_NULL;
-        thread->wait_monitor = SYS_MID_NULL;
-
-        SetEvent(thread->interrupt_event);
-    }
-
-    return SYS_OK;
-}
-
-/*
- * Atomically drop mutex and wait for notification.
- */
-int
-sysMonitorWait(sys_thread_t *self, sys_mon_t *mid, jlong millis)
-{
-    long entry_count;
-    DWORD timeout;
-
-    sysAssert(mid != SYS_MID_NULL);
-
-    if (mid->monitor_owner != self) {
-        return SYS_ERR;
-    }
-
-    if ( sysThreadIsInterrupted(self, 1) ) {
-        return SYS_INTRPT;
-    }
-
-    entry_count = mid->entry_count;
-    mid->entry_count = 1;
-
-    self->wait_monitor = mid;
-    self->next_waiter = 0;
-
-    if (mid->monitor_waiter == 0) {
-        mid->monitor_waiter = self;
-    } else {
-        sys_thread_t *thread = mid->monitor_waiter;
-        while (thread->next_waiter != 0) {
-            thread = thread->next_waiter;
-        }
-        thread->next_waiter = self;
-    }
-
-    if ( millis == SYS_TIMEOUT_INFINITY ||
-        millis > (jlong)((unsigned int)0xffffffff) ) {
-        timeout = INFINITE;
-    } else {
-        timeout = (long) millis;
-    }
-
-    mid->waiter_count++;
-
-    sysMonitorExit(self, mid);
-
-    self->state = CONDVAR_WAIT;
-
-    WaitForSingleObject(self->interrupt_event, timeout);
-
-    self->state = RUNNABLE;
-
-    sysMonitorEnter(self, mid);
-
-    mid->waiter_count--;
-
-    mid->entry_count = entry_count;
-    /* Reset event anyway, prevent racing the timeout */
-    ResetEvent(self->interrupt_event);
-
-    if (self->wait_monitor != SYS_MID_NULL) {
-        sys_thread_t *head;
-
-        sysAssert( self->wait_monitor == mid );
-        sysAssert( mid->monitor_waiter != SYS_THREAD_NULL );
-
-        head = mid->monitor_waiter;
-
-        if (head == self) {
-            mid->monitor_waiter = self->next_waiter;
-        } else {
-            while (head != SYS_THREAD_NULL) {
-                if (head->next_waiter == self) {
-                    head->next_waiter = self->next_waiter;
-                    break;
-                } else {
-                    head = head->next_waiter;
-                }
-            }
-        }
-
-        self->next_waiter = SYS_THREAD_NULL;
-        self->wait_monitor = SYS_MID_NULL;
-    }
-
-    if ( sysThreadIsInterrupted(self, 1) ) {
-        return SYS_INTRPT;
-    }
-
-    return SYS_OK;
-}
-
-static int
-dumpWaitingQueue(sys_thread_t *tid, sys_thread_t **waiters, int sz)
-{
-    int n;
-    for (n = 0; tid != 0; tid = tid->next_waiter, n++, sz--) {
-        if (sz > 0) {
-            waiters[n] = tid;
-        }
-    }
-    return n;
-}
-
-typedef struct {
-    sys_mon_t *mid;
-    sys_thread_t **waiters;
-    int sz;
-    int nwaiters;
-} wait_info;
-
-static int
-findWaitersHelper(sys_thread_t *t, void *arg)
-{
-    wait_info * winfo = (wait_info *) arg;
-    if (t->enter_monitor == winfo->mid) {
-        if (winfo->sz > 0) {
-            winfo->waiters[winfo->nwaiters] = t;
-        }
-        winfo->sz--;
-        winfo->nwaiters++;
-    }
-    return SYS_OK;
-}
-
-int
-sysMonitorGetInfo(sys_mon_t *mid, sys_mon_info *info)
-{
-    wait_info winfo;
-
-    sysAssert(mid != SYS_MID_NULL);
-    info->owner = mid->monitor_owner;
-    if (mid->monitor_owner) {
-        info->entry_count = mid->entry_count;
-    }
-
-    winfo.mid = mid;
-    winfo.nwaiters = 0;
-    winfo.waiters = info->monitor_waiters;
-    winfo.sz = info->sz_monitor_waiters;
-    sysThreadEnumerateOver(findWaitersHelper, (void *) &winfo);
-    info->n_monitor_waiters = winfo.nwaiters;
-
-    info->n_condvar_waiters = dumpWaitingQueue(mid->monitor_waiter,
-                                               info->condvar_waiters,
-                                               info->sz_condvar_waiters);
-
-    return SYS_OK;
-}
-
-/*
- * Return size of system-dependent monitor structure.
- */
-size_t
-sysMonitorSizeof(void)
-{
-    return sizeof(struct sys_mon);
-}
-
-
-/*
- *  Return true if there are any threads inside this monitor.
- */
-bool_t
-sysMonitorInUse(sys_mon_t *mid)
-{
-    return (mid->atomic_count != -1
-        || mid->waiter_count != 0
-        || mid->monitor_owner != SYS_THREAD_NULL
-        || mid->monitor_waiter != SYS_THREAD_NULL);
-}
-
-
-sys_thread_t *
-sysMonitorOwner(sys_mon_t *mon)
-{
-    return mon->monitor_owner;
-}
--- a/jdk/src/windows/hpi/src/path_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Machine dependent path name and file name manipulation code
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#include <windows.h>
-#include <errno.h>
-
-#include "hpi_impl.h"
-
-#undef DEBUG_PATH               /* Define this to debug path code */
-
-#define isfilesep(c) ((c) == '/' || (c) == '\\')
-#define islb(c)      (IsDBCSLeadByte((BYTE)(c)))
-
-
-/* Convert a pathname to native format.  On win32, this involves forcing all
-   separators to be '\\' rather than '/' (both are legal inputs, but Win95
-   sometimes rejects '/') and removing redundant separators.  The input path is
-   assumed to have been converted into the character encoding used by the local
-   system.  Because this might be a double-byte encoding, care is taken to
-   treat double-byte lead characters correctly.
-
-   This procedure modifies the given path in place, as the result is never
-   longer than the original.  There is no error return; this operation always
-   succeeds. */
-
-char *
-sysNativePath(char *path)
-{
-    char *src = path, *dst = path, *end = path;
-    char *colon = NULL;         /* If a drive specifier is found, this will
-                                   point to the colon following the drive
-                                   letter */
-
-    /* Assumption: '/', '\\', ':', and drive letters are never lead bytes */
-    sysAssert(!islb('/') && !islb('\\') && !islb(':'));
-
-    /* Check for leading separators */
-    while (isfilesep(*src)) src++;
-    if (isalpha(*src) && !islb(*src) && src[1] == ':') {
-        /* Remove leading separators if followed by drive specifier.  This
-           hack is necessary to support file URLs containing drive
-           specifiers (e.g., "file://c:/path").  As a side effect,
-           "/c:/path" can be used as an alternative to "c:/path". */
-        *dst++ = *src++;
-        colon = dst;
-        *dst++ = ':'; src++;
-    } else {
-        src = path;
-        if (isfilesep(src[0]) && isfilesep(src[1])) {
-            /* UNC pathname: Retain first separator; leave src pointed at
-               second separator so that further separators will be collapsed
-               into the second separator.  The result will be a pathname
-               beginning with "\\\\" followed (most likely) by a host name. */
-            src = dst = path + 1;
-            path[0] = '\\';     /* Force first separator to '\\' */
-        }
-    }
-
-    end = dst;
-
-    /* Remove redundant separators from remainder of path, forcing all
-       separators to be '\\' rather than '/'. Also, single byte space
-       characters are removed from the end of the path because those
-       are not legal ending characters on this operating system.
-    */
-    while (*src != '\0') {
-        if (isfilesep(*src)) {
-            *dst++ = '\\'; src++;
-            while (isfilesep(*src)) src++;
-            if (*src == '\0') { /* Check for trailing separator */
-                end = dst;
-                if (colon == dst - 2) break;                      /* "z:\\" */
-                if (dst == path + 1) break;                       /* "\\" */
-                if (dst == path + 2 && isfilesep(path[0])) {
-                    /* "\\\\" is not collapsed to "\\" because "\\\\" marks the
-                       beginning of a UNC pathname.  Even though it is not, by
-                       itself, a valid UNC pathname, we leave it as is in order
-                       to be consistent with the path canonicalizer as well
-                       as the win32 APIs, which treat this case as an invalid
-                       UNC pathname rather than as an alias for the root
-                       directory of the current drive. */
-                    break;
-                }
-                end = --dst;    /* Path does not denote a root directory, so
-                                   remove trailing separator */
-                break;
-            }
-            end = dst;
-        } else {
-            if (islb(*src)) {   /* Copy a double-byte character */
-                *dst++ = *src++;
-                if (*src) {
-                    *dst++ = *src++;
-                }
-                end = dst;
-            } else {            /* Copy a single-byte character */
-                char c = *src++;
-                *dst++ = c;
-                /* Space is not a legal ending character */
-                if (c != ' ')
-                    end = dst;
-            }
-        }
-    }
-
-    *end = '\0';
-
-    /* For "z:", add "." to work around a bug in the C runtime library */
-    if (colon == dst - 1) {
-        path[2] = '.';
-        path[3] = '\0';
-    }
-
-#ifdef DEBUG_PATH
-    jio_fprintf(stderr, "sysNativePath: %s\n", path);
-#endif DEBUG_PATH
-    return path;
-}
--- a/jdk/src/windows/hpi/src/socket_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,537 +0,0 @@
-/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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 <windef.h>
-#include <winsock.h>
-
-#include "hpi_impl.h"
-
-#include "mutex_md.h"
-
-struct sockaddr;
-
-#define FN_RECV           0
-#define FN_SEND           1
-#define FN_LISTEN         2
-#define FN_BIND           3
-#define FN_ACCEPT         4
-#define FN_RECVFROM       5
-#define FN_SENDTO         6
-#define FN_SELECT         7
-#define FN_CONNECT        8
-#define FN_CLOSESOCKET    9
-#define FN_SHUTDOWN       10
-#define FN_GETHOSTNAME    11
-#define FN_GETHOSTBYADDR  12
-#define FN_GETHOSTBYNAME  13
-#define FN_HTONS          14
-#define FN_HTONL          15
-#define FN_NTOHS          16
-#define FN_NTOHL          17
-#define FN_GETSOCKOPT     18
-#define FN_SETSOCKOPT     19
-#define FN_GETPROTOBYNAME 20
-#define FN_GETSOCKNAME    21
-#define FN_SOCKET         22
-#define FN_WSASENDDISCONNECT 23
-#define FN_SOCKETAVAILABLE 24
-
-static int (PASCAL FAR *sockfnptrs[])() =
-    {NULL, NULL, NULL, NULL, NULL,
-     NULL, NULL, NULL, NULL, NULL,
-     NULL, NULL, NULL, NULL, NULL,
-     NULL, NULL, NULL, NULL, NULL,
-     NULL, NULL, NULL, NULL, NULL,
-     };
-
-static bool_t sockfnptrs_initialized = FALSE;
-static mutex_t sockFnTableMutex;
-
-/* is Winsock2 loaded? better to be explicit than to rely on sockfnptrs */
-static bool_t winsock2Available = FALSE;
-
-/* Winsock2 options at the IPPROTO_IP level
-   We need the following translation in order to deal with the multiple
-   definitions for IPPROTO_IP level options in different winsock versions.
-
-in                         winsock.h vs. ws2tcpip.h
-#define IP_OPTIONS         1             1
-#define IP_MULTICAST_IF    2             9
-#define IP_MULTICAST_TTL   3             10
-#define IP_MULTICAST_LOOP  4             11
-#define IP_ADD_MEMBERSHIP  5             12
-#define IP_DROP_MEMBERSHIP 6             13
-#define IP_TTL             7             4
-#define IP_TOS             8             3
-#define IP_DONTFRAGMENT    9             14
-*/
-static int IPPROTO_OPTIONS[] = {-1, 1, 9, 10, 11, 12, 13, 4, 3, 14};
-
-/* IMPORTANT: whenever possible, we want to use Winsock2 (ws2_32.dll)
- * instead of Winsock (wsock32.dll). Other than the fact that it is
- * newer, less buggy and faster than Winsock, Winsock2 lets us to work
- * around the following problem:
- *
- * Generally speaking, it is important to shutdown a socket before
- * closing it, since failing to do so can sometimes result in a TCP
- * RST (abortive close) which is disturbing to the peer of the
- * connection.
- *
- * The Winsock way to shutdown a socket is the Berkeley call
- * shutdown(). We do not want to call it on Win95, since it
- * sporadically leads to an OS crash in IFS_MGR.VXD.  Complete hull
- * breach.  Blue screen.  Ugly.
- *
- * So, in initSockTable we look for Winsock 2, and if we find it we
- * assign wsassendisconnectfn function pointer. When we close, we
- * first check to see if it's bound, and if it is, we call it. Winsock
- * 2 will always be there on NT, and we recommend that win95 user
- * install it.
- *
- * - br 10/11/97
- */
-
-static void
-initSockFnTable() {
-    int (PASCAL FAR* WSAStartupPtr)(WORD, LPWSADATA);
-    WSADATA wsadata;
-    OSVERSIONINFO info;
-
-    mutexInit(&sockFnTableMutex);
-    mutexLock(&sockFnTableMutex);
-    if (sockfnptrs_initialized == FALSE) {
-        HANDLE hWinsock;
-
-        /* try to load Winsock2, and if that fails, load Winsock */
-        hWinsock = LoadLibrary("ws2_32.dll");
-        if (hWinsock == NULL) {
-            hWinsock = LoadLibrary("wsock32.dll");
-            winsock2Available = FALSE;
-        } else {
-            winsock2Available = TRUE;
-        }
-
-        if (hWinsock == NULL) {
-            VM_CALL(jio_fprintf)(stderr, "Could not load Winsock 1 or 2 (error: %d)\n",
-                        GetLastError());
-        }
-
-        /* If we loaded a DLL, then we might as well initialize it.  */
-        WSAStartupPtr = (int (PASCAL FAR *)(WORD, LPWSADATA))
-                            GetProcAddress(hWinsock, "WSAStartup");
-        if (WSAStartupPtr(MAKEWORD(1,1), &wsadata) != 0) {
-            VM_CALL(jio_fprintf)(stderr, "Could not initialize Winsock\n");
-        }
-
-        sockfnptrs[FN_RECV]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "recv");
-        sockfnptrs[FN_SEND]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "send");
-        sockfnptrs[FN_LISTEN]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "listen");
-        sockfnptrs[FN_BIND]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "bind");
-        sockfnptrs[FN_ACCEPT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "accept");
-        sockfnptrs[FN_RECVFROM]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "recvfrom");
-        sockfnptrs[FN_SENDTO]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "sendto");
-        sockfnptrs[FN_SELECT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "select");
-        sockfnptrs[FN_CONNECT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "connect");
-        sockfnptrs[FN_CLOSESOCKET]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "closesocket");
-        /* we don't use this */
-        sockfnptrs[FN_SHUTDOWN]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "shutdown");
-        sockfnptrs[FN_GETHOSTNAME]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "gethostname");
-        sockfnptrs[FN_GETHOSTBYADDR]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "gethostbyaddr");
-        sockfnptrs[FN_GETHOSTBYNAME]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "gethostbyname");
-        sockfnptrs[FN_HTONS]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "htons");
-        sockfnptrs[FN_HTONL]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "htonl");
-        sockfnptrs[FN_NTOHS]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "ntohs");
-        sockfnptrs[FN_NTOHL]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "ntohl");
-        sockfnptrs[FN_GETSOCKOPT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "getsockopt");
-        sockfnptrs[FN_SETSOCKOPT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "setsockopt");
-        sockfnptrs[FN_GETPROTOBYNAME]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "getprotobyname");
-        sockfnptrs[FN_GETSOCKNAME]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "getsockname");
-
-        sockfnptrs[FN_SOCKET]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock, "socket");
-        /* in winsock 1, this will simply be 0 */
-        sockfnptrs[FN_WSASENDDISCONNECT]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock,
-                                                   "WSASendDisconnect");
-        sockfnptrs[FN_SOCKETAVAILABLE]
-            = (int (PASCAL FAR *)())GetProcAddress(hWinsock,
-                                                   "ioctlsocket");
-    }
-
-    sysAssert(sockfnptrs[FN_RECV] != NULL);
-    sysAssert(sockfnptrs[FN_SEND] != NULL);
-    sysAssert(sockfnptrs[FN_LISTEN] != NULL);
-    sysAssert(sockfnptrs[FN_BIND] != NULL);
-    sysAssert(sockfnptrs[FN_ACCEPT] != NULL);
-    sysAssert(sockfnptrs[FN_RECVFROM] != NULL);
-    sysAssert(sockfnptrs[FN_SENDTO] != NULL);
-    sysAssert(sockfnptrs[FN_SELECT] != NULL);
-    sysAssert(sockfnptrs[FN_CONNECT] != NULL);
-    sysAssert(sockfnptrs[FN_CLOSESOCKET] != NULL);
-    sysAssert(sockfnptrs[FN_SHUTDOWN] != NULL);
-    sysAssert(sockfnptrs[FN_GETHOSTNAME] != NULL);
-    sysAssert(sockfnptrs[FN_GETHOSTBYADDR] != NULL);
-    sysAssert(sockfnptrs[FN_GETHOSTBYNAME] != NULL);
-    sysAssert(sockfnptrs[FN_HTONS] != NULL);
-    sysAssert(sockfnptrs[FN_HTONL] != NULL);
-    sysAssert(sockfnptrs[FN_NTOHS] != NULL);
-    sysAssert(sockfnptrs[FN_NTOHL] != NULL);
-    sysAssert(sockfnptrs[FN_GETSOCKOPT] != NULL);
-    sysAssert(sockfnptrs[FN_SETSOCKOPT] != NULL);
-    sysAssert(sockfnptrs[FN_GETPROTOBYNAME] != NULL);
-    sysAssert(sockfnptrs[FN_GETSOCKNAME] != NULL);
-    sysAssert(sockfnptrs[FN_SOCKET] != NULL);
-
-    if (winsock2Available) {
-        sysAssert(sockfnptrs[FN_WSASENDDISCONNECT] != NULL);
-    }
-
-    sysAssert(sockfnptrs[FN_SOCKETAVAILABLE] != NULL);
-
-    sockfnptrs_initialized = TRUE;
-    mutexUnlock(&sockFnTableMutex);
-}
-
-/*
- * If we get a nonnull function pointer it might still be the case
- * that some other thread is in the process of initializing the socket
- * function pointer table, but our pointer should still be good.
- */
-int
-sysListen(int fd, int count) {
-    int (PASCAL FAR *listenfn)();
-    if ((listenfn = sockfnptrs[FN_LISTEN]) == NULL) {
-        initSockFnTable();
-        listenfn = sockfnptrs[FN_LISTEN];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && listenfn != NULL);
-    return (*listenfn)(fd, (long)count);
-}
-
-int
-sysConnect(int fd, struct sockaddr *name, int namelen) {
-    int (PASCAL FAR *connectfn)();
-    if ((connectfn = sockfnptrs[FN_CONNECT]) == NULL) {
-        initSockFnTable();
-        connectfn = sockfnptrs[FN_CONNECT];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(connectfn != NULL);
-    return (*connectfn)(fd, name, namelen);
-}
-
-int
-sysBind(int fd, struct sockaddr *name, int namelen) {
-    int (PASCAL FAR *bindfn)();
-    if ((bindfn = sockfnptrs[FN_BIND]) == NULL) {
-        initSockFnTable();
-        bindfn = sockfnptrs[FN_BIND];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(bindfn != NULL);
-    return (*bindfn)(fd, name, namelen);
-}
-
-int
-sysAccept(int fd, struct sockaddr *name, int *namelen) {
-    int (PASCAL FAR *acceptfn)();
-    if ((acceptfn = sockfnptrs[FN_ACCEPT]) == NULL) {
-        initSockFnTable();
-        acceptfn = sockfnptrs[FN_ACCEPT];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && acceptfn != NULL);
-    return (*acceptfn)(fd, name, namelen);
-}
-
-int
-sysRecvFrom(int fd, char *buf, int nBytes,
-                  int flags, struct sockaddr *from, int *fromlen) {
-    int (PASCAL FAR *recvfromfn)();
-    if ((recvfromfn = sockfnptrs[FN_RECVFROM]) == NULL) {
-        initSockFnTable();
-        recvfromfn = sockfnptrs[FN_RECVFROM];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && recvfromfn != NULL);
-    return (*recvfromfn)(fd, buf, nBytes, flags, from, fromlen);
-}
-
-int
-sysSendTo(int fd, char *buf, int len,
-                int flags, struct sockaddr *to, int tolen) {
-    int (PASCAL FAR *sendtofn)();
-    if ((sendtofn = sockfnptrs[FN_SENDTO]) == NULL) {
-        initSockFnTable();
-        sendtofn = sockfnptrs[FN_SENDTO];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && sendtofn != NULL);
-    return (*sendtofn)(fd, buf, len, flags, to, tolen);
-}
-
-int
-sysRecv(int fd, char *buf, int nBytes, int flags) {
-    int (PASCAL FAR *recvfn)();
-    if ((recvfn = sockfnptrs[FN_RECV]) == NULL) {
-        initSockFnTable();
-        recvfn = sockfnptrs[FN_RECV];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && recvfn != NULL);
-    return (*recvfn)(fd, buf, nBytes, flags);
-}
-
-int
-sysSend(int fd, char *buf, int nBytes, int flags) {
-    int (PASCAL FAR *sendfn)();
-    if ((sendfn = sockfnptrs[FN_SEND]) == NULL) {
-        initSockFnTable();
-        sendfn = sockfnptrs[FN_SEND];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && sendfn != NULL);
-    return (*sendfn)(fd, buf, nBytes, flags);
-}
-
-
-int
-sysGetHostName(char *hostname, int namelen) {
-    int (PASCAL FAR *fn)();
-    if ((fn = sockfnptrs[FN_GETHOSTNAME]) == NULL) {
-        initSockFnTable();
-        fn = sockfnptrs[FN_GETHOSTNAME];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && fn != NULL);
-    return (*fn)(hostname, namelen);
-}
-
-struct hostent *
-sysGetHostByAddr(const char *hostname, int len, int type) {
-    struct hostent * (PASCAL FAR *fn)();
-    if ((fn = (struct hostent * (PASCAL FAR *)()) sockfnptrs[FN_GETHOSTBYADDR]) == NULL) {
-        initSockFnTable();
-        fn = (struct hostent * (PASCAL FAR *)()) sockfnptrs[FN_GETHOSTBYADDR];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && fn != NULL);
-    return (*fn)(hostname, len, type);
-}
-
-struct hostent *
-sysGetHostByName(char *hostname) {
-    struct hostent * (PASCAL FAR *fn)();
-    if ((fn = (struct hostent * (PASCAL FAR *)()) sockfnptrs[FN_GETHOSTBYNAME]) == NULL) {
-        initSockFnTable();
-        fn = (struct hostent * (PASCAL FAR *)()) sockfnptrs[FN_GETHOSTBYNAME];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && fn != NULL);
-    return (*fn)(hostname);
-}
-
-int
-sysSocket(int domain, int type, int protocol) {
-    int sock;
-    int (PASCAL FAR *socketfn)();
-    if ((socketfn = sockfnptrs[FN_SOCKET]) == NULL) {
-        initSockFnTable();
-        socketfn = sockfnptrs[FN_SOCKET];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && socketfn != NULL);
-    sock = (*socketfn)(domain, type, protocol);
-    if (sock != INVALID_SOCKET) {
-        SetHandleInformation((HANDLE)(uintptr_t)sock, HANDLE_FLAG_INHERIT, FALSE);
-    }
-    return sock;
-}
-
-int sysSocketShutdown(int fd, int how)  {
-    if (fd > 0) {
-        int (PASCAL FAR *shutdownfn)();
-        if ((shutdownfn = sockfnptrs[FN_SHUTDOWN]) == NULL) {
-            initSockFnTable();
-            shutdownfn = sockfnptrs[FN_SHUTDOWN];
-        }
-        /* At this point we are guaranteed the sockfnptrs are initialized */
-        sysAssert(sockfnptrs_initialized == TRUE && shutdownfn != NULL);
-        (void) (*shutdownfn)(fd, how);
-   }
-return TRUE;
-}
-
-/*
- * This function is carefully designed to work around a bug in Windows
- * 95's networking winsock. Please see the beginning of this file for
- * a complete description of the problem.
- */
-int sysSocketClose(int fd) {
-
-    if (fd > 0) {
-        int (PASCAL FAR *closesocketfn)();
-        int (PASCAL FAR *wsasenddisconnectfn)();
-        int dynamic_ref = -1;
-
-        if ((closesocketfn = sockfnptrs[FN_CLOSESOCKET]) == NULL) {
-            initSockFnTable();
-        }
-        /* At this point we are guaranteed the sockfnptrs are initialized */
-        sysAssert(sockfnptrs_initialized == TRUE);
-
-        closesocketfn = sockfnptrs[FN_CLOSESOCKET];
-        sysAssert(closesocketfn != NULL);
-
-        if (winsock2Available) {
-            struct linger l;
-            int len = sizeof(l);
-
-            if (sysGetSockOpt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) {
-                if (l.l_onoff == 0) {
-                    wsasenddisconnectfn = sockfnptrs[FN_WSASENDDISCONNECT];
-                    (*wsasenddisconnectfn)(fd, NULL);
-                }
-            }
-        }
-        (void) (*closesocketfn)(fd);
-    }
-    return TRUE;
-}
-
-/*
- * Poll the fd for reading for timeout ms.  Returns 1 if something's
- * ready, 0 if it timed out, -1 on error, -2 if interrupted (although
- * interruption isn't implemented yet).  Timeout in milliseconds.  */
-int
-sysTimeout(int fd, long timeout) {
-    int res;
-    fd_set tbl;
-    struct timeval t;
-    int (PASCAL FAR *selectfn)();
-
-    t.tv_sec = timeout / 1000;
-    t.tv_usec = (timeout % 1000) * 1000;
-    FD_ZERO(&tbl);
-    FD_SET(fd, &tbl);
-
-    if ((selectfn = sockfnptrs[FN_SELECT]) == NULL) {
-        initSockFnTable();
-        selectfn = sockfnptrs[FN_SELECT];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && selectfn != NULL);
-    res = (*selectfn)(fd + 1, &tbl, 0, 0, &t);
-    return res;
-}
-
-long
-sysSocketAvailable(int fd, jint *pbytes)
-{
-    int (PASCAL FAR *socketfn)();
-    if ((socketfn = sockfnptrs[FN_SOCKETAVAILABLE]) == NULL) {
-        initSockFnTable();
-        socketfn = sockfnptrs[FN_SOCKETAVAILABLE];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE && socketfn != NULL);
-    return (*socketfn)(fd, FIONREAD, pbytes);
-}
-
-int
-sysGetSockName(int fd, struct sockaddr *name, int *namelen) {
-    int (PASCAL FAR *getsocknamefn)();
-    if ((getsocknamefn = sockfnptrs[FN_GETSOCKNAME]) == NULL) {
-        initSockFnTable();
-        getsocknamefn = sockfnptrs[FN_GETSOCKNAME];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(getsocknamefn != NULL);
-    return (*getsocknamefn)(fd, name, namelen);
-}
-
-int
-sysGetSockOpt(int fd, int level, int optname, char *optval, int *optlen ) {
-    int (PASCAL FAR *getsockoptfn)();
-    if ((getsockoptfn = sockfnptrs[FN_GETSOCKOPT]) == NULL) {
-        initSockFnTable();
-        getsockoptfn = sockfnptrs[FN_GETSOCKOPT];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(getsockoptfn != NULL);
-
-    /* We need the following translation in order to deal with the multiple
-       definitions for IPPROTO_IP level options in different winsock versions
-       */
-    if (winsock2Available && level == IPPROTO_IP &&
-        optname >= IP_OPTIONS && optname <= IP_DONTFRAGMENT) {
-      optname = IPPROTO_OPTIONS[optname];
-    }
-    return (*getsockoptfn)(fd, level, optname, optval, optlen);
-}
-
-int
-sysSetSockOpt(int fd, int level, int optname, const char *optval, int optlen ) {
-    int (PASCAL FAR *setsockoptfn)();
-    if ((setsockoptfn = sockfnptrs[FN_SETSOCKOPT]) == NULL) {
-        initSockFnTable();
-        setsockoptfn = sockfnptrs[FN_SETSOCKOPT];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(setsockoptfn != NULL);
-
-    /* We need the following translation in order to deal with the multiple
-       definitions for IPPROTO_IP level options in different winsock versions
-       */
-    if (winsock2Available && level == IPPROTO_IP &&
-        optname >= IP_OPTIONS && optname <= IP_DONTFRAGMENT) {
-      optname = IPPROTO_OPTIONS[optname];
-    }
-
-    return (*setsockoptfn)(fd, level, optname, optval, optlen);
-}
-
-struct protoent *
-sysGetProtoByName(char *name) {
-    struct protoent * (PASCAL FAR *getprotobynamefn)();
-    if ((getprotobynamefn = (struct protoent * (PASCAL FAR *)()) sockfnptrs[FN_GETPROTOBYNAME]) == NULL) {
-        initSockFnTable();
-        getprotobynamefn = (struct protoent * (PASCAL FAR *)()) sockfnptrs[FN_GETPROTOBYNAME];
-    }
-    sysAssert(sockfnptrs_initialized == TRUE);
-    sysAssert(getprotobynamefn != NULL);
-    return (*getprotobynamefn)(name);
-}
--- a/jdk/src/windows/hpi/src/sys_api_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <io.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <limits.h>
-
-#include "hpi_impl.h"
-
-#include "path_md.h"
-
-static int MAX_INPUT_EVENTS = 2000;
-
-int
-sysOpen(const char *path, int oflag, int mode)
-{
-    char pathbuf[MAX_PATH];
-
-    if (strlen(path) > MAX_PATH - 1) {
-        errno = ENAMETOOLONG;
-        return -1;
-    }
-    return open(sysNativePath(strcpy(pathbuf, path)),
-                oflag | O_BINARY | O_NOINHERIT, mode);
-}
-
-
-static int
-nonSeekAvailable(int, long *);
-static int
-stdinAvailable(int, long *);
-
-int
-sysAvailable(int fd, jlong *pbytes) {
-    jlong cur, end;
-    struct _stati64 stbuf64;
-
-    if (_fstati64(fd, &stbuf64) >= 0) {
-        int mode = stbuf64.st_mode;
-        if (S_ISCHR(mode) || S_ISFIFO(mode)) {
-            int ret;
-            long lpbytes;
-            if (fd == 0) {
-                ret = stdinAvailable(fd, &lpbytes);
-            } else {
-                ret = nonSeekAvailable(fd, &lpbytes);
-            }
-            (*pbytes) = (jlong)(lpbytes);
-            return ret;
-        }
-        if ((cur = _lseeki64(fd, 0L, SEEK_CUR)) == -1) {
-            return FALSE;
-        } else if ((end = _lseeki64(fd, 0L, SEEK_END)) == -1) {
-            return FALSE;
-        } else if (_lseeki64(fd, cur, SEEK_SET) == -1) {
-            return FALSE;
-        }
-        *pbytes = end - cur;
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-}
-
-static int
-nonSeekAvailable(int fd, long *pbytes) {
-    /* This is used for available on non-seekable devices
-     * (like both named and anonymous pipes, such as pipes
-     *  connected to an exec'd process).
-     * Standard Input is a special case.
-     *
-     */
-    HANDLE han;
-
-    if ((han = (HANDLE) _get_osfhandle(fd)) == (HANDLE)(-1)) {
-        return FALSE;
-    }
-
-    if (! PeekNamedPipe(han, NULL, 0, NULL, pbytes, NULL)) {
-        /* PeekNamedPipe fails when at EOF.  In that case we
-         * simply make *pbytes = 0 which is consistent with the
-         * behavior we get on Solaris when an fd is at EOF.
-         * The only alternative is to raise an Exception,
-         * which isn't really warranted.
-         */
-        if (GetLastError() != ERROR_BROKEN_PIPE) {
-            return FALSE;
-        }
-        *pbytes = 0;
-    }
-    return TRUE;
-}
-
-static int
-stdinAvailable(int fd, long *pbytes) {
-    HANDLE han;
-    DWORD numEventsRead = 0;    /* Number of events read from buffer */
-    DWORD numEvents = 0;        /* Number of events in buffer */
-    DWORD i = 0;                /* Loop index */
-    DWORD curLength = 0;        /* Position marker */
-    DWORD actualLength = 0;     /* Number of bytes readable */
-    BOOL error = FALSE;         /* Error holder */
-    INPUT_RECORD *lpBuffer;     /* Pointer to records of input events */
-
-    if ((han = GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
-                return FALSE;
-    }
-
-    /* Construct an array of input records in the console buffer */
-    error = GetNumberOfConsoleInputEvents(han, &numEvents);
-    if (error == 0) {
-        return nonSeekAvailable(fd, pbytes);
-    }
-
-    /* lpBuffer must fit into 64K or else PeekConsoleInput fails */
-    if (numEvents > MAX_INPUT_EVENTS) {
-        numEvents = MAX_INPUT_EVENTS;
-    }
-
-    lpBuffer = sysMalloc(numEvents * sizeof(INPUT_RECORD));
-    if (lpBuffer == NULL) {
-        return FALSE;
-    }
-
-    error = PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
-    if (error == 0) {
-        sysFree(lpBuffer);
-        return FALSE;
-    }
-
-    /* Examine input records for the number of bytes available */
-    for(i=0; i<numEvents; i++) {
-        if (lpBuffer[i].EventType == KEY_EVENT) {
-            KEY_EVENT_RECORD *keyRecord = (KEY_EVENT_RECORD *)
-                                          &(lpBuffer[i].Event);
-            if (keyRecord->bKeyDown == TRUE) {
-                CHAR *keyPressed = (CHAR *) &(keyRecord->uChar);
-                curLength++;
-                if (*keyPressed == '\r')
-                    actualLength = curLength;
-            }
-        }
-    }
-    if(lpBuffer != NULL)
-        sysFree(lpBuffer);
-    *pbytes = (long) actualLength;
-    return TRUE;
-}
-
-/*
- * This is documented to succeed on read-only files, but Win32's
- * FlushFileBuffers functions fails with "access denied" in such a
- * case.  So we only signal an error if the error is *not* "access
- * denied".
- */
-
-int
-sysSync(int fd) {
-    /*
-     * From the documentation:
-     *
-     *     On Windows NT, the function FlushFileBuffers fails if hFile
-     *     is a handle to console output. That is because console
-     *     output is not buffered. The function returns FALSE, and
-     *     GetLastError returns ERROR_INVALID_HANDLE.
-     *
-     * On the other hand, on Win95, it returns without error.  I cannot
-     * assume that 0, 1, and 2 are console, because if someone closes
-     * System.out and then opens a file, they might get file descriptor
-     * 1.  An error on *that* version of 1 should be reported, whereas
-     * an error on System.out (which was the original 1) should be
-     * ignored.  So I use isatty() to ensure that such an error was due
-     * to this bogosity, and if it was, I ignore the error.
-     */
-
-    HANDLE handle = (HANDLE)_get_osfhandle(fd);
-
-    if (!FlushFileBuffers(handle)) {
-        if (GetLastError() != ERROR_ACCESS_DENIED) {    /* from winerror.h */
-            return -1;
-        }
-    }
-    return 0;
-}
-
-
-int
-sysSetLength(int fd, jlong length) {
-    HANDLE h = (HANDLE)_get_osfhandle(fd);
-    long high = (long)(length >> 32);
-    DWORD ret;
-
-    if (h == (HANDLE)(-1)) return -1;
-    ret = SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
-    if (ret == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
-        return -1;
-    }
-    if (SetEndOfFile(h) == FALSE) return -1;
-    return 0;
-}
-
-int
-sysFileSizeFD(int fd, jlong *size)
-{
-    struct _stati64 buf64;
-
-    if(_fstati64(fd, &buf64) < 0) {
-        return -1;
-    }
-    (*size) = buf64.st_size;
-
-    if (*size & 0xFFFFFFFF00000000) {
-        /*
-         * On Win98 accessing a non-local file we have observed a
-         * bogus file size of 0x100000000.  So if upper 32 bits
-         * are non-zero we re-calculate the size using lseek.  This
-         * should work for any file size, but it might have a
-         * performance impact relative to fstati64.  Note: Hotspot
-         * doesn't have this problem because it uses stat rather
-         * than fstat or fstati64.
-         */
-
-        jlong curpos;
-        jlong endpos;
-        jlong newpos;
-
-        curpos = _lseeki64(fd, 0, SEEK_CUR);
-        if (curpos < 0) {
-            return -1;
-        }
-        endpos = _lseeki64(fd, 0, SEEK_END);
-        if (endpos < 0) {
-            return -1;
-        }
-        newpos = _lseeki64(fd, curpos, SEEK_SET);
-        if (newpos != curpos) {
-            return -1;
-        }
-        (*size) = endpos;
-
-    }
-    return 0;
-}
-
-int
-sysFfileMode(int fd, int *mode)
-{
-    int ret;
-    struct _stati64 buf64;
-    ret = _fstati64(fd, &buf64);
-    (*mode) = buf64.st_mode;
-    return ret;
-}
-
-int
-sysFileType(const char *path)
-{
-    int ret;
-    struct _stati64 buf;
-
-    if ((ret = _stati64(path, &buf)) == 0) {
-      int mode = buf.st_mode & S_IFMT;
-      if (mode == S_IFREG) return SYS_FILETYPE_REGULAR;
-      if (mode == S_IFDIR) return SYS_FILETYPE_DIRECTORY;
-      return SYS_FILETYPE_OTHER;
-    }
-    return ret;
-}
-
-size_t sysRead(int fd, void *buf, unsigned int nBytes)
-{
-    return read(fd, buf, nBytes);
-}
-
-size_t sysWrite(int fd, const void *buf, unsigned int nBytes)
-{
-    return write(fd, buf, nBytes);
-}
-
-int sysClose(int fd)
-{
-    return close(fd);
-}
-
-jlong sysSeek(int fd, jlong offset, int whence)
-{
-    return _lseeki64(fd, offset, whence);
-}
--- a/jdk/src/windows/hpi/src/system_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved.
- * 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 <windows.h>
-#include <float.h>              /* For constants for _control87() */
-#include <signal.h>
-#include <time.h>               /* For _tzset() and _ftime() */
-#include <errno.h>
-
-#include "hpi_impl.h"
-
-#include "jni_md.h"
-#include "monitor_md.h"
-
-
-static int pending_signals[NSIG];
-static HANDLE sigEvent;
-static CRITICAL_SECTION userSigMon;
-
-
-void sysSignalNotify(int sig)
-{
-    sys_thread_t *self = sysThreadSelf();
-    EnterCriticalSection(&userSigMon);
-    pending_signals[sig]++;
-    LeaveCriticalSection(&userSigMon);
-    SetEvent(sigEvent);
-}
-
-static int lookupSignal()
-{
-    int i;
-    EnterCriticalSection(&userSigMon);
-    for (i = 0; i < NSIG; i++) {
-        if (pending_signals[i]) {
-            pending_signals[i]--;
-            LeaveCriticalSection(&userSigMon);
-            return i;
-        }
-    }
-    LeaveCriticalSection(&userSigMon);
-    return -1;
-}
-
-int sysSignalWait()
-{
-    int sig;
-    while ((sig = lookupSignal()) == -1) {
-        WaitForSingleObject(sigEvent, INFINITE);
-    }
-    return sig;
-}
-
-signal_handler_t sysSignal(int sig, signal_handler_t newHandler)
-{
-    return (signal_handler_t)signal(sig, (void (*)(int))newHandler);
-}
-
-void sysRaise(int sig)
-{
-    raise(sig);
-}
-
-int sysThreadBootstrap(sys_thread_t **tidP, sys_mon_t **lockP, int nb)
-{
-    extern void InitializeMem(void);
-
-    threadBootstrapMD(tidP, lockP, nb);
-
-    sigEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-    InitializeCriticalSection(&userSigMon);
-    memset(pending_signals, 0, sizeof(pending_signals));
-
-    /*
-     * Change default for std. streams stdout, stderr,
-     * stdin to be O_BINARY not O_TEXT.  The `\r` characters
-     * corrupt binary files.
-     */
-
-    _setmode(0, O_BINARY);
-    _setmode(1, O_BINARY);
-    _setmode(2, O_BINARY);
-
-    /*
-     * Set floating point processor to no floating point exceptions.
-     * See bug 4027374.  Should be the same values VC++ would set them
-     * to, but by doing this here we ensure other dll's don't override.
-     */
-    _control87(_MCW_EM | _RC_NEAR | _PC_53, _MCW_EM | _MCW_RC | _MCW_PC);
-
-    InitializeMem();
-
-    return SYS_OK;
-}
-
-long
-sysGetMilliTicks(void)
-{
-    return(GetTickCount());
-}
-
-#define FT2INT64(ft) \
-        ((jlong)(ft).dwHighDateTime << 32 | (jlong)(ft).dwLowDateTime)
-
-jlong
-sysTimeMillis(void)
-{
-    static jlong fileTime_1_1_70 = 0;
-    SYSTEMTIME st0;
-    FILETIME   ft0;
-
-    if (fileTime_1_1_70 == 0) {
-        /* Initialize fileTime_1_1_70 -- the Win32 file time of midnight
-         * 1/1/70.
-         */
-
-        memset(&st0, 0, sizeof(st0));
-        st0.wYear  = 1970;
-        st0.wMonth = 1;
-        st0.wDay   = 1;
-        SystemTimeToFileTime(&st0, &ft0);
-        fileTime_1_1_70 = FT2INT64(ft0);
-    }
-
-    GetSystemTime(&st0);
-    SystemTimeToFileTime(&st0, &ft0);
-
-    return (FT2INT64(ft0) - fileTime_1_1_70) / 10000;
-}
-
-void *
-sysAllocateMem(long size)
-{
-    return malloc(size);
-}
-
-int sysShutdown()
-{
-    return SYS_OK;
-}
-
-unsigned
-sleep(unsigned seconds)
-{
-    Sleep(seconds * 1000);
-    return 0;
-}
-
-int
-sysGetLastErrorString(char *buf, int len)
-{
-    long errval;
-
-    if ((errval = GetLastError()) != 0) {
-        /* DOS error */
-        int n = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
-                              NULL, errval,
-                              0, buf, len, NULL);
-        if (n > 3) {
-            /* Drop final '.', CR, LF */
-            if (buf[n - 1] == '\n') n--;
-            if (buf[n - 1] == '\r') n--;
-            if (buf[n - 1] == '.') n--;
-            buf[n] = '\0';
-        }
-        return n;
-    }
-
-    if (errno != 0) {
-        /* C runtime error that has no corresponding DOS error code */
-        const char *s = strerror(errno);
-        int n = strlen(s);
-        if (n >= len) n = len - 1;
-        strncpy(buf, s, n);
-        buf[n] = '\0';
-        return n;
-    }
-
-    return 0;
-}
--- a/jdk/src/windows/hpi/src/threads_md.c	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,831 +0,0 @@
-/*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Win32 implementation of Java threads
- */
-
-#include "hpi_impl.h"
-
-#include <windows.h>
-#include <process.h>              /* for _beginthreadex(), _endthreadex() */
-#include <stdlib.h>
-
-#include "threads_md.h"
-#include "monitor_md.h"
-
-
-/*
- * Queue of active Java threads
- */
-static sys_thread_t *ThreadQueue;
-sys_mon_t *_sys_queue_lock;
-
-static int ActiveThreadCount = 0;               /* All threads */
-
-/*
- * Set to TRUE once threads have been bootstrapped
- */
-bool_t ThreadsInitialized = FALSE;
-
-/*
- * Are we running under Window NT
- */
-static bool_t windowsNT = FALSE;
-
-/*
- * Thread local storage index used for looking up sys_thread_t struct
- * (tid) associated with the current thread.
- */
-#define TLS_INVALID_INDEX 0xffffffffUL
-static unsigned long tls_index = TLS_INVALID_INDEX;
-
-static void RecordNTTIB(sys_thread_t *tid)
-{
-#ifndef _WIN64
-    PNT_TIB nt_tib;
-    __asm {
-        mov eax, dword ptr fs:[18h];
-        mov nt_tib, eax;
-    }
-    tid->nt_tib = nt_tib;
-#else
-    tid->nt_tib = 0;
-#endif
-}
-
-/*
- * Add thread to queue of active threads.
- */
-static void
-queueInsert(sys_thread_t *tid)
-{
-    if (ThreadsInitialized)
-        SYS_QUEUE_LOCK(sysThreadSelf());
-    ActiveThreadCount++;
-    tid->next = ThreadQueue;
-    ThreadQueue = tid;
-    if (ThreadsInitialized)
-        SYS_QUEUE_UNLOCK(sysThreadSelf());
-    else
-        ThreadsInitialized = TRUE;
-}
-
-/*
- * Remove thread from queue of active threads.
- */
-static void
-removefromActiveQ(sys_thread_t *tid)
-{
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-    --ActiveThreadCount;
-
-    if (ThreadQueue == tid) {
-        ThreadQueue = tid->next;
-    } else {
-        sys_thread_t *p;
-        for (p = ThreadQueue; p->next != 0; p = p->next) {
-            if (p->next == tid) {
-                p->next = tid->next;
-                break;
-            }
-        }
-    }
-}
-
-/*
- * Allocate and initialize the sys_thread_t structure for an arbitary
- * native thread.
- */
-int
-sysThreadAlloc(sys_thread_t **tidP)
-{
-    HANDLE hnd = GetCurrentProcess();
-    sys_thread_t *tid = allocThreadBlock();
-    if (tid == NULL) {
-        return SYS_NOMEM;
-    }
-
-    tid->state = RUNNABLE;
-    tid->interrupted = FALSE;
-    tid->interrupt_event = CreateEvent(NULL, TRUE, FALSE, NULL);
-    tid->id = GetCurrentThreadId();
-    DuplicateHandle(hnd, GetCurrentThread(), hnd, &tid->handle, 0, FALSE,
-                    DUPLICATE_SAME_ACCESS);
-
-    RecordNTTIB(tid);
-    /* For the Invocation API:
-       We update the thread-specific storage before locking the
-       queue because sysMonitorEnter will access sysThreadSelf.
-     */
-    TlsSetValue(tls_index, tid);
-
-    queueInsert(tid);
-    tid->stack_ptr = &tid;
-    *tidP = tid;
-    return SYS_OK;
-}
-
-/*
- * Bootstrap the Java thread system by making the current thread the
- * "primordial" thread.
- */
-int threadBootstrapMD(sys_thread_t **tidP, sys_mon_t **lockP, int nb)
-{
-    OSVERSIONINFO windowsVersion;
-    HANDLE hnd = GetCurrentProcess();
-
-    nReservedBytes = (nb + 7) & (~7);
-    /*
-     * Allocate TLS index for thread-specific data.
-     */
-    tls_index = TlsAlloc();
-    if (tls_index == TLS_INVALID_INDEX) {
-        VM_CALL(jio_fprintf)(stderr, "TlsAlloc failed (errcode = %x)\n",
-                    GetLastError());
-        return SYS_NOMEM;
-    }
-
-    /* OS properties */
-    windowsVersion.dwOSVersionInfoSize = sizeof(windowsVersion);
-    GetVersionEx(&windowsVersion);
-    windowsNT = windowsVersion.dwPlatformId == VER_PLATFORM_WIN32_NT;
-
-   /* Initialize the queue lock monitor */
-    _sys_queue_lock = (sys_mon_t *)sysMalloc(sysMonitorSizeof());
-    if (_sys_queue_lock == NULL) {
-        return SYS_ERR;
-    }
-    VM_CALL(monitorRegister)(_sys_queue_lock, "Thread queue lock");
-    *lockP = _sys_queue_lock;
-
-    return sysThreadAlloc(tidP);
-}
-
-/*
- * Return current stack pointer of specified thread.
- */
-void *
-sysThreadStackPointer(sys_thread_t *tid)
-{
-#ifndef _WIN64
-    CONTEXT context;
-    WORD __current_SS;
-
-    /* REMIND: Need to fix this for Win95 */
-    context.ContextFlags = CONTEXT_CONTROL;
-    if (!GetThreadContext(tid->handle, &context)) {
-        VM_CALL(jio_fprintf)(stderr, "GetThreadContext failed (errcode = %x)\n",
-                GetLastError());
-        return 0;
-    }
-
-    /* With the NT TIB stuff that Hong came up with, I don't think we
-     * need any of the complicated VirtualQuery calls anymore. If
-     * context.Esp is within the stack limit and base, we return
-     * context.Esp, otherwise, we can simply return nt_tib->StackLimit.
-     * To minimize code changes, though, I'm keeping the code the way
-     * it was.
-     */
-    if (tid->nt_tib == NULL) {
-        /* thread hasn't started yet. */
-        return 0;
-    }
-
-    __asm {
-        mov ax, ss;
-        mov __current_SS, ax;
-    }
-
-    if (context.SegSs == __current_SS &&
-        context.Esp >= (uintptr_t)(tid->nt_tib->StackLimit) &&
-        context.Esp < (uintptr_t)(tid->nt_tib->StackBase)) {
-        MEMORY_BASIC_INFORMATION mbi;
-
-        VirtualQuery((PBYTE) context.Esp, &mbi, sizeof(mbi));
-
-        if (!(mbi.Protect & PAGE_GUARD)) {
-            return (void *) context.Esp;
-        } else {
-            SYSTEM_INFO si;
-            char *Esp = (char*) context.Esp;
-            DWORD dwPageSize;
-
-            GetSystemInfo(&si);
-            dwPageSize = si.dwPageSize;
-            Esp -= (((DWORD) Esp) % dwPageSize);
-            do {
-                Esp += dwPageSize;
-                VirtualQuery((PBYTE) Esp, &mbi, sizeof(mbi));
-            } while (mbi.Protect & PAGE_GUARD);
-            return Esp;
-        }
-    } else {
-        /* segment selectors don't match - thread is in some weird context */
-        MEMORY_BASIC_INFORMATION mbi;
-        PBYTE pbStackHwm, pbStackBase;
-        SYSTEM_INFO si;
-        DWORD dwPageSize;
-        stackp_t stack_ptr = tid->stack_ptr;
-
-        if (stack_ptr == 0) {
-            return 0;
-        }
-        GetSystemInfo(&si);
-        dwPageSize = si.dwPageSize;
-        VirtualQuery((PBYTE)stack_ptr - 1, &mbi, sizeof(mbi));
-        pbStackBase = (PBYTE)mbi.AllocationBase;
-        /* step backwards till beginning of segment, non-RW page, or guard
-           page (guard pages only on WinNT) */
-        do {
-            pbStackHwm = (PBYTE)mbi.BaseAddress;
-            if (pbStackHwm <= pbStackBase) {
-                break;
-            }
-            VirtualQuery(pbStackHwm - dwPageSize, &mbi, sizeof(mbi));
-        }
-        while ((mbi.Protect & PAGE_READWRITE) &&
-              !(mbi.Protect & PAGE_GUARD));
-        /* the best we can do for now is the first page of stack
-           storage - it should be a stack high-water mark, anyway */
-        return (void *)pbStackHwm;
-    }
-#else
-    return 0;
-#endif
-}
-
-/*
- * Get the end of stack (if you step beyond (above or below depending
- * on your architecture) you can die.  We refer to the logical top of
- * stack.
- *
- * NOTE!  There are restrictions about when you can call this method.  If
- * you did a sysThreadAlloc, then you can call this method as soon as
- * sysThreadAlloc returns.  If you called sysThreadCreate(start_function),
- * then you must call sysThreadStackTop only inside start_function and not
- * as soon as sysThreadCreate returns.
- */
-void *
-sysThreadStackTop(sys_thread_t *tid)
-{
-  return 0; /* FIXME: Unimplemented. */
-}
-
-long *
-sysThreadRegs(sys_thread_t *tid, int *nregs)
-{
-    *nregs = N_TRACED_REGS;
-    return tid->regs;
-}
-
-/*
- * Thread start routine for new Java threads
- */
-static unsigned __stdcall
-_start(sys_thread_t *tid)
-{
-    /* Should thread suspend itself at this point? */
-
-    tid->state = RUNNABLE;
-    RecordNTTIB(tid);
-    TlsSetValue(tls_index, tid);
-    tid->stack_ptr = &tid;
-    tid->start_proc(tid->start_parm);
-    sysThreadFree();
-    _endthreadex(0);
-    /* not reached */
-    return 0;
-}
-
-/*
- * Create a new Java thread. The thread is initially suspended.
- */
-int
-sysThreadCreate(sys_thread_t **tidP, long stack_size,
-                void (*proc)(void *), void *arg)
-{
-    sys_thread_t *tid = allocThreadBlock();
-    if (tid == NULL) {
-        return SYS_NOMEM;
-    }
-    tid->state = SUSPENDED;
-    tid->start_proc = proc;
-    tid->start_parm = arg;
-
-    tid->interrupt_event = CreateEvent(NULL, TRUE, FALSE, NULL);
-
-    /*
-     * Start the new thread.
-     */
-    tid->handle = (HANDLE)_beginthreadex(NULL, stack_size, _start, tid,
-                                         CREATE_SUSPENDED, &tid->id);
-    if (tid->handle == 0) {
-        return SYS_NORESOURCE;  /* Will be treated as though SYS_NOMEM */
-    }
-
-    queueInsert(tid);
-    *tidP = tid;
-    return SYS_OK;
-}
-
-/*
- * Free a system thread block.
- * Remove from the thread queue.
- */
-int
-sysThreadFree()
-{
-    sys_thread_t *tid = sysThreadSelf();
-
-    /*
-     * remove ourselves from the thread queue.  This must be done after
-     * the notify above since monitor operations aren't really safe if
-     * your thread isn't on the thread queue.  (This isn't true of
-     * the sysMonitor* functions, only monitor*)
-     */
-    SYS_QUEUE_LOCK(tid);
-    removefromActiveQ(tid);
-    SYS_QUEUE_UNLOCK(tid);
-
-    /* For invocation API: later sysThreadSelf() calls will return 0 */
-    TlsSetValue(tls_index, 0);
-
-    /*
-     * Close the thread and interrupt event handles, and free the
-     * sys_thread_t structure.
-     */
-    CloseHandle(tid->handle);
-    CloseHandle(tid->interrupt_event);
-    freeThreadBlock(tid);
-    return SYS_OK;
-}
-
-/*
- * Yield control to another thread.
- */
-void
-sysThreadYield(void)
-{
-    Sleep(0);
-}
-
-/*
- * Suspend execution of the specified thread.
- */
-int
-sysThreadSuspend(sys_thread_t *tid)
-{
-    /* REMIND: Fix for Win95 */
-    /* Set state first so state is reflected before this thread */
-    /* returns.  Fix suggested by ARB of SAS  */
-    thread_state_t oldstate = tid->state;
-    sys_thread_t *self = sysThreadSelf();
-
-    if (tid == self) {
-        self->state = SUSPENDED;
-    } else {
-        switch(tid->state) {
-            case RUNNABLE:
-                tid->state = SUSPENDED;
-                break;
-            case MONITOR_WAIT:
-                tid->state = SUSPENDED;
-                tid->suspend_flags |= MONITOR_WAIT_SUSPENDED;
-                break;
-            case CONDVAR_WAIT:
-                tid->state = SUSPENDED;
-                tid->suspend_flags |= CONDVAR_WAIT_SUSPENDED;
-                break;
-            case SUSPENDED:
-            case MONITOR_SUSPENDED:
-            default:
-                return SYS_ERR;
-        }
-    }
-    if (SuspendThread(tid->handle) == 0xffffffffUL) {
-        tid->state = oldstate;
-        tid->suspend_flags = 0;
-        return SYS_ERR;
-    }
-    return SYS_OK;
-}
-
-/*
- * Continue execution of the specified thread.
- */
-int
-sysThreadResume(sys_thread_t *tid)
-{
-    unsigned long n;
-
-    if (tid->suspend_flags & MONITOR_WAIT_SUSPENDED) {
-        tid->suspend_flags = 0;
-        tid->state = MONITOR_WAIT;
-    } else if (tid->suspend_flags & CONDVAR_WAIT_SUSPENDED) {
-        tid->suspend_flags = 0;
-        tid->state = CONDVAR_WAIT;
-    } else {
-        switch(tid->state) {
-            case SUSPENDED:
-                tid->state = RUNNABLE;
-                break;
-            case MONITOR_SUSPENDED:
-                tid->state = MONITOR_WAIT;
-                break;
-            case RUNNABLE:
-            case MONITOR_WAIT:
-            case CONDVAR_WAIT:
-            default:
-                return SYS_ERR;
-                break;
-        }
-    }
-
-    /* Decrement thread's suspend count until no longer suspended */
-    while ((n = ResumeThread(tid->handle)) > 1) {
-        if (n == 0xffffffffUL) {
-            return SYS_ERR;
-        }
-    }
-    return SYS_OK;
-}
-
-/*
- * Return priority of specified thread.
- */
-int
-sysThreadGetPriority(sys_thread_t *tid, int *pp)
-{
-    switch (GetThreadPriority(tid->handle)) {
-    case THREAD_PRIORITY_IDLE:
-        *pp = 0; break;
-    case THREAD_PRIORITY_LOWEST:
-        *pp = 2; break;
-    case THREAD_PRIORITY_BELOW_NORMAL:
-        *pp = 4; break;
-    case THREAD_PRIORITY_NORMAL:
-        *pp = 5; break;
-    case THREAD_PRIORITY_ABOVE_NORMAL:
-        *pp = 6; break;
-    case THREAD_PRIORITY_HIGHEST:
-        *pp = 8; break;
-    case THREAD_PRIORITY_TIME_CRITICAL:
-        *pp = 10; break;
-    case THREAD_PRIORITY_ERROR_RETURN:
-        return SYS_ERR;
-    }
-    return SYS_OK;
-}
-
-/*
- * Set priority of specified thread.
- */
-int
-sysThreadSetPriority(sys_thread_t *tid, int p)
-{
-    int priority;
-
-    switch (p) {
-    case 0:
-        priority = THREAD_PRIORITY_IDLE;
-        break;
-    case 1: case 2:
-        priority = THREAD_PRIORITY_LOWEST;
-        break;
-    case 3: case 4:
-        priority = THREAD_PRIORITY_BELOW_NORMAL;
-        break;
-    case 5:
-        priority = THREAD_PRIORITY_NORMAL;
-        break;
-    case 6: case 7:
-        priority = THREAD_PRIORITY_ABOVE_NORMAL;
-        break;
-    case 8: case 9:
-        priority = THREAD_PRIORITY_HIGHEST;
-        break;
-    case 10:
-        priority = THREAD_PRIORITY_TIME_CRITICAL;
-        break;
-    default:
-        return SYS_ERR;
-    }
-    return SetThreadPriority(tid->handle, priority) ? SYS_OK : SYS_ERR;
-}
-
-/*
- * Return the thread information block of the calling thread.
- */
-sys_thread_t *
-sysThreadSelf(void)
-{
-    return tls_index == 0xffffffffUL ? 0 : TlsGetValue(tls_index);
-}
-
-/*
- * Enumerate over all threads in active queue calling a function for
- * each one.  Expects the caller to lock _queue_lock
- */
-int
-sysThreadEnumerateOver(int (*func)(sys_thread_t *, void *), void *arg)
-{
-    sys_thread_t *tid;
-    int ret = SYS_OK;
-    sys_thread_t *self = sysThreadSelf();
-
-    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
-
-    for (tid = ThreadQueue; tid != 0; tid = tid->next) {
-        if ((ret = (*func)(tid, arg)) != SYS_OK) {
-            break;
-        }
-    }
-    return ret;
-}
-
-/*
- * Helper function for sysThreadSingle()
- */
-static int
-threadSingleHelper(sys_thread_t *tid, void *self)
-{
-    if (tid == self) {
-        return SYS_OK;
-    }
-    if (SuspendThread(tid->handle) == 0xffffffffUL) {
-        return SYS_ERR;
-    }
-    {
-        CONTEXT context;
-        DWORD *esp = (DWORD *)tid->regs;
-
-        context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
-        if (!GetThreadContext(tid->handle, &context)) {
-            VM_CALL(jio_fprintf)
-                (stderr, "GetThreadContext failed (errcode = %x)\n",
-                 GetLastError());
-            return SYS_ERR;
-        }
-#ifdef _M_AMD64
-        *esp++ = context.Rax;
-        *esp++ = context.Rbx;
-        *esp++ = context.Rcx;
-        *esp++ = context.Rdx;
-        *esp++ = context.Rsi;
-        *esp++ = context.Rdi;
-        *esp   = context.Rbp;
-#else
-        *esp++ = context.Eax;
-        *esp++ = context.Ebx;
-        *esp++ = context.Ecx;
-        *esp++ = context.Edx;
-        *esp++ = context.Esi;
-        *esp++ = context.Edi;
-        *esp   = context.Ebp;
-#endif
-    }
-    return SYS_OK;
-}
-
-/*
- * Puts each thread in the active thread queue to sleep except for the
- * calling thread. The threads must be later woken up with a corresponding
- * call to 'sysThreadMulti'. Returns SYS_OK on success, or SYS_ERR if any
- * of the threads could not be suspended.
- */
-int
-sysThreadSingle(void)
-{
-    return sysThreadEnumerateOver(threadSingleHelper, sysThreadSelf());
-}
-
-/*
- * Helper function for sysThreadMulti(): Only ResumeThread once, unlike
- * sysThreadResume(), which will repeatedly call ResumeThread until the
- * thread is really resumed.  That is, Thread.resume will unwind any
- * number of Thread.suspend invocations, but sysThreadMulti() calls must
- * be strictly matched with sysThreadSingle() calls.  Doing this keeps
- * the garbage collector, which uses thread suspension to stop threads
- * while it operates, from waking up threads that were already suspended
- * when GC was invoked.
- */
-static int
-threadMultiHelper(sys_thread_t *tid, void *self)
-{
-    if (tid == self || ResumeThread(tid->handle) != 0xffffffffUL) {
-        return SYS_OK;
-    } else {
-        return SYS_ERR;
-    }
-}
-
-/*
- * Wakes up each thread in active thread queue except for the calling
- * thread.  The mechanism uses thread suspension, and will not wake a
- * thread that was already suspended.  Must be matched 1-1 with calls
- * to sysThreadSingle().  Returns SYS_ERR if not all threads could be
- * woken up.
- */
-void
-sysThreadMulti(void)
-{
-    sysThreadEnumerateOver(threadMultiHelper, sysThreadSelf());
-}
-
-/*
- * Dump system-specific information about threads.
- */
-void *
-sysThreadNativeID(sys_thread_t *tid)
-{
-    return (void *)(uintptr_t)tid->id;
-}
-
-int
-sysThreadCheckStack(void)
-{
-    return 1;
-}
-
-/*
- * The mechanics of actually signalling an exception (in the future,
- * and Alarm or Interrupt) depend upon what thread implementation you
- * are using.
- */
-void
-sysThreadPostException(sys_thread_t *tid, void *exc)
-{
-    /* Interrupt the thread if it's waiting; REMIND: race??? */
-    SetEvent(tid->interrupt_event);
-}
-
-/*
- * Support for (Java-level) interrupts.
- */
-void
-sysThreadInterrupt(sys_thread_t *tid)
-{
-    if (tid->interrupted == FALSE) {
-        tid->interrupted = TRUE;
-        SetEvent(tid->interrupt_event);
-    }
-}
-
-int
-sysThreadIsInterrupted(sys_thread_t *tid, int ClearInterrupted)
-{
-    bool_t interrupted = tid->interrupted;
-    if (interrupted && ClearInterrupted) {
-        tid->interrupted = FALSE;
-        ResetEvent(tid->interrupt_event);
-    }
-    return interrupted;
-}
-
-HPI_SysInfo *
-sysGetSysInfo()
-{
-    static HPI_SysInfo info = {0, 0};
-
-    if (info.name == NULL) {
-        SYSTEM_INFO sysinfo;
-        GetSystemInfo(&sysinfo);
-        info.isMP = sysinfo.dwNumberOfProcessors > 1;
-        info.name = "native threads";
-    }
-    return &info;
-}
-
-#define FT2INT64(ft) \
-        ((jlong)(ft).dwHighDateTime << 32 | (jlong)(ft).dwLowDateTime)
-
-jlong
-sysThreadCPUTime()
-{
-    if (windowsNT) {
-        FILETIME CreationTime;
-        FILETIME ExitTime;
-        FILETIME KernelTime;
-        FILETIME UserTime;
-
-        GetThreadTimes(GetCurrentThread(),
-                       &CreationTime, &ExitTime, &KernelTime, &UserTime);
-        return FT2INT64(UserTime) * 100;
-    } else {
-        return (jlong)sysGetMilliTicks() * 1000000;
-    }
-}
-
-int
-sysThreadGetStatus(sys_thread_t *tid, sys_mon_t **monitorPtr)
-{
-    int status;
-    switch (tid->state) {
-      case RUNNABLE:
-          if (tid->enter_monitor)
-              status = SYS_THREAD_MONITOR_WAIT;
-          else
-              status = SYS_THREAD_RUNNABLE;
-          break;
-      case SUSPENDED:
-          if (tid->enter_monitor)
-              status = SYS_THREAD_SUSPENDED | SYS_THREAD_MONITOR_WAIT;
-          else if (tid->suspend_flags & CONDVAR_WAIT_SUSPENDED)
-              status = SYS_THREAD_SUSPENDED | SYS_THREAD_CONDVAR_WAIT;
-          else
-              status = SYS_THREAD_SUSPENDED;
-          break;
-      case MONITOR_SUSPENDED:
-          status = SYS_THREAD_SUSPENDED | SYS_THREAD_MONITOR_WAIT;
-          break;
-      case CONDVAR_WAIT:
-          status = SYS_THREAD_CONDVAR_WAIT;
-          break;
-      case MONITOR_WAIT:
-          /*
-           * this flag should never be in used on win32 since the
-           * state is actually signalled by setting self->enter_monitor
-           * to point at the monitor the thread is waiting to enter
-           */
-          sysAssert(FALSE);
-      default:
-          return SYS_ERR;
-    }
-    if (monitorPtr) {
-        if (status & SYS_THREAD_MONITOR_WAIT) {
-            *monitorPtr = tid->enter_monitor;
-        } else if (status & SYS_THREAD_CONDVAR_WAIT) {
-            *monitorPtr = tid->wait_monitor;
-        } else {
-            *monitorPtr = NULL;
-        }
-    }
-    return status;
-}
-
-int sysAdjustTimeSlice(int i)
-{
-    return JNI_ERR;
-}
-
-void sysThreadProfSuspend(sys_thread_t *tid)
-{
-    SuspendThread(tid->handle);
-}
-
-void sysThreadProfResume(sys_thread_t *tid)
-{
-    ResumeThread(tid->handle);
-}
-
-bool_t sysThreadIsRunning(sys_thread_t *tid)
-{
-#ifndef _M_AMD64
-    unsigned int sum = 0;
-    unsigned int *p;
-    CONTEXT context;
-
-    context.ContextFlags = CONTEXT_FULL;
-    GetThreadContext(tid->handle, &context);
-    p = &context.SegGs;
-    while (p <= &context.SegSs) {
-        sum += *p;
-        p++;
-    }
-
-    if (sum == tid->last_sum) {
-        return FALSE;
-    }
-    tid->last_sum = sum;
-#endif
-    return TRUE;
-}
-
-void *
-sysThreadInterruptEvent()
-{
-    return sysThreadSelf()->interrupt_event;
-}
--- a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c	Fri Feb 04 16:29:41 2011 -0800
@@ -1032,21 +1032,20 @@
      * SO_BINDADDR isn't a socket option
      */
     if (opt == java_net_SocketOptions_SO_BINDADDR) {
-        SOCKET_ADDRESS him;
+        SOCKETADDRESS him;
         int len;
         int port;
         jobject iaObj;
         jclass iaCntrClass;
         jfieldID iaFieldID;
 
-        len = sizeof(struct sockaddr_in);
+        len = sizeof(him);
 
         if (fd == -1) {
             /* must be an IPV6 only socket. Case where both sockets are != -1
              * is handled in java
              */
             fd = getFD1 (env, this);
-            len = sizeof(struct SOCKADDR_IN6);
         }
 
         if (getsockname(fd, (struct sockaddr *)&him, &len) < 0) {
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp	Fri Feb 04 16:29:41 2011 -0800
@@ -396,7 +396,7 @@
     UINT adapter;
     // EnumAdapterModes treats 555 and 565 formats as equivalents
     static D3DFORMAT formats[] =
-        { D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
+      { D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
 
     J2dTraceLn(J2D_TRACE_INFO, "D3DGD_enumDisplayModesNative");
 
@@ -404,7 +404,7 @@
     RETURN_IF_NULL(pd3d9 = pMgr->GetD3DObject());
     adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
 
-    for (formatNum = 0; formatNum < 3; formatNum++) {
+    for (formatNum = 0; formatNum < (sizeof formats)/(sizeof *formats); formatNum++) {
         modesCount = pd3d9->GetAdapterModeCount(adapter, formats[formatNum]);
         for (modeNum = 0; modeNum < modesCount; modeNum++) {
             if (SUCCEEDED(pd3d9->EnumAdapterModes(adapter, formats[formatNum],
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Fri Feb 04 16:29:41 2011 -0800
@@ -2491,7 +2491,7 @@
     jint* colorsPtr = NULL;
     try {
         colorsPtr = (jint *)env->GetPrimitiveArrayCritical(colors, 0);
-        for (int i = 0; i < sizeof indexMap && i < colorLen; i++) {
+        for (int i = 0; i < (sizeof indexMap)/(sizeof *indexMap) && i < colorLen; i++) {
             colorsPtr[i] = DesktopColor2RGB(indexMap[i]);
         }
     } catch (...) {
--- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Fri Feb 04 16:29:41 2011 -0800
@@ -214,6 +214,7 @@
 #define EUDCKEY_ZH_CN  L"EUDC\\936"
 #define EUDCKEY_ZH_TW  L"EUDC\\950"
 #define EUDCKEY_KO_KR  L"EUDC\\949"
+#define EUDCKEY_EN_US  L"EUDC\\1252"
 #define LANGID_JA_JP   0x411
 #define LANGID_ZH_CN   0x0804
 #define LANGID_ZH_SG   0x1004
@@ -221,6 +222,7 @@
 #define LANGID_ZH_HK   0x0c04
 #define LANGID_ZH_MO   0x1404
 #define LANGID_KO_KR   0x0412
+#define LANGID_EN_US   0x0409
 
 
 JNIEXPORT jstring JNICALL
@@ -237,6 +239,9 @@
     LANGID langID = GetSystemDefaultLangID();
     //lookup for encoding ID, EUDC only supported in
     //codepage 932, 936, 949, 950 (and unicode)
+    // On Windows 7, at least for me, it shows up in Cp1252 if
+    // I create a custom font. Might as well support that as it makes
+    // verification easier.
     if (langID == LANGID_JA_JP) {
         eudcKey = EUDCKEY_JA_JP;
     } else if (langID == LANGID_ZH_CN || langID == LANGID_ZH_SG) {
@@ -246,6 +251,8 @@
       eudcKey = EUDCKEY_ZH_TW;
     } else if (langID == LANGID_KO_KR) {
         eudcKey = EUDCKEY_KO_KR;
+    } else if (langID == LANGID_EN_US) {
+        eudcKey = EUDCKEY_EN_US;
     } else {
         return NULL;
     }
--- a/jdk/src/windows/resource/java.manifest	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/src/windows/resource/java.manifest	Fri Feb 04 16:29:41 2011 -0800
@@ -1,12 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
+          manifestVersion="1.0"
+          xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
+>
 <assemblyIdentity
-    version="1.0.0.0"
+    version="IMVERSION"
     processorArchitecture="X86"
     name="Oracle Corporation, Java(tm) 2 Standard Edition"
     type="win32"
 />
-<description>AWT</description>
+<description>Java(TM) SE PROGRAM process</description>
 <dependency>
     <dependentAssembly>
         <assemblyIdentity
@@ -19,4 +22,23 @@
         />
     </dependentAssembly>
 </dependency>
+
+  <!-- Identify the application security requirements. -->
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="asInvoker"
+          uiAccess="false"/>
+        </requestedPrivileges>
+       </security>
+  </trustInfo>
+
+  <!-- Indicate JDK is high-dpi aware. -->
+  <asmv3:application>
+    <asmv3:windowsSettings  xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+       <dpiAware>true</dpiAware>
+    </asmv3:windowsSettings>
+  </asmv3:application>
+
 </assembly>
--- a/jdk/test/ProblemList.txt	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/ProblemList.txt	Fri Feb 04 16:29:41 2011 -0800
@@ -439,6 +439,9 @@
 java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java generic-all
 java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java generic-all
 
+java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java         generic-all
+java/rmi/transport/dgcDeadLock/TestImpl_Stub.java                       generic-all
+
 # Address already in use, othervm mode, solaris
 java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java	generic-all
 java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java	generic-all
@@ -718,9 +721,6 @@
 #   11 separate stacktraces created... file reuse problem?
 java/util/zip/ZipFile/ReadLongZipFileName.java			generic-all
 
-# Failing on all -client 32bit platforms starting with b77? See 6908348.
-java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java generic-all
-
 # Assert error, failures, on Linux Fedora 9 -server
 #   Windows samevm failure, assert error "Passed = 134, failed = 2"
 java/util/Arrays/ArrayObjectMethods.java			generic-all
@@ -737,11 +737,5 @@
 # Fails on solaris-sparc -server (Set not equal to copy. 1)
 java/util/EnumSet/EnumSetBash.java			 	solaris-sparc
 
-# Failing to close an input stream? "foo", triggers samevm windows failures
-java/util/Formatter/Constructors.java				generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/util/WeakHashMap/GCDuringIteration.java			generic-all
-
 ############################################################################
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 6426034
+ *  @summary Instance filter doesn't filter event if it occurs in native method
+ *
+ *  @author Keith McGuigan
+ *
+ *  @library scaffold
+ *  @run build JDIScaffold VMConnection
+ *  @compile -XDignore.symbol.file NativeInstanceFilterTarg.java
+ *  @run main/othervm NativeInstanceFilter
+ */
+
+/*
+ *  This test tests instance filters for events generated from a native method
+ */
+
+import java.util.*;
+import com.sun.jdi.*;
+import com.sun.jdi.event.*;
+import com.sun.jdi.request.*;
+
+public class NativeInstanceFilter extends JDIScaffold {
+
+    static int unfilteredEvents = 0;
+
+    public static void main(String args[]) throws Exception {
+        new NativeInstanceFilter().startTests();
+    }
+
+    public NativeInstanceFilter() {
+        super();
+    }
+
+    static EventRequestManager requestManager = null;
+    static MethodExitRequest request = null;
+
+    private void listen() {
+        TargetAdapter adapter = new TargetAdapter() {
+            EventSet set = null;
+            ObjectReference instance = null;
+
+            public boolean eventSetReceived(EventSet set) {
+                this.set = set;
+                return false;
+            }
+
+            public boolean methodExited(MethodExitEvent event) {
+                String name = event.method().name();
+                if (instance == null && name.equals("latch")) {
+                    // Grab the instance (return value) and set up as filter
+                    System.out.println("Setting up instance filter");
+                    instance = (ObjectReference)event.returnValue();
+                    requestManager.deleteEventRequest(request);
+                    request = requestManager.createMethodExitRequest();
+                    request.addInstanceFilter(instance);
+                    request.enable();
+                } else if (instance != null && name.equals("intern")) {
+                    // If not for the filter, this will be called twice
+                    System.out.println("method exit event (String.intern())");
+                    ++unfilteredEvents;
+                }
+                set.resume();
+                return false;
+            }
+        };
+        addListener(adapter);
+    }
+
+
+    protected void runTests() throws Exception {
+        String[] args = new String[2];
+        args[0] = "-connect";
+        args[1] = "com.sun.jdi.CommandLineLaunch:main=NativeInstanceFilterTarg";
+
+        connect(args);
+        waitForVMStart();
+
+        // VM has started, but hasn't started running the test program yet.
+        requestManager = vm().eventRequestManager();
+        ReferenceType referenceType =
+            resumeToPrepareOf("NativeInstanceFilterTarg").referenceType();
+
+        request = requestManager.createMethodExitRequest();
+        request.enable();
+
+        listen();
+
+        vm().resume();
+
+        waitForVMDeath();
+
+        if (unfilteredEvents != 1) {
+            throw new Exception(
+                "Failed: Event from native frame not filtered out.");
+        }
+        System.out.println("Passed: Event filtered out.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilterTarg.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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.misc.Version;
+
+public class NativeInstanceFilterTarg {
+
+    public static void main(String args[]) {
+        boolean runTest = jvmSupportsJVMTI_12x();
+        String s1 = "abc";
+        String s2 = "def";
+        latch(s1);
+        s1.intern();
+        if (runTest) {
+            s2.intern(); // this is the call that generates events that ought
+                         // to be filtered out.
+        } else {
+            System.out.println("Neutering test since JVMTI 1.2 not supported");
+        }
+    }
+
+    // Used by debugger to get an instance to filter with
+    public static String latch(String s) { return s; }
+
+    public static boolean jvmSupportsJVMTI_12x() {
+        // This fix requires the JVM to support JVMTI 1.2, which doesn't
+        // happen until HSX 20.0, build 05.
+        int major = Version.jvmMajorVersion();
+        int minor = Version.jvmMinorVersion();
+        int micro = Version.jvmMicroVersion();
+        int build = Version.jvmBuildNumber();
+
+        return (major > 20 || major == 20 &&
+                   (minor > 0 || micro > 0 || build >= 5));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 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     6173675
+ * @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
+ * @author  Paul Hohensee
+ */
+
+import java.lang.management.*;
+
+public class ThreadAllocatedMemory {
+    private static com.sun.management.ThreadMXBean mbean =
+        (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
+    private static boolean testFailed = false;
+    private static boolean done = false;
+    private static boolean done1 = false;
+    private static Object obj = new Object();
+    private static final int NUM_THREADS = 10;
+    private static Thread[] threads = new Thread[NUM_THREADS];
+    private static long[] sizes = new long[NUM_THREADS];
+
+    public static void main(String[] argv)
+        throws Exception {
+
+        if (!mbean.isThreadAllocatedMemorySupported()) {
+            return;
+        }
+
+        // disable allocated memory measurement
+        if (mbean.isThreadAllocatedMemoryEnabled()) {
+            mbean.setThreadAllocatedMemoryEnabled(false);
+        }
+
+        if (mbean.isThreadAllocatedMemoryEnabled()) {
+            throw new RuntimeException(
+                "ThreadAllocatedMemory is expected to be disabled");
+        }
+
+        Thread curThread = Thread.currentThread();
+        long id = curThread.getId();
+
+        long s = mbean.getThreadAllocatedBytes(id);
+        if (s != -1) {
+            throw new RuntimeException(
+                "Invalid ThreadAllocatedBytes returned = " +
+                s + " expected = -1");
+        }
+
+        // enable allocated memory measurement
+        if (!mbean.isThreadAllocatedMemoryEnabled()) {
+            mbean.setThreadAllocatedMemoryEnabled(true);
+        }
+
+        if (!mbean.isThreadAllocatedMemoryEnabled()) {
+            throw new RuntimeException(
+                "ThreadAllocatedMemory is expected to be enabled");
+        }
+
+        long size = mbean.getThreadAllocatedBytes(id);
+        // implementation could have started measurement when
+        // measurement was enabled, in which case size can be 0
+        if (size < 0) {
+            throw new RuntimeException(
+                "Invalid allocated bytes returned = " + size);
+        }
+
+        doit();
+
+        // Expected to be size1 >= size
+        long size1 = mbean.getThreadAllocatedBytes(id);
+        if (size1 < size) {
+            throw new RuntimeException("Allocated bytes " + size1 +
+                " expected >= " + size);
+        }
+        System.out.println(curThread.getName() +
+            " Current thread allocated bytes = " + size +
+            " allocated bytes = " + size1);
+
+
+        // start threads, wait for them to block
+        for (int i = 0; i < NUM_THREADS; i++) {
+            threads[i] = new MyThread("MyThread-" + i);
+            threads[i].start();
+        }
+
+        // threads block after doing some allocation
+        waitUntilThreadBlocked();
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            sizes[i] = mbean.getThreadAllocatedBytes(threads[i].getId());
+        }
+
+        // let threads go and do some more allocation
+        synchronized (obj) {
+            done = true;
+            obj.notifyAll();
+        }
+
+        // wait for threads to get going again.  we don't care if we
+        // catch them in mid-execution or if some of them haven't
+        // restarted after we're done sleeping.
+        goSleep(400);
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long newSize = mbean.getThreadAllocatedBytes(threads[i].getId());
+            if (sizes[i] > newSize) {
+                throw new RuntimeException("TEST FAILED: " +
+                    threads[i].getName() +
+                    " previous allocated bytes = " + sizes[i] +
+                    " > current allocated bytes = " + newSize);
+            }
+            System.out.println(threads[i].getName() +
+                " Previous allocated bytes = " + sizes[i] +
+                " Current allocated bytes = " + newSize);
+        }
+
+        // let threads exit
+        synchronized (obj) {
+            done1 = true;
+            obj.notifyAll();
+        }
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            try {
+                threads[i].join();
+            } catch (InterruptedException e) {
+                System.out.println("Unexpected exception is thrown.");
+                e.printStackTrace(System.out);
+                testFailed = true;
+                break;
+            }
+        }
+        if (testFailed) {
+            throw new RuntimeException("TEST FAILED");
+        }
+
+        System.out.println("Test passed");
+    }
+
+
+    private static void goSleep(long ms) throws Exception {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            System.out.println("Unexpected exception is thrown.");
+            throw e;
+        }
+    }
+
+    private static void waitUntilThreadBlocked()
+        throws Exception {
+        int count = 0;
+        while (count != NUM_THREADS) {
+            goSleep(100);
+            count = 0;
+            for (int i = 0; i < NUM_THREADS; i++) {
+                ThreadInfo info = mbean.getThreadInfo(threads[i].getId());
+                if (info.getThreadState() == Thread.State.WAITING) {
+                    count++;
+                }
+            }
+        }
+    }
+
+    public static void doit() {
+        String tmp = "";
+        long hashCode = 0;
+        for (int counter = 0; counter < 1000; counter++) {
+            tmp += counter;
+            hashCode = tmp.hashCode();
+        }
+        System.out.println(Thread.currentThread().getName() +
+                           " hashcode: " + hashCode);
+    }
+
+    static class MyThread extends Thread {
+        public MyThread(String name) {
+            super(name);
+        }
+
+        public void run() {
+            ThreadAllocatedMemory.doit();
+
+            synchronized (obj) {
+                while (!done) {
+                    try {
+                        obj.wait();
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                        break;
+                    }
+                }
+            }
+
+            long size1 = mbean.getThreadAllocatedBytes(getId());
+            ThreadAllocatedMemory.doit();
+            long size2 = mbean.getThreadAllocatedBytes(getId());
+
+            System.out.println(getName() + ": " +
+                "ThreadAllocatedBytes  = " + size1 +
+                " ThreadAllocatedBytes  = " + size2);
+
+            if (size1 > size2) {
+                throw new RuntimeException("TEST FAILED: " + getName() +
+                    " ThreadAllocatedBytes = " + size1 +
+                    " > ThreadAllocatedBytes = " + size2);
+            }
+
+            synchronized (obj) {
+                while (!done1) {
+                    try {
+                        obj.wait();
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemoryArray.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 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     6173675
+ * @summary Basic test of ThreadMXBean.getThreadAllocatedBytes(long[])
+ * @author  Paul Hohensee
+ */
+
+import java.lang.management.*;
+
+public class ThreadAllocatedMemoryArray {
+    private static com.sun.management.ThreadMXBean mbean =
+        (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
+    private static boolean testFailed = false;
+    private static boolean done = false;
+    private static boolean done1 = false;
+    private static Object obj = new Object();
+    private static final int NUM_THREADS = 10;
+    private static Thread[] threads = new Thread[NUM_THREADS];
+
+    public static void main(String[] argv)
+        throws Exception {
+
+        if (!mbean.isThreadAllocatedMemorySupported()) {
+            return;
+        }
+
+
+        // start threads, wait for them to block
+        long[] ids = new long[NUM_THREADS];
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            threads[i] = new MyThread("MyThread-" + i);
+            threads[i].start();
+            ids[i] = threads[i].getId();
+        }
+
+        waitUntilThreadBlocked();
+
+
+        // disable allocated memory measurement
+        if (mbean.isThreadAllocatedMemoryEnabled()) {
+            mbean.setThreadAllocatedMemoryEnabled(false);
+        }
+
+        if (mbean.isThreadAllocatedMemoryEnabled()) {
+            throw new RuntimeException(
+                "ThreadAllocatedMemory is expected to be disabled");
+        }
+
+        long sizes[] = mbean.getThreadAllocatedBytes(ids);
+
+        if (sizes == null) {
+          throw new RuntimeException("Null ThreadAllocatedBytes array returned");
+        }
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long s = sizes[i];
+            if (s != -1) {
+                throw new RuntimeException(
+                    "Invalid ThreadAllocatedBytes returned for thread " +
+                    threads[i].getName() + " = " +  s + " expected = -1");
+            }
+        }
+
+        // Enable allocated memory measurement
+        if (!mbean.isThreadAllocatedMemoryEnabled()) {
+            mbean.setThreadAllocatedMemoryEnabled(true);
+        }
+
+        if (!mbean.isThreadAllocatedMemoryEnabled()) {
+            throw new RuntimeException(
+                "ThreadAllocatedMemory is expected to be enabled");
+        }
+
+        sizes = mbean.getThreadAllocatedBytes(ids);
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long s = sizes[i];
+            if (s < 0) {
+                throw new RuntimeException(
+                    "Invalid allocated bytes returned for thread " +
+                    threads[i].getName() + " = " + s);
+            }
+        }
+
+        // let threads go and do some more allocation
+        synchronized (obj) {
+            done = true;
+            obj.notifyAll();
+        }
+
+        // wait for threads to get going again.  we don't care if we
+        // catch them in mid-execution or if some of them haven't
+        // restarted after we're done sleeping.
+        goSleep(400);
+
+        long[] sizes1 = mbean.getThreadAllocatedBytes(ids);
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long newSize = sizes1[i];
+            if (sizes[i] > newSize) {
+                throw new RuntimeException("TEST FAILED: " +
+                    threads[i].getName() +
+                    " previous allocated bytes = " + sizes[i] +
+                    " > current allocated bytes = " + newSize);
+            }
+            System.out.println(threads[i].getName() +
+                " Previous allocated bytes = " + sizes[i] +
+                " Current allocated bytes = " + newSize);
+        }
+
+        try {
+            sizes = mbean.getThreadAllocatedBytes(null);
+        } catch (NullPointerException e) {
+            System.out.println(
+                "Caught expected NullPointerException: " + e.getMessage());
+        }
+
+        try {
+            ids[0] = 0;
+            sizes = mbean.getThreadAllocatedBytes(ids);
+        } catch (IllegalArgumentException e) {
+            System.out.println(
+                "Caught expected IllegalArgumentException: " + e.getMessage());
+        }
+
+
+        // let threads exit
+        synchronized (obj) {
+            done1 = true;
+            obj.notifyAll();
+        }
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            try {
+                threads[i].join();
+            } catch (InterruptedException e) {
+                System.out.println("Unexpected exception is thrown.");
+                e.printStackTrace(System.out);
+                testFailed = true;
+                break;
+            }
+        }
+
+        if (testFailed) {
+            throw new RuntimeException("TEST FAILED");
+        }
+
+        System.out.println("Test passed");
+    }
+
+
+    private static void goSleep(long ms) throws Exception {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            System.out.println("Unexpected exception is thrown.");
+            throw e;
+        }
+    }
+
+    private static void waitUntilThreadBlocked()
+        throws Exception {
+        int count = 0;
+        while (count != NUM_THREADS) {
+            goSleep(100);
+            count = 0;
+            for (int i = 0; i < NUM_THREADS; i++) {
+                ThreadInfo info = mbean.getThreadInfo(threads[i].getId());
+                if (info.getThreadState() == Thread.State.WAITING) {
+                    count++;
+                }
+            }
+        }
+    }
+
+    public static void doit() {
+        String tmp = "";
+        long hashCode = 0;
+        for (int counter = 0; counter < 1000; counter++) {
+            tmp += counter;
+            hashCode = tmp.hashCode();
+        }
+        System.out.println(Thread.currentThread().getName() +
+                           " hashcode: " + hashCode);
+    }
+
+    static class MyThread extends Thread {
+        public MyThread(String name) {
+            super(name);
+        }
+
+        public void run() {
+            ThreadAllocatedMemoryArray.doit();
+
+            synchronized (obj) {
+                while (!done) {
+                    try {
+                        obj.wait();
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                        break;
+                    }
+                }
+            }
+
+            ThreadAllocatedMemoryArray.doit();
+
+            synchronized (obj) {
+                while (!done1) {
+                    try {
+                        obj.wait();
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                        break;
+                    }
+                }
+            }
+
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 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     6173675
+ * @summary Basic test of ThreadMXBean.getThreadCpuTime(long[]) and
+ *          getThreadUserTime(long[]).
+ * @author  Paul Hohensee
+ */
+
+import java.lang.management.*;
+
+public class ThreadCpuTimeArray {
+    private static com.sun.management.ThreadMXBean mbean =
+        (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
+    private static boolean testFailed = false;
+    private static boolean done = false;
+    private static Object obj = new Object();
+    private static final int NUM_THREADS = 10;
+    private static Thread[] threads = new Thread[NUM_THREADS];
+
+    // careful about this value
+    private static final int DELTA = 100;
+
+    public static void main(String[] argv)
+        throws Exception {
+
+        if (!mbean.isThreadCpuTimeSupported()) {
+            return;
+        }
+
+
+        // disable CPU time
+        if (mbean.isThreadCpuTimeEnabled()) {
+            mbean.setThreadCpuTimeEnabled(false);
+        }
+
+        if (mbean.isThreadCpuTimeEnabled()) {
+            throw new RuntimeException("ThreadCpuTime is expected to be disabled");
+        }
+
+        // start threads, wait for them to block
+        long[] ids = new long[NUM_THREADS];
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            threads[i] = new MyThread("MyThread-" + i);
+            threads[i].start();
+            ids[i] = threads[i].getId();
+        }
+
+        // threads block after doing some computation
+        waitUntilThreadBlocked();
+
+
+        long times[] = mbean.getThreadCpuTime(ids);
+        long userTimes[] = mbean.getThreadUserTime(ids);
+
+        if (times == null) {
+            throw new RuntimeException("Null ThreadCpuTime array returned");
+        }
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long t = times[i];
+            if (t != -1) {
+                throw new RuntimeException(
+                    "Invalid ThreadCpuTime returned for thread " +
+                    threads[i].getName() + " = " +  t + " expected = -1");
+            }
+            long ut = userTimes[i];
+            if (ut != -1) {
+                throw new RuntimeException(
+                    "Invalid ThreadUserTime returned for thread " +
+                    threads[i].getName() + " = " +  ut + " expected = -1");
+            }
+        }
+
+
+        // Enable CPU Time measurement
+        if (!mbean.isThreadCpuTimeEnabled()) {
+            mbean.setThreadCpuTimeEnabled(true);
+        }
+
+        if (!mbean.isThreadCpuTimeEnabled()) {
+            throw new RuntimeException("ThreadCpuTime is expected to be enabled");
+        }
+
+        times = mbean.getThreadCpuTime(ids);
+        userTimes = mbean.getThreadUserTime(ids);
+
+        goSleep(200);
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long t = times[i];
+            if (t < 0) {
+                throw new RuntimeException(
+                    "Invalid CPU time returned for thread " +
+                    threads[i].getName() + " = " + t);
+            }
+            long ut = userTimes[i];
+            if (ut < 0) {
+                throw new RuntimeException(
+                    "Invalid user time returned for thread " +
+                    threads[i].getName() + " = " + ut);
+            }
+        }
+
+        long[] times1 = mbean.getThreadCpuTime(ids);
+        long[] userTimes1 = mbean.getThreadUserTime(ids);
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            long newTime = times1[i];
+            long newUserTime = userTimes1[i];
+
+            if (times[i] > newTime) {
+                throw new RuntimeException("TEST FAILED: " +
+                    threads[i].getName() +
+                    " previous CPU time = " + times[i] +
+                    " > current CPU time = " + newTime);
+            }
+            if ((times[i] + DELTA) < newTime) {
+                throw new RuntimeException("TEST FAILED: " +
+                    threads[i].getName() +
+                    " CPU time = " + newTime +
+                    " previous CPU time " + times[i] +
+                    " out of expected range");
+            }
+
+            System.out.println(threads[i].getName() +
+                " Previous Cpu Time = " + times[i] +
+                " Current CPU time = " + newTime);
+
+            System.out.println(threads[i].getName() +
+                " Previous User Time = " + userTimes[i] +
+                " Current User time = " + newUserTime);
+        }
+
+
+        try {
+            times = mbean.getThreadCpuTime(null);
+        } catch (NullPointerException e) {
+            System.out.println(
+                "Caught expected NullPointerException: " + e.getMessage());
+        }
+
+        try {
+            ids[0] = 0;
+            times = mbean.getThreadCpuTime(ids);
+        } catch (IllegalArgumentException e) {
+            System.out.println(
+                "Caught expected IllegalArgumentException: " + e.getMessage());
+        }
+
+
+        // let threads exit
+        synchronized (obj) {
+            done = true;
+            obj.notifyAll();
+        }
+
+        for (int i = 0; i < NUM_THREADS; i++) {
+            try {
+                threads[i].join();
+            } catch (InterruptedException e) {
+                System.out.println("Unexpected exception is thrown.");
+                e.printStackTrace(System.out);
+                testFailed = true;
+                break;
+            }
+        }
+
+        if (testFailed) {
+            throw new RuntimeException("TEST FAILED");
+        }
+
+        System.out.println("Test passed");
+    }
+
+
+    private static void goSleep(long ms) throws Exception {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            System.out.println("Unexpected exception is thrown.");
+            throw e;
+        }
+    }
+
+    private static void waitUntilThreadBlocked()
+        throws Exception {
+        int count = 0;
+        while (count != NUM_THREADS) {
+            goSleep(100);
+            count = 0;
+            for (int i = 0; i < NUM_THREADS; i++) {
+                ThreadInfo info = mbean.getThreadInfo(threads[i].getId());
+                if (info.getThreadState() == Thread.State.WAITING) {
+                    count++;
+                }
+            }
+        }
+    }
+
+    public static void doit() {
+        double sum = 0;
+        for (int i = 0; i < 5000; i++) {
+           double r = Math.random();
+           double x = Math.pow(3, r);
+           sum += x - r;
+        }
+        System.out.println(Thread.currentThread().getName() +
+                           " sum = " + sum);
+    }
+
+    static class MyThread extends Thread {
+        public MyThread(String name) {
+            super(name);
+        }
+
+        public void run() {
+            ThreadCpuTimeArray.doit();
+
+            synchronized (obj) {
+                while (!done) {
+                    try {
+                        obj.wait();
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                        break;
+                    }
+                }
+            }
+
+            ThreadCpuTimeArray.doit();
+        }
+    }
+}
--- a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java	Fri Feb 04 16:29:41 2011 -0800
@@ -178,7 +178,7 @@
     public SearchFirstMode() {
         super();
 
-        Map<String, String> options = new HashMap<String, String>(4);
+        Map<String, String> options = new HashMap<>(4);
         options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com");
         options.put("userFilter",
             "(&(uid={USERNAME})(objectClass=inetOrgPerson))");
@@ -213,7 +213,7 @@
     public AuthFirstMode() {
         super();
 
-        Map<String, String> options = new HashMap<String, String>(5);
+        Map<String, String> options = new HashMap<>(5);
         options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com");
         options.put("authIdentity", "{USERNAME}");
         options.put("userFilter",
@@ -248,7 +248,7 @@
     public AuthOnlyMode() {
         super();
 
-        Map<String, String> options = new HashMap<String, String>(4);
+        Map<String, String> options = new HashMap<>(4);
         options.put("userProvider",
             "ldap://localhost:23456 ldap://localhost:23457");
         options.put("authIdentity",
--- a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java	Fri Feb 04 16:29:41 2011 -0800
@@ -73,7 +73,7 @@
 
         // bad value for userProvider option
 
-        Map<String, String> options = new HashMap<String, String>();
+        Map<String, String> options = new HashMap<>();
         options.put(USER_PROVIDER_OPTION, "ldap://localhost:23456");
         ldap.initialize(subject, null, null, options);
 
@@ -93,7 +93,7 @@
 
         LdapLoginModule ldap = new LdapLoginModule();
         Subject subject = new Subject();
-        Map<String, String> options = new HashMap<String, String>();
+        Map<String, String> options = new HashMap<>();
         ldap.initialize(subject, null, null, options);
 
         try {
@@ -110,7 +110,7 @@
 
         LdapLoginModule ldap = new LdapLoginModule();
         Subject subject = new Subject();
-        Map<String, String> options = new HashMap<String, String>();
+        Map<String, String> options = new HashMap<>();
 
         CallbackHandler goodHandler = new MyCallbackHandler(true);
         ldap.initialize(subject, goodHandler, null, options);
--- a/jdk/test/demo/zipfs/PathOps.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/demo/zipfs/PathOps.java	Fri Feb 04 16:29:41 2011 -0800
@@ -193,6 +193,17 @@
         return this;
     }
 
+    PathOps isSameFile(String target) {
+        try {
+            out.println("check two paths are same");
+            checkPath();
+            check(path.isSameFile(test(target).path()), true);
+        } catch (IOException ioe) {
+            fail();
+        }
+        return this;
+    }
+
     PathOps invalid() {
         if (!(exc instanceof InvalidPathException)) {
             out.println("InvalidPathException not thrown as expected");
@@ -344,7 +355,12 @@
             .normalize("foo");
         test("/foo/bar/gus/../..")
             .normalize("/foo");
-
+        test("/./.")
+            .normalize("/");
+        test("/.")
+            .normalize("/");
+        test("/./abc")
+            .normalize("/abc");
         // invalid
         test("foo\u0000bar")
             .invalid();
@@ -365,6 +381,10 @@
             .root("/")
             .parent("/foo")
             .name("bar");
+
+        // isSameFile
+        test("/fileDoesNotExist")
+            .isSameFile("/fileDoesNotExist");
     }
 
     static void npes() {
--- a/jdk/test/demo/zipfs/ZipFSTester.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/demo/zipfs/ZipFSTester.java	Fri Feb 04 16:29:41 2011 -0800
@@ -28,6 +28,7 @@
 import java.nio.file.attribute.*;
 import java.net.*;
 import java.util.*;
+import java.util.zip.*;
 
 import static java.nio.file.StandardOpenOption.*;
 import static java.nio.file.StandardCopyOption.*;
@@ -42,7 +43,8 @@
         FileSystem fs = null;
         try {
             fs = newZipFileSystem(Paths.get(args[0]), new HashMap<String, Object>());
-            test(fs);
+            test0(fs);
+            test1(fs);
             test2(fs);   // more tests
         } finally {
             if (fs != null)
@@ -50,11 +52,31 @@
         }
     }
 
-    static void test(FileSystem fs)
+    static void test0(FileSystem fs)
+        throws Exception
+    {
+        List<String> list = new LinkedList<>();
+        try (ZipFile zf = new ZipFile(fs.toString())) {
+            Enumeration<? extends ZipEntry> zes = zf.entries();
+            while (zes.hasMoreElements()) {
+                list.add(zes.nextElement().getName());
+            }
+            for (String pname : list) {
+                Path path = fs.getPath(pname);
+                if (!path.exists())
+                    throw new RuntimeException("path existence check failed!");
+                while ((path = path.getParent()) != null) {
+                    if (!path.exists())
+                        throw new RuntimeException("parent existence check failed!");
+                }
+            }
+        }
+    }
+
+    static void test1(FileSystem fs)
         throws Exception
     {
         Random rdm = new Random();
-
         // clone a fs and test on it
         Path tmpfsPath = getTempPath();
         Map<String, Object> env = new HashMap<String, Object>();
--- a/jdk/test/demo/zipfs/basic.sh	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/demo/zipfs/basic.sh	Fri Feb 04 16:29:41 2011 -0800
@@ -21,7 +21,7 @@
 # questions.
 #
 # @test
-# @bug 6990846
+# @bug 6990846 7009092 7009085
 # @summary Test ZipFileSystem demo
 # @build Basic PathOps ZipFSTester
 # @run shell basic.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FontClass/LCDScale.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+/*
+ *
+ * @bug 6925760
+ * @summary Scaled graphics causes overlapped LCD glyphs on Windows
+ */
+
+import java.awt.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+
+public class LCDScale extends Component {
+
+    public static void main(String args[]) {
+        Frame f = new Frame("TL TEST");
+        LCDScale td = new LCDScale();
+        f.add("Center", td);
+        f.pack(); f.setVisible(true);
+    }
+
+
+    public LCDScale() {
+        super();
+    }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(500,500);
+    }
+
+    public void paint(Graphics g) {
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.setRenderingHint(
+                 RenderingHints.KEY_TEXT_ANTIALIASING,
+                 RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+
+        Font f = new Font("Dialog", Font.PLAIN, 40);
+        g.setFont(f);
+        FontRenderContext frc = g2d.getFontRenderContext();
+        GlyphVector gv = f.createGlyphVector(frc, "Help");
+        g2d.drawGlyphVector(gv, 10f, 50f);
+        Rectangle2D bds1 = gv.getLogicalBounds();
+
+        f = new Font("Arial", Font.PLAIN, 25);
+        g.setFont(f);
+        double s = 2.0;
+        AffineTransform tx = AffineTransform.getScaleInstance(s,s);
+        g2d.transform(tx);
+        frc = g2d.getFontRenderContext();
+        gv = f.createGlyphVector(frc, "Help");
+        g2d.drawGlyphVector(gv, 10f, 100f);
+        Rectangle2D bds2 = gv.getLogicalBounds();
+
+        System.out.println(bds1);
+        System.out.println(bds2);
+        if (bds2.getWidth()*s < bds1.getWidth()) {
+            throw new RuntimeException("Bounds too small");
+        }
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FontClass/X11FontPathCrashTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 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 6958221
+ * @summary Test no crashing getting fonts on X11
+ * @run main X11FontPathCrashTest
+ */
+
+import java.awt.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+
+
+public class X11FontPathCrashTest {
+    public static void main(String[] args) {
+        new Font("nonexistentfont", Font.PLAIN, 12).getFamily();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/FontNames/LocaleFamilyNames.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ *
+ * 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 4935798 6521210 6901159
+ * @summary Tests that all family names that are reported in all locales
+ * correspond to some font returned from getAllFonts().
+ * @run main LocaleFamilyNames
+ */
+import java.awt.*;
+import java.util.*;
+
+public class LocaleFamilyNames {
+    public static void main(String[] args) throws Exception {
+
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+        Font[] all_fonts = ge.getAllFonts();
+
+        Locale[] all_locales = Locale.getAvailableLocales();
+
+        HashSet all_families = new HashSet();
+        for (int i=0; i<all_fonts.length; i++) {
+            all_families.add(all_fonts[i].getFamily());
+            for (int j=0; j<all_locales.length;j++) {
+              all_families.add(all_fonts[i].getFamily(all_locales[j]));
+            }
+
+        }
+
+
+        for (int i=0; i<all_locales.length; i++) {
+            String[] families_for_locale =
+                 ge.getAvailableFontFamilyNames(all_locales[i]);
+            for (int j=0; j<families_for_locale.length; j++) {
+                if ( !all_families.contains(families_for_locale[j]) ) {
+                    System.out.println("LOCALE: [" + all_locales[i]+"]");
+                    System.out.print("NO FONT HAS " +
+                                       "THE FOLLOWING FAMILY NAME:");
+                    System.out.println("["+families_for_locale[j]+"]");
+                    throw new Exception("test failed");
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/PrintStream/FailingConstructors.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 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 7000511
+ * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when
+ *          exception thrown
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+
+public class FailingConstructors {
+    static final String fileName = "FailingConstructorsTest";
+    static final String UNSUPPORTED_CHARSET = "unknownCharset";
+    static final String FILE_CONTENTS = "This is a small file!";
+
+    private static void realMain(String[] args) throws Throwable {
+        test(false, new File(fileName));
+
+        /* create the file and write its contents */
+        File file = File.createTempFile(fileName, null);
+        file.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(FILE_CONTENTS.getBytes());
+        fos.close();
+
+        test(true, file);
+        file.delete();
+    }
+
+    private static void test(boolean exists, File file) throws Throwable {
+        /* PrintStream(File file, String csn) */
+        try {
+            new PrintStream(file, UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new PrintStream(file, null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        /* PrintStream(String fileName, String csn)  */
+        try {
+            new PrintStream(file.getName(), UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new PrintStream(file.getName(), null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+    }
+
+    private static void check(boolean exists, File file) {
+        if (exists) {
+            /* the file should be unchanged */
+            verifyContents(file);
+        } else {
+            /* the file should not have been created */
+            if (file.exists()) { fail(file + " should not have been created"); }
+        }
+    }
+
+    private static void verifyContents(File file) {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            byte[] contents = FILE_CONTENTS.getBytes();
+            int read, count = 0;
+            while ((read = fis.read()) != -1) {
+                if (read != contents[count++])  {
+                    fail("file contents have been altered");
+                    return;
+                }
+            }
+        } catch (IOException ioe) {
+            unexpected(ioe);
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String message) {System.out.println(message); fail(); }
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/PrintWriter/FailingConstructors.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 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 7000511
+ * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when
+ *          exception thrown
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+
+public class FailingConstructors {
+    static final String fileName = "FailingConstructorsTest";
+    static final String UNSUPPORTED_CHARSET = "unknownCharset";
+    static final String FILE_CONTENTS = "This is a small file!";
+
+    private static void realMain(String[] args) throws Throwable {
+        test(false, new File(fileName));
+
+        /* create the file and write its contents */
+        File file = File.createTempFile(fileName, null);
+        file.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(FILE_CONTENTS.getBytes());
+        fos.close();
+
+        test(true, file);
+        file.delete();
+    }
+
+    private static void test(boolean exists, File file) throws Throwable {
+        /* PrintWriter(File file, String csn) */
+        try {
+            new PrintWriter(file, UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new PrintWriter(file, null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        /* PrintWriter(String fileName, String csn)  */
+        try {
+            new PrintWriter(file.getName(), UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new PrintWriter(file.getName(), null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+    }
+
+    private static void check(boolean exists, File file) {
+        if (exists) {
+            /* the file should be unchanged */
+            verifyContents(file);
+        } else {
+            /* the file should not have been created */
+            if (file.exists()) { fail(file + " should not have been created"); }
+        }
+    }
+
+    private static void verifyContents(File file) {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            byte[] contents = FILE_CONTENTS.getBytes();
+            int read, count = 0;
+            while ((read = fis.read()) != -1) {
+                if (read != contents[count++])  {
+                    fail("file contents have been altered");
+                    return;
+                }
+            }
+        } catch (IOException ioe) {
+            unexpected(ioe);
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String message) {System.out.println(message); fail(); }
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- a/jdk/test/java/net/InetAddress/B4762344.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * 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 4762344
- * @summary 2nd nameservice provider is non functional
- * @build B4762344 SimpleNameService Simple1NameServiceDescriptor Simple2NameServiceDescriptor
- * @run main/othervm -Dsun.net.spi.nameservice.provider.1=simple1,sun -Dsun.net.spi.nameservice.provider.2=simple2,sun B4762344
- */
-
-import java.net.*;
-import java.util.*;
-
-
-public class B4762344 {
-    private static String[][] hostnames = new String[][] {
-            // both providers know this host, but with different address
-            new String[] {"blade", "10.0.0.1"},
-            // provider1 knwos this host
-            new String[] {"blade.domain1", "10.0.0.2"},
-            // provider2 knows this host
-            new String[] {"blade.domain2", "20.0.0.2"}
-        };
-    private static String[][] hostaddrs = new String[][] {
-            new String[] {"10.0.0.1", "blade"},
-            new String[] {"10.0.0.2", "blade.domain1"},
-            new String[] {"20.0.0.2", "blade.domain2"}
-        };
-
-    public static void main(String[] args) throws Exception {
-        for (int i = 0; i < hostnames.length; i++) {
-            doLookup(hostnames[i][0], hostnames[i][1]);
-        }
-        for (int i = 0; i < hostaddrs.length; i++) {
-            doReverseLookup(hostaddrs[i][0], hostaddrs[i][1]);
-        }
-    }
-
-    private static void doLookup(String host, String addr) throws Exception {
-        String res = InetAddress.getByName(host).getHostAddress();
-        if (!res.equals(addr)) {
-            throw new RuntimeException("Test failed: wrong address for host " + host);
-        }
-    }
-
-    private static void doReverseLookup(String addr, String host) throws Exception {
-        StringTokenizer tokenizer = new StringTokenizer(addr, ".");
-        byte addrs[] = new byte[4];
-        for (int i = 0; i < 4; i++) {
-            addrs[i] = (byte)Integer.parseInt(tokenizer.nextToken());
-        }
-        String res = InetAddress.getByAddress(addrs).getHostName();
-        if (!res.equals(host)) {
-            throw new RuntimeException("Test failed: wrong host name for address " + addr);
-        }
-    }
-}
--- a/jdk/test/java/net/InetAddress/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Simple1NameServiceDescriptor
-Simple2NameServiceDescriptor
--- a/jdk/test/java/net/InetAddress/Simple1NameServiceDescriptor.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.net.spi.nameservice.*;
-
-
-public class Simple1NameServiceDescriptor implements NameServiceDescriptor {
-    public NameService createNameService() {
-        SimpleNameService ns = new SimpleNameService();
-
-        // both providers know this host, but the address is different
-        ns.put("blade", "10.0.0.1");
-        // only this provider knows this host
-        ns.put("blade.domain1", "10.0.0.2");
-
-        return ns;
-    }
-
-    public String getProviderName() {
-        return "sun";
-    }
-
-    public String getType() {
-        return "simple1";
-    }
-}
--- a/jdk/test/java/net/InetAddress/Simple2NameServiceDescriptor.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.net.spi.nameservice.*;
-
-
-public class Simple2NameServiceDescriptor implements NameServiceDescriptor {
-    public NameService createNameService() {
-        SimpleNameService ns = new SimpleNameService();
-        // both providers know this host, but the address of it is different
-        ns.put("blade", "20.0.0.1");
-        // only this provider knows this host
-        ns.put("blade.domain2", "20.0.0.2");
-
-        return ns;
-    }
-
-    public String getProviderName() {
-        return "sun";
-    }
-
-    public String getType() {
-        return "simple2";
-    }
-}
--- a/jdk/test/java/net/InetAddress/SimpleNameService.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.net.*;
-import java.util.*;
-import sun.net.spi.nameservice.*;
-
-
-public class SimpleNameService implements NameService {
-    // host name <-> host addr mapping
-    private HashMap<String, String> hosts = new LinkedHashMap<String, String>();
-
-    public void put(String host, String addr) {
-        hosts.put(host, addr);
-    }
-
-    private static String addrToString(byte addr[]) {
-        return Byte.toString(addr[0]) + "." +
-               Byte.toString(addr[1]) + "." +
-               Byte.toString(addr[2]) + "." +
-               Byte.toString(addr[3]);
-    }
-
-    public SimpleNameService() {
-    }
-
-    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
-        String addr = hosts.get(host);
-        if (addr == null) {
-            throw new UnknownHostException(host);
-        }
-
-        StringTokenizer tokenizer = new StringTokenizer(addr, ".");
-        byte addrs[] = new byte[4];
-        for (int i = 0; i < 4; i++) {
-            addrs[i] = (byte)Integer.parseInt(tokenizer.nextToken());
-        }
-        InetAddress[] ret = new InetAddress[1];
-        ret[0] = InetAddress.getByAddress(host, addrs);
-        return ret;
-    }
-
-    public String getHostByAddr(byte[] addr) throws UnknownHostException {
-        String addrString = addrToString(addr);
-        Iterator i = hosts.keySet().iterator();
-        while (i.hasNext()) {
-            String host = (String)i.next();
-            String value = (String)hosts.get(host);
-            if (value.equals(addrString)) {
-                return host;
-            }
-        }
-        throw new UnknownHostException();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkInterface/Equals.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 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 7003398
+ * @run main/othervm Equals
+ */
+import java.net.NetworkInterface;
+import java.net.InetAddress;
+import java.util.Enumeration;
+import java.util.HashMap;
+
+public class Equals {
+
+    public static void main(String args[]) throws Exception {
+
+        Enumeration nifs1 = NetworkInterface.getNetworkInterfaces();
+        HashMap<String,Integer> hashes = new HashMap<>();
+        HashMap<String,NetworkInterface> nicMap = new HashMap<>();
+
+        while (nifs1.hasMoreElements()) {
+            NetworkInterface ni = (NetworkInterface)nifs1.nextElement();
+            hashes.put(ni.getName(),ni.hashCode());
+            nicMap.put(ni.getName(),ni);
+        }
+
+        System.setSecurityManager(new SecurityManager());
+
+        Enumeration nifs2 = NetworkInterface.getNetworkInterfaces();
+        while (nifs2.hasMoreElements()) {
+            NetworkInterface ni = (NetworkInterface)nifs2.nextElement();
+            NetworkInterface niOrig = nicMap.get(ni.getName());
+
+            int h = hashes.get(ni.getName());
+            if (h != ni.hashCode()) {
+                throw new RuntimeException ("Hashcodes different for " +
+                        ni.getName());
+            }
+            if (!ni.equals(niOrig)) {
+                throw new RuntimeException ("equality different for " +
+                        ni.getName());
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Socks/SocksProxyVersion.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 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 6964547
+ * @run main/othervm SocksProxyVersion
+ * @summary test socksProxyVersion system property
+ */
+
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class SocksProxyVersion implements Runnable {
+    ServerSocket ss;
+    volatile boolean failed;
+
+    public static void main(String[] args) throws Exception {
+        new SocksProxyVersion();
+    }
+
+    public SocksProxyVersion() throws Exception {
+        ss = new ServerSocket(0);
+        int port = ss.getLocalPort();
+        Thread serverThread = new Thread(this);
+        serverThread.start();
+
+        System.setProperty("socksProxyHost", "localhost");
+        System.setProperty("socksProxyPort", Integer.toString(port));
+
+        // SOCKS V4
+        System.setProperty("socksProxyVersion", Integer.toString(4));
+        try (Socket s = new Socket()) {
+            s.connect(new InetSocketAddress("localhost", port));
+        } catch (SocketException e) {
+            // java.net.SocketException: Malformed reply from SOCKS server
+            // This exception is OK, since the "server" does not implement
+            // the socks protocol. It just verifies the version and closes.
+        }
+
+        // SOCKS V5
+        System.setProperty("socksProxyVersion", Integer.toString(5));
+        try (Socket s = new Socket()) {
+            s.connect(new InetSocketAddress("localhost", port));
+        } catch (SocketException e) { /* OK */ }
+
+        serverThread.join();
+        if (failed) {
+            throw new RuntimeException("socksProxyVersion not being set correctly");
+        }
+    }
+
+    public void run() {
+        try (ss) {
+            Socket s = ss.accept();
+            int version = (s.getInputStream()).read();
+            if (version != 4) {
+                System.out.println("Got " + version + ", expected 4");
+                failed = true;
+            }
+            s.close();
+
+            s = ss.accept();
+            version = (s.getInputStream()).read();
+            if (version != 5) {
+                System.out.println("Got " + version + ", expected 5");
+                failed = true;
+            }
+            s.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/B6896088.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 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 6896088
+ * @run main/othervm B6896088
+ * @summary URLClassLoader.close() apparently not working for JAR URLs on Windows
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.file.Path;
+
+public class B6896088 {
+
+   public static void main(String[] args) throws Exception {
+
+       String dir = System.getProperty ("test.classes");
+       File jarf = new File (dir, "foo.jar");
+       FileOutputStream fos = new FileOutputStream (jarf);
+       fos.write(bytes(nums));
+       fos.close();
+
+       // Create URL using JAR protocol
+       String jarName = (jarf.toURI()).toString();
+       URL url = new URL("jar", "", jarName + "!/");
+
+       // Create URLClassLoader from the URL
+       URLClassLoader loader = new URLClassLoader(new URL[]{url});
+       Class c = loader.loadClass("Foo");
+
+       // Close the URLClassLoader so we can delete/update the jar file
+       loader.close();
+
+       // Now try to delete the jar file
+
+       if (jarf.delete() && !jarf.exists()) {
+           System.out.println(jarf.getName()+" File Deleted");
+       } else {
+           System.out.println(jarf.getName()+" File Not Deleted");
+           throw new RuntimeException ("File not deleted");
+       }
+   }
+
+   static byte[] bytes (int[] i) {
+        byte[] buf = new byte [i.length];
+
+        for (int j=0; j<i.length; j++) {
+            buf[j] = (byte)i[j];
+        }
+        return buf;
+   }
+
+   /* contents of foo.jar */
+
+   static final int nums[] = {
+       0x50,0x4b,0x03,0x04,0x14,0x00,0x08,0x08,0x08,0x00,0xc8,0x61,
+       0x90,0x3d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x09,0x00,0x04,0x00,0x4d,0x45,0x54,0x41,0x2d,0x49,
+       0x4e,0x46,0x2f,0xfe,0xca,0x00,0x00,0x03,0x00,0x50,0x4b,0x07,
+       0x08,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x50,0x4b,0x03,0x04,0x14,0x00,0x08,0x08,0x08,0x00,0xc8,
+       0x61,0x90,0x3d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x4d,0x45,0x54,0x41,0x2d,
+       0x49,0x4e,0x46,0x2f,0x4d,0x41,0x4e,0x49,0x46,0x45,0x53,0x54,
+       0x2e,0x4d,0x46,0xf3,0x4d,0xcc,0xcb,0x4c,0x4b,0x2d,0x2e,0xd1,
+       0x0d,0x4b,0x2d,0x2a,0xce,0xcc,0xcf,0xb3,0x52,0x30,0xd4,0x33,
+       0xe0,0xe5,0x72,0x2e,0x4a,0x4d,0x2c,0x49,0x4d,0xd1,0x75,0xaa,
+       0x04,0x09,0x98,0xeb,0x19,0xe8,0x66,0xe6,0x95,0xa4,0x16,0xe5,
+       0x25,0xe6,0x28,0x68,0xf8,0x17,0x25,0x26,0xe7,0xa4,0x2a,0x38,
+       0xe7,0x17,0x15,0xe4,0x17,0x25,0x96,0x00,0x35,0x69,0xf2,0x72,
+       0xf1,0x72,0x01,0x00,0x50,0x4b,0x07,0x08,0x4c,0xd8,0x5e,0x68,
+       0x49,0x00,0x00,0x00,0x4a,0x00,0x00,0x00,0x50,0x4b,0x03,0x04,
+       0x14,0x00,0x08,0x08,0x08,0x00,0xbd,0x61,0x90,0x3d,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,
+       0x00,0x00,0x46,0x6f,0x6f,0x2e,0x63,0x6c,0x61,0x73,0x73,0x3b,
+       0xf5,0x6f,0xd7,0x3e,0x06,0x06,0x06,0x63,0x06,0x5e,0x2e,0x06,
+       0x66,0x06,0x2e,0x76,0x06,0x6e,0x76,0x06,0x1e,0x46,0x06,0x36,
+       0x9b,0xcc,0xbc,0xcc,0x12,0x3b,0x46,0x06,0x66,0x0d,0xcd,0x30,
+       0x46,0x06,0x16,0xe7,0xfc,0x94,0x54,0x46,0x06,0x7e,0x9f,0xcc,
+       0xbc,0x54,0xbf,0xd2,0xdc,0xa4,0xd4,0xa2,0x90,0xc4,0xa4,0x1c,
+       0xa0,0x08,0x57,0x70,0x7e,0x69,0x51,0x72,0xaa,0x5b,0x26,0x88,
+       0xc3,0xe1,0x96,0x9f,0xaf,0x97,0x95,0x58,0x96,0xc8,0xc3,0xc0,
+       0xc2,0xc0,0x0a,0xd4,0x0b,0xe4,0x33,0x32,0x08,0x80,0x44,0xf4,
+       0x73,0x12,0xf3,0xd2,0xf5,0xfd,0x93,0xb2,0x52,0x93,0x4b,0x18,
+       0x14,0x19,0x98,0x80,0x76,0x81,0x00,0x23,0x10,0x02,0x95,0x02,
+       0x49,0x36,0x20,0x4f,0x16,0xcc,0x67,0x60,0x60,0xd5,0xda,0xce,
+       0xc0,0xb8,0x11,0x2c,0xcd,0x0e,0x24,0xd9,0xc0,0x82,0x20,0x29,
+       0x0e,0x20,0xcd,0xc4,0xc0,0x09,0x00,0x50,0x4b,0x07,0x08,0x3e,
+       0x0a,0xdc,0x88,0x98,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0x50,
+       0x4b,0x01,0x02,0x14,0x00,0x14,0x00,0x08,0x08,0x08,0x00,0xc8,
+       0x61,0x90,0x3d,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x09,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4d,0x45,0x54,
+       0x41,0x2d,0x49,0x4e,0x46,0x2f,0xfe,0xca,0x00,0x00,0x50,0x4b,
+       0x01,0x02,0x14,0x00,0x14,0x00,0x08,0x08,0x08,0x00,0xc8,0x61,
+       0x90,0x3d,0x4c,0xd8,0x5e,0x68,0x49,0x00,0x00,0x00,0x4a,0x00,
+       0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x3d,0x00,0x00,0x00,0x4d,0x45,0x54,0x41,
+       0x2d,0x49,0x4e,0x46,0x2f,0x4d,0x41,0x4e,0x49,0x46,0x45,0x53,
+       0x54,0x2e,0x4d,0x46,0x50,0x4b,0x01,0x02,0x14,0x00,0x14,0x00,
+       0x08,0x08,0x08,0x00,0xbd,0x61,0x90,0x3d,0x3e,0x0a,0xdc,0x88,
+       0x98,0x00,0x00,0x00,0xb4,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
+       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,
+       0x00,0x00,0x46,0x6f,0x6f,0x2e,0x63,0x6c,0x61,0x73,0x73,0x50,
+       0x4b,0x05,0x06,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0xb4,
+       0x00,0x00,0x00,0x97,0x01,0x00,0x00,0x00,0x00,0x00
+   };
+}
--- a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -36,94 +36,7 @@
 import java.lang.reflect.*;
 import com.sun.net.httpserver.*;
 
-public class CloseTest {
-
-    static void copyFile (String src, String dst) {
-        copyFile (new File(src), new File(dst));
-    }
-
-    static void copyDir (String src, String dst) {
-        copyDir (new File(src), new File(dst));
-    }
-
-    static void copyFile (File src, File dst) {
-        try {
-            if (!src.isFile()) {
-                throw new RuntimeException ("File not found: " + src.toString());
-            }
-            dst.delete();
-            dst.createNewFile();
-            FileInputStream i = new FileInputStream (src);
-            FileOutputStream o = new FileOutputStream (dst);
-            byte[] buf = new byte [1024];
-            int count;
-            while ((count=i.read(buf)) >= 0) {
-                o.write (buf, 0, count);
-            }
-            i.close();
-            o.close();
-        } catch (IOException e) {
-            throw new RuntimeException (e);
-        }
-    }
-
-    static void rm_minus_rf (File path) {
-        if (!path.exists()) {
-            return;
-        }
-        if (path.isFile()) {
-            if (!path.delete()) {
-                throw new RuntimeException ("Could not delete " + path);
-            }
-        } else if (path.isDirectory ()) {
-            String[] names = path.list();
-            File[] files = path.listFiles();
-            for (int i=0; i<files.length; i++) {
-                rm_minus_rf (new File(path, names[i]));
-            }
-            if (!path.delete()) {
-                throw new RuntimeException ("Could not delete " + path);
-            }
-        } else {
-            throw new RuntimeException ("Trying to delete something that isn't a file or a directory");
-        }
-    }
-
-    static void copyDir (File src, File dst) {
-        if (!src.isDirectory()) {
-            throw new RuntimeException ("Dir not found: " + src.toString());
-        }
-        if (dst.exists()) {
-            throw new RuntimeException ("Dir exists: " + dst.toString());
-        }
-        dst.mkdir();
-        String[] names = src.list();
-        File[] files = src.listFiles();
-        for (int i=0; i<files.length; i++) {
-            String f = names[i];
-            if (files[i].isDirectory()) {
-                copyDir (files[i], new File (dst, f));
-            } else {
-                copyFile (new File (src, f), new File (dst, f));
-            }
-        }
-    }
-
-    /* expect is true if you expect to find it, false if you expect not to */
-    static Class loadClass (String name, URLClassLoader loader, boolean expect){
-        try {
-            Class clazz = Class.forName (name, true, loader);
-            if (!expect) {
-                throw new RuntimeException ("loadClass: "+name+" unexpected");
-            }
-            return clazz;
-        } catch (ClassNotFoundException e) {
-            if (expect) {
-                throw new RuntimeException ("loadClass: " +name + " not found");
-            }
-        }
-        return null;
-    }
+public class CloseTest extends Common {
 
 //
 // needs two jar files test1.jar and test2.jar with following structure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/Common.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import java.io.*;
+import java.net.*;
+
+public class Common {
+
+    static void copyFile (String src, String dst) {
+        copyFile (new File(src), new File(dst));
+    }
+
+    static void copyDir (String src, String dst) {
+        copyDir (new File(src), new File(dst));
+    }
+
+    static void copyFile (File src, File dst) {
+        try {
+            if (!src.isFile()) {
+                throw new RuntimeException ("File not found: " + src.toString());
+            }
+            dst.delete();
+            dst.createNewFile();
+            FileInputStream i = new FileInputStream (src);
+            FileOutputStream o = new FileOutputStream (dst);
+            byte[] buf = new byte [1024];
+            int count;
+            while ((count=i.read(buf)) >= 0) {
+                o.write (buf, 0, count);
+            }
+            i.close();
+            o.close();
+        } catch (IOException e) {
+            throw new RuntimeException (e);
+        }
+    }
+
+    static void rm_minus_rf (File path) {
+        if (!path.exists()) {
+            return;
+        }
+        if (path.isFile()) {
+            if (!path.delete()) {
+                throw new RuntimeException ("Could not delete " + path);
+            }
+        } else if (path.isDirectory ()) {
+            String[] names = path.list();
+            File[] files = path.listFiles();
+            for (int i=0; i<files.length; i++) {
+                rm_minus_rf (new File(path, names[i]));
+            }
+            if (!path.delete()) {
+                throw new RuntimeException ("Could not delete " + path);
+            }
+        } else {
+            throw new RuntimeException ("Trying to delete something that isn't a file or a directory");
+        }
+    }
+
+    static void copyDir (File src, File dst) {
+        if (!src.isDirectory()) {
+            throw new RuntimeException ("Dir not found: " + src.toString());
+        }
+        if (dst.exists()) {
+            throw new RuntimeException ("Dir exists: " + dst.toString());
+        }
+        dst.mkdir();
+        String[] names = src.list();
+        File[] files = src.listFiles();
+        for (int i=0; i<files.length; i++) {
+            String f = names[i];
+            if (files[i].isDirectory()) {
+                copyDir (files[i], new File (dst, f));
+            } else {
+                copyFile (new File (src, f), new File (dst, f));
+            }
+        }
+    }
+
+    /* expect is true if you expect to find it, false if you expect not to */
+    static Class loadClass (String name, URLClassLoader loader, boolean expect){
+        try {
+            Class clazz = Class.forName (name, true, loader);
+            if (!expect) {
+                throw new RuntimeException ("loadClass: "+name+" unexpected");
+            }
+            return clazz;
+        } catch (ClassNotFoundException e) {
+            if (expect) {
+                throw new RuntimeException ("loadClass: " +name + " not found");
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 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 6899919
+ * @run shell build2.sh
+ * @run main/othervm GetResourceAsStream
+ */
+
+import java.io.*;
+import java.net.*;
+
+public class GetResourceAsStream extends Common {
+
+/*
+ * We simply test various scenarios with class/resource files
+ * and make sure the files can be deleted after closing
+ * the loader. Therefore, the test will only really be verified
+ * on Windows. It will still run correctly on other platforms
+ */
+    public static void main (String args[]) throws Exception {
+
+        String workdir = System.getProperty("test.classes");
+        if (workdir == null) {
+            workdir = args[0];
+        }
+
+        /* the jar we copy for each test */
+        File srcfile = new File (workdir, "foo.jar");
+
+        /* the jar we use for the test */
+        File testfile = new File (workdir, "test.jar");
+
+        copyFile (srcfile, testfile);
+        test (testfile, false, false);
+
+        copyFile (srcfile, testfile);
+        test (testfile, true, false);
+
+        copyFile (srcfile, testfile);
+        test (testfile, true, true);
+
+        // repeat test using a directory of files
+
+        File testdir= new File (workdir, "testdir");
+        File srcdir= new File (workdir, "test3");
+
+        copyDir (srcdir, testdir);
+        test (testdir, true, false);
+
+    }
+
+    // create a loader on jarfile (or directory)
+    // load a class , then look for a resource
+    // then close the loader
+    // check further new classes/resources cannot be loaded
+    // check jar (or dir) can be deleted
+
+    static void test (File file, boolean loadclass, boolean readall)
+        throws Exception
+    {
+        URL[] urls = new URL[] {file.toURL()};
+        System.out.println ("Doing tests with URL: " + urls[0]);
+        URLClassLoader loader = new URLClassLoader (urls);
+        if (loadclass) {
+            Class testclass = loadClass ("com.foo.TestClass", loader, true);
+        }
+        InputStream s = loader.getResourceAsStream ("hello.txt");
+        s.read();
+        if (readall) {
+            while (s.read() != -1) ;
+            s.close();
+        }
+
+        loader.close ();
+
+        // shouuld not find bye.txt now
+        InputStream s1 = loader.getResourceAsStream("bye.txt");
+        if (s1 != null) {
+            throw new RuntimeException ("closed loader returned resource");
+        }
+
+        // now check we can delete the path
+        rm_minus_rf (file);
+        System.out.println (" ... OK");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/build2.sh	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+#  Copyright (c) 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.
+#
+if [ "${TESTSRC}" = "" ]
+then
+  echo "TESTSRC not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTSRC=${TESTSRC}"
+
+if [ "${TESTJAVA}" = "" ]
+then
+  echo "TESTJAVA not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTJAVA=${TESTJAVA}"
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+JAVAC="${TESTJAVA}/bin/javac"
+JAR="${TESTJAVA}/bin/jar"
+
+rm -rf ${TESTCLASSES}/test3
+mkdir -p ${TESTCLASSES}/test3
+
+echo "Hello world" > ${TESTCLASSES}/test3/hello.txt
+echo "Bye world" > ${TESTCLASSES}/test3/bye.txt
+cp ${TESTSRC}/test1/com/foo/TestClass.java ${TESTCLASSES}/test3
+cd ${TESTCLASSES}/test3
+${JAVAC} -d . TestClass.java
+
+${JAR} cvf foo.jar hello.txt bye.txt com/foo/TestClass.class
+rm -f ../foo.jar
+mv foo.jar ..
--- a/jdk/test/java/util/Formatter/Constructors.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/Formatter/Constructors.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4981811 4984465 5064492 6240171
+ * @bug 4981811 4984465 5064492 6240171 7000511
  * @summary Unit test for all constructors introduced by the formatter feature
  */
 
@@ -85,10 +85,8 @@
     }
 
     public static void main(String [] args) {
-
         // Formatter()
-        try {
-            Formatter f = new Formatter();
+        try (Formatter f = new Formatter()) {
             pass();
             out(f, StringBuilder.class);
             locale(f);
@@ -97,8 +95,7 @@
         }
 
         // Formatter(Appendable a)
-        try {
-            Formatter f = new Formatter((Appendable) null);
+        try (Formatter f = new Formatter((Appendable) null)) {
             pass();
             out(f, StringBuilder.class);
             locale(f);
@@ -107,8 +104,7 @@
         }
 
         // Formatter(Locale l)
-        try {
-            Formatter f = new Formatter((Locale) null);
+        try (Formatter f = new Formatter((Locale) null)) {
             pass();
             out(f, StringBuilder.class);
             locale(f, null);
@@ -117,8 +113,7 @@
         }
 
         // Formatter(Appendable a, Locale l)
-        try {
-            Formatter f = new Formatter((Appendable) null, (Locale) null);
+        try (Formatter f = new Formatter((Appendable) null, (Locale) null)) {
             pass();
             out(f, StringBuilder.class);
             locale(f, null);
@@ -127,8 +122,7 @@
         }
 
         // Formatter(String fileName)
-        try {
-            Formatter f = new Formatter("foo");
+        try (Formatter f = new Formatter("foo")) {
             pass();
             out(f, BufferedWriter.class);
             locale(f);
@@ -137,7 +131,7 @@
         }
 
         try {
-            Formatter f = new Formatter((String)null);
+            new Formatter((String)null);
             fail("new Formatter((String)null)");
         } catch (NullPointerException x) {
             pass();
@@ -146,8 +140,7 @@
         }
 
         // Formatter(String fileName, String csn)
-        try {
-            Formatter f = new Formatter("foo", "UTF-8");
+        try (Formatter f = new Formatter("foo", "UTF-8")) {
             pass();
             out(f, BufferedWriter.class);
             locale(f);
@@ -167,15 +160,14 @@
         try {
             new Formatter(".", "bar");
             fail("new Formatter(\".\", \"bar\")");
-        } catch (FileNotFoundException x) {
+        } catch (FileNotFoundException|UnsupportedEncodingException x) {
             pass();
         } catch (Exception x) {
             fail("new Formatter(\".\", \"bar\")", x);
         }
 
         // Formatter(String fileName, String csn, Locale l)
-        try {
-            Formatter f = new Formatter("foo", "ISO-8859-1", Locale.GERMANY);
+        try (Formatter f = new Formatter("foo", "ISO-8859-1", Locale.GERMANY)) {
             pass();
             out(f, BufferedWriter.class);
             locale(f, Locale.GERMANY);
@@ -183,8 +175,7 @@
             fail("new Formatter(\"foo\", \"ISO-8859-1\", Locale.GERMANY)", x);
         }
 
-        try {
-            Formatter f = new Formatter("foo", "ISO-8859-1", null);
+        try (Formatter f = new Formatter("foo", "ISO-8859-1", null)) {
             pass();
             locale(f, null);
             out(f, BufferedWriter.class);
@@ -193,8 +184,7 @@
         }
 
         // Formatter(File)
-        try {
-            Formatter f = new Formatter(new File("foo"));
+        try (Formatter f = new Formatter(new File("foo"))) {
             pass();
             locale(f);
             out(f, BufferedWriter.class);
@@ -203,7 +193,7 @@
         }
 
         try {
-            Formatter f = new Formatter((File)null);
+            new Formatter((File)null);
             fail("new Formatter((File)null)");
         } catch (NullPointerException x) {
             pass();
@@ -231,8 +221,7 @@
             fail("new Formatter((PrintStream) null)", x);
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"));
+        try (Formatter f = new Formatter(new PrintStream("foo"))) {
             pass();
             locale(f);
             out(f, PrintStream.class);
@@ -242,9 +231,8 @@
             fail("new Formatter(new PrintStream(\"foo\")", x);
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        Locale.JAPANESE);
+        try (Formatter f = new Formatter(new PrintStream("foo"),
+                                         Locale.JAPANESE)) {
             pass();
             locale(f, Locale.JAPANESE);
             out(f, PrintStream.class);
@@ -254,12 +242,11 @@
             fail("new Formatter(new PrintStream(\"foo\")", x);
         }
 
-        try {
+        try (PrintStream ps = new PrintStream("foo")) {
             // The cast here is necessary to avoid an ambiguity error
             // between Formatter(Appendable a, Locale l)
-            // and     Formatter(OutputStream os, String csn)
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        (String)null);
+            // and Formatter(OutputStream os, String csn)
+            new Formatter(ps, (String)null);
             fail("new Formatter(new PrintStream(\"foo\"), (String)null)");
         } catch (FileNotFoundException x) {
             fail("new Formatter(new PrintStream(\"foo\"), (String)null)", x);
@@ -271,12 +258,11 @@
             fail("new Formatter(new PrintStream(\"foo\"), (String)null)", x);
         }
 
-        try {
-            // The cast here is necessary to avoid an ambiguity error
-            // between Formatter(Appendable a, Locale l)
-            // and     Formatter(OutputStream os, String csn)
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        (Locale)null);
+        // The cast here is necessary to avoid an ambiguity error
+        // between Formatter(Appendable a, Locale l)
+        // and  Formatter(OutputStream os, String csn)
+        try (Formatter f = new Formatter(new PrintStream("foo"),
+                                         (Locale)null)) {
             pass();
             locale(f, null);
             out(f, PrintStream.class);
@@ -286,9 +272,8 @@
             fail("new Formatter(new PrintStream(\"foo\"), (Locale)null)", x);
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        Locale.KOREAN);
+        try (Formatter f = new Formatter(new PrintStream("foo"),
+                                         Locale.KOREAN)) {
             pass();
             locale(f, Locale.KOREAN);
             out(f, PrintStream.class);
@@ -298,9 +283,8 @@
             fail("new Formatter(new PrintStream(\"foo\"), Locale.KOREAN)", x);
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        "UTF-16BE", null);
+        try (Formatter f = new Formatter(new PrintStream("foo"),
+                                         "UTF-16BE", null)) {
             pass();
             locale(f, null);
             out(f, BufferedWriter.class);
@@ -312,9 +296,8 @@
             fail("new Formatter(new PrintStream(\"foo\"), \"UTF-16BE\", null");
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"),
-                                        "UTF-16BE", Locale.ITALIAN);
+        try (Formatter f = new Formatter(new PrintStream("foo"),
+                                         "UTF-16BE", Locale.ITALIAN)) {
             pass();
             locale(f, Locale.ITALIAN);
             out(f, BufferedWriter.class);
@@ -361,8 +344,7 @@
             fail("new Formatter((OutputStream) null)", x);
         }
 
-        try {
-            Formatter f = new Formatter((OutputStream) new PrintStream("foo"));
+        try (Formatter f = new Formatter((OutputStream) new PrintStream("foo"))) {
             pass();
             locale(f);
             out(f, BufferedWriter.class);
@@ -380,8 +362,8 @@
             fail("new Formatter((OutputStream) null, \"ISO-8859-1\")", x);
         }
 
-        try {
-            new Formatter((OutputStream) new PrintStream("foo"), null);
+        try (PrintStream ps = new PrintStream("foo")) {
+            new Formatter((OutputStream) ps, null);
             fail("new Formatter((OutputStream) new PrintStream(\"foo\"), null");
         } catch (NullPointerException x) {
             pass();
@@ -390,8 +372,8 @@
                  x);
         }
 
-        try {
-            new Formatter(new PrintStream("foo"), "bar");
+        try (PrintStream ps = new PrintStream("foo")) {
+            new Formatter(ps, "bar");
             fail("new Formatter(new PrintStream(\"foo\"), \"bar\")");
         } catch (UnsupportedEncodingException x) {
             pass();
@@ -399,8 +381,7 @@
             fail("new Formatter(new PrintStream(\"foo\"), \"bar\")", x);
         }
 
-        try {
-            Formatter f = new Formatter(new PrintStream("foo"), "UTF-8");
+        try (Formatter f = new Formatter(new PrintStream("foo"), "UTF-8")) {
             pass();
             locale(f);
             out(f, BufferedWriter.class);
@@ -419,8 +400,8 @@
                  x);
         }
 
-        try {
-            new Formatter(new PrintStream("foo"), null, Locale.UK);
+        try (PrintStream ps = new PrintStream("foo")) {
+            new Formatter(ps, null, Locale.UK);
             fail("new Formatter(new PrintStream(\"foo\"), null, Locale.UK)");
         } catch (NullPointerException x) {
             pass();
@@ -429,8 +410,8 @@
                  x);
         }
 
-        try {
-            new Formatter(new PrintStream("foo"), "bar", Locale.UK);
+        try (PrintStream ps = new PrintStream("foo")) {
+            new Formatter(ps, "bar", Locale.UK);
             fail("new Formatter(new PrintStream(\"foo\"), \"bar\", Locale.UK)");
         } catch (UnsupportedEncodingException x) {
             pass();
@@ -439,9 +420,7 @@
                  x);
         }
 
-        try {
-            Formatter f
-                = new Formatter(new PrintStream("foo"), "UTF-8", Locale.UK);
+        try (Formatter f = new Formatter(new PrintStream("foo"), "UTF-8", Locale.UK)) {
             pass();
             out(f, BufferedWriter.class);
             locale(f, Locale.UK);
@@ -451,8 +430,7 @@
         }
 
         // PrintStream(String fileName)
-        try {
-            new PrintStream("foo");
+        try (PrintStream ps = new PrintStream("foo")) {
             pass();
         } catch (Exception x) {
             fail("new PrintStream(\"foo\")", x);
@@ -469,8 +447,7 @@
         }
 
         // PrintStream(File file)
-        try {
-            new PrintStream(new File("foo"));
+        try (PrintStream ps = new PrintStream(new File("foo"))) {
             pass();
         } catch (Exception x) {
             fail("new PrintStream(new File(\"foo\"))", x);
@@ -487,8 +464,7 @@
         }
 
         // PrintWriter(String fileName)
-        try {
-            new PrintWriter("foo");
+        try (PrintWriter pw = new PrintWriter("foo")) {
             pass();
         } catch (Exception x) {
             fail("new PrintWriter(\"foo\")", x);
@@ -505,8 +481,7 @@
         }
 
         // PrintWriter(File file)
-        try {
-            new PrintWriter(new File("foo"));
+        try (PrintWriter pw = new PrintWriter(new File("foo"))) {
             pass();
         } catch (Exception x) {
             fail("new PrintWriter(new File(\"foo\"))", x);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Formatter/FailingConstructors.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 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 7000511
+ * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when
+ *          exception thrown
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Formatter;
+
+public class FailingConstructors {
+    static final String fileName = "FailingConstructorsTest";
+    static final String UNSUPPORTED_CHARSET = "unknownCharset";
+    static final String FILE_CONTENTS = "This is a small file!";
+
+    private static void realMain(String[] args) throws Throwable {
+        test(false, new File(fileName));
+
+        /* create the file and write its contents */
+        File file = File.createTempFile(fileName, null);
+        file.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(FILE_CONTENTS.getBytes());
+        fos.close();
+
+        test(true, file);
+        file.delete();
+    }
+
+    private static void test(boolean exists, File file) throws Throwable {
+        /* Formatter(File file, String csn) */
+        try {
+            new Formatter(file, UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new Formatter(file, null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        /* Formatter(String fileName, String csn)  */
+        try {
+            new Formatter(file.getName(), UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|UnsupportedEncodingException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new Formatter(file.getName(), null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+    }
+
+    private static void check(boolean exists, File file) {
+        if (exists) {
+            /* the file should be unchanged */
+            verifyContents(file);
+        } else {
+            /* the file should not have been created */
+            if (file.exists()) { fail(file + " should not have been created"); }
+        }
+    }
+
+    private static void verifyContents(File file) {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            byte[] contents = FILE_CONTENTS.getBytes();
+            int read, count = 0;
+            while ((read = fis.read()) != -1) {
+                if (read != contents[count++])  {
+                    fail("file contents have been altered");
+                    return;
+                }
+            }
+        } catch (IOException ioe) {
+            unexpected(ioe);
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String message) {System.out.println(message); fail(); }
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Scanner/FailingConstructors.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 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 7000511
+ * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when
+ *          exception thrown
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Scanner;
+
+public class FailingConstructors {
+    static final String fileName = "FailingConstructorsTest";
+    static final String UNSUPPORTED_CHARSET = "unknownCharset";
+    static final String FILE_CONTENTS = "This is a small file!";
+
+    private static void realMain(String[] args) throws Throwable {
+        test(false, new File(fileName));
+
+        /* create the file and write its contents */
+        File file = File.createTempFile(fileName, null);
+        file.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(FILE_CONTENTS.getBytes());
+        fos.close();
+
+        test(true, file);
+        file.delete();
+    }
+
+    private static void test(boolean exists, File file) throws Throwable {
+        /* Scanner(File source, String charsetName) */
+        try {
+            new Scanner(file, UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|IllegalArgumentException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new Scanner(file, null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        /* Scanner(FileRef source, String charsetName) */
+        try {
+            new Scanner(file.toPath(), UNSUPPORTED_CHARSET);
+            fail();
+        } catch(FileNotFoundException|IllegalArgumentException  e) {
+            pass();
+        }
+
+        check(exists, file);
+
+        try {
+            new Scanner(file.toPath(), null);
+            fail();
+        } catch(FileNotFoundException|NullPointerException e) {
+            pass();
+        }
+
+        check(exists, file);
+    }
+
+    private static void check(boolean exists, File file) {
+        if (exists) {
+            /* the file should be unchanged */
+            verifyContents(file);
+        } else {
+            /* the file should not have been created */
+            if (file.exists()) { fail(file + " should not have been created"); }
+        }
+    }
+
+    private static void verifyContents(File file) {
+        try (FileInputStream fis = new FileInputStream(file)) {
+            byte[] contents = FILE_CONTENTS.getBytes();
+            int read, count = 0;
+            while ((read = fis.read()) != -1) {
+                if (read != contents[count++])  {
+                    fail("file contents have been altered");
+                    return;
+                }
+            }
+        } catch (IOException ioe) {
+            unexpected(ioe);
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String message) {System.out.println(message); fail(); }
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Fri Feb 04 16:29:41 2011 -0800
@@ -33,18 +33,17 @@
 import java.util.concurrent.CountDownLatch;
 
 public class GCDuringIteration {
-    static void finalizeTillYouDrop() {
-        System.gc();              // Enqueue all finalizables
-
-        System.runFinalization(); // Drain finalizer queue
+    private static void waitForFinalizersToRun() {
+        for (int i = 0; i < 2; i++)
+            tryWaitForFinalizersToRun();
+    }
 
-        // There may be a straggler finalizable object still being
-        // finalized by the dedicated finalizer thread.  Enqueue one
-        // more finalizable object, and wait for it to be finalized.
-        final CountDownLatch latch = new CountDownLatch(1);
-        new Object() { protected void finalize() { latch.countDown(); }};
+    private static void tryWaitForFinalizersToRun() {
         System.gc();
-        try { latch.await(); }
+        final CountDownLatch fin = new CountDownLatch(1);
+        new Object() { protected void finalize() { fin.countDown(); }};
+        System.gc();
+        try { fin.await(); }
         catch (InterruptedException ie) { throw new Error(ie); }
     }
 
@@ -101,7 +100,9 @@
         {
             int first = firstValue(map);
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
-            foos[first] = null; finalizeTillYouDrop();
+            foos[first] = null;
+            for (int i = 0; i < 10 && map.size() != first; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first);
             checkIterator(it, first-1);
             equal(map.size(), first);
@@ -113,11 +114,14 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.next();          // protects first entry
             System.out.println(map.values());
-            foos[first] = null; finalizeTillYouDrop();
+            foos[first] = null;
+            tryWaitForFinalizersToRun()
             equal(map.size(), first+1);
             System.out.println(map.values());
             checkIterator(it, first-1);
-            finalizeTillYouDrop(); // first entry no longer protected
+            // first entry no longer protected
+            for (int i = 0; i < 10 && map.size() != first; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first);
             equal(firstValue(map), first-1);
         }
@@ -127,12 +131,15 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.next();          // protects first entry
             System.out.println(map.values());
-            foos[first] = foos[first-1] = null; finalizeTillYouDrop();
+            foos[first] = foos[first-1] = null;
+            tryWaitForFinalizersToRun();
             equal(map.size(), first);
             equal(firstValue(map), first);
             System.out.println(map.values());
             checkIterator(it, first-2);
-            finalizeTillYouDrop(); // first entry no longer protected
+            // first entry no longer protected
+            for (int i = 0; i < 10 && map.size() != first-1; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first-1);
             equal(firstValue(map), first-2);
         }
@@ -143,12 +150,15 @@
             it.next();          // protects first entry
             it.hasNext();       // protects second entry
             System.out.println(map.values());
-            foos[first] = foos[first-1] = null; finalizeTillYouDrop();
+            foos[first] = foos[first-1] = null;
+            tryWaitForFinalizersToRun();
             equal(firstValue(map), first);
             equal(map.size(), first+1);
             System.out.println(map.values());
             checkIterator(it, first-1);
-            finalizeTillYouDrop(); // first entry no longer protected
+            // first entry no longer protected
+            for (int i = 0; i < 10 && map.size() != first-1; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first-1);
             equal(firstValue(map), first-2);
         }
@@ -158,13 +168,16 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.next();          // protects first entry
             System.out.println(map.values());
-            foos[first] = foos[first-1] = null; finalizeTillYouDrop();
+            foos[first] = foos[first-1] = null;
+            tryWaitForFinalizersToRun();
             it.remove();
             equal(firstValue(map), first-2);
             equal(map.size(), first-1);
             System.out.println(map.values());
             checkIterator(it, first-2);
-            finalizeTillYouDrop();
+            // first entry no longer protected
+            for (int i = 0; i < 10 && map.size() != first-1; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first-1);
             equal(firstValue(map), first-2);
         }
@@ -176,12 +189,14 @@
             it.remove();
             it.hasNext();       // protects second entry
             System.out.println(map.values());
-            foos[first] = foos[first-1] = null; finalizeTillYouDrop();
+            foos[first] = foos[first-1] = null;
+            tryWaitForFinalizersToRun();
             equal(firstValue(map), first-1);
             equal(map.size(), first);
             System.out.println(map.values());
             checkIterator(it, first-1);
-            finalizeTillYouDrop();
+            for (int i = 0; i < 10 && map.size() != first-1; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), first-1);
             equal(firstValue(map), first-2);
         }
@@ -191,12 +206,13 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.hasNext();       // protects first entry
             Arrays.fill(foos, null);
-            finalizeTillYouDrop();
+            tryWaitForFinalizersToRun();
             equal(map.size(), 1);
             System.out.println(map.values());
             equal(it.next().getValue(), first);
             check(! it.hasNext());
-            finalizeTillYouDrop();
+            for (int i = 0; i < 10 && map.size() != 0; i++)
+                tryWaitForFinalizersToRun();
             equal(map.size(), 0);
             check(map.isEmpty());
         }
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile CancelledProducerConsumerLoops.java
+ * @compile -source 1.5 CancelledProducerConsumerLoops.java
  * @run main/timeout=7000 CancelledProducerConsumerLoops
  * @summary Checks for responsiveness of blocking queues to cancellation.
  * Runs under the assumption that ITERS computations require more than
@@ -119,48 +119,24 @@
         }
     }
 
-    static final class LTQasSQ<T> extends LinkedTransferQueue<T> {
-        LTQasSQ() { super(); }
-        public void put(T x) {
-            try { super.transfer(x); }
-            catch (InterruptedException ex) { throw new Error(); }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
-    static final class HalfSyncLTQ<T> extends LinkedTransferQueue<T> {
-        HalfSyncLTQ() { super(); }
-        public void put(T x) {
-            if (ThreadLocalRandom.current().nextBoolean())
-                super.put(x);
-            else {
-                try { super.transfer(x); }
-                catch (InterruptedException ex) { throw new Error(); }
-            }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
     static void oneTest(int pairs, int iters) throws Exception {
 
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY), pairs, iters);
         oneRun(new LinkedBlockingQueue<Integer>(CAPACITY), pairs, iters);
         oneRun(new LinkedBlockingDeque<Integer>(CAPACITY), pairs, iters);
+        oneRun(new LinkedTransferQueue<Integer>(), pairs, iters);
         oneRun(new SynchronousQueue<Integer>(), pairs, iters / 8);
 
-        /* TODO: unbounded queue implementations are prone to OOME
+        /* PriorityBlockingQueue is unbounded
         oneRun(new PriorityBlockingQueue<Integer>(iters / 2 * pairs), pairs, iters / 4);
-        oneRun(new LinkedTransferQueue<Integer>(), pairs, iters);
-        oneRun(new LTQasSQ<Integer>(), pairs, iters);
-        oneRun(new HalfSyncLTQ<Integer>(), pairs, iters);
         */
     }
 
-    static abstract class Stage implements Callable<Integer> {
+    abstract static class Stage implements Callable<Integer> {
         final BlockingQueue<Integer> queue;
         final CyclicBarrier barrier;
         final int iters;
-        Stage (BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
+        Stage(BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
             queue = q;
             barrier = b;
             this.iters = iters;
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile MultipleProducersSingleConsumerLoops.java
+ * @compile -source 1.5 MultipleProducersSingleConsumerLoops.java
  * @run main/timeout=3600 MultipleProducersSingleConsumerLoops
  * @summary  multiple producers and single consumer using blocking queues
  */
@@ -87,35 +87,11 @@
             throw new Error();
    }
 
-    static final class LTQasSQ<T> extends LinkedTransferQueue<T> {
-        LTQasSQ() { super(); }
-        public void put(T x) {
-            try { super.transfer(x); }
-            catch (InterruptedException ex) { throw new Error(); }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
-    static final class HalfSyncLTQ<T> extends LinkedTransferQueue<T> {
-        HalfSyncLTQ() { super(); }
-        public void put(T x) {
-            if (ThreadLocalRandom.current().nextBoolean())
-                super.put(x);
-            else {
-                try { super.transfer(x); }
-                catch (InterruptedException ex) { throw new Error(); }
-            }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
     static void oneTest(int producers, int iters) throws Exception {
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY), producers, iters);
         oneRun(new LinkedBlockingQueue<Integer>(CAPACITY), producers, iters);
         oneRun(new LinkedBlockingDeque<Integer>(CAPACITY), producers, iters);
         oneRun(new LinkedTransferQueue<Integer>(), producers, iters);
-        oneRun(new LTQasSQ<Integer>(), producers, iters);
-        oneRun(new HalfSyncLTQ<Integer>(), producers, iters);
 
         // Don't run PBQ since can legitimately run out of memory
         //        if (print)
@@ -129,11 +105,11 @@
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY, true), producers, iters);
     }
 
-    static abstract class Stage implements Runnable {
+    abstract static class Stage implements Runnable {
         final int iters;
         final BlockingQueue<Integer> queue;
         final CyclicBarrier barrier;
-        Stage (BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
+        Stage(BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
             queue = q;
             barrier = b;
             this.iters = iters;
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile ProducerConsumerLoops.java
+ * @compile -source 1.5 ProducerConsumerLoops.java
  * @run main/timeout=3600 ProducerConsumerLoops
  * @summary  multiple producers and consumers using blocking queues
  */
@@ -87,35 +87,11 @@
             throw new Error();
    }
 
-    static final class LTQasSQ<T> extends LinkedTransferQueue<T> {
-        LTQasSQ() { super(); }
-        public void put(T x) {
-            try { super.transfer(x); }
-            catch (InterruptedException ex) { throw new Error(); }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
-    static final class HalfSyncLTQ<T> extends LinkedTransferQueue<T> {
-        HalfSyncLTQ() { super(); }
-        public void put(T x) {
-            if (ThreadLocalRandom.current().nextBoolean())
-                super.put(x);
-            else {
-                try { super.transfer(x); }
-                catch (InterruptedException ex) { throw new Error(); }
-            }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
     static void oneTest(int pairs, int iters) throws Exception {
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY), pairs, iters);
         oneRun(new LinkedBlockingQueue<Integer>(CAPACITY), pairs, iters);
         oneRun(new LinkedBlockingDeque<Integer>(CAPACITY), pairs, iters);
         oneRun(new LinkedTransferQueue<Integer>(), pairs, iters);
-        oneRun(new LTQasSQ<Integer>(), pairs, iters);
-        oneRun(new HalfSyncLTQ<Integer>(), pairs, iters);
         oneRun(new PriorityBlockingQueue<Integer>(), pairs, iters);
         oneRun(new SynchronousQueue<Integer>(), pairs, iters);
 
@@ -126,11 +102,11 @@
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY, true), pairs, iters);
     }
 
-    static abstract class Stage implements Runnable {
+    abstract static class Stage implements Runnable {
         final int iters;
         final BlockingQueue<Integer> queue;
         final CyclicBarrier barrier;
-        Stage (BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
+        Stage(BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
             queue = q;
             barrier = b;
             this.iters = iters;
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Fri Feb 04 16:29:41 2011 -0800
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile SingleProducerMultipleConsumerLoops.java
+ * @compile -source 1.5 SingleProducerMultipleConsumerLoops.java
  * @run main/timeout=600 SingleProducerMultipleConsumerLoops
  * @summary  check ordering for blocking queues with 1 producer and multiple consumers
  */
@@ -73,35 +73,11 @@
             throw new Error();
    }
 
-    static final class LTQasSQ<T> extends LinkedTransferQueue<T> {
-        LTQasSQ() { super(); }
-        public void put(T x) {
-            try { super.transfer(x); }
-            catch (InterruptedException ex) { throw new Error(); }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
-    static final class HalfSyncLTQ<T> extends LinkedTransferQueue<T> {
-        HalfSyncLTQ() { super(); }
-        public void put(T x) {
-            if (ThreadLocalRandom.current().nextBoolean())
-                super.put(x);
-            else {
-                try { super.transfer(x); }
-                catch (InterruptedException ex) { throw new Error(); }
-            }
-        }
-        private final static long serialVersionUID = 42;
-    }
-
     static void oneTest(int consumers, int iters) throws Exception {
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY), consumers, iters);
         oneRun(new LinkedBlockingQueue<Integer>(CAPACITY), consumers, iters);
         oneRun(new LinkedBlockingDeque<Integer>(CAPACITY), consumers, iters);
         oneRun(new LinkedTransferQueue<Integer>(), consumers, iters);
-        oneRun(new LTQasSQ<Integer>(), consumers, iters);
-        oneRun(new HalfSyncLTQ<Integer>(), consumers, iters);
         oneRun(new PriorityBlockingQueue<Integer>(), consumers, iters);
         oneRun(new SynchronousQueue<Integer>(), consumers, iters);
         if (print)
@@ -110,12 +86,12 @@
         oneRun(new ArrayBlockingQueue<Integer>(CAPACITY, true), consumers, iters);
     }
 
-    static abstract class Stage implements Runnable {
+    abstract static class Stage implements Runnable {
         final int iters;
         final BlockingQueue<Integer> queue;
         final CyclicBarrier barrier;
         volatile int result;
-        Stage (BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
+        Stage(BlockingQueue<Integer> q, CyclicBarrier b, int iters) {
             queue = q;
             barrier = b;
             this.iters = iters;
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Fri Feb 04 16:29:41 2011 -0800
@@ -53,7 +53,9 @@
         test(new LinkedTransferQueue());
         // Other concurrent queues (e.g. ArrayBlockingQueue) do not
         // currently have weakly consistent iterators.
-        // test(new ArrayBlockingQueue(20));
+        // As of 2010-09, ArrayBlockingQueue passes this test, but
+        // does not fully implement weak consistency.
+        test(new ArrayBlockingQueue(20));
     }
 
     void test(Queue q) {
--- a/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Fri Feb 04 16:29:41 2011 -0800
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6399443
+ * @run main/othervm AutoShutdown
  * @summary Check for auto-shutdown and gc of singleThreadExecutors
  * @author Martin Buchholz
  */
--- a/jdk/test/java/util/concurrent/Phaser/Basic.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/Phaser/Basic.java	Fri Feb 04 16:29:41 2011 -0800
@@ -52,15 +52,16 @@
         check(phaser.isTerminated());
         int unarriverParties = phaser.getUnarrivedParties();
         int registeredParties = phaser.getRegisteredParties();
-        equal(phaser.arrive(), -1);
-        equal(phaser.arriveAndDeregister(), -1);
-        equal(phaser.arriveAndAwaitAdvance(), -1);
-        equal(phaser.bulkRegister(10), -1);
-        equal(phaser.getPhase(), -1);
-        equal(phaser.register(), -1);
+        int phase = phaser.getPhase();
+        check(phase < 0);
+        equal(phase, phaser.arrive());
+        equal(phase, phaser.arriveAndDeregister());
+        equal(phase, phaser.arriveAndAwaitAdvance());
+        equal(phase, phaser.bulkRegister(10));
+        equal(phase, phaser.register());
         try {
-            equal(phaser.awaitAdvanceInterruptibly(0), -1);
-            equal(phaser.awaitAdvanceInterruptibly(0, 10, SECONDS), -1);
+            equal(phase, phaser.awaitAdvanceInterruptibly(0));
+            equal(phase, phaser.awaitAdvanceInterruptibly(0, 10, SECONDS));
         } catch (Exception ie) {
             unexpected(ie);
         }
@@ -94,10 +95,9 @@
             }
             int phase = atTheStartingGate.getPhase();
             equal(phase, atTheStartingGate.arrive());
-            int AwaitPhase = atTheStartingGate.awaitAdvanceInterruptibly(phase,
-                                                        10,
-                                                        SECONDS);
-            if (expectNextPhase) check(AwaitPhase == (phase + 1));
+            int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly
+                (phase, 10, SECONDS);
+            if (expectNextPhase) check(awaitPhase == (phase + 1));
 
             pass();
         } catch (Throwable t) {
@@ -271,18 +271,19 @@
         // Phaser is terminated while threads are waiting
         //----------------------------------------------------------------
         try {
-            Phaser phaser = new Phaser(3);
-            Iterator<Awaiter> awaiters = awaiterIterator(phaser);
             for (int i = 0; i < 4; i++) {
+                Phaser phaser = new Phaser(3);
+                Iterator<Awaiter> awaiters = awaiterIterator(phaser);
                 Arriver a1 = awaiters.next(); a1.start();
                 Arriver a2 = awaiters.next(); a2.start();
                 toTheStartingGate();
                 while (phaser.getArrivedParties() < 2) Thread.yield();
+                equal(0, phaser.getPhase());
                 phaser.forceTermination();
                 a1.join();
                 a2.join();
-                check(a1.phase == -1);
-                check(a2.phase == -1);
+                equal(0 + Integer.MIN_VALUE, a1.phase);
+                equal(0 + Integer.MIN_VALUE, a2.phase);
                 int arrivedParties = phaser.getArrivedParties();
                 checkTerminated(phaser);
                 equal(phaser.getArrivedParties(), arrivedParties);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/Phaser/FickleRegister.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,150 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+/*
+ * @test
+ * @summary stress test for register/arriveAndDeregister
+ * @run main FickleRegister 300
+ */
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+public class FickleRegister {
+    final AtomicLong count = new AtomicLong(0);
+    final long testDurationMillisDefault = 10L * 1000L;
+    final long testDurationMillis;
+    final long quittingTimeNanos;
+    final int chunkSize = 1000;
+
+    FickleRegister(String[] args) {
+        testDurationMillis = (args.length > 0) ?
+            Long.valueOf(args[0]) : testDurationMillisDefault;
+        quittingTimeNanos = System.nanoTime() +
+            testDurationMillis * 1000L * 1000L;
+    }
+
+    class Runner extends CheckedRunnable {
+        final Phaser p;
+        Runner(Phaser phaser) { p = phaser; }
+        public void realRun() {
+            int prevPhase = -1;
+            for (int k = 1;; k++) {
+                for (int i = 0; i < chunkSize; i++) {
+                    int phase = p.register();
+                    if (phase < 0) break;
+                    check(phase > prevPhase);
+                    prevPhase = phase;
+                    equal(phase, p.arriveAndDeregister());
+                    check(phase < p.awaitAdvance(phase));
+                }
+                if (System.nanoTime() - quittingTimeNanos > 0) {
+                    count.getAndAdd(k * chunkSize);
+                    break;
+                }
+            }
+        }
+    }
+
+    void test(String[] args) throws Throwable {
+        final Phaser parent = new Phaser() {
+                protected boolean onAdvance(int phase, int parties) {
+                    return false;
+                }
+            };
+
+        final Phaser child1 = new Phaser(parent);
+        final Phaser child2 = new Phaser(parent);
+        final Phaser subchild1 = new Phaser(child1);
+        final Phaser subchild2 = new Phaser(child2);
+        final Phaser[] phasers = {
+            parent, child1, child2, subchild1, subchild2
+        };
+
+        int reps = 4;
+        ArrayList<Thread> threads = new ArrayList<Thread>();
+        for (int j = 0; j < reps; ++j) {
+            threads.add(new Thread(new Runner(subchild1)));
+            threads.add(new Thread(new Runner(child1)));
+            threads.add(new Thread(new Runner(parent)));
+            threads.add(new Thread(new Runner(child2)));
+            threads.add(new Thread(new Runner(subchild2)));
+        }
+
+        for (Thread thread : threads)
+            thread.start();
+
+        for (Thread thread : threads)
+            thread.join();
+
+        System.out.println("Parent:    " + parent);
+        System.out.println("Child1:    " + child1);
+        System.out.println("Child2:    " + child2);
+        System.out.println("Subchild1: " + subchild1);
+        System.out.println("Subchild2: " + subchild2);
+        System.out.println("Iterations:" + count.get());
+
+        for (Phaser phaser : phasers) {
+            check(phaser.getPhase() > 0);
+            equal(0, phaser.getRegisteredParties());
+            equal(0, phaser.getUnarrivedParties());
+            equal(parent.getPhase(), phaser.getPhase());
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++; Thread.dumpStack();}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond) {if (cond) pass(); else fail();}
+    void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        new FickleRegister(args).instanceMain(args);}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+
+    abstract class CheckedRunnable implements Runnable {
+        protected abstract void realRun() throws Throwable;
+
+        public final void run() {
+            try {realRun();} catch (Throwable t) {unexpected(t);}
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,158 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Martin Buchholz and Doug Lea with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+/*
+ * @test
+ * @summary Test Phaser phase integer overflow behavior
+ */
+
+import java.util.concurrent.Phaser;
+import java.lang.reflect.Field;
+
+public class PhaseOverflow {
+    Field stateField;
+
+    void checkState(Phaser phaser,
+                    int phase, int parties, int unarrived) {
+        equal(phase, phaser.getPhase());
+        equal(parties, phaser.getRegisteredParties());
+        equal(unarrived, phaser.getUnarrivedParties());
+    }
+
+    void test(String[] args) throws Throwable {
+        stateField = Phaser.class.getDeclaredField("state");
+        stateField.setAccessible(true);
+        testLeaf();
+        testTiered();
+    }
+
+    void testLeaf() throws Throwable {
+        Phaser phaser = new Phaser();
+        // this is extremely dependent on internal representation
+        stateField.setLong(phaser, ((Integer.MAX_VALUE - 1L) << 32) | 1L);
+        checkState(phaser, Integer.MAX_VALUE - 1, 0, 0);
+        phaser.register();
+        checkState(phaser, Integer.MAX_VALUE - 1, 1, 1);
+        phaser.arrive();
+        checkState(phaser, Integer.MAX_VALUE, 1, 1);
+        phaser.arrive();
+        checkState(phaser, 0, 1, 1);
+        phaser.arrive();
+        checkState(phaser, 1, 1, 1);
+    }
+
+    int phaseInc(int phase) { return (phase + 1) & Integer.MAX_VALUE; }
+
+    void testTiered() throws Throwable {
+        Phaser root = new Phaser();
+        // this is extremely dependent on internal representation
+        stateField.setLong(root, ((Integer.MAX_VALUE - 1L) << 32) | 1L);
+        checkState(root, Integer.MAX_VALUE - 1, 0, 0);
+        Phaser p1 = new Phaser(root, 1);
+        checkState(root, Integer.MAX_VALUE - 1, 1, 1);
+        checkState(p1, Integer.MAX_VALUE - 1, 1, 1);
+        Phaser p2 = new Phaser(root, 2);
+        checkState(root, Integer.MAX_VALUE - 1, 2, 2);
+        checkState(p2, Integer.MAX_VALUE - 1, 2, 2);
+        int ph = Integer.MAX_VALUE - 1;
+        for (int k = 0; k < 5; k++) {
+            checkState(root, ph, 2, 2);
+            checkState(p1, ph, 1, 1);
+            checkState(p2, ph, 2, 2);
+            p1.arrive();
+            checkState(root, ph, 2, 1);
+            checkState(p1, ph, 1, 0);
+            checkState(p2, ph, 2, 2);
+            p2.arrive();
+            checkState(root, ph, 2, 1);
+            checkState(p1, ph, 1, 0);
+            checkState(p2, ph, 2, 1);
+            p2.arrive();
+            ph = phaseInc(ph);
+            checkState(root, ph, 2, 2);
+            checkState(p1, ph, 1, 1);
+            checkState(p2, ph, 2, 2);
+        }
+        equal(3, ph);
+    }
+
+    void xtestTiered() throws Throwable {
+        Phaser root = new Phaser();
+        stateField.setLong(root, ((Integer.MAX_VALUE - 1L) << 32) | 1L);
+        checkState(root, Integer.MAX_VALUE - 1, 0, 0);
+        Phaser p1 = new Phaser(root, 1);
+        checkState(root, Integer.MAX_VALUE - 1, 1, 1);
+        checkState(p1, Integer.MAX_VALUE - 1, 1, 1);
+        Phaser p2 = new Phaser(root, 2);
+        checkState(root, Integer.MAX_VALUE - 1, 2, 2);
+        checkState(p2, Integer.MAX_VALUE - 1, 2, 2);
+        int ph = Integer.MAX_VALUE - 1;
+        for (int k = 0; k < 5; k++) {
+            checkState(root, ph, 2, 2);
+            checkState(p1, ph, 1, 1);
+            checkState(p2, ph, 2, 2);
+            p1.arrive();
+            checkState(root, ph, 2, 1);
+            checkState(p1, ph, 1, 0);
+            checkState(p2, ph, 2, 2);
+            p2.arrive();
+            checkState(root, ph, 2, 1);
+            checkState(p1, ph, 1, 0);
+            checkState(p2, ph, 2, 1);
+            p2.arrive();
+            ph = phaseInc(ph);
+            checkState(root, ph, 2, 2);
+            checkState(p1, ph, 1, 1);
+            checkState(p2, ph, 2, 2);
+        }
+        equal(3, ph);
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++; Thread.dumpStack();}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond) {if (cond) pass(); else fail();}
+    void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        new PhaseOverflow().instanceMain(args);}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,117 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+/*
+ * @test
+ * @summary stress test for arrivals in a tiered phaser
+ * @run main TieredArriveLoops 300
+ */
+import java.util.*;
+import java.util.concurrent.*;
+
+public class TieredArriveLoops {
+    final long testDurationMillisDefault = 10L * 1000L;
+    final long testDurationMillis;
+    final long quittingTimeNanos;
+
+    TieredArriveLoops(String[] args) {
+        testDurationMillis = (args.length > 0) ?
+            Long.valueOf(args[0]) : testDurationMillisDefault;
+        quittingTimeNanos = System.nanoTime() +
+            testDurationMillis * 1000L * 1000L;
+    }
+
+    Runnable runner(final Phaser p) {
+        return new CheckedRunnable() { public void realRun() {
+            int prevPhase = p.register();
+            while (!p.isTerminated()) {
+                int phase = p.awaitAdvance(p.arrive());
+                if (phase < 0)
+                    return;
+                equal(phase, (prevPhase + 1) & Integer.MAX_VALUE);
+                int ph = p.getPhase();
+                check(ph < 0 || ph == phase);
+                prevPhase = phase;
+            }
+        }};
+    }
+
+    void test(String[] args) throws Throwable {
+        final Phaser parent = new Phaser();
+        final Phaser child1 = new Phaser(parent);
+        final Phaser child2 = new Phaser(parent);
+
+        Thread t1 = new Thread(runner(child1));
+        Thread t2 = new Thread(runner(child2));
+        t1.start();
+        t2.start();
+
+        for (int prevPhase = 0, phase; ; prevPhase = phase) {
+            phase = child2.getPhase();
+            check(phase >= prevPhase);
+            if (System.nanoTime() - quittingTimeNanos > 0) {
+                System.err.printf("phase=%d%n", phase);
+                child1.forceTermination();
+                break;
+            }
+        }
+
+        t1.join();
+        t2.join();
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++; Thread.dumpStack();}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond) {if (cond) pass(); else fail();}
+    void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        new TieredArriveLoops(args).instanceMain(args);}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+
+    abstract class CheckedRunnable implements Runnable {
+        protected abstract void realRun() throws Throwable;
+
+        public final void run() {
+            try {realRun();} catch (Throwable t) {unexpected(t);}
+        }
+    }
+}
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Fri Feb 04 16:29:41 2011 -0800
@@ -31,47 +31,79 @@
 import java.util.concurrent.*;
 
 public class CoreThreadTimeOut {
-    static volatile int passed = 0, failed = 0;
-    static void pass() { passed++; }
-    static void fail() { failed++; Thread.dumpStack(); }
-    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
-    static void check(boolean cond) { if (cond) pass(); else fail(); }
-    static void equal(Object x, Object y) {
-        if (x == null ? y == null : x.equals(y)) pass();
-        else {System.out.println(x + " not equal to " + y); fail(); }}
+
+    static class IdentifiableThreadFactory implements ThreadFactory {
+        static ThreadFactory defaultThreadFactory
+            = Executors.defaultThreadFactory();
 
-    static int countExecutorThreads() {
+        public Thread newThread(Runnable r) {
+            Thread t = defaultThreadFactory.newThread(r);
+            t.setName("CoreThreadTimeOut-" + t.getName());
+            return t;
+        }
+    }
+
+    int countExecutorThreads() {
         Thread[] threads = new Thread[Thread.activeCount()+100];
         Thread.enumerate(threads);
         int count = 0;
         for (Thread t : threads)
-            if (t != null && t.getName().matches("pool-[0-9]+-thread-[0-9]+"))
+            if (t != null &&
+                t.getName().matches
+                ("CoreThreadTimeOut-pool-[0-9]+-thread-[0-9]+"))
                 count++;
         return count;
     }
 
-    public static void main(String[] args) throws Throwable {
+    long millisElapsedSince(long t0) {
+        return (System.nanoTime() - t0) / (1000L * 1000L);
+    }
+
+    void test(String[] args) throws Throwable {
         final int threadCount = 10;
+        final int timeoutMillis = 30;
         BlockingQueue<Runnable> q
             = new ArrayBlockingQueue<Runnable>(2*threadCount);
         ThreadPoolExecutor tpe
             = new ThreadPoolExecutor(threadCount, threadCount,
-                                     30, TimeUnit.MILLISECONDS,
-                                     q);
+                                     timeoutMillis, TimeUnit.MILLISECONDS,
+                                     q, new IdentifiableThreadFactory());
         equal(tpe.getCorePoolSize(), threadCount);
         check(! tpe.allowsCoreThreadTimeOut());
         tpe.allowCoreThreadTimeOut(true);
         check(tpe.allowsCoreThreadTimeOut());
         equal(countExecutorThreads(), 0);
+        long t0 = System.nanoTime();
         for (int i = 0; i < threadCount; i++)
             tpe.submit(new Runnable() { public void run() {}});
-        equal(countExecutorThreads(), threadCount);
-        Thread.sleep(500);
+        int count = countExecutorThreads();
+        if (millisElapsedSince(t0) < timeoutMillis)
+            equal(count, threadCount);
+        while (countExecutorThreads() > 0 &&
+               millisElapsedSince(t0) < 10 * 1000);
         equal(countExecutorThreads(), 0);
         tpe.shutdown();
         check(tpe.allowsCoreThreadTimeOut());
+        check(tpe.awaitTermination(10, TimeUnit.SECONDS));
 
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new Exception("Some tests failed");
     }
+
+    //--------------------- Infrastructure ---------------------------
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++; Thread.dumpStack();}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond) {if (cond) pass(); else fail();}
+    void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        new CoreThreadTimeOut().instanceMain(args);}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
 }
--- a/jdk/test/javax/print/DialogMargins.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/javax/print/DialogMargins.java	Fri Feb 04 16:29:41 2011 -0800
@@ -25,7 +25,7 @@
 
 /**
  * @test
- * @bug 4485755 6361370 6448717 5080051
+ * @bug 4485755 6361370 6448717 5080051 6939417
  * @summary dialog doesn't have way to specify margins
  *          for 6361370, verify exception for offline printer in Windows
  *          for 6448717, faster display of print dialog
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/script/CauseExceptionTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 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 6869617
+ * @summary RhinoScriptEngine bug : ScriptException cause not set (with fix)
+ */
+
+import javax.script.*;
+import java.io.*;
+
+public class CauseExceptionTest {
+    public static void main(String[] args) throws ScriptException, NoSuchMethodException {
+        ScriptEngineManager sem = new ScriptEngineManager();
+        ScriptEngine engine = sem.getEngineByName("js");
+        engine.eval("function hello_world() { println('hello world'); throw 'out of here'; } ");
+        Invocable invocable = (Invocable) engine;
+        try {
+            invocable.invokeFunction("hello_world", (Object[])null);
+        } catch (ScriptException se) {
+            Throwable cause = se.getCause();
+            if (cause == null) {
+                throw new RuntimeException("null cause");
+            }
+            System.out.println(cause);
+        }
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/script/StringWriterPrintTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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 6759414
+ * @summary javascript engine can not write to StringWriter.
+ */
+
+import javax.script.*;
+import java.io.*;
+
+public class StringWriterPrintTest {
+    public static void main(String[] args) throws ScriptException {
+        ScriptEngineManager sem = new ScriptEngineManager();
+        ScriptEngine engine = sem.getEngineByName("js");
+        StringWriter sw = new StringWriter();
+        engine.eval("print(\"hello world 1\\n\")");
+        engine.getContext().setWriter(sw);
+        // the following "print" call throws exception
+        engine.eval("print(\"hello world 2\\n\")");
+        System.out.println(sw.toString());
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/script/UnescapedBracketRegExTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 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 7012701
+ * @summary 7012701 Add a test to check that Rhino's RegExp parser accepts unescaped '['
+ */
+
+import javax.script.*;
+import java.io.*;
+
+public class UnescapedBracketRegExTest {
+    public static void main(String[] args) throws ScriptException {
+        ScriptEngineManager sem = new ScriptEngineManager();
+        ScriptEngine engine = sem.getEngineByName("js");
+        // the following throws exception
+        engine.eval("var x = /[a-zA-Z+/=]/;");
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/6342301/bug6342301.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 6342301
+   @summary Bad interaction between setting the ui and file filters in JFileChooser
+   @author Pavel Porvatov
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import java.io.File;
+
+public class bug6342301 {
+    private static String tempDir;
+
+    public static void main(String[] args) throws Exception {
+        tempDir = System.getProperty("java.io.tmpdir");
+
+        if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
+            tempDir = System.getProperty("user.home");
+        }
+
+        System.out.println("Temp directory: " + tempDir);
+
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                HackedFileChooser openChooser = new HackedFileChooser();
+
+                openChooser.setUI(new MetalFileChooserUI(openChooser));
+                openChooser.setCurrentDirectory(new File(tempDir));
+            }
+        });
+    }
+
+    private static class HackedFileChooser extends JFileChooser {
+        public void setUI(ComponentUI newUI) {
+            super.setUI(newUI);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 7004134
+   @summary JLabel containing a ToolTipText does no longer show ToolTip after browser refresh
+   @author Pavel Porvatov
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.Field;
+
+public class bug7004134 {
+    private static volatile JFrame frame;
+
+    private static volatile JLabel label;
+
+    private static volatile int toolTipWidth;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                label = new JLabel("A JLabel used as object for an HTML-formatted tooltip");
+                label.setToolTipText("<html><body bgcolor=FFFFE1>An HTML-formatted ToolTip</body></html>");
+
+                frame = new JFrame();
+
+                frame.add(label);
+                frame.pack();
+                frame.setVisible(true);
+
+                ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
+
+                toolTipManager.setInitialDelay(0);
+                toolTipManager.mouseMoved(new MouseEvent(label, 0, 0, 0, 0, 0, 0, false));
+            }
+        });
+
+        Thread.sleep(500);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                toolTipWidth = getTipWindow().getWidth();
+
+                frame.dispose();
+            }
+        });
+
+        Thread thread = new Thread(new ThreadGroup("Some ThreadGroup"), new Runnable() {
+            public void run() {
+                SunToolkit.createNewAppContext();
+
+                try {
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        public void run() {
+                            frame = new JFrame();
+
+                            frame.add(label);
+                            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                            frame.pack();
+                            frame.setVisible(true);
+
+                            ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
+
+                            toolTipManager.setInitialDelay(0);
+                            toolTipManager.mouseMoved(new MouseEvent(label, 0, 0, 0, 0, 0, 0, false));
+                        }
+                    });
+
+                    Thread.sleep(500);
+
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        public void run() {
+                            int newToolTipWidth = getTipWindow().getWidth();
+
+                            frame.dispose();
+
+                            if (toolTipWidth != newToolTipWidth) {
+                                throw new RuntimeException("Tooltip width is different. Initial: " + toolTipWidth +
+                                        ", new: " + newToolTipWidth);
+                            }
+                        }
+                    });
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+            }
+        });
+
+        thread.start();
+        thread.join();
+    }
+
+    private static Component getTipWindow() {
+        try {
+            Field tipWindowField = ToolTipManager.class.getDeclaredField("tipWindow");
+
+            tipWindowField.setAccessible(true);
+
+            Popup value = (Popup) tipWindowField.get(ToolTipManager.sharedInstance());
+
+            Field componentField = Popup.class.getDeclaredField("component");
+
+            componentField.setAccessible(true);
+
+            return (Component) componentField.get(value);
+        } catch (Exception e) {
+            throw new RuntimeException("getToolTipComponent failed", e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/NavigationFilter/6735293/bug6735293.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 6735293
+ * @summary javax.swing.text.NavigationFilter.getNextVisualPositionFrom() not always throws BadLocationException
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.NavigationFilter;
+import javax.swing.text.Position;
+
+public class bug6735293 {
+    private static volatile JFormattedTextField jtf;
+
+    private static volatile NavigationFilter nf;
+
+    private static volatile JFrame jFrame;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                jtf = new JFormattedTextField();
+                nf = new NavigationFilter();
+                jtf.setText("A text message");
+
+                jFrame = new JFrame();
+                jFrame.getContentPane().add(jtf);
+                jFrame.pack();
+                jFrame.setVisible(true);
+            }
+        });
+
+        Thread.sleep(1000);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Position.Bias[] biasRet = {Position.Bias.Forward};
+
+                for (int direction : new int[]{
+                        SwingConstants.EAST,
+                        SwingConstants.WEST,
+                        //  the following constants still will lead to "BadLocationException: Length must be positive"
+                        SwingConstants.SOUTH,
+                        SwingConstants.NORTH,
+                }) {
+                    for (int position : new int[]{-100, Integer.MIN_VALUE}) {
+                        for (Position.Bias bias : new Position.Bias[]{Position.Bias.Backward, Position.Bias.Forward}) {
+                            try {
+                                nf.getNextVisualPositionFrom(jtf, position, bias, direction, biasRet);
+
+                                throw new RuntimeException("BadLocationException was not thrown: position = " +
+                                        position + ", bias = " + bias + ", direction = " + direction);
+                            } catch (BadLocationException e) {
+                                // Ok
+                            }
+                        }
+                    }
+                }
+
+                jFrame.dispose();
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/6990651/bug6990651.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 6990651
+   @summary Regression: NPE when refreshing applet since 6u22-b01
+   @author Pavel Porvatov
+*/
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+
+public class bug6990651 {
+    private static volatile JEditorPane editor;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                editor = new JEditorPane("text/html", "Hello world!");
+            }
+        });
+
+        Thread thread = new Thread(new ThreadGroup("Some ThreadGroup"), new Runnable() {
+            public void run() {
+                SunToolkit.createNewAppContext();
+
+                try {
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        public void run() {
+                            editor.setText("Hello world!");
+                        }
+                    });
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+            }
+        });
+
+        thread.start();
+        thread.join();
+    }
+}
--- a/jdk/test/sun/net/InetAddress/nameservice/B6442088.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6442088
- * @summary Change default DNS caching behavior for code not running under
- *          security manager.
- *
- * @build B6442088 SimpleNameService SimpleNameServiceDescriptor
- * @run main/othervm/timeout=200 -Dsun.net.inetaddr.ttl=20 -Dsun.net.spi.nameservice.provider.1=simple,sun B6442088
- */
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.Security;
-
-public class B6442088 {
-
-    public static void main(String args[]) throws Exception {
-
-        // name service needs to resolve this.
-        SimpleNameService.put("theclub", "129.156.220.219");
-
-        test ("theclub", "129.156.220.219", true);      // lk: 1
-        test ("luster", "1.16.20.2", false);            // lk: 2
-
-        // name service now needs to know about luster
-        SimpleNameService.put("luster", "10.5.18.21");
-
-        test ("luster", "1.16.20.2", false);            // lk: 2
-        sleep (10+1);
-        test("luster", "10.5.18.21", true, 3);          // lk: 3
-        sleep (5);
-
-        SimpleNameService.put("foo", "10.5.18.22");
-        SimpleNameService.put("theclub", "129.156.220.1");
-
-        test ("theclub", "129.156.220.219", true, 3);
-        test ("luster", "10.5.18.21", true, 3);
-        test ("bar", "10.5.18.22", false, 4);
-        test ("foo", "10.5.18.22", true, 5);
-
-        // now delay to see if theclub has expired
-        sleep (5);
-
-        test ("foo", "10.5.18.22", true, 5);
-        test ("theclub", "129.156.220.1", true, 6);
-
-        sleep (11);
-        // now see if luster has expired
-        test ("luster", "10.5.18.21", true, 7);
-        test ("theclub", "129.156.220.1", true, 7);
-
-        // now delay to see if 3rd has expired
-        sleep (10+6);
-
-        test ("theclub", "129.156.220.1", true, 8);
-        test ("luster", "10.5.18.21", true, 8);
-        test ("foo", "10.5.18.22", true, 9);
-    }
-
-    /* throws RuntimeException if it fails */
-
-    static void test (String host, String address,
-                        boolean shouldSucceed, int count) {
-        test (host, address, shouldSucceed);
-        int got = SimpleNameService.lookupCalls();
-        if (got != count) {
-            throw new RuntimeException ("lookups exp/got: " + count+"/"+got);
-        }
-    }
-
-    static void sleep (int seconds) {
-        try {
-            Thread.sleep (seconds * 1000);
-        } catch (InterruptedException e) {}
-    }
-
-    static void test (String host, String address, boolean shouldSucceed) {
-        InetAddress addr = null;
-        try {
-            addr = InetAddress.getByName (host);
-            if (!shouldSucceed) {
-                throw new RuntimeException (host+":"+address+": should fail");
-
-            }
-            if (!address.equals(addr.getHostAddress())) {
-                throw new RuntimeException(host+":"+address+": compare failed");
-            }
-        } catch (UnknownHostException e) {
-            if (shouldSucceed) {
-                throw new RuntimeException(host+":"+address+": should succeed");
-            }
-        }
-    }
-
-}
--- a/jdk/test/sun/net/InetAddress/nameservice/CacheTest.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * 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 4292867
- * @summary Check that InetAddress doesn't continue to throw UHE
- *          after the name service has recovered and the negative ttl
- *          on the initial lookup has expired.
- *
- * @build CacheTest SimpleNameService SimpleNameServiceDescriptor
- * @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun CacheTest
- */
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.Security;
-
-public class CacheTest {
-
-
-    public static void main(String args[]) throws Exception {
-
-        /*
-         * First check the ttl on negative lookups is in the <15 second
-         * range. If the ttl is <=0 it means we cache forever or always
-         * consult the name service. For ttl > 15 the test would take
-         * too long so we skip it (need to coordinate jtreg timeout
-         * with negative ttl)
-         */
-        String ttlProp = "networkaddress.cache.negative.ttl";
-        int ttl = 0;
-        String policy = Security.getProperty(ttlProp);
-        if (policy != null) {
-            ttl = Integer.parseInt(policy);
-        }
-        if (ttl <= 0  || ttl > 15) {
-            System.err.println("Security property " + ttlProp + " needs to " +
-                " in 1-15 second range to execute this test");
-            return;
-
-        }
-
-        /*
-         * The following outlines how the test works :-
-         *
-         * 1. Do a lookup via InetAddress.getByName that it guaranteed
-         *    to succeed. This forces at least one entry into the cache
-         *    that will not expire.
-         *
-         * 2. Do a lookup via InetAddress.getByName that is guarnateed
-         *    to fail. This results in a negative lookup cached for
-         *    for a short period to time.
-         *
-         * 3. Wait for the cache entry to expire.
-         *
-         * 4. Do a lookup (which should consult the name service) and
-         *    the lookup should succeed.
-         */
-
-        // name service needs to resolve this.
-        SimpleNameService.put("theclub", "129.156.220.219");
-
-        // this lookup will succeed
-        InetAddress.getByName("theclub");
-
-        // lookup "luster" - this should throw UHE as name service
-        // doesn't know anything about this host.
-
-        try {
-            InetAddress.getByName("luster");
-            throw new RuntimeException("Test internal error " +
-                " - luster is bring resolved by name service");
-        } catch (UnknownHostException x) {
-        }
-
-        // name service now needs to know about luster
-        SimpleNameService.put("luster", "10.5.18.21");
-
-        // wait for the cache entry to expire and lookup should
-        // succeed.
-        Thread.currentThread().sleep(ttl*1000 + 1000);
-        InetAddress.getByName("luster");
-    }
-
-}
--- a/jdk/test/sun/net/InetAddress/nameservice/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-# name service provider descriptor
-SimpleNameServiceDescriptor
--- a/jdk/test/sun/net/InetAddress/nameservice/SimpleNameService.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-/*
- * A simple name service based on an in-memory HashMap.
- */
-import java.net.UnknownHostException;
-import java.net.InetAddress;
-import sun.net.spi.nameservice.*;
-import java.util.*;
-
-public final class SimpleNameService implements NameService {
-
-    private static LinkedHashMap hosts = new LinkedHashMap();
-
-    private static String addrToString(byte addr[]) {
-        return Byte.toString(addr[0]) + "." +
-               Byte.toString(addr[1]) + "." +
-               Byte.toString(addr[2]) + "." +
-               Byte.toString(addr[3]);
-    }
-
-    // ------------
-
-    public static void put(String host, String addr) {
-        hosts.put(host, addr);
-    }
-
-    public static void put(String host, byte addr[]) {
-        hosts.put(host, addrToString(addr));
-    }
-
-    public static void remove(String host) {
-        hosts.remove(host);
-    }
-
-    public static int entries () {
-        return hosts.size();
-    }
-
-    public static int lookupCalls() {
-        return lookupCalls;
-    }
-
-    static int lookupCalls = 0;
-
-    // ------------
-
-    public SimpleNameService() throws Exception {
-    }
-
-    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
-
-        lookupCalls ++;
-
-        String value = (String)hosts.get(host);
-        if (value == null) {
-            throw new UnknownHostException(host);
-        }
-        StringTokenizer st = new StringTokenizer(value, ".");
-        byte addr[] = new byte[4];
-        for (int i=0; i<4; i++) {
-            addr[i] = (byte)Integer.parseInt(st.nextToken());
-        }
-        InetAddress[] res = new InetAddress[1];
-        res[0] = InetAddress.getByAddress(host, addr);
-        return res;
-    }
-
-    public String getHostByAddr(byte[] addr) throws UnknownHostException {
-        String addrString = addrToString(addr);
-        Iterator i = hosts.keySet().iterator();
-        while (i.hasNext()) {
-            String host = (String)i.next();
-            String value = (String)hosts.get(host);
-            if (value.equals(addrString)) {
-                return host;
-            }
-        }
-        throw new UnknownHostException();
-    }
-}
--- a/jdk/test/sun/net/InetAddress/nameservice/SimpleNameServiceDescriptor.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * Descriptor for the simple name service
- */
-import sun.net.spi.nameservice.*;
-
-public final class SimpleNameServiceDescriptor implements NameServiceDescriptor {
-    /**
-     * Create a new instance of the corresponding name service.
-     */
-    public NameService createNameService() throws Exception {
-        return new SimpleNameService();
-    }
-
-    /**
-     * Returns this service provider's name
-     *
-     */
-    public String getProviderName() {
-        return "sun";
-    }
-
-    /**
-     * Returns this name service type
-     * "dns" "nis" etc
-     */
-    public String getType() {
-        return "simple";
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,23 @@
+# Copyright (c) 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
+
+Simple1NameServiceDescriptor
+Simple2NameServiceDescriptor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/Providers.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * 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 4762344
+ * @summary 2nd nameservice provider is non functional
+ * @compile -XDignore.symbol.file=true SimpleNameService.java
+ *                                     Simple1NameServiceDescriptor.java
+ *                                     Simple2NameServiceDescriptor.java
+ * @run main/othervm -Dsun.net.spi.nameservice.provider.1=simple1,sun -Dsun.net.spi.nameservice.provider.2=simple2,sun Providers
+ */
+
+import java.net.*;
+import java.util.*;
+
+
+public class Providers {
+    private static String[][] hostnames = new String[][] {
+            // both providers know this host, but with different address
+            new String[] {"blade", "10.0.0.1"},
+            // provider1 knwos this host
+            new String[] {"blade.domain1", "10.0.0.2"},
+            // provider2 knows this host
+            new String[] {"blade.domain2", "20.0.0.2"}
+        };
+    private static String[][] hostaddrs = new String[][] {
+            new String[] {"10.0.0.1", "blade"},
+            new String[] {"10.0.0.2", "blade.domain1"},
+            new String[] {"20.0.0.2", "blade.domain2"}
+        };
+
+    public static void main(String[] args) throws Exception {
+        for (int i = 0; i < hostnames.length; i++) {
+            doLookup(hostnames[i][0], hostnames[i][1]);
+        }
+        for (int i = 0; i < hostaddrs.length; i++) {
+            doReverseLookup(hostaddrs[i][0], hostaddrs[i][1]);
+        }
+    }
+
+    private static void doLookup(String host, String addr) throws Exception {
+        String res = InetAddress.getByName(host).getHostAddress();
+        if (!res.equals(addr)) {
+            throw new RuntimeException("Test failed: wrong address for host " + host);
+        }
+    }
+
+    private static void doReverseLookup(String addr, String host) throws Exception {
+        StringTokenizer tokenizer = new StringTokenizer(addr, ".");
+        byte addrs[] = new byte[4];
+        for (int i = 0; i < 4; i++) {
+            addrs[i] = (byte)Integer.parseInt(tokenizer.nextToken());
+        }
+        String res = InetAddress.getByAddress(addrs).getHostName();
+        if (!res.equals(host)) {
+            throw new RuntimeException("Test failed: wrong host name for address " + addr);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/Simple1NameServiceDescriptor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.net.spi.nameservice.*;
+
+
+public class Simple1NameServiceDescriptor implements NameServiceDescriptor {
+    public NameService createNameService() {
+        SimpleNameService ns = new SimpleNameService();
+
+        // both providers know this host, but the address is different
+        ns.put("blade", "10.0.0.1");
+        // only this provider knows this host
+        ns.put("blade.domain1", "10.0.0.2");
+
+        return ns;
+    }
+
+    public String getProviderName() {
+        return "sun";
+    }
+
+    public String getType() {
+        return "simple1";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/Simple2NameServiceDescriptor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.net.spi.nameservice.*;
+
+
+public class Simple2NameServiceDescriptor implements NameServiceDescriptor {
+    public NameService createNameService() {
+        SimpleNameService ns = new SimpleNameService();
+        // both providers know this host, but the address of it is different
+        ns.put("blade", "20.0.0.1");
+        // only this provider knows this host
+        ns.put("blade.domain2", "20.0.0.2");
+
+        return ns;
+    }
+
+    public String getProviderName() {
+        return "sun";
+    }
+
+    public String getType() {
+        return "simple2";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/SimpleNameService.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.net.*;
+import java.util.*;
+import sun.net.spi.nameservice.*;
+
+
+public class SimpleNameService implements NameService {
+    // host name <-> host addr mapping
+    private HashMap<String, String> hosts = new LinkedHashMap<String, String>();
+
+    public void put(String host, String addr) {
+        hosts.put(host, addr);
+    }
+
+    private static String addrToString(byte addr[]) {
+        return Byte.toString(addr[0]) + "." +
+               Byte.toString(addr[1]) + "." +
+               Byte.toString(addr[2]) + "." +
+               Byte.toString(addr[3]);
+    }
+
+    public SimpleNameService() {
+    }
+
+    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
+        String addr = hosts.get(host);
+        if (addr == null) {
+            throw new UnknownHostException(host);
+        }
+
+        StringTokenizer tokenizer = new StringTokenizer(addr, ".");
+        byte addrs[] = new byte[4];
+        for (int i = 0; i < 4; i++) {
+            addrs[i] = (byte)Integer.parseInt(tokenizer.nextToken());
+        }
+        InetAddress[] ret = new InetAddress[1];
+        ret[0] = InetAddress.getByAddress(host, addrs);
+        return ret;
+    }
+
+    public String getHostByAddr(byte[] addr) throws UnknownHostException {
+        String addrString = addrToString(addr);
+        Iterator i = hosts.keySet().iterator();
+        while (i.hasNext()) {
+            String host = (String)i.next();
+            String value = (String)hosts.get(host);
+            if (value.equals(addrString)) {
+                return host;
+            }
+        }
+        throw new UnknownHostException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/deadlock/Hang.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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 7012768
+ * @compile -XDignore.symbol.file=true ThrowingNameService.java
+ *          ThrowingNameServiceDescriptor.java
+ * @run main/othervm/timeout=30 -Dsun.net.spi.nameservice.provider.1=throwing,sun Hang
+ * @summary InetAddress lookupTable leaks/deadlocks when using unsupported
+ *          name service spi
+ */
+
+import java.net.InetAddress;
+
+public class Hang {
+    public static void main(String[] args) throws Exception {
+        try {
+            // 1st attempt - IllegalStateException caught below
+            InetAddress.getByName("host.company.com");
+        } catch (IllegalStateException e) { }
+
+        // 2nd attempt - Stuck here forever if bug exists
+        InetAddress.getByName("host.company.com");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/deadlock/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,22 @@
+# Copyright (c) 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.
+
+ThrowingNameServiceDescriptor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/deadlock/ThrowingNameService.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import sun.net.spi.nameservice.NameService;
+
+public class ThrowingNameService implements NameService {
+    static boolean firstCall = true;
+
+    @Override
+    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
+        if (firstCall) {
+            firstCall = false;
+            // throw unchecked exception first time round
+            throw new IllegalStateException();
+        }
+
+        // return any valid address
+        return new InetAddress[] { InetAddress.getLoopbackAddress() };
+    }
+
+    @Override
+    public String getHostByAddr(byte[] addr) throws UnknownHostException {
+        throw new IllegalStateException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/deadlock/ThrowingNameServiceDescriptor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import sun.net.spi.nameservice.*;
+
+public class ThrowingNameServiceDescriptor implements NameServiceDescriptor {
+    public NameService createNameService() {
+        return new ThrowingNameService();
+    }
+
+    @Override
+    public String getProviderName() {
+        return "sun";
+    }
+
+    @Override
+    public String getType() {
+        return "throwing";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/CacheTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * 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 4292867
+ * @summary Check that InetAddress doesn't continue to throw UHE
+ *          after the name service has recovered and the negative ttl
+ *          on the initial lookup has expired.
+ * @compile -XDignore.symbol.file=true SimpleNameService.java
+ *                                     SimpleNameServiceDescriptor.java
+ * @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun CacheTest
+ */
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.Security;
+
+public class CacheTest {
+
+
+    public static void main(String args[]) throws Exception {
+
+        /*
+         * First check the ttl on negative lookups is in the <15 second
+         * range. If the ttl is <=0 it means we cache forever or always
+         * consult the name service. For ttl > 15 the test would take
+         * too long so we skip it (need to coordinate jtreg timeout
+         * with negative ttl)
+         */
+        String ttlProp = "networkaddress.cache.negative.ttl";
+        int ttl = 0;
+        String policy = Security.getProperty(ttlProp);
+        if (policy != null) {
+            ttl = Integer.parseInt(policy);
+        }
+        if (ttl <= 0  || ttl > 15) {
+            System.err.println("Security property " + ttlProp + " needs to " +
+                " in 1-15 second range to execute this test");
+            return;
+
+        }
+
+        /*
+         * The following outlines how the test works :-
+         *
+         * 1. Do a lookup via InetAddress.getByName that it guaranteed
+         *    to succeed. This forces at least one entry into the cache
+         *    that will not expire.
+         *
+         * 2. Do a lookup via InetAddress.getByName that is guarnateed
+         *    to fail. This results in a negative lookup cached for
+         *    for a short period to time.
+         *
+         * 3. Wait for the cache entry to expire.
+         *
+         * 4. Do a lookup (which should consult the name service) and
+         *    the lookup should succeed.
+         */
+
+        // name service needs to resolve this.
+        SimpleNameService.put("theclub", "129.156.220.219");
+
+        // this lookup will succeed
+        InetAddress.getByName("theclub");
+
+        // lookup "luster" - this should throw UHE as name service
+        // doesn't know anything about this host.
+
+        try {
+            InetAddress.getByName("luster");
+            throw new RuntimeException("Test internal error " +
+                " - luster is bring resolved by name service");
+        } catch (UnknownHostException x) {
+        }
+
+        // name service now needs to know about luster
+        SimpleNameService.put("luster", "10.5.18.21");
+
+        // wait for the cache entry to expire and lookup should
+        // succeed.
+        Thread.currentThread().sleep(ttl*1000 + 1000);
+        InetAddress.getByName("luster");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/DefaultCaching.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6442088
+ * @summary Change default DNS caching behavior for code not running under
+ *          security manager.
+ * @compile -XDignore.symbol.file=true SimpleNameService.java
+ *                                     SimpleNameServiceDescriptor.java
+ * @run main/othervm/timeout=200 -Dsun.net.inetaddr.ttl=20 -Dsun.net.spi.nameservice.provider.1=simple,sun DefaultCaching
+ */
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.Security;
+
+public class DefaultCaching {
+
+    public static void main(String args[]) throws Exception {
+
+        // name service needs to resolve this.
+        SimpleNameService.put("theclub", "129.156.220.219");
+
+        test ("theclub", "129.156.220.219", true);      // lk: 1
+        test ("luster", "1.16.20.2", false);            // lk: 2
+
+        // name service now needs to know about luster
+        SimpleNameService.put("luster", "10.5.18.21");
+
+        test ("luster", "1.16.20.2", false);            // lk: 2
+        sleep (10+1);
+        test("luster", "10.5.18.21", true, 3);          // lk: 3
+        sleep (5);
+
+        SimpleNameService.put("foo", "10.5.18.22");
+        SimpleNameService.put("theclub", "129.156.220.1");
+
+        test ("theclub", "129.156.220.219", true, 3);
+        test ("luster", "10.5.18.21", true, 3);
+        test ("bar", "10.5.18.22", false, 4);
+        test ("foo", "10.5.18.22", true, 5);
+
+        // now delay to see if theclub has expired
+        sleep (5);
+
+        test ("foo", "10.5.18.22", true, 5);
+        test ("theclub", "129.156.220.1", true, 6);
+
+        sleep (11);
+        // now see if luster has expired
+        test ("luster", "10.5.18.21", true, 7);
+        test ("theclub", "129.156.220.1", true, 7);
+
+        // now delay to see if 3rd has expired
+        sleep (10+6);
+
+        test ("theclub", "129.156.220.1", true, 8);
+        test ("luster", "10.5.18.21", true, 8);
+        test ("foo", "10.5.18.22", true, 9);
+    }
+
+    /* throws RuntimeException if it fails */
+
+    static void test (String host, String address,
+                        boolean shouldSucceed, int count) {
+        test (host, address, shouldSucceed);
+        int got = SimpleNameService.lookupCalls();
+        if (got != count) {
+            throw new RuntimeException ("lookups exp/got: " + count+"/"+got);
+        }
+    }
+
+    static void sleep (int seconds) {
+        try {
+            Thread.sleep (seconds * 1000);
+        } catch (InterruptedException e) {}
+    }
+
+    static void test (String host, String address, boolean shouldSucceed) {
+        InetAddress addr = null;
+        try {
+            addr = InetAddress.getByName (host);
+            if (!shouldSucceed) {
+                throw new RuntimeException (host+":"+address+": should fail");
+
+            }
+            if (!address.equals(addr.getHostAddress())) {
+                throw new RuntimeException(host+":"+address+": compare failed");
+            }
+        } catch (UnknownHostException e) {
+            if (shouldSucceed) {
+                throw new RuntimeException(host+":"+address+": should succeed");
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,22 @@
+# Copyright (c) 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.
+
+SimpleNameServiceDescriptor    # name service provider descriptor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/SimpleNameService.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/*
+ * A simple name service based on an in-memory HashMap.
+ */
+import java.net.UnknownHostException;
+import java.net.InetAddress;
+import sun.net.spi.nameservice.*;
+import java.util.*;
+
+public final class SimpleNameService implements NameService {
+
+    private static LinkedHashMap hosts = new LinkedHashMap();
+
+    private static String addrToString(byte addr[]) {
+        return Byte.toString(addr[0]) + "." +
+               Byte.toString(addr[1]) + "." +
+               Byte.toString(addr[2]) + "." +
+               Byte.toString(addr[3]);
+    }
+
+    // ------------
+
+    public static void put(String host, String addr) {
+        hosts.put(host, addr);
+    }
+
+    public static void put(String host, byte addr[]) {
+        hosts.put(host, addrToString(addr));
+    }
+
+    public static void remove(String host) {
+        hosts.remove(host);
+    }
+
+    public static int entries () {
+        return hosts.size();
+    }
+
+    public static int lookupCalls() {
+        return lookupCalls;
+    }
+
+    static int lookupCalls = 0;
+
+    // ------------
+
+    public SimpleNameService() throws Exception {
+    }
+
+    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
+
+        lookupCalls ++;
+
+        String value = (String)hosts.get(host);
+        if (value == null) {
+            throw new UnknownHostException(host);
+        }
+        StringTokenizer st = new StringTokenizer(value, ".");
+        byte addr[] = new byte[4];
+        for (int i=0; i<4; i++) {
+            addr[i] = (byte)Integer.parseInt(st.nextToken());
+        }
+        InetAddress[] res = new InetAddress[1];
+        res[0] = InetAddress.getByAddress(host, addr);
+        return res;
+    }
+
+    public String getHostByAddr(byte[] addr) throws UnknownHostException {
+        String addrString = addrToString(addr);
+        Iterator i = hosts.keySet().iterator();
+        while (i.hasNext()) {
+            String host = (String)i.next();
+            String value = (String)hosts.get(host);
+            if (value.equals(addrString)) {
+                return host;
+            }
+        }
+        throw new UnknownHostException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/SimpleNameServiceDescriptor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+/*
+ * Descriptor for the simple name service
+ */
+import sun.net.spi.nameservice.*;
+
+public final class SimpleNameServiceDescriptor implements NameServiceDescriptor {
+    /**
+     * Create a new instance of the corresponding name service.
+     */
+    public NameService createNameService() throws Exception {
+        return new SimpleNameService();
+    }
+
+    /**
+     * Returns this service provider's name
+     *
+     */
+    public String getProviderName() {
+        return "sun";
+    }
+
+    /**
+     * Returns this name service type
+     * "dns" "nis" etc
+     */
+    public String getType() {
+        return "simple";
+    }
+}
--- a/jdk/test/sun/security/krb5/IPv6.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/IPv6.java	Fri Feb 04 16:29:41 2011 -0800
@@ -78,8 +78,8 @@
         try {
             Subject subject = new Subject();
             Krb5LoginModule krb5 = new Krb5LoginModule();
-            Map<String, String> map = new HashMap<String, String>();
-            Map<String, Object> shared = new HashMap<String, Object>();
+            Map<String, String> map = new HashMap<>();
+            Map<String, Object> shared = new HashMap<>();
 
             map.put("debug", "true");
             map.put("doNotPrompt", "true");
--- a/jdk/test/sun/security/krb5/auto/CleanState.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/auto/CleanState.java	Fri Feb 04 16:29:41 2011 -0800
@@ -49,11 +49,11 @@
         final char[] password = OneKDC.PASS;
         char[] badpassword = "hellokitty".toCharArray();
 
-        Map<String,String> map = new HashMap<String,String>();
+        Map<String,String> map = new HashMap<>();
         map.put("useTicketCache", "false");
         map.put("doNotPrompt", "false");
         map.put("tryFirstPass", "true");
-        Map<String,Object> shared = new HashMap<String,Object>();
+        Map<String,Object> shared = new HashMap<>();
         shared.put("javax.security.auth.login.name", name);
         shared.put("javax.security.auth.login.password", badpassword);
 
--- a/jdk/test/sun/security/krb5/auto/Context.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/auto/Context.java	Fri Feb 04 16:29:41 2011 -0800
@@ -117,8 +117,8 @@
         out.name = user;
         out.s = new Subject();
         Krb5LoginModule krb5 = new Krb5LoginModule();
-        Map<String, String> map = new HashMap<String, String>();
-        Map<String, Object> shared = new HashMap<String, Object>();
+        Map<String, String> map = new HashMap<>();
+        Map<String, Object> shared = new HashMap<>();
 
         if (pass != null) {
             map.put("useFirstPass", "true");
@@ -151,7 +151,7 @@
         out.name = user;
         out.s = new Subject();
         Krb5LoginModule krb5 = new Krb5LoginModule();
-        Map<String, String> map = new HashMap<String, String>();
+        Map<String, String> map = new HashMap<>();
 
         map.put("doNotPrompt", "true");
         map.put("useTicketCache", "false");
--- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java	Fri Feb 04 16:29:41 2011 -0800
@@ -297,8 +297,8 @@
             }
 
             Krb5LoginModule krb5 = new Krb5LoginModule();
-            Map<String, String> map = new HashMap<String, String>();
-            Map<String, Object> shared = new HashMap<String, Object>();
+            Map<String, String> map = new HashMap<>();
+            Map<String, Object> shared = new HashMap<>();
 
             map.put("storeKey", "true");
             map.put("isInitiator", "false");
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Fri Feb 04 16:29:41 2011 -0800
@@ -132,7 +132,7 @@
     // Principal db. principal -> pass. A case-insensitive TreeMap is used
     // so that even if the client provides a name with different case, the KDC
     // can still locate the principal and give back correct salt.
-    private TreeMap<String,char[]> passwords = new TreeMap<String,char[]>
+    private TreeMap<String,char[]> passwords = new TreeMap<>
             (String.CASE_INSENSITIVE_ORDER);
 
     // Realm name
@@ -142,9 +142,9 @@
     // Service port number
     private int port;
     // The request/response job queue
-    private BlockingQueue<Job> q = new ArrayBlockingQueue<Job>(100);
+    private BlockingQueue<Job> q = new ArrayBlockingQueue<>(100);
     // Options
-    private Map<Option,Object> options = new HashMap<Option,Object>();
+    private Map<Option,Object> options = new HashMap<>();
 
     private Thread thread1, thread2, thread3;
     DatagramSocket u1 = null;
@@ -537,7 +537,7 @@
         }
     }
 
-    private Map<String,String> policies = new HashMap<String,String>();
+    private Map<String,String> policies = new HashMap<>();
 
     public void setPolicy(String rule, String value) {
         if (value == null) {
@@ -760,7 +760,7 @@
     private byte[] processAsReq(byte[] in) throws Exception {
         ASReq asReq = new ASReq(in);
         int[] eTypes = null;
-        List<PAData> outPAs = new ArrayList<PAData>();
+        List<PAData> outPAs = new ArrayList<>();
 
         try {
             System.out.println(realm + "> " + asReq.reqBody.cname +
--- a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java	Fri Feb 04 16:29:41 2011 -0800
@@ -135,8 +135,8 @@
             throws Exception {
         Krb5LoginModule krb5 = new Krb5LoginModule();
         Subject subject = new Subject();
-        Map<String, String> map = new HashMap<String, String>();
-        Map<String, Object> shared = new HashMap<String, Object>();
+        Map<String, String> map = new HashMap<>();
+        Map<String, Object> shared = new HashMap<>();
 
         int count = options.length / 2;
         for (int i = 0; i < count; i++) {
--- a/jdk/test/sun/security/krb5/tools/KtabCheck.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/krb5/tools/KtabCheck.java	Fri Feb 04 16:29:41 2011 -0800
@@ -39,7 +39,7 @@
     public static void main(String[] args) throws Exception {
         System.out.println("Checking " + Arrays.toString(args));
         KeyTab ktab = KeyTab.getInstance(args[0]);
-        Set<String> expected = new HashSet<String>();
+        Set<String> expected = new HashSet<>();
         for (int i=1; i<args.length; i += 2) {
             expected.add(args[i]+":"+args[i+1]);
         }
--- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -300,8 +300,8 @@
             getCalled = true;
             // returns cookies[0]
             // they will be include in request
-            Map<String,List<String>> map = new HashMap<String,List<String>>();
-            List<String> l = new ArrayList<String>();
+            Map<String,List<String>> map = new HashMap<>();
+            List<String> l = new ArrayList<>();
             l.add(cookies.get("Cookie"));
             map.put("Cookie",l);
             return Collections.unmodifiableMap(map);
--- a/langtools/.hgtags	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/.hgtags	Fri Feb 04 16:29:41 2011 -0800
@@ -101,3 +101,5 @@
 4868a36f6fd8972505c466013813eeb28f0482ea jdk7-b124
 4b0560c72b529d4b952924b2da94d8436af79d05 jdk7-b125
 438a8ad60f7ae7aa897663148fd43fe85ef05e5b jdk7-b126
+1e6094c33187f6c3dca55ced3701ee1f9d73a77d jdk7-b127
+d7225b476a5d1aebffb8827e7c72ba2e1651f4e7 jdk7-b128
--- a/langtools/make/build.xml	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/make/build.xml	Fri Feb 04 16:29:41 2011 -0800
@@ -352,6 +352,45 @@
         </java>
     </target>
 
+    <!-- a patching facility to speed up incorporating the langtools' classfiles
+         into a jdk of your choice. Either target.java.home or patch.jdk can be
+         set on the command line; setting target.java.home has the advantage of
+         patching the jdk used for jtreg and other tests.
+    -->
+    <target name="patch" depends="build-all-classes">
+        <condition property="patch.jdk" value="${target.java.home}">
+            <available file="${target.java.home}" type="dir"/>
+        </condition>
+        <fail message="patch.jdk or target.java.home is not set, please set target.java.home, or patch.jdk for an alternate jdk image to patch">
+            <condition>
+                <not>
+                    <isset property="patch.jdk"/>
+                </not>
+            </condition>
+        </fail>
+        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
+        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
+        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
+            <condition>
+                <not>
+                    <available file="${patch.tools.jar}" type="file"/>
+                </not>
+            </condition>
+        </fail>
+        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
+            <condition>
+                <not>
+                    <available file="${patch.rt.jar}" type="file"/>
+                </not>
+            </condition>
+        </fail>
+        <zip zipfile="${patch.tools.jar}" update="true">
+            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
+        </zip>
+        <zip zipfile="${patch.rt.jar}" update="true">
+            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
+        </zip>
+    </target>
 
     <!--
     **** Debugging/diagnostic targets.
--- a/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -53,7 +53,6 @@
     Tree getReturnType();
     List<? extends TypeParameterTree> getTypeParameters();
     List<? extends VariableTree> getParameters();
-//308    List<? extends AnnotationTree> getReceiverAnnotations();
     List<? extends ExpressionTree> getThrows();
     BlockTree getBody();
     Tree getDefaultValue(); // for annotation types
--- a/langtools/src/share/classes/com/sun/source/tree/Tree.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -46,8 +46,6 @@
      */
     public enum Kind {
 
-//308        ANNOTATED_TYPE(AnnotatedTypeTree.class),
-
         /**
          * Used for instances of {@link AnnotationTree}.
          */
--- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -57,7 +57,6 @@
  * @since 1.6
  */
 public interface TreeVisitor<R,P> {
-//308    R visitAnnotatedType(AnnotatedTypeTree node, P p);
     R visitAnnotation(AnnotationTree node, P p);
     R visitMethodInvocation(MethodInvocationTree node, P p);
     R visitAssert(AssertTree node, P p);
--- a/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -47,5 +47,4 @@
 public interface TypeParameterTree extends Tree {
     Name getName();
     List<? extends Tree> getBounds();
-//308    List<? extends AnnotationTree> getAnnotations();
 }
--- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -248,10 +248,6 @@
         return defaultAction(node, p);
     }
 
-//308    public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        return defaultAction(node, p);
-//308    }
-
     public R visitErroneous(ErroneousTree node, P p) {
         return defaultAction(node, p);
     }
--- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -138,7 +138,6 @@
         r = scanAndReduce(node.getReturnType(), p, r);
         r = scanAndReduce(node.getTypeParameters(), p, r);
         r = scanAndReduce(node.getParameters(), p, r);
-//308        r = scanAndReduce(node.getReceiverAnnotations(), p, r);
         r = scanAndReduce(node.getThrows(), p, r);
         r = scanAndReduce(node.getBody(), p, r);
         r = scanAndReduce(node.getDefaultValue(), p, r);
@@ -362,7 +361,6 @@
 
     public R visitTypeParameter(TypeParameterTree node, P p) {
         R r = scan(node.getBounds(), p);
-//308        R r = scanAndReduce(node.getAnnotations(), p, r);
         return r;
     }
 
@@ -380,12 +378,6 @@
         return r;
     }
 
-//308   public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308       R r = scan(node.getAnnotations(), p);
-//308       r = scanAndReduce(node.getUnderlyingType(), p, r);
-//308       return r;
-//308   }
-
     public R visitOther(Tree node, P p) {
         return null;
     }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -39,6 +39,7 @@
 
 public abstract class Attribute {
     public static final String AnnotationDefault        = "AnnotationDefault";
+    public static final String BootstrapMethods         = "BootstrapMethods";
     public static final String CharacterRangeTable      = "CharacterRangeTable";
     public static final String Code                     = "Code";
     public static final String ConstantValue            = "ConstantValue";
@@ -54,8 +55,6 @@
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
     public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
-    public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
-    public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
     public static final String Signature                = "Signature";
     public static final String SourceDebugExtension     = "SourceDebugExtension";
     public static final String SourceFile               = "SourceFile";
@@ -101,6 +100,7 @@
         protected void init() {
             standardAttributes = new HashMap<String,Class<? extends Attribute>>();
             standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
+            standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
             standardAttributes.put(Code,              Code_attribute.class);
             standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);
@@ -118,8 +118,6 @@
                 standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
-                standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
-                standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
                 standardAttributes.put(Signature,     Signature_attribute.class);
                 standardAttributes.put(SourceID, SourceID_attribute.class);
             }
@@ -159,6 +157,7 @@
 
 
     public interface Visitor<R,P> {
+        R visitBootstrapMethods(BootstrapMethods_attribute attr, P p);
         R visitDefault(DefaultAttribute attr, P p);
         R visitAnnotationDefault(AnnotationDefault_attribute attr, P p);
         R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
@@ -176,8 +175,6 @@
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
-        R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
-        R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
         R visitSignature(Signature_attribute attr, P p);
         R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
         R visitSourceFile(SourceFile_attribute attr, P p);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/BootstrapMethods_attribute.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 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.  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.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS3 <TBD>
+ * http://cr.openjdk.java.net/~jrose/pres/indy-javadoc-mlvm/
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class BootstrapMethods_attribute extends Attribute {
+    public final BootstrapMethodSpecifier[] bootstrap_method_specifiers;
+
+    BootstrapMethods_attribute(ClassReader cr, int name_index, int length)
+            throws IOException, AttributeException {
+        super(name_index, length);
+        int bootstrap_method_count = cr.readUnsignedShort();
+        bootstrap_method_specifiers = new BootstrapMethodSpecifier[bootstrap_method_count];
+        for (int i = 0; i < bootstrap_method_specifiers.length; i++)
+            bootstrap_method_specifiers[i] = new BootstrapMethodSpecifier(cr);
+    }
+
+    public  BootstrapMethods_attribute(int name_index, BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+        super(name_index, length(bootstrap_method_specifiers));
+        this.bootstrap_method_specifiers = bootstrap_method_specifiers;
+    }
+
+    public static int length(BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+        int n = 2;
+        for (BootstrapMethodSpecifier b : bootstrap_method_specifiers)
+            n += b.length();
+        return n;
+    }
+
+    @Override
+    public <R, P> R accept(Visitor<R, P> visitor, P p) {
+        return visitor.visitBootstrapMethods(this, p);
+    }
+
+    public static class BootstrapMethodSpecifier {
+        public int bootstrap_method_ref;
+        public int[] bootstrap_arguments;
+
+        public BootstrapMethodSpecifier(int bootstrap_method_ref, int[] bootstrap_arguments) {
+            this.bootstrap_method_ref = bootstrap_method_ref;
+            this.bootstrap_arguments = bootstrap_arguments;
+        }
+        BootstrapMethodSpecifier(ClassReader cr) throws IOException {
+            bootstrap_method_ref = cr.readUnsignedShort();
+            int method_count = cr.readUnsignedShort();
+            bootstrap_arguments = new int[method_count];
+            for (int i = 0; i < bootstrap_arguments.length; i++) {
+                bootstrap_arguments[i] = cr.readUnsignedShort();
+            }
+        }
+
+        int length() {
+            // u2 (method_ref) + u2 (argc) + u2 * argc
+            return 2 + 2 + (bootstrap_arguments.length * 2);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -31,7 +31,10 @@
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Float_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Integer_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_InterfaceMethodref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_InvokeDynamic_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Long_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
@@ -304,6 +307,20 @@
         return info;
     }
 
+    public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
+        CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
     public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
         CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
         if (info2 == null) {
@@ -339,6 +356,34 @@
         return info;
     }
 
+    public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
+        CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_MethodHandle_info(cp2, info.reference_kind, info.reference_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
+    public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
+        CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_MethodType_info(cp2, info.descriptor_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
     public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
         CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
         if (info2 == null) {
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -267,6 +267,12 @@
             return 1;
         }
 
+        public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ClassOutputStream out) {
+            out.writeShort(info.bootstrap_method_attr_index);
+            out.writeShort(info.name_and_type_index);
+            return 1;
+        }
+
         public Integer visitLong(CONSTANT_Long_info info, ClassOutputStream out) {
             out.writeLong(info.value);
             return 2;
@@ -278,6 +284,17 @@
             return 1;
         }
 
+        public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
+            out.writeByte(info.reference_kind.tag);
+            out.writeShort(info.reference_index);
+            return 1;
+        }
+
+        public Integer visitMethodType(CONSTANT_MethodType_info info, ClassOutputStream out) {
+            out.writeShort(info.descriptor_index);
+            return 1;
+        }
+
         public Integer visitMethodref(CONSTANT_Methodref_info info, ClassOutputStream out) {
             return writeRef(info, out);
         }
@@ -332,6 +349,19 @@
             return null;
         }
 
+        public Void visitBootstrapMethods(BootstrapMethods_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.bootstrap_method_specifiers.length);
+            for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : attr.bootstrap_method_specifiers) {
+                out.writeShort(bsm.bootstrap_method_ref);
+                int bsm_args_count = bsm.bootstrap_arguments.length;
+                out.writeShort(bsm_args_count);
+                for (int i : bsm.bootstrap_arguments) {
+                    out.writeShort(i);
+                }
+            }
+            return null;
+        }
+
         public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.character_range_table.length);
             for (CharacterRangeTable_attribute.Entry e: attr.character_range_table)
@@ -459,16 +489,6 @@
             return null;
         }
 
-        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
-        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
         public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
             out.writeByte(attr.parameter_annotations.length);
             for (Annotation[] annos: attr.parameter_annotations)
@@ -628,12 +648,6 @@
                 write(anno, out);
         }
 
-        public void write(ExtendedAnnotation[] annos, ClassOutputStream out) {
-            out.writeShort(annos.length);
-            for (ExtendedAnnotation anno: annos)
-                write(anno, out);
-        }
-
         public void write(Annotation anno, ClassOutputStream out) {
             out.writeShort(anno.type_index);
             out.writeShort(anno.element_value_pairs.length);
@@ -641,11 +655,6 @@
                 write(p, out);
         }
 
-        public void write(ExtendedAnnotation anno, ClassOutputStream out) {
-            write(anno.annotation, out);
-            write(anno.position, out);
-        }
-
         public void write(element_value_pair pair, ClassOutputStream out) {
             out.writeShort(pair.element_name_index);
             write(pair.value, out);
@@ -684,95 +693,5 @@
             return null;
         }
 
-        private void write(ExtendedAnnotation.Position p, ClassOutputStream out) {
-            out.writeByte(p.type.targetTypeValue());
-            switch (p.type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                int table_length = p.lvarOffset.length;
-                out.writeShort(table_length);
-                for (int i = 0; i < table_length; ++i) {
-                    out.writeShort(1);  // for table length
-                    out.writeShort(p.lvarOffset[i]);
-                    out.writeShort(p.lvarLength[i]);
-                    out.writeShort(p.lvarIndex[i]);
-                }
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                out.writeByte(p.parameter_index);
-                break;
-            // type parameters bounds
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                out.writeByte(p.bound_index);
-                break;
-             // wildcards
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                write(p.wildcard_position, out);
-                break;
-            // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                out.writeByte(p.type_index);
-                break;
-            // throws
-            case THROWS:
-                out.writeByte(p.type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                out.writeByte(p.type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + p);
-            }
-
-            // Append location data for generics/arrays.
-            if (p.type.hasLocation()) {
-                out.writeShort(p.location.size());
-                for (int i : p.location)
-                    out.writeByte((byte)i);
-            }
-        }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -114,6 +114,54 @@
     public static final int CONSTANT_Methodref = 10;
     public static final int CONSTANT_InterfaceMethodref = 11;
     public static final int CONSTANT_NameAndType = 12;
+    public static final int CONSTANT_MethodHandle = 15;
+    public static final int CONSTANT_MethodType = 16;
+    public static final int CONSTANT_InvokeDynamic = 18;
+
+    public static enum RefKind {
+        REF_getField(1, "getfield"),
+        REF_getStatic(2, "getstatic"),
+        REF_putField(3, "putfield"),
+        REF_putStatic(4, "putstatic"),
+        REF_invokeVirtual(5, "invokevirtual"),
+        REF_invokeStatic(6, "invokestatic"),
+        REF_invokeSpecial(7, "invokespecial"),
+        REF_newInvokeSpecial(8, "newinvokespecial"),
+        REF_invokeInterface(9, "invokeinterface");
+
+        public final int tag;
+        public final String name;
+
+        RefKind(int tag, String name) {
+            this.tag = tag;
+            this.name = name;
+        }
+
+        static RefKind getRefkind(int tag) {
+            switch(tag) {
+                case 1:
+                    return REF_getField;
+                case 2:
+                    return REF_getStatic;
+                case 3:
+                    return REF_putField;
+                case 4:
+                    return REF_putStatic;
+                case 5:
+                    return REF_invokeVirtual;
+                case 6:
+                    return REF_invokeStatic;
+                case 7:
+                    return REF_invokeSpecial;
+                case 8:
+                    return REF_newInvokeSpecial;
+                case 9:
+                    return REF_invokeInterface;
+                default:
+                    return null;
+            }
+        }
+    }
 
     ConstantPool(ClassReader cr) throws IOException, InvalidEntry {
         int count = cr.readUnsignedShort();
@@ -146,11 +194,23 @@
                 pool[i] = new CONSTANT_InterfaceMethodref_info(this, cr);
                 break;
 
+            case CONSTANT_InvokeDynamic:
+                pool[i] = new CONSTANT_InvokeDynamic_info(this, cr);
+                break;
+
             case CONSTANT_Long:
                 pool[i] = new CONSTANT_Long_info(cr);
                 i++;
                 break;
 
+            case CONSTANT_MethodHandle:
+                pool[i] = new CONSTANT_MethodHandle_info(this, cr);
+                break;
+
+            case CONSTANT_MethodType:
+                pool[i] = new CONSTANT_MethodType_info(this, cr);
+                break;
+
             case CONSTANT_Methodref:
                 pool[i] = new CONSTANT_Methodref_info(this, cr);
                 break;
@@ -279,9 +339,12 @@
         R visitFloat(CONSTANT_Float_info info, P p);
         R visitInteger(CONSTANT_Integer_info info, P p);
         R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
+        R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
         R visitLong(CONSTANT_Long_info info, P p);
         R visitNameAndType(CONSTANT_NameAndType_info info, P p);
         R visitMethodref(CONSTANT_Methodref_info info, P p);
+        R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
+        R visitMethodType(CONSTANT_MethodType_info info, P p);
         R visitString(CONSTANT_String_info info, P p);
         R visitUtf8(CONSTANT_Utf8_info info, P p);
     }
@@ -548,6 +611,44 @@
         }
     }
 
+    public static class CONSTANT_InvokeDynamic_info extends CPInfo {
+        CONSTANT_InvokeDynamic_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            bootstrap_method_attr_index = cr.readUnsignedShort();
+            name_and_type_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_InvokeDynamic_info(ConstantPool cp, int bootstrap_method_index, int name_and_type_index) {
+            super(cp);
+            this.bootstrap_method_attr_index = bootstrap_method_index;
+            this.name_and_type_index = name_and_type_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_InvokeDynamic;
+        }
+
+        public int byteLength() {
+            return 5;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_InvokeDynamic_info[bootstrap_method_index: " + bootstrap_method_attr_index + ", name_and_type_index: " + name_and_type_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitInvokeDynamic(this, data);
+        }
+
+        public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
+            return cp.getNameAndTypeInfo(name_and_type_index);
+        }
+
+        public final int bootstrap_method_attr_index;
+        public final int name_and_type_index;
+    }
+
     public static class CONSTANT_Long_info extends CPInfo {
         CONSTANT_Long_info(ClassReader cr) throws IOException {
             value = cr.readLong();
@@ -582,6 +683,87 @@
         public final long value;
     }
 
+    public static class CONSTANT_MethodHandle_info extends CPInfo {
+        CONSTANT_MethodHandle_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            reference_kind =  RefKind.getRefkind(cr.readUnsignedByte());
+            reference_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_MethodHandle_info(ConstantPool cp, RefKind ref_kind, int member_index) {
+            super(cp);
+            this.reference_kind = ref_kind;
+            this.reference_index = member_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_MethodHandle;
+        }
+
+        public int byteLength() {
+            return 4;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_MethodHandle_info[ref_kind: " + reference_kind + ", member_index: " + reference_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitMethodHandle(this, data);
+        }
+
+        public CPRefInfo getCPRefInfo() throws ConstantPoolException {
+            int expected = CONSTANT_Methodref;
+            int actual = cp.get(reference_index).getTag();
+            // allow these tag types also:
+            switch (actual) {
+                case CONSTANT_Fieldref:
+                case CONSTANT_InterfaceMethodref:
+                    expected = actual;
+            }
+            return (CPRefInfo) cp.get(reference_index, expected);
+        }
+
+        public final RefKind reference_kind;
+        public final int reference_index;
+    }
+
+    public static class CONSTANT_MethodType_info extends CPInfo {
+        CONSTANT_MethodType_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            descriptor_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_MethodType_info(ConstantPool cp, int signature_index) {
+            super(cp);
+            this.descriptor_index = signature_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_MethodType;
+        }
+
+        public int byteLength() {
+            return 3;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_MethodType_info[signature_index: " + descriptor_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitMethodType(this, data);
+        }
+
+        public String getType() throws ConstantPoolException {
+            return cp.getUTF8Value(descriptor_index);
+        }
+
+        public final int descriptor_index;
+    }
+
     public static class CONSTANT_Methodref_info extends CPRefInfo {
         CONSTANT_Methodref_info(ConstantPool cp, ClassReader cr) throws IOException {
             super(cp, cr, CONSTANT_Methodref);
@@ -729,5 +911,4 @@
         public final String value;
     }
 
-
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -626,10 +626,26 @@
                 return visitRef(info, p);
             }
 
+            public Void visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+                return null;
+            }
+
             public Void visitLong(CONSTANT_Long_info info, Void p) {
                 return null;
             }
 
+            public Void visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+                return null;
+            }
+
+            public Void visitMethodType(CONSTANT_MethodType_info info, Void p) {
+                return null;
+            }
+
+            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
+                return visitRef(info, p);
+            }
+
             public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
                 try {
                     new Signature(info.type_index).getType(constant_pool).accept(this, null);
@@ -639,10 +655,6 @@
                 }
             }
 
-            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
-                return visitRef(info, p);
-            }
-
             public Void visitString(CONSTANT_String_info info, Void p) {
                 return null;
             }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,612 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * 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.classfile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-
-import static com.sun.tools.classfile.ExtendedAnnotation.TargetAttribute.*;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ExtendedAnnotation {
-    ExtendedAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        annotation = new Annotation(cr);
-        position = read_position(cr);
-    }
-
-    public ExtendedAnnotation(ConstantPool constant_pool,
-            Annotation annotation, Position position) {
-        this.annotation = annotation;
-        this.position = position;
-    }
-
-    public int length() {
-        int n = annotation.length();
-        n += position_length(position);
-        return n;
-    }
-
-    public final Annotation annotation;
-    public final Position position;
-
-    private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        // Copied from ClassReader
-        int tag = (byte)cr.readUnsignedByte();  // cast to introduce signedness
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw new Annotation.InvalidAnnotation("invalid type annotation target type value: " + tag);
-
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        Position position = new Position();
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = cr.readUnsignedShort();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = cr.readUnsignedShort();
-                position.lvarLength[i] = cr.readUnsignedShort();
-                position.lvarIndex[i] = cr.readUnsignedShort();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            position.bound_index = cr.readUnsignedByte();
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = read_position(cr);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            int in = cr.readUnsignedShort();
-            if (in == 0xFFFF)
-                in = -1;
-            position.type_index = in;
-            break;
-        // throws
-        case THROWS:
-            position.type_index = cr.readUnsignedShort();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            position.type_index = cr.readUnsignedByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("Cannot be here");
-        }
-
-        if (type.hasLocation()) {
-            int len = cr.readUnsignedShort();
-            List<Integer> loc = new ArrayList<Integer>(len);
-            for (int i = 0; i < len; i++)
-                loc.add(cr.readUnsignedByte());
-            position.location = loc;
-        }
-        return position;
-    }
-
-    private static int position_length(Position pos) {
-        int n = 0;
-        n += 1; // target_type
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            n += 2;
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            n += 2; // table_length;
-            int table_length = pos.lvarOffset.length;
-            n += 2 * table_length; // offset
-            n += 2 * table_length; // length;
-            n += 2 * table_length; // index
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            n += 1; // parameter_index;
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            n += 1; // bound_index
-            break;
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            n += position_length(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            n += 2; // type_index
-            break;
-        // throws
-        case THROWS:
-            n += 2; // type_index
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            n += 1; // offset
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            n += 2; // offset
-            n += 1; // type index
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-        }
-
-        if (pos.type.hasLocation()) {
-            n += 2; // length
-            n += 1 * pos.location.size(); // actual array size
-        }
-
-        return n;
-    }
-
-    // Code duplicated from com.sun.tools.javac.code.TypeAnnotations.Position
-    public static class Position {
-
-        public TargetType type = TargetType.UNKNOWN;
-
-        // For generic/array types.
-        public List<Integer> location = new ArrayList<Integer>();
-
-        // For typecasts, type tests, new (and locals, as start_pc).
-        public int offset = -1;
-
-        // For locals.
-        public int[] lvarOffset = null;
-        public int[] lvarLength = null;
-        public int[] lvarIndex = null;
-
-        // For type parameter bound
-        public int bound_index = Integer.MIN_VALUE;
-
-        // For type parameter and method parameter
-        public int parameter_index = Integer.MIN_VALUE;
-
-        // For class extends, implements, and throws classes
-        public int type_index = Integer.MIN_VALUE;
-
-        // For wildcards
-        public Position wildcard_position = null;
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append('[');
-            sb.append(type);
-
-            switch (type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                sb.append(", {");
-                for (int i = 0; i < lvarOffset.length; ++i) {
-                    if (i != 0) sb.append("; ");
-                    sb.append(", start_pc = ");
-                    sb.append(lvarOffset[i]);
-                    sb.append(", length = ");
-                    sb.append(lvarLength[i]);
-                    sb.append(", index = ");
-                    sb.append(lvarIndex[i]);
-                }
-                sb.append("}");
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // type parameters bound
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                sb.append(", bound_index = ");
-                sb.append(bound_index);
-                break;
-             // wildcard
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", wild_card = ");
-                sb.append(wildcard_position);
-                break;
-             // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // throws
-            case THROWS:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + type);
-            }
-
-            // Append location data for generics/arrays.
-            if (type.hasLocation()) {
-                sb.append(", location = (");
-                sb.append(location);
-                sb.append(")");
-            }
-
-            sb.append(']');
-            return sb.toString();
-        }
-    }
-
-    // Code duplicated from com.sun.tools.javac.comp.TargetType
-    public enum TargetType {
-
-        /** For annotations on typecasts. */
-        TYPECAST(0x00),
-
-        /** For annotations on a type argument or nested array of a typecast. */
-        TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation),
-
-        /** For annotations on type tests. */
-        INSTANCEOF(0x02),
-
-        /** For annotations on a type argument or nested array of a type test. */
-        INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation),
-
-        /** For annotations on object creation expressions. */
-        NEW(0x04),
-
-        /**
-         * For annotations on a type argument or nested array of an object creation
-         * expression.
-         */
-        NEW_GENERIC_OR_ARRAY(0x05, HasLocation),
-
-
-        /** For annotations on the method receiver. */
-        METHOD_RECEIVER(0x06),
-
-        // invalid location
-        // METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation),
-
-        /** For annotations on local variables. */
-        LOCAL_VARIABLE(0x08),
-
-        /** For annotations on a type argument or nested array of a local. */
-        LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_RETURN(0x0A),
-
-        /**
-         * For annotations on a type argument or nested array of a method return
-         * type.
-         */
-        METHOD_RETURN_GENERIC_OR_ARRAY(0x0B, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_PARAMETER(0x0C),
-
-        /** For annotations on a type argument or nested array of a method parameter. */
-        METHOD_PARAMETER_GENERIC_OR_ARRAY(0x0D, HasLocation),
-
-        // already handled by regular annotations
-        // FIELD(0x0E),
-
-        /** For annotations on a type argument or nested array of a field. */
-        FIELD_GENERIC_OR_ARRAY(0x0F, HasLocation),
-
-        /** For annotations on a bound of a type parameter of a class. */
-        CLASS_TYPE_PARAMETER_BOUND(0x10, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a class.
-         */
-        CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x11, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on a bound of a type parameter of a method. */
-        METHOD_TYPE_PARAMETER_BOUND(0x12, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a method.
-         */
-        METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x13, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on the type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS(0x14),
-
-        /** For annotations on the inner type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS_GENERIC_OR_ARRAY(0x15, HasLocation),
-
-        /** For annotations on a throws clause in a method declaration. */
-        THROWS(0x16),
-
-        // invalid location
-        // THROWS_GENERIC_OR_ARRAY(0x17, HasLocation),
-
-        /** For annotations in type arguments of object creation expressions. */
-        NEW_TYPE_ARGUMENT(0x18),
-        NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation),
-
-        METHOD_TYPE_ARGUMENT(0x1A),
-        METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation),
-
-        WILDCARD_BOUND(0x1C, HasBound),
-        WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation),
-
-        CLASS_LITERAL(0x1E),
-        CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation),
-
-        METHOD_TYPE_PARAMETER(0x20, HasParameter),
-
-        // invalid location
-        // METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter),
-
-        CLASS_TYPE_PARAMETER(0x22, HasParameter),
-
-        // invalid location
-        // CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter),
-
-        /** For annotations with an unknown target. */
-        UNKNOWN(-1);
-
-        static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
-
-        private final int targetTypeValue;
-        private Set<TargetAttribute> flags;
-
-        TargetType(int targetTypeValue, TargetAttribute... attrs) {
-            if (targetTypeValue < Byte.MIN_VALUE
-                || targetTypeValue > Byte.MAX_VALUE)
-                throw new AssertionError("attribute type value needs to be a byte: " + targetTypeValue);
-            this.targetTypeValue = (byte)targetTypeValue;
-            this.flags = EnumSet.noneOf(TargetAttribute.class);
-            for (TargetAttribute attr : attrs)
-                this.flags.add(attr);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is an inner type of a generic or array type.
-         *
-         * @return true if this TargetType represents an annotation on an inner
-         *         type, false otherwise
-         */
-        public boolean hasLocation() {
-            return flags.contains(HasLocation);
-        }
-
-        public TargetType getGenericComplement() {
-            if (hasLocation())
-                return this;
-            else
-                return fromTargetTypeValue(targetTypeValue() + 1);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target has a parameter index.
-         *
-         * @return true if this TargetType has a parameter index,
-         *         false otherwise
-         */
-        public boolean hasParameter() {
-            return flags.contains(HasParameter);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is a type parameter bound.
-         *
-         * @return true if this TargetType represents an type parameter bound
-         *         annotation, false otherwise
-         */
-        public boolean hasBound() {
-            return flags.contains(HasBound);
-        }
-
-        public int targetTypeValue() {
-            return this.targetTypeValue;
-        }
-
-        private static TargetType[] targets = null;
-
-        private static TargetType[] buildTargets() {
-            TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
-            TargetType[] alltargets = values();
-            for (TargetType target : alltargets)
-                if (target.targetTypeValue >= 0)
-                    targets[target.targetTypeValue] = target;
-            for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i)
-                if (targets[i] == null)
-                    targets[i] = UNKNOWN;
-            return targets;
-        }
-
-        public static boolean isValidTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return true;
-
-            return (tag >= 0 && tag < targets.length);
-        }
-
-        public static TargetType fromTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return UNKNOWN;
-
-            if (tag < 0 || tag >= targets.length)
-                throw new IllegalArgumentException("Unknown TargetType: " + tag);
-            return targets[tag];
-        }
-    }
-
-    static enum TargetAttribute {
-        HasLocation, HasParameter, HasBound;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
-    protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(name_index, length);
-        int num_annotations = cr.readUnsignedShort();
-        annotations = new ExtendedAnnotation[num_annotations];
-        for (int i = 0; i < annotations.length; i++)
-            annotations[i] = new ExtendedAnnotation(cr);
-    }
-
-    protected RuntimeTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, length(annotations));
-        this.annotations = annotations;
-    }
-
-    private static int length(ExtendedAnnotation[] annos) {
-        int n = 2;
-        for (ExtendedAnnotation anno: annos)
-            n += anno.length();
-        return n;
-    }
-
-    public final ExtendedAnnotation[] annotations;
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * 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.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Feb 04 16:29:41 2011 -0800
@@ -755,22 +755,30 @@
         if (!isInline() && !endsWithNewLine(contentBuilder))
             contentBuilder.append(DocletConstants.NL);
         String tagString = htmlTag.toString();
-        contentBuilder.append("<" + tagString);
+        contentBuilder.append("<");
+        contentBuilder.append(tagString);
         Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
         HtmlAttr key;
         String value = "";
         while (iterator.hasNext()) {
             key = iterator.next();
             value = attrs.get(key);
-            contentBuilder.append(" " + key.toString());
-            if (!value.isEmpty())
-                contentBuilder.append("=\"" + value + "\"");
+            contentBuilder.append(" ");
+            contentBuilder.append(key.toString());
+            if (!value.isEmpty()) {
+                contentBuilder.append("=\"");
+                contentBuilder.append(value);
+                contentBuilder.append("\"");
+            }
         }
         contentBuilder.append(">");
         for (Content c : content)
             c.write(contentBuilder);
-        if (htmlTag.endTagRequired())
-            contentBuilder.append("</" + tagString + ">");
+        if (htmlTag.endTagRequired()) {
+            contentBuilder.append("</");
+            contentBuilder.append(tagString);
+            contentBuilder.append(">");
+        }
         if (!isInline())
             contentBuilder.append(DocletConstants.NL);
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Fri Feb 04 16:29:41 2011 -0800
@@ -99,8 +99,24 @@
      * @param contentBuilder content to test for newline character at the end
      * @return true if the content ends with newline.
      */
-    public boolean endsWithNewLine(StringBuilder contentBuilder) {
-        return ((contentBuilder.length() == 0) ||
-                (contentBuilder.toString().endsWith(DocletConstants.NL)));
+    protected boolean endsWithNewLine(StringBuilder contentBuilder) {
+        int contentLength = contentBuilder.length();
+        if (contentLength == 0) {
+            return true;
+        }
+        int nlLength = DocletConstants.NL.length();
+        if (contentLength < nlLength) {
+            return false;
+        }
+        int contentIndex = contentLength - 1;
+        int nlIndex = nlLength - 1;
+        while (nlIndex >= 0) {
+            if (contentBuilder.charAt(contentIndex) != DocletConstants.NL.charAt(nlIndex)) {
+                return false;
+            }
+            contentIndex--;
+            nlIndex--;
+        }
+        return true;
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/Main.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/Main.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -43,12 +43,6 @@
  */
 public class Main {
 
-    static {
-        ClassLoader loader = Main.class.getClassLoader();
-        if (loader != null)
-            loader.setPackageAssertionStatus("com.sun.tools.javac", true);
-    }
-
     /** Unsupported command line interface.
      * @param args   The command line parameters.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -204,21 +204,6 @@
         }
     }
 
-    public static class TypeCompound extends Compound {
-        public TypeAnnotationPosition position;
-        public TypeCompound(Compound compound,
-                TypeAnnotationPosition position) {
-            this(compound.type, compound.values, position);
-        }
-        public TypeCompound(Type type,
-                List<Pair<MethodSymbol, Attribute>> values,
-                TypeAnnotationPosition position) {
-            super(type, values);
-            this.position = position;
-        }
-
-    }
-
     /** The value for an annotation element of an array type.
      */
     public static class Array extends Attribute {
@@ -255,8 +240,7 @@
         public VarSymbol value;
         public Enum(Type type, VarSymbol value) {
             super(type);
-            assert value != null;
-            this.value = value;
+            this.value = Assert.checkNonNull(value);
         }
         public void accept(Visitor v) { v.visitEnum(this); }
         public String toString() {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,7 +133,7 @@
      */
     private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
         this.next = next;
-        assert emptyScope == null || owner != null;
+        Assert.check(emptyScope == null || owner != null);
         this.owner = owner;
         this.table = table;
         this.hashMask = table.length - 1;
@@ -191,16 +191,16 @@
      *  with next.
      */
     public Scope leave() {
-        assert shared == 0;
+        Assert.check(shared == 0);
         if (table != next.table) return next;
         while (elems != null) {
             int hash = getIndex(elems.sym.name);
             Entry e = table[hash];
-            assert e == elems : elems.sym;
+            Assert.check(e == elems, elems.sym);
             table[hash] = elems.shadowed;
             elems = elems.sibling;
         }
-        assert next.shared > 0;
+        Assert.check(next.shared > 0);
         next.shared--;
         next.nelems = nelems;
         // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
@@ -211,12 +211,12 @@
     /** Double size of hash table.
      */
     private void dble() {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry[] oldtable = table;
         Entry[] newtable = new Entry[oldtable.length * 2];
         for (Scope s = this; s != null; s = s.next) {
             if (s.table == oldtable) {
-                assert s == this || s.shared != 0;
+                Assert.check(s == this || s.shared != 0);
                 s.table = newtable;
                 s.hashMask = newtable.length - 1;
             }
@@ -237,7 +237,7 @@
     /** Enter symbol sym in this scope.
      */
     public void enter(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         enter(sym, this);
     }
 
@@ -251,7 +251,7 @@
      * arguments are only used in import scopes.
      */
     public void enter(Symbol sym, Scope s, Scope origin) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         if (nelems * 3 >= hashMask * 2)
             dble();
         int hash = getIndex(sym.name);
@@ -274,7 +274,7 @@
      *  attribute tells us that the class isn't a package member.
      */
     public void remove(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry e = lookup(sym.name);
         if (e.scope == null) return;
 
@@ -314,7 +314,7 @@
     /** Enter symbol sym in this scope if not already there.
      */
     public void enterIfAbsent(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry e = lookup(sym.name);
         while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
         if (e.scope != this) enter(sym);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -81,8 +81,7 @@
      *  method to make sure that the class symbol is loaded.
      */
     public List<Attribute.Compound> getAnnotationMirrors() {
-        assert attributes_field != null;
-        return attributes_field;
+        return Assert.checkNonNull(attributes_field);
     }
 
     /** Fetch a particular annotation from a symbol. */
@@ -100,17 +99,6 @@
      */
     public Type type;
 
-    /** The type annotations targeted to a tree directly owned by this symbol
-     */
-    // type annotations are stored here for two purposes:
-    //  - convenient location to store annotations for generation after erasure
-    //  - a private interface for accessing type annotations parsed from
-    //    classfiles
-    //  the field is populated for the following declaration only
-    //  class, field, variable and type parameters
-    //
-    public List<Attribute.TypeCompound> typeAnnotations;
-
     /** The owner of this symbol.
      */
     public Symbol owner;
@@ -133,7 +121,6 @@
         this.completer = null;
         this.erasure_field = null;
         this.attributes_field = List.nil();
-        this.typeAnnotations = List.nil();
         this.name = name;
     }
 
@@ -608,7 +595,7 @@
         }
 
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
-            assert type.tag == TYPEVAR; // else override will be invoked
+            Assert.check(type.tag == TYPEVAR); // else override will be invoked
             return v.visitTypeParameter(this, p);
         }
 
@@ -682,8 +669,7 @@
                 if (attributes_field.isEmpty())
                     attributes_field = package_info.attributes_field;
             }
-            assert attributes_field != null;
-            return attributes_field;
+            return Assert.checkNonNull(attributes_field);
         }
 
         /** A package "exists" if a type or package that exists has
@@ -780,8 +766,7 @@
 
         public List<Attribute.Compound> getAnnotationMirrors() {
             if (completer != null) complete();
-            assert attributes_field != null;
-            return attributes_field;
+            return Assert.checkNonNull(attributes_field);
         }
 
         public Type erasure(Types types) {
@@ -1032,7 +1017,7 @@
         }
 
         public void setData(Object data) {
-            assert !(data instanceof Env<?>) : this;
+            Assert.check(!(data instanceof Env<?>), this);
             this.data = data;
         }
 
@@ -1064,7 +1049,7 @@
          */
         public MethodSymbol(long flags, Name name, Type type, Symbol owner) {
             super(MTH, flags, name, type, owner);
-            assert owner.type.tag != TYPEVAR : owner + "." + name;
+            if (owner.type.tag == TYPEVAR) Assert.error(owner + "." + name);
         }
 
         /** Clone this symbol with new owner.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Feb 04 16:29:41 2011 -0800
@@ -126,7 +126,6 @@
     public final Type serializableType;
     public final Type methodHandleType;
     public final Type polymorphicSignatureType;
-    public final Type invokeDynamicType;
     public final Type throwableType;
     public final Type errorType;
     public final Type illegalArgumentExceptionType;
@@ -422,7 +421,6 @@
         serializableType = enterClass("java.io.Serializable");
         methodHandleType = enterClass("java.dyn.MethodHandle");
         polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
-        invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
         errorType = enterClass("java.lang.Error");
         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
         exceptionType = enterClass("java.lang.Exception");
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -138,7 +138,7 @@
      */
     public Type constType(Object constValue) {
         final Object value = constValue;
-        assert tag <= BOOLEAN;
+        Assert.check(tag <= BOOLEAN);
         return new Type(tag, tsym) {
                 @Override
                 public Object constValue() {
@@ -202,13 +202,13 @@
      * The constant value of this type, converted to String
      */
     public String stringValue() {
-        assert constValue() != null;
+        Object cv = Assert.checkNonNull(constValue());
         if (tag == BOOLEAN)
-            return ((Integer) constValue()).intValue() == 0 ? "false" : "true";
+            return ((Integer) cv).intValue() == 0 ? "false" : "true";
         else if (tag == CHAR)
-            return String.valueOf((char) ((Integer) constValue()).intValue());
+            return String.valueOf((char) ((Integer) cv).intValue());
         else
-            return constValue().toString();
+            return cv.toString();
     }
 
     /**
@@ -365,6 +365,16 @@
         return false;
     }
 
+    public static List<Type> filter(List<Type> ts, Filter<Type> tf) {
+        ListBuffer<Type> buf = ListBuffer.lb();
+        for (Type t : ts) {
+            if (tf.accepts(t)) {
+                buf.append(t);
+            }
+        }
+        return buf.toList();
+    }
+
     public boolean isSuperBound() { return false; }
     public boolean isExtendsBound() { return false; }
     public boolean isUnbound() { return false; }
@@ -428,9 +438,8 @@
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
             super(WILDCARD, tsym);
-            assert(type != null);
+            this.type = Assert.checkNonNull(type);
             this.kind = kind;
-            this.type = type;
         }
         public WildcardType(WildcardType t, TypeVar bound) {
             this(t.type, t.kind, t.tsym, bound);
@@ -1021,9 +1030,8 @@
                             Type lower,
                             WildcardType wildcard) {
             super(name, owner, lower);
-            assert lower != null;
+            this.lower = Assert.checkNonNull(lower);
             this.bound = upper;
-            this.lower = lower;
             this.wildcard = wildcard;
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,403 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * 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.javac.code;
-
-import javax.lang.model.element.ElementKind;
-
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Contains operations specific to processing type annotations
- */
-public class TypeAnnotations {
-    private static final Context.Key<TypeAnnotations> key
-        = new Context.Key<TypeAnnotations>();
-
-    public static TypeAnnotations instance(Context context) {
-        TypeAnnotations instance = context.get(key);
-        if (instance == null)
-            instance = new TypeAnnotations(context);
-        return instance;
-    }
-
-    protected TypeAnnotations(Context context) {
-        context.put(key, this);
-    }
-
-    public void taFillAndLift(JCClassDecl tree, boolean visitBodies) {
-//308        new TypeAnnotationPositions().scan(tree);
-//308        new TypeAnnotationLift().scan(tree);
-    }
-
-    private static class TypeAnnotationPositions extends TreeScanner {
-
-        private ListBuffer<JCTree> frames = ListBuffer.lb();
-        private void push(JCTree t) { frames = frames.prepend(t); }
-        private JCTree pop() { return frames.next(); }
-        private JCTree peek2() { return frames.toList().tail.head; }
-
-        @Override
-        public void scan(JCTree tree) {
-            push(tree);
-            super.scan(tree);
-            pop();
-        }
-
-        private boolean inClass = false;
-
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-           if (!inClass) {
-               // Do not recurse into nested and inner classes since
-               // TransTypes.visitClassDef makes an invocation for each class
-               // separately.
-               inClass = true;
-               try {
-                   super.visitClassDef(tree);
-               } finally {
-                   inClass = false;
-               }
-           }
-        }
-
-        private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame,
-                List<JCTree> path, TypeAnnotationPosition p) {
-            switch (frame.getKind()) {
-                case TYPE_CAST:
-                    p.type = TargetType.TYPECAST;
-                    p.pos = frame.pos;
-                    return p;
-
-                case INSTANCE_OF:
-                    p.type = TargetType.INSTANCEOF;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_CLASS:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_ARRAY:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case ANNOTATION_TYPE:
-                case CLASS:
-                case ENUM:
-                case INTERFACE:
-                    p.pos = frame.pos;
-                    if (((JCClassDecl)frame).extending == tree) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = -1;
-                    } else if (((JCClassDecl)frame).implementing.contains(tree)) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
-                    } else if (((JCClassDecl)frame).typarams.contains(tree)) {
-                        p.type = TargetType.CLASS_TYPE_PARAMETER;
-                        p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-
-                case METHOD: {
-                    JCMethodDecl frameMethod = (JCMethodDecl)frame;
-                    p.pos = frame.pos;
-                    if (frameMethod.receiverAnnotations.contains(tree))
-                        p.type = TargetType.METHOD_RECEIVER;
-                    else if (frameMethod.thrown.contains(tree)) {
-                        p.type = TargetType.THROWS;
-                        p.type_index = frameMethod.thrown.indexOf(tree);
-                    } else if (((JCMethodDecl)frame).restype == tree) {
-                        p.type = TargetType.METHOD_RETURN_GENERIC_OR_ARRAY;
-                    } else if (frameMethod.typarams.contains(tree)) {
-                        p.type = TargetType.METHOD_TYPE_PARAMETER;
-                        p.parameter_index = frameMethod.typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case MEMBER_SELECT: {
-                    JCFieldAccess fieldFrame = (JCFieldAccess)frame;
-                    if ("class".contentEquals(fieldFrame.name)) {
-                        p.type = TargetType.CLASS_LITERAL;
-                        p.pos = TreeInfo.innermostType(fieldFrame.selected).pos;
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case PARAMETERIZED_TYPE: {
-                    TypeAnnotationPosition nextP;
-                    if (((JCTypeApply)frame).clazz == tree)
-                        nextP = p; // generic: RAW; noop
-                    else if (((JCTypeApply)frame).arguments.contains(tree))
-                        p.location = p.location.prepend(
-                                ((JCTypeApply)frame).arguments.indexOf(tree));
-                    else
-                        throw new AssertionError();
-
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case ARRAY_TYPE: {
-                    p.location = p.location.prepend(0);
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case TYPE_PARAMETER:
-                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF) {
-                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
-                        p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
-                        JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
-                        p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = method.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    p.pos = frame.pos;
-                    return p;
-
-                case VARIABLE:
-                    VarSymbol v = ((JCVariableDecl)frame).sym;
-                    p.pos = frame.pos;
-                    switch (v.getKind()) {
-                        case LOCAL_VARIABLE:
-                            p.type = TargetType.LOCAL_VARIABLE; break;
-                        case FIELD:
-                            p.type = TargetType.FIELD_GENERIC_OR_ARRAY; break;
-                        case PARAMETER:
-                            p.type = TargetType.METHOD_PARAMETER_GENERIC_OR_ARRAY;
-                            p.parameter_index = methodParamIndex(path, frame);
-                            break;
-                        default: throw new AssertionError();
-                    }
-                    return p;
-
-//308                case ANNOTATED_TYPE: {
-//308                    List<JCTree> newPath = path.tail;
-//308                    return resolveFrame(newPath.head, newPath.tail.head,
-//308                            newPath, p);
-//308                }
-
-                case METHOD_INVOCATION: {
-                    JCMethodInvocation invocation = (JCMethodInvocation)frame;
-                    if (!invocation.typeargs.contains(tree))
-                        throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
-                    p.type = TargetType.METHOD_TYPE_ARGUMENT;
-                    p.pos = invocation.pos;
-                    p.type_index = invocation.typeargs.indexOf(tree);
-                    return p;
-                }
-
-                case EXTENDS_WILDCARD:
-                case SUPER_WILDCARD: {
-                    p.type = TargetType.WILDCARD_BOUND;
-                    List<JCTree> newPath = path.tail;
-
-                    TypeAnnotationPosition wildcard =
-                        resolveFrame(newPath.head, newPath.tail.head, newPath,
-                                new TypeAnnotationPosition());
-                    if (!wildcard.location.isEmpty())
-                        wildcard.type = wildcard.type.getGenericComplement();
-                    p.wildcard_position = wildcard;
-                    p.pos = frame.pos;
-                    return p;
-                }
-            }
-            return p;
-        }
-
-        private void setTypeAnnotationPos(List<JCTypeAnnotation> annotations, TypeAnnotationPosition position) {
-            for (JCTypeAnnotation anno : annotations) {
-                anno.annotation_position = position;
-                anno.attribute_field.position = position;
-            }
-        }
-
-        @Override
-        public void visitNewArray(JCNewArray tree) {
-            findPosition(tree, tree, tree.annotations);
-            int dimAnnosCount = tree.dimAnnotations.size();
-
-            // handle annotations associated with dimentions
-            for (int i = 0; i < dimAnnosCount; ++i) {
-                TypeAnnotationPosition p = new TypeAnnotationPosition();
-                p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                p.pos = tree.pos;
-                p.location = p.location.append(i);
-                setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
-            }
-
-            // handle "free" annotations
-            int i = dimAnnosCount == 0 ? 0 : dimAnnosCount - 1;
-            JCExpression elemType = tree.elemtype;
-            while (elemType != null) {
-                if (elemType.getTag() == JCTree.ANNOTATED_TYPE) {
-                    JCAnnotatedType at = (JCAnnotatedType)elemType;
-                    TypeAnnotationPosition p = new TypeAnnotationPosition();
-                    p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                    p.pos = tree.pos;
-                    p.location = p.location.append(i);
-                    setTypeAnnotationPos(at.annotations, p);
-                    elemType = at.underlyingType;
-                } else if (elemType.getTag() == JCTree.TYPEARRAY) {
-                    ++i;
-                    elemType = ((JCArrayTypeTree)elemType).elemtype;
-                } else
-                    break;
-            }
-
-            // find annotations locations of initializer elements
-            scan(tree.elems);
-        }
-
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            TypeAnnotationPosition p = new TypeAnnotationPosition();
-            p.type = TargetType.METHOD_RECEIVER;
-            setTypeAnnotationPos(tree.receiverAnnotations, p);
-            super.visitMethodDef(tree);
-        }
-        @Override
-        public void visitTypeParameter(JCTypeParameter tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-
-        void findPosition(JCTree tree, JCTree frame, List<JCTypeAnnotation> annotations) {
-            if (!annotations.isEmpty()) {
-                TypeAnnotationPosition p =
-                        resolveFrame(tree, frame, frames.toList(),
-                                new TypeAnnotationPosition());
-                if (!p.location.isEmpty())
-                    p.type = p.type.getGenericComplement();
-                setTypeAnnotationPos(annotations, p);
-            }
-        }
-
-        private int methodParamIndex(List<JCTree> path, JCTree param) {
-            List<JCTree> curr = path;
-            if (curr.head != param)
-                curr = path.tail;
-            JCMethodDecl method = (JCMethodDecl)curr.tail.head;
-            return method.params.indexOf(param);
-        }
-    }
-
-    private static class TypeAnnotationLift extends TreeScanner {
-        List<Attribute.TypeCompound> recordedTypeAnnotations = List.nil();
-
-        boolean isInner = false;
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-            if (isInner) {
-                // tree is an inner class tree.  stop now.
-                // TransTypes.visitClassDef makes an invocation for each class
-                // separately.
-                return;
-            }
-            isInner = true;
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitClassDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitMethodDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitVarDef(JCVariableDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            ElementKind kind = tree.sym.getKind();
-            if (kind == ElementKind.LOCAL_VARIABLE && tree.mods.annotations.nonEmpty()) {
-                // need to lift the annotations
-                TypeAnnotationPosition position = new TypeAnnotationPosition();
-                position.pos = tree.pos;
-                position.type = TargetType.LOCAL_VARIABLE;
-                for (Attribute.Compound attribute : tree.sym.attributes_field) {
-                    Attribute.TypeCompound tc =
-                        new Attribute.TypeCompound(attribute.type, attribute.values, position);
-                    recordedTypeAnnotations = recordedTypeAnnotations.append(tc);
-                }
-            }
-            try {
-                super.visitVarDef(tree);
-            } finally {
-                if (kind.isField() || kind == ElementKind.LOCAL_VARIABLE)
-                    tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = kind.isField() ? prevTAs : prevTAs.appendList(recordedTypeAnnotations);
-            }
-        }
-
-        @Override
-        public void visitApply(JCMethodInvocation tree) {
-            scan(tree.meth);
-            scan(tree.typeargs);
-            scan(tree.args);
-        }
-
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation)
-                recordedTypeAnnotations = recordedTypeAnnotations.append(((JCTypeAnnotation)tree).attribute_field);
-            super.visitAnnotation(tree);
-        }
-    }
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1061,8 +1061,9 @@
                             highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
                         }
                         if (highSub != null) {
-                            assert a.tsym == highSub.tsym && a.tsym == lowSub.tsym
-                                : a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym;
+                            if (!(a.tsym == highSub.tsym && a.tsym == lowSub.tsym)) {
+                                Assert.error(a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym);
+                            }
                             if (!disjointTypes(aHigh.allparams(), highSub.allparams())
                                 && !disjointTypes(aHigh.allparams(), lowSub.allparams())
                                 && !disjointTypes(aLow.allparams(), highSub.allparams())
@@ -1703,9 +1704,9 @@
             bt.supertype_field = bounds.head;
             bt.interfaces_field = bounds.tail;
         }
-        assert bt.supertype_field.tsym.completer != null
-            || !bt.supertype_field.isInterface()
-            : bt.supertype_field;
+        Assert.check(bt.supertype_field.tsym.completer != null
+                || !bt.supertype_field.isInterface(),
+            bt.supertype_field);
         return bt;
     }
 
@@ -1834,7 +1835,7 @@
                         // t.interfaces_field is null after
                         // completion, we can assume that t is not the
                         // type of a class/interface declaration.
-                        assert t != t.tsym.type : t.toString();
+                        Assert.check(t != t.tsym.type, t);
                         List<Type> actuals = t.allparams();
                         List<Type> formals = t.tsym.type.allparams();
                         if (t.hasErasedSupertypes()) {
@@ -2646,7 +2647,7 @@
                 act2 = act2.tail;
                 typarams = typarams.tail;
             }
-            assert(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
+            Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
             return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
         }
 
@@ -2758,7 +2759,7 @@
             // calculate lub(A, B)
             while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
                 ts = ts.tail;
-            assert !ts.isEmpty();
+            Assert.check(!ts.isEmpty());
             List<Type> cl = closure(ts.head);
             for (Type t : ts.tail) {
                 if (t.tag == CLASS || t.tag == TYPEVAR)
@@ -3138,7 +3139,7 @@
         boolean reverse = false;
         Type target = to;
         if ((to.tsym.flags() & INTERFACE) == 0) {
-            assert (from.tsym.flags() & INTERFACE) != 0;
+            Assert.check((from.tsym.flags() & INTERFACE) != 0);
             reverse = true;
             to = from;
             from = target;
@@ -3173,12 +3174,12 @@
         boolean reverse = false;
         Type target = to;
         if ((to.tsym.flags() & INTERFACE) == 0) {
-            assert (from.tsym.flags() & INTERFACE) != 0;
+            Assert.check((from.tsym.flags() & INTERFACE) != 0);
             reverse = true;
             to = from;
             from = target;
         }
-        assert (from.tsym.flags() & FINAL) != 0;
+        Assert.check((from.tsym.flags() & FINAL) != 0);
         Type t1 = asSuper(from, to.tsym);
         if (t1 == null) return false;
         Type t2 = to;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -563,7 +563,7 @@
             if (bound != null && bound.tsym instanceof ClassSymbol) {
                 ClassSymbol c = (ClassSymbol)bound.tsym;
                 if ((c.flags_field & COMPOUND) != 0) {
-                    assert (c.flags_field & UNATTRIBUTED) != 0 : c;
+                    Assert.check((c.flags_field & UNATTRIBUTED) != 0, c);
                     attribClass(typaram.pos(), c);
                 }
             }
@@ -905,7 +905,10 @@
             // or perhaps expr implements Iterable<T>?
             Type base = types.asSuper(exprType, syms.iterableType.tsym);
             if (base == null) {
-                log.error(tree.expr.pos(), "foreach.not.applicable.to.type");
+                log.error(tree.expr.pos(),
+                        "foreach.not.applicable.to.type",
+                        exprType,
+                        diags.fragment("type.req.array.or.iterable"));
                 elemtype = types.createErrorType(exprType);
             } else {
                 List<Type> iterableParams = base.allparams();
@@ -970,7 +973,7 @@
                 if (enumSwitch) {
                     Symbol sym = enumConstant(c.pat, seltype);
                     if (sym == null) {
-                        log.error(c.pat.pos(), "enum.const.req");
+                        log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
                     } else if (!labels.add(sym)) {
                         log.error(c.pos(), "duplicate.case.label");
                     }
@@ -1334,7 +1337,6 @@
 
         // The types of the actual method type arguments.
         List<Type> typeargtypes = null;
-        boolean typeargtypesNonRefOK = false;
 
         Name methName = TreeInfo.name(tree.meth);
 
@@ -1434,7 +1436,7 @@
             localEnv.info.varArgs = false;
             Type mtype = attribExpr(tree.meth, localEnv, mpt);
             if (localEnv.info.varArgs)
-                assert mtype.isErroneous() || tree.varargsElement != null;
+                Assert.check(mtype.isErroneous() || tree.varargsElement != null);
 
             // Compute the result type.
             Type restype = mtype.getReturnType();
@@ -1463,21 +1465,7 @@
                               restype.tsym);
             }
 
-            // Special case logic for JSR 292 types.
-            if (rs.allowTransitionalJSR292 &&
-                    tree.meth.getTag() == JCTree.SELECT &&
-                    !typeargtypes.isEmpty()) {
-                JCFieldAccess mfield = (JCFieldAccess) tree.meth;
-                // MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
-                // has type <T>, and T can be a primitive type.
-                if (mfield.sym != null &&
-                        mfield.sym.isPolymorphicSignatureInstance())
-                    typeargtypesNonRefOK = true;
-            }
-
-            if (!(rs.allowTransitionalJSR292 && typeargtypesNonRefOK)) {
-                chk.checkRefTypes(tree.typeargs, typeargtypes);
-            }
+            chk.checkRefTypes(tree.typeargs, typeargtypes);
 
             // Check that value of resulting type is admissible in the
             // current context.  Also, capture the return type
@@ -1667,7 +1655,7 @@
                         typeargtypes,
                         localEnv.info.varArgs);
                 if (localEnv.info.varArgs)
-                    assert tree.constructorType.isErroneous() || tree.varargsElement != null;
+                    Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
             }
 
             if (cdef != null) {
@@ -1727,7 +1715,7 @@
                 Symbol sym = rs.resolveConstructor(
                     tree.pos(), localEnv, clazztype, argtypes,
                     typeargtypes, true, tree.varargsElement != null);
-                assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
+                Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous());
                 tree.constructor = sym;
                 if (tree.constructor.kind > ERRONEOUS) {
                     tree.constructorType =  syms.errType;
@@ -2243,10 +2231,10 @@
 
         // Determine the symbol represented by the selection.
         env.info.varArgs = false;
-        Symbol sym = selectSym(tree, site, env, pt, pkind);
+        Symbol sym = selectSym(tree, sitesym, site, env, pt, pkind);
         if (sym.exists() && !isType(sym) && (pkind & (PCK | TYP)) != 0) {
             site = capture(site);
-            sym = selectSym(tree, site, env, pt, pkind);
+            sym = selectSym(tree, sitesym, site, env, pt, pkind);
         }
         boolean varArgs = env.info.varArgs;
         tree.sym = sym;
@@ -2335,6 +2323,14 @@
          *  @param pkind  The expected kind(s) of the Select expression.
          */
         private Symbol selectSym(JCFieldAccess tree,
+                                     Type site,
+                                     Env<AttrContext> env,
+                                     Type pt,
+                                     int pkind) {
+            return selectSym(tree, site.tsym, site, env, pt, pkind);
+        }
+        private Symbol selectSym(JCFieldAccess tree,
+                                 Symbol location,
                                  Type site,
                                  Env<AttrContext> env,
                                  Type pt,
@@ -2346,12 +2342,12 @@
             case PACKAGE:
                 return rs.access(
                     rs.findIdentInPackage(env, site.tsym, name, pkind),
-                    pos, site, name, true);
+                    pos, location, site, name, true);
             case ARRAY:
             case CLASS:
                 if (pt.tag == METHOD || pt.tag == FORALL) {
                     return rs.resolveQualifiedMethod(
-                        pos, env, site, name, pt.getParameterTypes(), pt.getTypeArguments());
+                        pos, env, location, site, name, pt.getParameterTypes(), pt.getTypeArguments());
                 } else if (name == names._this || name == names._super) {
                     return rs.resolveSelf(pos, env, site.tsym, name);
                 } else if (name == names._class) {
@@ -2368,7 +2364,7 @@
                     // We are seeing a plain identifier as selector.
                     Symbol sym = rs.findIdentInType(env, site, name, pkind);
                     if ((pkind & ERRONEOUS) == 0)
-                        sym = rs.access(sym, pos, site, name, true);
+                        sym = rs.access(sym, pos, location, site, name, true);
                     return sym;
                 }
             case WILDCARD:
@@ -2376,12 +2372,12 @@
             case TYPEVAR:
                 // Normally, site.getUpperBound() shouldn't be null.
                 // It should only happen during memberEnter/attribBase
-                // when determining the super type which *must* be
+                // when determining the super type which *must* beac
                 // done before attributing the type variables.  In
                 // other words, we are seeing this illegal program:
                 // class B<T> extends A<T.foo> {}
                 Symbol sym = (site.getUpperBound() != null)
-                    ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
+                    ? selectSym(tree, location, capture(site.getUpperBound()), env, pt, pkind)
                     : null;
                 if (sym == null) {
                     log.error(pos, "type.var.cant.be.deref");
@@ -2390,7 +2386,7 @@
                     Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
                         rs.new AccessError(env, site, sym) :
                                 sym;
-                    rs.access(sym2, pos, site, name, true);
+                    rs.access(sym2, pos, location, site, name, true);
                     return sym;
                 }
             case ERROR:
@@ -2961,7 +2957,7 @@
                 extending, implementing, List.<JCTree>nil());
 
             ClassSymbol c = (ClassSymbol)a.getUpperBound().tsym;
-            assert (c.flags() & COMPOUND) != 0;
+            Assert.check((c.flags() & COMPOUND) != 0);
             cd.sym = c;
             c.sourcefile = env.toplevel.sourcefile;
 
@@ -2989,10 +2985,6 @@
         result = tree.type = syms.errType;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        result = tree.type = attribType(tree.getUnderlyingType(), env);
-    }
-
     public void visitErroneous(JCErroneous tree) {
         if (tree.errs != null)
             for (JCTree err : tree.errs)
@@ -3097,7 +3089,7 @@
     /** Finish the attribution of a class. */
     private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
         JCClassDecl tree = (JCClassDecl)env.tree;
-        assert c == tree.sym;
+        Assert.check(c == tree.sym);
 
         // Validate annotations
         chk.validateAnnotations(tree.mods.annotations, c);
@@ -3138,12 +3130,9 @@
 
         tree.type = c.type;
 
-        boolean assertsEnabled = false;
-        assert assertsEnabled = true;
-        if (assertsEnabled) {
-            for (List<JCTypeParameter> l = tree.typarams;
-                 l.nonEmpty(); l = l.tail)
-                assert env.info.scope.lookup(l.head.name).scope != null;
+        for (List<JCTypeParameter> l = tree.typarams;
+             l.nonEmpty(); l = l.tail) {
+             Assert.checkNonNull(env.info.scope.lookup(l.head.name).scope);
         }
 
         // Check that a generic class doesn't extend Throwable
@@ -3167,7 +3156,7 @@
                 if (sym == null ||
                     sym.kind != VAR ||
                     ((VarSymbol) sym).getConstValue() == null)
-                    log.error(l.head.pos(), "icls.cant.have.static.decl");
+                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
             }
         }
 
@@ -3184,9 +3173,6 @@
             (c.flags() & ABSTRACT) == 0) {
             checkSerialVersionUID(tree, c);
         }
-
-        // Check type annotations applicability rules
-        validateTypeAnnotations(tree);
     }
         // where
         /** check if a class is a subtype of Serializable, if that is available. */
@@ -3234,35 +3220,6 @@
         return types.capture(type);
     }
 
-    private void validateTypeAnnotations(JCTree tree) {
-        tree.accept(typeAnnotationsValidator);
-    }
-    //where
-    private final JCTree.Visitor typeAnnotationsValidator =
-        new TreeScanner() {
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation) {
-                chk.validateTypeAnnotation((JCTypeAnnotation)tree, false);
-            }
-            super.visitAnnotation(tree);
-        }
-        public void visitTypeParameter(JCTypeParameter tree) {
-            chk.validateTypeAnnotations(tree.annotations, true);
-            // don't call super. skip type annotations
-            scan(tree.bounds);
-        }
-        public void visitMethodDef(JCMethodDecl tree) {
-            // need to check static methods
-            if ((tree.sym.flags() & Flags.STATIC) != 0) {
-                for (JCTypeAnnotation a : tree.receiverAnnotations) {
-                    if (chk.isTypeAnnotation(a, false))
-                        log.error(a.pos(), "annotation.type.not.applicable");
-                }
-            }
-            super.visitMethodDef(tree);
-        }
-    };
-
     // <editor-fold desc="post-attribution visitor">
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -506,43 +506,18 @@
      *  @param a             The type that should be bounded by bs.
      *  @param bs            The bound.
      */
-    private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
+    private boolean checkExtends(Type a, TypeVar bs) {
          if (a.isUnbound()) {
-             return;
+             return true;
          } else if (a.tag != WILDCARD) {
              a = types.upperBound(a);
-             for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
-                 if (!types.isSubtype(a, l.head)) {
-                     log.error(pos, "not.within.bounds", a);
-                     return;
-                 }
-             }
+             return types.isSubtype(a, bs.bound);
          } else if (a.isExtendsBound()) {
-             if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
-                 log.error(pos, "not.within.bounds", a);
+             return types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings);
          } else if (a.isSuperBound()) {
-             if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
-                 log.error(pos, "not.within.bounds", a);
+             return !types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound());
          }
-     }
-
-    /** Check that a type is within some bounds.
-     *
-     *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
-     *  type argument.
-     *  @param pos           Position to be used for error reporting.
-     *  @param a             The type that should be bounded by bs.
-     *  @param bs            The bound.
-     */
-    private void checkCapture(JCTypeApply tree) {
-        List<JCExpression> args = tree.getTypeArguments();
-        for (Type arg : types.capture(tree.type).getTypeArguments()) {
-            if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) {
-                log.error(args.head.pos, "not.within.bounds", args.head.type);
-                break;
-            }
-            args = args.tail;
-        }
+         return true;
      }
 
     /** Check that type is different from 'void'.
@@ -775,6 +750,79 @@
         }
     }
 
+    /**
+     * Check that type 't' is a valid instantiation of a generic class
+     * (see JLS 4.5)
+     *
+     * @param t class type to be checked
+     * @return true if 't' is well-formed
+     */
+    public boolean checkValidGenericType(Type t) {
+        return firstIncompatibleTypeArg(t) == null;
+    }
+    //WHERE
+        private Type firstIncompatibleTypeArg(Type type) {
+            List<Type> formals = type.tsym.type.allparams();
+            List<Type> actuals = type.allparams();
+            List<Type> args = type.getTypeArguments();
+            List<Type> forms = type.tsym.type.getTypeArguments();
+            ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
+
+            // For matching pairs of actual argument types `a' and
+            // formal type parameters with declared bound `b' ...
+            while (args.nonEmpty() && forms.nonEmpty()) {
+                // exact type arguments needs to know their
+                // bounds (for upper and lower bound
+                // calculations).  So we create new TypeVars with
+                // bounds substed with actuals.
+                tvars_buf.append(types.substBound(((TypeVar)forms.head),
+                                                  formals,
+                                                  actuals));
+                args = args.tail;
+                forms = forms.tail;
+            }
+
+            args = type.getTypeArguments();
+            List<Type> tvars_cap = types.substBounds(formals,
+                                      formals,
+                                      types.capture(type).allparams());
+            while (args.nonEmpty() && tvars_cap.nonEmpty()) {
+                // Let the actual arguments know their bound
+                args.head.withTypeVar((TypeVar)tvars_cap.head);
+                args = args.tail;
+                tvars_cap = tvars_cap.tail;
+            }
+
+            args = type.getTypeArguments();
+            List<Type> tvars = tvars_buf.toList();
+
+            while (args.nonEmpty() && tvars.nonEmpty()) {
+                Type actual = types.subst(args.head,
+                    type.tsym.type.getTypeArguments(),
+                    tvars_buf.toList());
+                if (!checkExtends(actual, (TypeVar)tvars.head) &&
+                        !tvars.head.getUpperBound().isErroneous()) {
+                    return args.head;
+                }
+                args = args.tail;
+                tvars = tvars.tail;
+            }
+
+            args = type.getTypeArguments();
+            tvars = tvars_buf.toList();
+
+            for (Type arg : types.capture(type).getTypeArguments()) {
+                if (arg.tag == TYPEVAR &&
+                        arg.getUpperBound().isErroneous() &&
+                        !tvars.head.getUpperBound().isErroneous()) {
+                    return args.head;
+                }
+                tvars = tvars.tail;
+            }
+
+            return null;
+        }
+
     /** Check that given modifiers are legal for given symbol and
      *  return modifiers together with any implicit modififiers for that symbol.
      *  Warning: we can't use flags() here since this method
@@ -987,11 +1035,20 @@
         @Override
         public void visitTypeApply(JCTypeApply tree) {
             if (tree.type.tag == CLASS) {
-                List<Type> formals = tree.type.tsym.type.allparams();
-                List<Type> actuals = tree.type.allparams();
                 List<JCExpression> args = tree.arguments;
                 List<Type> forms = tree.type.tsym.type.getTypeArguments();
-                ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
+
+                Type incompatibleArg = firstIncompatibleTypeArg(tree.type);
+                if (incompatibleArg != null) {
+                    for (JCTree arg : tree.arguments) {
+                        if (arg.type == incompatibleArg) {
+                            log.error(arg, "not.within.bounds", incompatibleArg, forms.head);
+                        }
+                        forms = forms.tail;
+                     }
+                 }
+
+                forms = tree.type.tsym.type.getTypeArguments();
 
                 boolean is_java_lang_Class = tree.type.tsym.flatName() == names.java_lang_Class;
 
@@ -1001,46 +1058,10 @@
                     validateTree(args.head,
                             !(isOuter && is_java_lang_Class),
                             false);
-
-                    // exact type arguments needs to know their
-                    // bounds (for upper and lower bound
-                    // calculations).  So we create new TypeVars with
-                    // bounds substed with actuals.
-                    tvars_buf.append(types.substBound(((TypeVar)forms.head),
-                                                      formals,
-                                                      actuals));
-
                     args = args.tail;
                     forms = forms.tail;
                 }
 
-                args = tree.arguments;
-                List<Type> tvars_cap = types.substBounds(formals,
-                                          formals,
-                                          types.capture(tree.type).allparams());
-                while (args.nonEmpty() && tvars_cap.nonEmpty()) {
-                    // Let the actual arguments know their bound
-                    args.head.type.withTypeVar((TypeVar)tvars_cap.head);
-                    args = args.tail;
-                    tvars_cap = tvars_cap.tail;
-                }
-
-                args = tree.arguments;
-                List<Type> tvars = tvars_buf.toList();
-
-                while (args.nonEmpty() && tvars.nonEmpty()) {
-                    Type actual = types.subst(args.head.type,
-                        tree.type.tsym.type.getTypeArguments(),
-                        tvars_buf.toList());
-                    checkExtends(args.head.pos(),
-                                 actual,
-                                 (TypeVar)tvars.head);
-                    args = args.tail;
-                    tvars = tvars.tail;
-                }
-
-                checkCapture(tree);
-
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
                 if (tree.type.getEnclosingType().isRaw())
@@ -1086,11 +1107,6 @@
             }
         }
 
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            tree.underlyingType.accept(this);
-        }
-
         /** Default visitor method: do nothing.
          */
         @Override
@@ -2239,14 +2255,6 @@
             validateAnnotation(a, s);
     }
 
-    /** Check the type annotations
-     */
-    public void validateTypeAnnotations(List<JCTypeAnnotation> annotations, boolean isTypeParameter) {
-        if (skipAnnotations) return;
-        for (JCTypeAnnotation a : annotations)
-            validateTypeAnnotation(a, isTypeParameter);
-    }
-
     /** Check an annotation of a symbol.
      */
     public void validateAnnotation(JCAnnotation a, Symbol s) {
@@ -2261,15 +2269,6 @@
         }
     }
 
-    public void validateTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        if (a.type == null)
-            throw new AssertionError("annotation tree hasn't been attributed yet: " + a);
-        validateAnnotationTree(a);
-
-        if (!isTypeAnnotation(a, isTypeParameter))
-            log.error(a.pos(), "annotation.type.not.applicable");
-    }
-
     /** Is s a method symbol that overrides a method in a superclass? */
     boolean isOverrider(Symbol s) {
         if (s.kind != MTH || s.isStatic())
@@ -2288,25 +2287,6 @@
         return false;
     }
 
-    /** Is the annotation applicable to type annotations */
-    boolean isTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        Attribute.Compound atTarget =
-            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
-        if (atTarget == null) return true;
-        Attribute atValue = atTarget.member(names.value);
-        if (!(atValue instanceof Attribute.Array)) return true; // error recovery
-        Attribute.Array arr = (Attribute.Array) atValue;
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) return true; // recovery
-            Attribute.Enum e = (Attribute.Enum) app;
-            if (!isTypeParameter && e.value.name == names.TYPE_USE)
-                return true;
-            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
-                return true;
-        }
-        return false;
-    }
-
     /** Is the annotation applicable to the symbol? */
     boolean annotationApplicable(JCAnnotation a, Symbol s) {
         Attribute.Compound atTarget =
@@ -2438,7 +2418,7 @@
      */
     void checkNonCyclicElements(JCClassDecl tree) {
         if ((tree.sym.flags_field & ANNOTATION) == 0) return;
-        assert (tree.sym.flags_field & LOCKED) == 0;
+        Assert.check((tree.sym.flags_field & LOCKED) == 0);
         try {
             tree.sym.flags_field |= LOCKED;
             for (JCTree def : tree.defs) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,7 +37,6 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -709,7 +708,7 @@
 
         lint = lint.augment(tree.sym.attributes_field);
 
-        assert pendingExits.isEmpty();
+        Assert.check(pendingExits.isEmpty());
 
         try {
             boolean isInitialConstructor =
@@ -747,7 +746,7 @@
                 PendingExit exit = exits.head;
                 exits = exits.tail;
                 if (exit.thrown == null) {
-                    assert exit.tree.getTag() == JCTree.RETURN;
+                    Assert.check(exit.tree.getTag() == JCTree.RETURN);
                     if (isInitialConstructor) {
                         inits = exit.inits;
                         for (int i = firstadr; i < nextadr; i++)
@@ -1350,11 +1349,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        // annotations don't get scanned
-        tree.underlyingType.accept(this);
-    }
-
     public void visitIdent(JCIdent tree) {
         if (tree.sym.kind == VAR) {
             checkInit(tree.pos(), (VarSymbol)tree.sym);
@@ -1373,7 +1367,6 @@
         if (!tree.type.isErroneous()
             && lint.isEnabled(Lint.LintCategory.CAST)
             && types.isSameType(tree.expr.type, tree.clazz.type)
-            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))
             && !is292targetTypeCast(tree)) {
             log.warning(Lint.LintCategory.CAST,
                     tree.pos(), "redundant.cast", tree.expr.type);
@@ -1382,8 +1375,9 @@
     //where
         private boolean is292targetTypeCast(JCTypeCast tree) {
             boolean is292targetTypeCast = false;
-            if (tree.expr.getTag() == JCTree.APPLY) {
-                JCMethodInvocation apply = (JCMethodInvocation)tree.expr;
+            JCExpression expr = TreeInfo.skipParens(tree.expr);
+            if (expr.getTag() == JCTree.APPLY) {
+                JCMethodInvocation apply = (JCMethodInvocation)expr;
                 Symbol sym = TreeInfo.symbol(apply.meth);
                 is292targetTypeCast = sym != null &&
                     sym.kind == MTH &&
@@ -1397,23 +1391,6 @@
     }
 
 /**************************************************************************
- * utility methods for ignoring type-annotated casts lint checking
- *************************************************************************/
-    private static final boolean ignoreAnnotatedCasts = true;
-    private static class AnnotationFinder extends TreeScanner {
-        public boolean foundTypeAnno = false;
-        public void visitAnnotation(JCAnnotation tree) {
-            foundTypeAnno = foundTypeAnno || (tree instanceof JCTypeAnnotation);
-        }
-    }
-
-    private boolean containsTypeAnnotation(JCTree e) {
-        AnnotationFinder finder = new AnnotationFinder();
-        finder.scan(e);
-        return finder.foundTypeAnno;
-    }
-
-/**************************************************************************
  * main method
  *************************************************************************/
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Feb 04 16:29:41 2011 -0800
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCTypeCast;
+import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.code.*;
@@ -204,19 +205,20 @@
      *  Throw a NoInstanceException if this not possible.
      */
     void maximizeInst(UndetVar that, Warner warn) throws NoInstanceException {
+        List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
         if (that.inst == null) {
-            if (that.hibounds.isEmpty())
+            if (hibounds.isEmpty())
                 that.inst = syms.objectType;
-            else if (that.hibounds.tail.isEmpty())
-                that.inst = that.hibounds.head;
+            else if (hibounds.tail.isEmpty())
+                that.inst = hibounds.head;
             else
-                that.inst = types.glb(that.hibounds);
+                that.inst = types.glb(hibounds);
         }
         if (that.inst == null ||
             that.inst.isErroneous())
             throw ambiguousNoInstanceException
                 .setMessage("no.unique.maximal.instance.exists",
-                            that.qtype, that.hibounds);
+                            that.qtype, hibounds);
     }
     //where
         private boolean isSubClass(Type t, final List<Type> ts) {
@@ -240,37 +242,46 @@
             return true;
         }
 
+    private Filter<Type> errorFilter = new Filter<Type>() {
+        @Override
+        public boolean accepts(Type t) {
+            return !t.isErroneous();
+        }
+    };
+
     /** Instantiate undetermined type variable to the lub of all its lower bounds.
      *  Throw a NoInstanceException if this not possible.
      */
     void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException {
+        List<Type> lobounds = Type.filter(that.lobounds, errorFilter);
         if (that.inst == null) {
-            if (that.lobounds.isEmpty())
+            if (lobounds.isEmpty())
                 that.inst = syms.botType;
-            else if (that.lobounds.tail.isEmpty())
-                that.inst = that.lobounds.head.isPrimitive() ? syms.errType : that.lobounds.head;
+            else if (lobounds.tail.isEmpty())
+                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
             else {
-                that.inst = types.lub(that.lobounds);
+                that.inst = types.lub(lobounds);
             }
             if (that.inst == null || that.inst.tag == ERROR)
                     throw ambiguousNoInstanceException
                         .setMessage("no.unique.minimal.instance.exists",
-                                    that.qtype, that.lobounds);
+                                    that.qtype, lobounds);
             // VGJ: sort of inlined maximizeInst() below.  Adding
             // bounds can cause lobounds that are above hibounds.
-            if (that.hibounds.isEmpty())
+            List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
+            if (hibounds.isEmpty())
                 return;
             Type hb = null;
-            if (that.hibounds.tail.isEmpty())
-                hb = that.hibounds.head;
-            else for (List<Type> bs = that.hibounds;
+            if (hibounds.tail.isEmpty())
+                hb = hibounds.head;
+            else for (List<Type> bs = hibounds;
                       bs.nonEmpty() && hb == null;
                       bs = bs.tail) {
-                if (isSubClass(bs.head, that.hibounds))
+                if (isSubClass(bs.head, hibounds))
                     hb = types.fromUnknownFun.apply(bs.head);
             }
             if (hb == null ||
-                !types.isSubtypeUnchecked(hb, that.hibounds, warn) ||
+                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
                 !types.isSubtypeUnchecked(that.inst, hb, warn))
                 throw ambiguousNoInstanceException;
         }
@@ -396,7 +407,9 @@
 
         // for varargs arguments as well
         if (useVarargs) {
-            Type elemType = types.elemtype(varargsFormal);
+            //note: if applicability check is triggered by most specific test,
+            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
+            Type elemType = types.elemtypeOrType(varargsFormal);
             Type elemUndet = types.subst(elemType, tvars, undetvars);
             while (actuals.nonEmpty()) {
                 Type actual = actuals.head.baseType();
@@ -527,7 +540,8 @@
         for (List<Type> tvs = tvars, args = arguments;
              tvs.nonEmpty();
              tvs = tvs.tail, args = args.tail) {
-            if (args.head instanceof UndetVar) continue;
+            if (args.head instanceof UndetVar ||
+                    tvars.head.getUpperBound().isErroneous()) continue;
             List<Type> bounds = types.subst(types.getBounds((TypeVar)tvs.head), tvars, arguments);
             if (!types.isSubtypeUnchecked(args.head, bounds, warn))
                 throw invalidInstanceException
@@ -538,43 +552,39 @@
 
     /**
      * Compute a synthetic method type corresponding to the requested polymorphic
-     * method signature. If no explicit return type is supplied, a provisional
-     * return type is computed (just Object in case of non-transitional 292)
+     * method signature. The target return type is computed from the immediately
+     * enclosing scope surrounding the polymorphic-signature call.
      */
     Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, Type site,
                                             Name name,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
-                                            List<Type> argtypes,
-                                            List<Type> typeargtypes) {
+                                            List<Type> argtypes) {
         final Type restype;
-        if (rs.allowTransitionalJSR292 && typeargtypes.nonEmpty()) {
-            restype = typeargtypes.head;
-        } else {
-            //The return type for a polymorphic signature call is computed from
-            //the enclosing tree E, as follows: if E is a cast, then use the
-            //target type of the cast expression as a return type; if E is an
-            //expression statement, the return type is 'void' - otherwise the
-            //return type is simply 'Object'. A correctness check ensures that
-            //env.next refers to the lexically enclosing environment in which
-            //the polymorphic signature call environment is nested.
+
+        //The return type for a polymorphic signature call is computed from
+        //the enclosing tree E, as follows: if E is a cast, then use the
+        //target type of the cast expression as a return type; if E is an
+        //expression statement, the return type is 'void' - otherwise the
+        //return type is simply 'Object'. A correctness check ensures that
+        //env.next refers to the lexically enclosing environment in which
+        //the polymorphic signature call environment is nested.
 
-            switch (env.next.tree.getTag()) {
-                case JCTree.TYPECAST:
-                    JCTypeCast castTree = (JCTypeCast)env.next.tree;
-                    restype = (castTree.expr == env.tree) ?
-                        castTree.clazz.type :
-                        syms.objectType;
-                    break;
-                case JCTree.EXEC:
-                    JCTree.JCExpressionStatement execTree =
-                            (JCTree.JCExpressionStatement)env.next.tree;
-                    restype = (execTree.expr == env.tree) ?
-                        syms.voidType :
-                        syms.objectType;
-                    break;
-                default:
-                    restype = syms.objectType;
-            }
+        switch (env.next.tree.getTag()) {
+            case JCTree.TYPECAST:
+                JCTypeCast castTree = (JCTypeCast)env.next.tree;
+                restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
+                    castTree.clazz.type :
+                    syms.objectType;
+                break;
+            case JCTree.EXEC:
+                JCTree.JCExpressionStatement execTree =
+                        (JCTree.JCExpressionStatement)env.next.tree;
+                restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
+                    syms.voidType :
+                    syms.objectType;
+                break;
+            default:
+                restype = syms.objectType;
         }
 
         List<Type> paramtypes = Type.map(argtypes, implicitArgType);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1057,7 +1057,7 @@
             }
             // Otherwise replace the variable by its proxy.
             sym = proxies.lookup(proxyName(sym.name)).sym;
-            assert sym != null && (sym.flags_field & FINAL) != 0;
+            Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
             tree = make.at(tree.pos).Ident(sym);
         }
         JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
@@ -1208,7 +1208,7 @@
      */
     void makeAccessible(Symbol sym) {
         JCClassDecl cdef = classDef(sym.owner.enclClass());
-        assert cdef != null : "class def not found: " + sym + " in " + sym.owner;
+        if (cdef == null) Assert.error("class def not found: " + sym + " in " + sym.owner);
         if (sym.name == names.init) {
             cdef.defs = cdef.defs.prepend(
                 accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
@@ -1458,7 +1458,7 @@
             expr = make.Ident(var.sym).setType(resource.type);
             stats.add(var);
         } else {
-            assert resource instanceof JCExpression;
+            Assert.check(resource instanceof JCExpression);
             VarSymbol syntheticTwrVar =
             new VarSymbol(SYNTHETIC | FINAL,
                           makeSyntheticName(names.fromString("twrVar" +
@@ -1552,7 +1552,7 @@
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
             log.error(pos, "no.encl.instance.of.type.in.scope", c);
-            assert false;
+            Assert.error();
             return makeNull();
         }
         VarSymbol ot = ots.head;
@@ -1565,14 +1565,14 @@
                     log.error(pos,
                               "no.encl.instance.of.type.in.scope",
                               c);
-                    assert false; // should have been caught in Attr
+                    Assert.error(); // should have been caught in Attr
                     return tree;
                 }
                 ot = ots.head;
             } while (ot.owner != otc);
             if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
                 chk.earlyRefError(pos, c);
-                assert false; // should have been caught in Attr
+                Assert.error(); // should have been caught in Attr
                 return makeNull();
             }
             tree = access(make.at(pos).Select(tree, ot));
@@ -1610,7 +1610,7 @@
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
             log.error(pos, "no.encl.instance.of.type.in.scope", c);
-            assert false;
+            Assert.error();
             return makeNull();
         }
         VarSymbol ot = ots.head;
@@ -1623,7 +1623,7 @@
                     log.error(pos,
                         "no.encl.instance.of.type.in.scope",
                         c);
-                    assert false;
+                    Assert.error();
                     return tree;
                 }
                 ot = ots.head;
@@ -1640,9 +1640,9 @@
     JCStatement initField(int pos, Name name) {
         Scope.Entry e = proxies.lookup(name);
         Symbol rhs = e.sym;
-        assert rhs.owner.kind == MTH;
+        Assert.check(rhs.owner.kind == MTH);
         Symbol lhs = e.next().sym;
-        assert rhs.owner.owner == lhs.owner;
+        Assert.check(rhs.owner.owner == lhs.owner);
         make.at(pos);
         return
             make.Exec(
@@ -1655,9 +1655,9 @@
      */
     JCStatement initOuterThis(int pos) {
         VarSymbol rhs = outerThisStack.head;
-        assert rhs.owner.kind == MTH;
+        Assert.check(rhs.owner.kind == MTH);
         VarSymbol lhs = outerThisStack.tail.head;
-        assert rhs.owner.owner == lhs.owner;
+        Assert.check(rhs.owner.owner == lhs.owner);
         make.at(pos);
         return
             make.Exec(
@@ -1856,7 +1856,7 @@
     // where
         /** Create an attributed tree of the form left.name(). */
         private JCMethodInvocation makeCall(JCExpression left, Name name, List<JCExpression> args) {
-            assert left.type != null;
+            Assert.checkNonNull(left.type);
             Symbol funcsym = lookupMethod(make_pos, name, left.type,
                                           TreeInfo.types(args));
             return make.App(make.Select(left, funcsym), args);
@@ -2399,7 +2399,7 @@
                          names.valueOf,
                          tree.sym.type,
                          List.of(syms.stringType));
-        assert (valueOfSym.flags() & STATIC) != 0;
+        Assert.check((valueOfSym.flags() & STATIC) != 0);
         VarSymbol nameArgSym = valueOfSym.params.head;
         JCIdent nameVal = make.Ident(nameArgSym);
         JCStatement enum_ValueOf =
@@ -2585,11 +2585,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree.underlyingType;
-    }
-
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz);
         if (tree.type.isPrimitive() != tree.expr.type.isPrimitive())
@@ -3421,7 +3416,7 @@
                 if (expression != null) { // expression for a "default" case is null
                     String labelExpr = (String) expression.type.constValue();
                     Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
-                    assert mapping == null;
+                    Assert.checkNull(mapping);
                     int hashCode = labelExpr.hashCode();
 
                     Set<String> stringSet = hashToString.get(hashCode);
@@ -3431,7 +3426,7 @@
                         hashToString.put(hashCode, stringSet);
                     } else {
                         boolean added = stringSet.add(labelExpr);
-                        assert added;
+                        Assert.check(added);
                     }
                 }
                 casePosition++;
@@ -3483,7 +3478,7 @@
             for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
                 int hashCode = entry.getKey();
                 Set<String> stringsWithHashCode = entry.getValue();
-                assert stringsWithHashCode.size() >= 1;
+                Assert.check(stringsWithHashCode.size() >= 1);
 
                 JCStatement elsepart = null;
                 for(String caseLabel : stringsWithHashCode ) {
@@ -3697,8 +3692,7 @@
                                          cdef.type,
                                          List.<Type>nil());
 
-        assert(ordinalSym != null);
-        assert(ordinalSym instanceof MethodSymbol);
+        Assert.check(ordinalSym instanceof MethodSymbol);
 
         JCStatement ret = make.Return(make.Ident(ordinalSymbol));
         cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
@@ -3714,8 +3708,7 @@
                                    cdef.type,
                                    List.<Type>nil());
 
-        assert(nameSym != null);
-        assert(nameSym instanceof MethodSymbol);
+        Assert.check(nameSym instanceof MethodSymbol);
 
         JCStatement ret = make.Return(make.Ident(nameSymbol));
 
@@ -3766,8 +3759,7 @@
                                    cdef.type,
                                    List.of(cdef.sym.type));
 
-        assert(compareToSym != null);
-        assert(compareToSym instanceof MethodSymbol);
+        Assert.check(compareToSym instanceof MethodSymbol);
 
         JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -581,8 +581,7 @@
         JCVariableDecl lastParam = null;
         for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
             JCVariableDecl param = lastParam = l.head;
-            assert param.sym != null;
-            params.append(param.sym);
+            params.append(Assert.checkNonNull(param.sym));
         }
         m.params = params.toList();
 
@@ -699,7 +698,7 @@
  *********************************************************************/
 
     Type attribImportType(JCTree tree, Env<AttrContext> env) {
-        assert completionEnabled;
+        Assert.check(completionEnabled);
         try {
             // To prevent deep recursion, suppress completion of some
             // types.
@@ -725,7 +724,7 @@
                     return "annotate " + annotations + " onto " + s + " in " + s.owner;
                 }
                 public void enterAnnotation() {
-                    assert s.kind == PCK || s.attributes_field == null;
+                    Assert.check(s.kind == PCK || s.attributes_field == null);
                     JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
                     try {
                         if (s.attributes_field != null &&
@@ -782,8 +781,8 @@
                     types.isSameType(c.type, syms.polymorphicSignatureType)) {
                 if (!target.hasMethodHandles()) {
                     // Somebody is compiling JDK7 source code to a JDK6 target.
-                    // Make it a strict warning, since it is unlikely but important.
-                    log.strictWarning(env.tree.pos(),
+                    // Make it an error, since it is unlikely but important.
+                    log.error(env.tree.pos(),
                             "wrong.target.for.polymorphic.signature.definition",
                             target.name);
                 }
@@ -836,7 +835,7 @@
         // Suppress some (recursive) MemberEnter invocations
         if (!completionEnabled) {
             // Re-install same completer for next time around and return.
-            assert (sym.flags() & Flags.COMPOUND) == 0;
+            Assert.check((sym.flags() & Flags.COMPOUND) == 0);
             sym.completer = this;
             return;
         }
@@ -928,10 +927,6 @@
             if (hasDeprecatedAnnotation(tree.mods.annotations))
                 c.flags_field |= DEPRECATED;
             annotateLater(tree.mods.annotations, baseEnv, c);
-            // class type parameters use baseEnv but everything uses env
-            for (JCTypeParameter tp : tree.typarams)
-                tp.accept(new TypeAnnotate(baseEnv));
-            tree.accept(new TypeAnnotate(env));
 
             chk.checkNonCyclicDecl(tree);
 
@@ -989,7 +984,7 @@
                 c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
                 reader.packageExists(c.fullname))
                 {
-                    log.error(tree.pos, "clash.with.pkg.of.same.name", c);
+                    log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
                 }
 
         } catch (CompletionFailure ex) {
@@ -1014,86 +1009,6 @@
         }
     }
 
-    // A sub-phase that "compiles" annotations in annotated types.
-    private class TypeAnnotate extends TreeScanner {
-        private Env<AttrContext> env;
-        public TypeAnnotate(Env<AttrContext> env) { this.env = env; }
-
-        private void enterTypeAnnotations(List<JCTypeAnnotation> annotations) {
-            Set<TypeSymbol> annotated = new HashSet<TypeSymbol>();
-            if (!skipAnnotations)
-                for (List<JCTypeAnnotation> al = annotations; al.nonEmpty(); al = al.tail) {
-                    JCTypeAnnotation a = al.head;
-                    Attribute.Compound c = annotate.enterAnnotation(a,
-                            syms.annotationType,
-                            env);
-                    if (c == null) continue;
-                    Attribute.TypeCompound tc = new Attribute.TypeCompound(c.type, c.values, a.annotation_position);
-                    a.attribute_field = tc;
-                    // Note: @Deprecated has no effect on local variables and parameters
-                    if (!annotated.add(a.type.tsym))
-                        log.error(a.pos, "duplicate.annotation");
-                }
-        }
-
-        // each class (including enclosed inner classes) should be visited
-        // separately through MemberEnter.complete(Symbol)
-        // this flag is used to prevent from visiting inner classes.
-        private boolean isEnclosingClass = false;
-        @Override
-        public void visitClassDef(final JCClassDecl tree) {
-            if (isEnclosingClass)
-                return;
-            isEnclosingClass = true;
-            scan(tree.mods);
-            // type parameter need to be visited with a separate env
-            // scan(tree.typarams);
-            scan(tree.extending);
-            scan(tree.implementing);
-            scan(tree.defs);
-        }
-
-        private void annotate(final JCTree tree, final List<JCTypeAnnotation> annotations) {
-            annotate.later(new Annotate.Annotator() {
-                public String toString() {
-                    return "annotate " + annotations + " onto " + tree;
-                }
-                public void enterAnnotation() {
-                    JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-                    try {
-                        enterTypeAnnotations(annotations);
-                    } finally {
-                        log.useSource(prev);
-                    }
-                }
-            });
-        }
-
-        @Override
-        public void visitAnnotatedType(final JCAnnotatedType tree) {
-            annotate(tree, tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-        @Override
-        public void visitTypeParameter(final JCTypeParameter tree) {
-            annotate(tree, tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-        @Override
-        public void visitNewArray(final JCNewArray tree) {
-            annotate(tree, tree.annotations);
-            for (List<JCTypeAnnotation> dimAnnos : tree.dimAnnotations)
-                annotate(tree, dimAnnos);
-            super.visitNewArray(tree);
-        }
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            annotate(tree, tree.receiverAnnotations);
-            super.visitMethodDef(tree);
-        }
-    }
-
-
     private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
         Scope baseScope = new Scope.ClassScope(tree.sym, scopeCounter);
         //import already entered local classes into base scope
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -70,8 +70,6 @@
     public final boolean boxingEnabled; // = source.allowBoxing();
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
-    public final boolean allowInvokeDynamic;
-    public final boolean allowTransitionalJSR292;
     private final boolean debugResolve;
 
     Scope polymorphicSignatureScope;
@@ -111,13 +109,8 @@
         varargsEnabled = source.allowVarargs();
         Options options = Options.instance(context);
         debugResolve = options.isSet("debugresolve");
-        allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292");
         Target target = Target.instance(context);
-        allowMethodHandles = allowTransitionalJSR292 ||
-                target.hasMethodHandles();
-        allowInvokeDynamic = (allowTransitionalJSR292 ||
-                target.hasInvokedynamic()) &&
-                options.isSet("invokedynamic");
+        allowMethodHandles = target.hasMethodHandles();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
 
         inapplicableMethodException = new InapplicableMethodException(diags);
@@ -336,8 +329,7 @@
                         boolean useVarargs,
                         Warner warn)
         throws Infer.InferenceException {
-        boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) ||
-                                        isTransitionalDynamicCallSite(site, m);
+        boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
         if (useVarargs && (m.flags() & VARARGS) == 0)
             throw inapplicableMethodException.setMessage(null);
         Type mt = types.memberType(site, m);
@@ -346,10 +338,7 @@
         // need to inferred.
         List<Type> tvars = env.info.tvars;
         if (typeargtypes == null) typeargtypes = List.nil();
-        if (allowTransitionalJSR292 && polymorphicSignature && typeargtypes.nonEmpty()) {
-            //transitional 292 call sites might have wrong number of targs
-        }
-        else if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
+        if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
             // This is not a polymorphic method, but typeargs are supplied
             // which is fine, see JLS3 15.12.2.1
         } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) {
@@ -387,7 +376,7 @@
 
         if (instNeeded)
             return polymorphicSignature ?
-                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes, typeargtypes) :
+                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
                 infer.instantiateMethod(env,
                                     tvars,
                                     (MethodType)mt,
@@ -402,14 +391,6 @@
         return mt;
     }
 
-    boolean isTransitionalDynamicCallSite(Type site, Symbol sym) {
-        return allowTransitionalJSR292 &&  // old logic that doesn't use annotations
-                !sym.isPolymorphicSignatureInstance() &&
-                ((allowMethodHandles && site == syms.methodHandleType && // invokeExact, invokeGeneric, invoke
-                    (sym.name == names.invoke && sym.isPolymorphicSignatureGeneric())) ||
-                (site == syms.invokeDynamicType && allowInvokeDynamic)); // InvokeDynamic.XYZ
-    }
-
     /** Same but returns null instead throwing a NoInstanceException
      */
     Type instantiate(Env<AttrContext> env,
@@ -679,7 +660,7 @@
                       boolean operator) {
         if (sym.kind == ERR) return bestSoFar;
         if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
-        assert sym.kind < AMBIGUOUS;
+        Assert.check(sym.kind < AMBIGUOUS);
         try {
             rawInstantiate(env, site, sym, argtypes, typeargtypes,
                                allowBoxing, useVarargs, Warner.noWarnings);
@@ -1255,6 +1236,7 @@
      */
     Symbol access(Symbol sym,
                   DiagnosticPosition pos,
+                  Symbol location,
                   Type site,
                   Name name,
                   boolean qualified,
@@ -1265,23 +1247,46 @@
             if (!site.isErroneous() &&
                 !Type.isErroneous(argtypes) &&
                 (typeargtypes==null || !Type.isErroneous(typeargtypes)))
-                logResolveError(errSym, pos, site, name, argtypes, typeargtypes);
+                logResolveError(errSym, pos, location, site, name, argtypes, typeargtypes);
             sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol);
         }
         return sym;
     }
 
-    /** Same as above, but without type arguments and arguments.
+    /** Same as original access(), but without location.
+     */
+    Symbol access(Symbol sym,
+                  DiagnosticPosition pos,
+                  Type site,
+                  Name name,
+                  boolean qualified,
+                  List<Type> argtypes,
+                  List<Type> typeargtypes) {
+        return access(sym, pos, site.tsym, site, name, qualified, argtypes, typeargtypes);
+    }
+
+    /** Same as original access(), but without type arguments and arguments.
+     */
+    Symbol access(Symbol sym,
+                  DiagnosticPosition pos,
+                  Symbol location,
+                  Type site,
+                  Name name,
+                  boolean qualified) {
+        if (sym.kind >= AMBIGUOUS)
+            return access(sym, pos, location, site, name, qualified, List.<Type>nil(), null);
+        else
+            return sym;
+    }
+
+    /** Same as original access(), but without location, type arguments and arguments.
      */
     Symbol access(Symbol sym,
                   DiagnosticPosition pos,
                   Type site,
                   Name name,
                   boolean qualified) {
-        if (sym.kind >= AMBIGUOUS)
-            return access(sym, pos, site, name, qualified, List.<Type>nil(), null);
-        else
-            return sym;
+        return access(sym, pos, site.tsym, site, name, qualified);
     }
 
     /** Check that sym is not an abstract method.
@@ -1399,6 +1404,11 @@
     Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
                                   Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
+        return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes);
+    }
+    Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
+                                  Symbol location, Type site, Name name, List<Type> argtypes,
+                                  List<Type> typeargtypes) {
         Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
@@ -1412,26 +1422,25 @@
             steps = steps.tail;
         }
         if (sym.kind >= AMBIGUOUS) {
-            if (site.tsym.isPolymorphicSignatureGeneric() ||
-                    isTransitionalDynamicCallSite(site, sym)) {
+            if (site.tsym.isPolymorphicSignatureGeneric()) {
                 //polymorphic receiver - synthesize new method symbol
                 env.info.varArgs = false;
                 sym = findPolymorphicSignatureInstance(env,
-                        site, name, null, argtypes, typeargtypes);
+                        site, name, null, argtypes);
             }
             else {
                 //if nothing is found return the 'first' error
                 MethodResolutionPhase errPhase =
                         firstErroneousResolutionPhase();
                 sym = access(methodResolutionCache.get(errPhase),
-                        pos, site, name, true, argtypes, typeargtypes);
+                        pos, location, site, name, true, argtypes, typeargtypes);
                 env.info.varArgs = errPhase.isVarargsRequired;
             }
         } else if (allowMethodHandles && sym.isPolymorphicSignatureGeneric()) {
             //non-instantiated polymorphic signature - synthesize new method symbol
             env.info.varArgs = false;
             sym = findPolymorphicSignatureInstance(env,
-                    site, name, (MethodSymbol)sym, argtypes, typeargtypes);
+                    site, name, (MethodSymbol)sym, argtypes);
         }
         return sym;
     }
@@ -1449,15 +1458,9 @@
     Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
                                             Name name,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
-                                            List<Type> argtypes,
-                                            List<Type> typeargtypes) {
-        if (typeargtypes.nonEmpty() && (site.tsym.isPolymorphicSignatureGeneric() ||
-                (spMethod != null && spMethod.isPolymorphicSignatureGeneric()))) {
-            log.warning(env.tree.pos(), "type.parameter.on.polymorphic.signature");
-        }
-
+                                            List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
-                site, name, spMethod, argtypes, typeargtypes);
+                site, name, spMethod, argtypes);
         long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
                     (spMethod != null ?
                         spMethod.flags() & Flags.AccessFlags :
@@ -1497,7 +1500,7 @@
                                         List<Type> argtypes,
                                         List<Type> typeargtypes) {
         Symbol sym = resolveQualifiedMethod(
-            pos, env, site, name, argtypes, typeargtypes);
+            pos, env, site.tsym, site, name, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
                  diags.fragment("fatal.err.cant.locate.meth",
@@ -1572,11 +1575,13 @@
                 null;
             Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
                 @Override
-                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
+                        Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
                     String key = details == null ?
                         "cant.apply.diamond" :
                         "cant.apply.diamond.1";
-                    return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details);
+                    return diags.create(dkind, log.currentSource(), pos, key,
+                            diags.fragment("diamond", site.tsym), details);
                 }
             };
             MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
@@ -1755,17 +1760,18 @@
 
     public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) {
         AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym);
-        logResolveError(error, tree.pos(), type.getEnclosingType(), null, null, null);
+        logResolveError(error, tree.pos(), type.getEnclosingType().tsym, type.getEnclosingType(), null, null, null);
     }
     //where
     private void logResolveError(ResolveError error,
             DiagnosticPosition pos,
+            Symbol location,
             Type site,
             Name name,
             List<Type> argtypes,
             List<Type> typeargtypes) {
         JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
-                pos, site, name, argtypes, typeargtypes);
+                pos, location, site, name, argtypes, typeargtypes);
         if (d != null) {
             d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
             log.report(d);
@@ -1835,6 +1841,7 @@
          */
         abstract JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -1900,6 +1907,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -1910,16 +1918,23 @@
                 return null;
 
             if (isOperator(name)) {
+                boolean isUnaryOp = argtypes.size() == 1;
+                String key = argtypes.size() == 1 ?
+                    "operator.cant.be.applied" :
+                    "operator.cant.be.applied.1";
+                Type first = argtypes.head;
+                Type second = !isUnaryOp ? argtypes.tail.head : null;
                 return diags.create(dkind, log.currentSource(), pos,
-                        "operator.cant.be.applied", name, argtypes);
+                        key, name, first, second);
             }
             boolean hasLocation = false;
-            if (!site.tsym.name.isEmpty()) {
-                if (site.tsym.kind == PCK && !site.tsym.exists()) {
+            if (!location.name.isEmpty()) {
+                if (location.kind == PCK && !site.tsym.exists()) {
                     return diags.create(dkind, log.currentSource(), pos,
-                        "doesnt.exist", site.tsym);
+                        "doesnt.exist", location);
                 }
-                hasLocation = true;
+                hasLocation = !location.name.equals(names._this) &&
+                        !location.name.equals(names._super);
             }
             boolean isConstructor = kind == ABSENT_MTH &&
                     name == names.table.names.init;
@@ -1930,7 +1945,7 @@
                 return diags.create(dkind, log.currentSource(), pos,
                         errKey, kindname, idname, //symbol kindname, name
                         typeargtypes, argtypes, //type parameters and arguments (if any)
-                        typeKindName(site), site); //location kindname, type
+                        getLocationDiag(location)); //location kindname, type
             }
             else {
                 return diags.create(dkind, log.currentSource(), pos,
@@ -1951,6 +1966,16 @@
             }
             return key + suffix;
         }
+        private JCDiagnostic getLocationDiag(Symbol location) {
+            boolean isVar = location.kind == VAR;
+            String key = isVar ?
+                "location.1" :
+                "location";
+            return diags.fragment(key,
+                    kindName(location),
+                    location,
+                    isVar ? location.type : null);
+        }
     }
 
     /**
@@ -1991,6 +2016,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2042,6 +2068,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2057,7 +2084,7 @@
                 return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
             } else {
                 return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
-                    site, name, argtypes, typeargtypes);
+                    location, site, name, argtypes, typeargtypes);
             }
         }
 
@@ -2157,6 +2184,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2166,7 +2194,7 @@
 
             if (sym.name == names.init && sym.owner != site.tsym) {
                 return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind,
-                        pos, site, name, argtypes, typeargtypes);
+                        pos, location, site, name, argtypes, typeargtypes);
             }
             else if ((sym.flags() & PUBLIC) != 0
                 || (env != null && this.site != null
@@ -2201,6 +2229,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2231,6 +2260,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -69,7 +69,6 @@
     private boolean allowEnums;
     private Types types;
     private final Resolve resolve;
-    private final TypeAnnotations typeAnnotations;
 
     /**
      * Flag to indicate whether or not to generate bridge methods.
@@ -91,7 +90,6 @@
         types = Types.instance(context);
         make = TreeMaker.instance(context);
         resolve = Resolve.instance(context);
-        typeAnnotations = TypeAnnotations.instance(context);
     }
 
     /** A hashtable mapping bridge methods to the methods they override after
@@ -182,7 +180,7 @@
             parameters = parameters.tail;
         }
         Type parameter = parameters.head;
-        assert varargsElement != null || args.length() == 1;
+        Assert.check(varargsElement != null || args.length() == 1);
         if (varargsElement != null) {
             while (args.nonEmpty()) {
                 args.head = translate(args.head, varargsElement);
@@ -445,14 +443,12 @@
     }
 
     public void visitClassDef(JCClassDecl tree) {
-        typeAnnotations.taFillAndLift(tree, true);
         translateClass(tree.sym);
         result = tree;
     }
 
     JCMethodDecl currentMethod = null;
     public void visitMethodDef(JCMethodDecl tree) {
-        tree.sym.typeAnnotations = tree.sym.typeAnnotations;
         JCMethodDecl previousMethod = currentMethod;
         try {
             currentMethod = tree;
@@ -598,7 +594,7 @@
         if (tree.varargsElement != null)
             tree.varargsElement = types.erasure(tree.varargsElement);
         else
-            assert tree.args.length() == argtypes.length();
+            Assert.check(tree.args.length() == argtypes.length());
         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 
         // Insert casts of method invocation results as needed.
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -472,7 +472,7 @@
      */
     protected Archive openArchive(File zipFileName) throws IOException {
         File origZipFileName = zipFileName;
-        if (!ignoreSymbolFile && paths.isBootClassPathRtJar(zipFileName)) {
+        if (!ignoreSymbolFile && paths.isDefaultBootClassPathRtJar(zipFileName)) {
             File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
             if (new File(file.getName()).equals(new File("jre")))
                 file = file.getParentFile();
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -112,7 +112,7 @@
      * rt.jar as found on the default bootclass path.  If the user specified a
      * bootclasspath, null is used.
      */
-    private File bootClassPathRtJar = null;
+    private File defaultBootClassPathRtJar = null;
 
     /**
      *  Is bootclasspath the default?
@@ -143,8 +143,10 @@
                 // no defaults for other paths
                 p = null;
         } else {
-            if (location == PLATFORM_CLASS_PATH)
+            if (location == PLATFORM_CLASS_PATH) {
+                defaultBootClassPathRtJar = null;
                 isDefaultBootClassPath = false;
+            }
             p = new Path();
             for (File f: path)
                 p.addFile(f, warn); // TODO: is use of warn appropriate?
@@ -185,8 +187,8 @@
             : Collections.unmodifiableCollection(p);
     }
 
-    boolean isBootClassPathRtJar(File file) {
-        return file.equals(bootClassPathRtJar);
+    boolean isDefaultBootClassPathRtJar(File file) {
+        return file.equals(defaultBootClassPathRtJar);
     }
 
     /**
@@ -355,7 +357,7 @@
     }
 
     private Path computeBootClassPath() {
-        bootClassPathRtJar = null;
+        defaultBootClassPathRtJar = null;
         Path path = new Path();
 
         String bootclasspathOpt = options.get(BOOTCLASSPATH);
@@ -380,7 +382,7 @@
             File rt_jar = new File("rt.jar");
             for (File file : getPathEntries(files)) {
                 if (new File(file.getName()).equals(rt_jar))
-                    bootClassPathRtJar = file;
+                    defaultBootClassPathRtJar = file;
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.file.JavacFileManager.Archive;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.List;
 
 /**
@@ -146,7 +147,7 @@
         @Override
         public InputStream openInputStream() throws IOException {
             if (inputStream == null) {
-                assert entry != null; // see constructor
+                Assert.checkNonNull(entry); // see constructor
                 inputStream = new ByteArrayInputStream(zfIndex.read(entry));
             }
             return inputStream;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -101,7 +101,7 @@
                 continue;
 
             SourceRange pos = positions.get(entry.tree);
-            assert pos != null : "CRT: tree source positions are undefined";
+            Assert.checkNonNull(pos, "CRT: tree source positions are undefined");
             if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS))
                 continue;
 
@@ -517,7 +517,7 @@
         }
 
         public void visitTree(JCTree tree) {
-            assert false;
+            Assert.error();
         }
 
         /** The start position of given tree.
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -80,6 +80,9 @@
     public final static int CONSTANT_Methodref = 10;
     public final static int CONSTANT_InterfaceMethodref = 11;
     public final static int CONSTANT_NameandType = 12;
+    public final static int CONSTANT_MethodHandle = 15;
+    public final static int CONSTANT_MethodType = 16;
+    public final static int CONSTANT_InvokeDynamic = 18;
 
     public final static int MAX_PARAMETERS = 0xff;
     public final static int MAX_DIMENSIONS = 0xff;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -207,10 +207,6 @@
     /** The minor version number of the class file being read. */
     int minorVersion;
 
-    /** Switch: debug output for JSR 308-related operations.
-     */
-    boolean debugJSR308;
-
     /** A table to hold the constant pool indices for method parameter
      * names, as given in LocalVariableTable attributes.
      */
@@ -246,9 +242,9 @@
         if (classes != null) return;
 
         if (definitive) {
-            assert packages == null || packages == syms.packages;
+            Assert.check(packages == null || packages == syms.packages);
             packages = syms.packages;
-            assert classes == null || classes == syms.classes;
+            Assert.check(classes == null || classes == syms.classes);
             classes = syms.classes;
         } else {
             packages = new HashMap<Name, PackageSymbol>();
@@ -297,7 +293,6 @@
             : null;
 
         typevars = new Scope(syms.noSymbol);
-        debugJSR308 = options.isSet("TA:reader");
 
         lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE);
 
@@ -439,14 +434,19 @@
             }
             case CONSTANT_Class:
             case CONSTANT_String:
+            case CONSTANT_MethodType:
                 bp = bp + 2;
                 break;
+            case CONSTANT_MethodHandle:
+                bp = bp + 3;
+                break;
             case CONSTANT_Fieldref:
             case CONSTANT_Methodref:
             case CONSTANT_InterfaceMethodref:
             case CONSTANT_NameandType:
             case CONSTANT_Integer:
             case CONSTANT_Float:
+            case CONSTANT_InvokeDynamic:
                 bp = bp + 4;
                 break;
             case CONSTANT_Long:
@@ -515,6 +515,15 @@
         case CONSTANT_Double:
             poolObj[i] = new Double(getDouble(index + 1));
             break;
+        case CONSTANT_MethodHandle:
+            skipBytes(4);
+            break;
+        case CONSTANT_MethodType:
+            skipBytes(3);
+            break;
+        case CONSTANT_InvokeDynamic:
+            skipBytes(5);
+            break;
         default:
             throw badClassFile("bad.const.pool.tag", Byte.toString(tag));
         }
@@ -535,7 +544,7 @@
         int index =  poolIdx[i];
         int len = getChar(index + 1);
         int start = index + 3;
-        assert buf[start] == '[' || buf[start + len - 1] != ';';
+        Assert.check(buf[start] == '[' || buf[start + len - 1] != ';');
         // by the above assertion, the following test can be
         // simplified to (buf[start] == '[')
         return (buf[start] == '[' || buf[start + len - 1] == ';')
@@ -1046,7 +1055,7 @@
                         readingClassAttr = true;
                         try {
                             ClassType ct1 = (ClassType)c.type;
-                            assert c == currentOwner;
+                            Assert.check(c == currentOwner);
                             ct1.typarams_field = readTypeParams(nextChar());
                             ct1.supertype_field = sigToType();
                             ListBuffer<Type> is = new ListBuffer<Type>();
@@ -1128,20 +1137,6 @@
                 }
             },
 
-            // v51 attributes
-            new AttributeReader(names.RuntimeVisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-            new AttributeReader(names.RuntimeInvisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-
             // The following attributes for a Code attribute are not currently handled
             // StackMapTable
             // SourceDebugExtension
@@ -1351,17 +1346,6 @@
         }
     }
 
-    void attachTypeAnnotations(final Symbol sym) {
-        int numAttributes = nextChar();
-        if (numAttributes != 0) {
-            ListBuffer<TypeAnnotationProxy> proxies =
-                ListBuffer.lb();
-            for (int i = 0; i < numAttributes; i++)
-                proxies.append(readTypeAnnotation());
-            annotate.later(new TypeAnnotationCompleter(sym, proxies.toList()));
-        }
-    }
-
     /** Attach the default value for an annotation element.
      */
     void attachAnnotationDefault(final Symbol sym) {
@@ -1398,121 +1382,6 @@
         return new CompoundAnnotationProxy(t, pairs.toList());
     }
 
-    TypeAnnotationProxy readTypeAnnotation() {
-        CompoundAnnotationProxy proxy = readCompoundAnnotation();
-        TypeAnnotationPosition position = readPosition();
-
-        if (debugJSR308)
-            System.out.println("TA: reading: " + proxy + " @ " + position
-                    + " in " + log.currentSourceFile());
-
-        return new TypeAnnotationProxy(proxy, position);
-    }
-
-    TypeAnnotationPosition readPosition() {
-        byte tag = nextByte();
-
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw this.badClassFile("bad.type.annotation.value", tag);
-
-        TypeAnnotationPosition position = new TypeAnnotationPosition();
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = nextChar();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = nextChar();
-                position.lvarLength[i] = nextChar();
-                position.lvarIndex[i] = nextChar();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = nextByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            position.bound_index = nextByte();
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = readPosition();
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            position.type_index = nextChar();
-            break;
-        // throws
-        case THROWS:
-            position.type_index = nextChar();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            position.type_index = nextByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + position);
-        }
-
-        if (type.hasLocation()) {
-            int len = nextChar();
-            ListBuffer<Integer> loc = ListBuffer.lb();
-            for (int i = 0; i < len; i++)
-                loc = loc.append((int)nextByte());
-            position.location = loc.toList();
-        }
-
-        return position;
-    }
     Attribute readAttributeValue() {
         char c = (char) buf[bp++];
         switch (c) {
@@ -1825,45 +1694,6 @@
         }
     }
 
-    class TypeAnnotationCompleter extends AnnotationCompleter {
-
-        List<TypeAnnotationProxy> proxies;
-
-        TypeAnnotationCompleter(Symbol sym,
-                List<TypeAnnotationProxy> proxies) {
-            super(sym, List.<CompoundAnnotationProxy>nil());
-            this.proxies = proxies;
-        }
-
-        List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
-            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
-            for (TypeAnnotationProxy proxy: proxies) {
-                Attribute.Compound compound = deproxyCompound(proxy.compound);
-                Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
-                buf.add(typeCompound);
-            }
-            return buf.toList();
-        }
-
-        @Override
-        public void enterAnnotation() {
-            JavaFileObject previousClassFile = currentClassFile;
-            try {
-                currentClassFile = classFile;
-                List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
-              if (debugJSR308)
-              System.out.println("TA: reading: adding " + newList
-                      + " to symbol " + sym + " in " + log.currentSourceFile());
-                sym.typeAnnotations = ((sym.typeAnnotations == null)
-                                        ? newList
-                                        : newList.prependList(sym.typeAnnotations));
-
-            } finally {
-                currentClassFile = previousClassFile;
-            }
-        }
-    }
-
 
 /************************************************************************
  * Reading Symbols
@@ -2005,6 +1835,13 @@
         sym.savedParameterNames = paramNames.reverse();
     }
 
+    /**
+     * skip n bytes
+     */
+    void skipBytes(int n) {
+        bp = bp + n;
+    }
+
     /** Skip a field or method
      */
     void skipMember() {
@@ -2092,9 +1929,9 @@
         if (ct.interfaces_field == null)
             ct.interfaces_field = is.reverse();
 
-        if (fieldCount != nextChar()) assert false;
+        Assert.check(fieldCount == nextChar());
         for (int i = 0; i < fieldCount; i++) enterMember(c, readField());
-        if (methodCount != nextChar()) assert false;
+        Assert.check(methodCount == nextChar());
         for (int i = 0; i < methodCount; i++) enterMember(c, readMethod());
 
         typevars = typevars.leave();
@@ -2203,7 +2040,7 @@
     public ClassSymbol defineClass(Name name, Symbol owner) {
         ClassSymbol c = new ClassSymbol(0, name, owner);
         if (owner.kind == PCK)
-            assert classes.get(c.flatname) == null : c;
+            Assert.checkNull(classes.get(c.flatname), c);
         c.completer = this;
         return c;
     }
@@ -2343,9 +2180,9 @@
         if (classfile != null) {
             JavaFileObject previousClassFile = currentClassFile;
             try {
-                assert !filling :
-                    "Filling " + classfile.toUri() +
-                    " during " + previousClassFile;
+                if (filling) {
+                    Assert.error("Filling " + classfile.toUri() + " during " + previousClassFile);
+                }
                 currentClassFile = classfile;
                 if (verbose) {
                     printVerbose("loading", currentClassFile.toString());
@@ -2491,7 +2328,7 @@
     public PackageSymbol enterPackage(Name fullname) {
         PackageSymbol p = packages.get(fullname);
         if (p == null) {
-            assert !fullname.isEmpty() : "rootPackage missing!";
+            Assert.check(!fullname.isEmpty(), "rootPackage missing!");
             p = new PackageSymbol(
                 Convert.shortName(fullname),
                 enterPackage(Convert.packagePart(fullname)));
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -65,10 +65,6 @@
 
     private final Options options;
 
-    /** Switch: debugging output for JSR 308-related operations.
-     */
-    private boolean debugJSR308;
-
     /** Switch: verbose output.
      */
     private boolean verbose;
@@ -180,7 +176,6 @@
         types = Types.instance(context);
         fileManager = context.get(JavaFileManager.class);
 
-        debugJSR308    = options.isSet("TA:writer");
         verbose        = options.isSet(VERBOSE);
         scramble       = options.isSet("-scramble");
         scrambleAll    = options.isSet("-scrambleAll");
@@ -224,11 +219,14 @@
     /** Return flags as a string, separated by " ".
      */
     public static String flagNames(long flags) {
-        StringBuffer sbuf = new StringBuffer();
+        StringBuilder sbuf = new StringBuilder();
         int i = 0;
         long f = flags & StandardFlags;
         while (f != 0) {
-            if ((f & 1) != 0) sbuf.append(" " + flagName[i]);
+            if ((f & 1) != 0) {
+                sbuf.append(" ");
+                sbuf.append(flagName[i]);
+            }
             f = f >> 1;
             i++;
         }
@@ -381,7 +379,7 @@
                              ? types.erasure(outer)
                              : outer);
             sigbuf.appendByte('.');
-            assert c.flatname.startsWith(c.owner.enclClass().flatname);
+            Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
             sigbuf.appendName(rawOuter
                               ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
                               : c.name);
@@ -421,7 +419,7 @@
     /** Return signature of given type
      */
     Name typeSig(Type type) {
-        assert sigbuf.length == 0;
+        Assert.check(sigbuf.length == 0);
         //- System.out.println(" ? " + type);
         assembleSig(type);
         Name n = sigbuf.toName(names);
@@ -471,7 +469,7 @@
         int i = 1;
         while (i < pool.pp) {
             Object value = pool.pool[i];
-            assert value != null;
+            Assert.checkNonNull(value);
             if (value instanceof Pool.Method)
                 value = ((Pool.Method)value).m;
             else if (value instanceof Pool.Variable)
@@ -534,7 +532,7 @@
                 poolbuf.appendByte(CONSTANT_Class);
                 poolbuf.appendChar(pool.put(xClassName(type)));
             } else {
-                assert false : "writePool " + value;
+                Assert.error("writePool " + value);
             }
             i++;
         }
@@ -677,7 +675,6 @@
             acount++;
         }
         acount += writeJavaAnnotations(sym.getAnnotationMirrors());
-        acount += writeTypeAnnotations(sym.typeAnnotations);
         return acount;
     }
 
@@ -772,46 +769,6 @@
         return attrCount;
     }
 
-    int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) {
-        if (typeAnnos.isEmpty()) return 0;
-
-        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
-        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
-
-        for (Attribute.TypeCompound tc : typeAnnos) {
-            if (tc.position.type == TargetType.UNKNOWN
-                || !tc.position.emitToClassfile())
-                continue;
-            switch (types.getRetention(tc)) {
-            case SOURCE: break;
-            case CLASS: invisibles.append(tc); break;
-            case RUNTIME: visibles.append(tc); break;
-            default: ;// /* fail soft */ throw new AssertionError(vis);
-            }
-        }
-
-        int attrCount = 0;
-        if (visibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations);
-            databuf.appendChar(visibles.length());
-            for (Attribute.TypeCompound p : visibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        if (invisibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations);
-            databuf.appendChar(invisibles.length());
-            for (Attribute.TypeCompound p : invisibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        return attrCount;
-    }
-
     /** A visitor to write an attribute including its leading
      *  single-character marker.
      */
@@ -844,7 +801,7 @@
                 databuf.appendByte('Z');
                 break;
             case CLASS:
-                assert value instanceof String;
+                Assert.check(value instanceof String);
                 databuf.appendByte('s');
                 value = names.fromString(value.toString()); // CONSTANT_Utf8
                 break;
@@ -888,104 +845,6 @@
             p.snd.accept(awriter);
         }
     }
-
-    void writeTypeAnnotation(Attribute.TypeCompound c) {
-        if (debugJSR308)
-            System.out.println("TA: writing " + c + " at " + c.position
-                    + " in " + log.currentSourceFile());
-        writeCompoundAttribute(c);
-        writePosition(c.position);
-    }
-
-    void writePosition(TypeAnnotationPosition p) {
-        databuf.appendByte(p.type.targetTypeValue());
-        switch (p.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.lvarOffset.length);  // for table length
-            for (int i = 0; i < p.lvarOffset.length; ++i) {
-                databuf.appendChar(p.lvarOffset[i]);
-                databuf.appendChar(p.lvarLength[i]);
-                databuf.appendChar(p.lvarIndex[i]);
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // type parameters bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            databuf.appendByte(p.bound_index);
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            writePosition(p.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.type_index);
-            break;
-        // throws
-        case THROWS:
-            databuf.appendChar(p.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            databuf.appendByte(p.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown position: " + p);
-        }
-
-        // Append location data for generics/arrays.
-        if (p.type.hasLocation()) {
-            databuf.appendChar(p.location.size());
-            for (int i : p.location)
-                databuf.appendByte((byte)i);
-        }
-    }
-
 /**********************************************************************
  * Writing Objects
  **********************************************************************/
@@ -1159,11 +1018,11 @@
                 Code.LocalVar var = code.varBuffer[i];
 
                 // write variable info
-                assert var.start_pc >= 0;
-                assert var.start_pc <= code.cp;
+                Assert.check(var.start_pc >= 0
+                        && var.start_pc <= code.cp);
                 databuf.appendChar(var.start_pc);
-                assert var.length >= 0;
-                assert (var.start_pc + var.length) <= code.cp;
+                Assert.check(var.length >= 0
+                        && (var.start_pc + var.length) <= code.cp);
                 databuf.appendChar(var.length);
                 VarSymbol sym = var.sym;
                 databuf.appendChar(pool.put(sym.name));
@@ -1195,7 +1054,7 @@
                 databuf.appendChar(pool.put(typeSig(sym.type)));
                 databuf.appendChar(var.reg);
             }
-            assert count == nGenericVars;
+            Assert.check(count == nGenericVars);
             endAttr(alenIdx);
             acount++;
         }
@@ -1266,7 +1125,7 @@
             }
             break;
         case JSR202: {
-            assert code.stackMapBuffer == null;
+            Assert.checkNull(code.stackMapBuffer);
             for (int i=0; i<nframes; i++) {
                 if (debugstackmap) System.out.print("  " + i + ":");
                 StackMapTableFrame frame = code.stackMapTableBuffer[i];
@@ -1606,7 +1465,7 @@
      */
     public void writeClassFile(OutputStream out, ClassSymbol c)
         throws IOException, PoolOverflow, StringOverflow {
-        assert (c.flags() & COMPOUND) == 0;
+        Assert.check((c.flags() & COMPOUND) == 0);
         databuf.reset();
         poolbuf.reset();
         sigbuf.reset();
@@ -1643,7 +1502,7 @@
             case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
                       break;
             case TYP: enterInner((ClassSymbol)e.sym); break;
-            default : assert false;
+            default : Assert.error();
             }
         }
         databuf.appendChar(fieldsCount);
@@ -1659,7 +1518,7 @@
         for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
             sigReq = l.head.allparams().length() != 0;
         if (sigReq) {
-            assert source.allowGenerics();
+            Assert.check(source.allowGenerics());
             int alenIdx = writeAttr(names.Signature);
             if (typarams.length() != 0) assembleParamsSig(typarams);
             assembleSig(supertype);
@@ -1698,7 +1557,6 @@
 
         acount += writeFlagAttrs(c.flags());
         acount += writeJavaAnnotations(c.getAnnotationMirrors());
-        acount += writeTypeAnnotations(c.typeAnnotations);
         acount += writeEnclosingMethodAttribute(c);
 
         poolbuf.appendInt(JAVA_MAGIC);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -372,7 +372,7 @@
     }
 
     void postop() {
-        assert alive || state.stacksize == 0;
+        Assert.check(alive || state.stacksize == 0);
     }
 
     /** Emit a multinewarray instruction.
@@ -583,7 +583,7 @@
         case areturn:
         case ireturn:
         case freturn:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             state.pop(1);
             markDead();
             break;
@@ -604,7 +604,7 @@
             break;
         case lreturn:
         case dreturn:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             state.pop(2);
             markDead();
             break;
@@ -612,7 +612,7 @@
             state.push(state.stack[state.stacksize-1]);
             break;
         case return_:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             markDead();
             break;
         case arraylength:
@@ -1147,7 +1147,7 @@
         int pc = curPc();
         alive = true;
         this.state = state.dup();
-        assert state.stacksize <= max_stack;
+        Assert.check(state.stacksize <= max_stack);
         if (debugCode) System.err.println("entry point " + state);
         pendingStackMap = needStackMap;
         return pc;
@@ -1160,7 +1160,7 @@
         int pc = curPc();
         alive = true;
         this.state = state.dup();
-        assert state.stacksize <= max_stack;
+        Assert.check(state.stacksize <= max_stack);
         this.state.push(pushed);
         if (debugCode) System.err.println("entry point " + state);
         pendingStackMap = needStackMap;
@@ -1289,7 +1289,7 @@
         }
         frame.locals = new Type[localCount];
         for (int i=0, j=0; i<localsSize; i++, j++) {
-            assert(j < localCount);
+            Assert.check(j < localCount);
             frame.locals[j] = locals[i];
             if (width(locals[i]) > 1) i++;
         }
@@ -1435,8 +1435,8 @@
         boolean changed = false;
         State newState = state;
         for (; chain != null; chain = chain.next) {
-            assert state != chain.state;
-            assert target > chain.pc || state.stacksize == 0;
+            Assert.check(state != chain.state
+                    && (target > chain.pc || state.stacksize == 0));
             if (target >= cp) {
                 target = cp;
             } else if (get1(target) == goto_) {
@@ -1464,9 +1464,9 @@
                     fatcode = true;
                 else
                     put2(chain.pc + 1, target - chain.pc);
-                assert !alive ||
+                Assert.check(!alive ||
                     chain.state.stacksize == newState.stacksize &&
-                    chain.state.nlocks == newState.nlocks;
+                    chain.state.nlocks == newState.nlocks);
             }
             fixedPc = true;
             if (cp == target) {
@@ -1481,7 +1481,7 @@
                 }
             }
         }
-        assert !changed || state != newState;
+        Assert.check(!changed || state != newState);
         if (state != newState) {
             setDefined(newState.defined);
             state = newState;
@@ -1492,11 +1492,11 @@
     /** Resolve chain to point to current code pointer.
      */
     public void resolve(Chain chain) {
-        assert
+        Assert.check(
             !alive ||
             chain==null ||
             state.stacksize == chain.state.stacksize &&
-            state.nlocks == chain.state.nlocks;
+            state.nlocks == chain.state.nlocks);
         pendingJumps = mergeChains(chain, pendingJumps);
     }
 
@@ -1514,9 +1514,9 @@
         // recursive merge sort
         if (chain2 == null) return chain1;
         if (chain1 == null) return chain2;
-        assert
+        Assert.check(
             chain1.state.stacksize == chain2.state.stacksize &&
-            chain1.state.nlocks == chain2.state.nlocks;
+            chain1.state.nlocks == chain2.state.nlocks);
         if (chain1.pc < chain2.pc)
             return new Chain(
                 chain2.pc,
@@ -1631,7 +1631,7 @@
 
         void unlock(int register) {
             nlocks--;
-            assert locks[nlocks] == register;
+            Assert.check(locks[nlocks] == register);
             locks[nlocks] = -1;
         }
 
@@ -1673,7 +1673,7 @@
             stacksize--;
             Type result = stack[stacksize];
             stack[stacksize] = null;
-            assert result != null && width(result) == 1;
+            Assert.check(result != null && width(result) == 1);
             return result;
         }
 
@@ -1686,8 +1686,8 @@
             stacksize -= 2;
             Type result = stack[stacksize];
             stack[stacksize] = null;
-            assert stack[stacksize+1] == null;
-            assert result != null && width(result) == 2;
+            Assert.check(stack[stacksize+1] == null
+                    && result != null && width(result) == 2);
             return result;
         }
 
@@ -1712,8 +1712,8 @@
             case ARRAY:
                 int width = width(t);
                 Type old = stack[stacksize-width];
-                assert types.isSubtype(types.erasure(old),
-                                       types.erasure(t));
+                Assert.check(types.isSubtype(types.erasure(old),
+                                       types.erasure(t)));
                 stack[stacksize-width] = t;
                 break;
             default:
@@ -1739,8 +1739,8 @@
 
         State join(State other) {
             defined = defined.andSet(other.defined);
-            assert stacksize == other.stacksize;
-            assert nlocks == other.nlocks;
+            Assert.check(stacksize == other.stacksize
+                    && nlocks == other.nlocks);
             for (int i=0; i<stacksize; ) {
                 Type t = stack[i];
                 Type tother = other.stack[i];
@@ -1751,7 +1751,7 @@
                     error();
                 int w = width(result);
                 stack[i] = result;
-                if (w == 2) assert stack[i+1] == null;
+                if (w == 2) Assert.checkNull(stack[i+1]);
                 i += w;
             }
             return this;
@@ -1847,7 +1847,7 @@
             System.arraycopy(lvar, 0, new_lvar, 0, lvar.length);
             lvar = new_lvar;
         }
-        assert lvar[adr] == null;
+        Assert.checkNull(lvar[adr]);
         if (pendingJumps != null) resolvePending();
         lvar[adr] = new LocalVar(v);
         state.defined.excl(adr);
@@ -1912,29 +1912,12 @@
                 if (length < Character.MAX_VALUE) {
                     v.length = length;
                     putVar(v);
-                    fillLocalVarPosition(v);
                 }
             }
         }
         state.defined.excl(adr);
     }
 
-    private void fillLocalVarPosition(LocalVar lv) {
-        if (lv == null || lv.sym == null
-                || lv.sym.typeAnnotations == null)
-            return;
-        for (Attribute.TypeCompound ta : lv.sym.typeAnnotations) {
-            TypeAnnotationPosition p = ta.position;
-            while (p != null) {
-                p.lvarOffset = new int[] { (int)lv.start_pc };
-                p.lvarLength = new int[] { (int)lv.length };
-                p.lvarIndex = new int[] { (int)lv.reg };
-                p.isValidOffset = true;
-                p = p.wildcard_position;
-            }
-        }
-    }
-
     /** Put a live variable range into the buffer to be output to the
      *  class file.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -500,7 +500,7 @@
                 }
                 break;
             default:
-                assert false;
+                Assert.error();
             }
         }
         // Insert any instance initializers into all constructors.
@@ -857,7 +857,7 @@
             pts = pts.tail;
         }
         // require lists be of same length
-        assert pts.isEmpty();
+        Assert.check(pts.isEmpty());
     }
 
 /* ************************************************************************
@@ -1111,7 +1111,7 @@
 
     public void visitSwitch(JCSwitch tree) {
         int limit = code.nextreg;
-        assert tree.selector.type.tag != CLASS;
+        Assert.check(tree.selector.type.tag != CLASS);
         int startpcCrt = genCrt ? code.curPc() : 0;
         Item sel = genExpr(tree.selector, syms.intType);
         List<JCCase> cases = tree.cases;
@@ -1148,7 +1148,7 @@
                     if (hi < val) hi = val;
                     nlabels++;
                 } else {
-                    assert defaultIndex == -1;
+                    Assert.check(defaultIndex == -1);
                     defaultIndex = i;
                 }
                 l = l.tail;
@@ -1290,7 +1290,7 @@
         syncEnv.info.finalize = new GenFinalizer() {
             void gen() {
                 genLast();
-                assert syncEnv.info.gaps.length() % 2 == 0;
+                Assert.check(syncEnv.info.gaps.length() % 2 == 0);
                 syncEnv.info.gaps.append(code.curPc());
             }
             void genLast() {
@@ -1329,10 +1329,10 @@
                                       tryEnv.info.cont,
                                       jsrState);
                     }
-                    assert tryEnv.info.gaps.length() % 2 == 0;
+                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
                     tryEnv.info.gaps.append(code.curPc());
                 } else {
-                    assert tryEnv.info.gaps.length() % 2 == 0;
+                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
                     tryEnv.info.gaps.append(code.curPc());
                     genLast();
                 }
@@ -1640,14 +1640,14 @@
 
     public void visitBreak(JCBreak tree) {
         Env<GenContext> targetEnv = unwind(tree.target, env);
-        assert code.state.stacksize == 0;
+        Assert.check(code.state.stacksize == 0);
         targetEnv.info.addExit(code.branch(goto_));
         endFinalizerGaps(env, targetEnv);
     }
 
     public void visitContinue(JCContinue tree) {
         Env<GenContext> targetEnv = unwind(tree.target, env);
-        assert code.state.stacksize == 0;
+        Assert.check(code.state.stacksize == 0);
         targetEnv.info.addCont(code.branch(goto_));
         endFinalizerGaps(env, targetEnv);
     }
@@ -1682,7 +1682,6 @@
  *************************************************************************/
 
     public void visitApply(JCMethodInvocation tree) {
-        setTypeAnnotationPositions(tree.pos);
         // Generate code for method.
         Item m = genExpr(tree.meth, methodType);
         // Generate code for all arguments, where the expected types are
@@ -1718,48 +1717,10 @@
         result = items.makeStackItem(pt);
     }
 
-    private void setTypeAnnotationPositions(int treePos) {
-        MethodSymbol meth = code.meth;
-
-        for (Attribute.TypeCompound ta : meth.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        if (code.meth.getKind() != ElementKind.CONSTRUCTOR
-                && code.meth.getKind() != ElementKind.STATIC_INIT)
-            return;
-
-        for (Attribute.TypeCompound ta : meth.owner.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        ClassSymbol clazz = meth.enclClass();
-        for (Symbol s : new com.sun.tools.javac.model.FilteredMemberList(clazz.members())) {
-            if (!s.getKind().isField())
-                continue;
-            for (Attribute.TypeCompound ta : s.typeAnnotations) {
-                if (ta.position.pos == treePos) {
-                    ta.position.offset = code.cp;
-                    ta.position.lvarOffset = new int[] { code.cp };
-                    ta.position.isValidOffset = true;
-                }
-            }
-        }
-    }
-
     public void visitNewClass(JCNewClass tree) {
         // Enclosing instances or anonymous classes should have been eliminated
         // by now.
-        assert tree.encl == null && tree.def == null;
-        setTypeAnnotationPositions(tree.pos);
+        Assert.check(tree.encl == null && tree.def == null);
 
         code.emitop2(new_, makeRef(tree.pos(), tree.type));
         code.emitop0(dup);
@@ -1774,7 +1735,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        setTypeAnnotationPositions(tree.pos);
 
         if (tree.elems != null) {
             Type elemtype = types.elemtype(tree.type);
@@ -1942,7 +1902,7 @@
                 genNullCheck(tree.pos());
                 break;
             default:
-                assert false;
+                Assert.error();
             }
         }
     }
@@ -2017,7 +1977,7 @@
             items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
         }
         Symbol getStringBufferAppend(JCTree tree, Type t) {
-            assert t.constValue() == null;
+            Assert.checkNull(t.constValue());
             Symbol method = stringBufferAppend.get(t);
             if (method == null) {
                 method = rs.resolveInternalMethod(tree.pos(),
@@ -2104,7 +2064,6 @@
         }
 
     public void visitTypeCast(JCTypeCast tree) {
-        setTypeAnnotationPositions(tree.pos);
         result = genExpr(tree.expr, tree.clazz.type).load();
         // Additional code is only needed if we cast to a reference type
         // which is not statically a supertype of the expression's type.
@@ -2121,8 +2080,6 @@
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
-        setTypeAnnotationPositions(tree.pos);
-
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
         result = items.makeStackItem(syms.booleanType);
@@ -2163,16 +2120,10 @@
         Symbol sym = tree.sym;
 
         if (tree.name == names._class) {
-            assert target.hasClassLiterals();
-            setTypeAnnotationPositions(tree.pos);
+            Assert.check(target.hasClassLiterals());
             code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
             result = items.makeStackItem(pt);
             return;
-        } else if (tree.name == names.TYPE) {
-            // Set the annotation positions for primitive class literals
-            // (e.g. int.class) which have been converted to TYPE field
-            // access on the corresponding boxed type (e.g. Integer.TYPE).
-            setTypeAnnotationPositions(tree.pos);
         }
 
         Symbol ssym = TreeInfo.symbol(tree.selected);
@@ -2202,9 +2153,6 @@
             }
             result = items.
                 makeImmediateItem(sym.type, ((VarSymbol) sym).getConstValue());
-        } else if (allowInvokedynamic && sym.kind == MTH && ssym == syms.invokeDynamicType.tsym) {
-            base.drop();
-            result = items.makeDynamicItem(sym);
         } else {
             if (!accessSuper)
                 sym = binaryQualifier(sym, tree.selected.type);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,11 +26,11 @@
 package com.sun.tools.javac.jvm;
 
 import com.sun.tools.javac.code.*;
-
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.Assert;
 
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 
@@ -139,13 +139,6 @@
         return new StaticItem(member);
     }
 
-    /** Make an item representing a dynamically invoked method.
-     *  @param member   The represented symbol.
-     */
-    Item makeDynamicItem(Symbol member) {
-        return new DynamicItem(member);
-    }
-
     /** Make an item representing an instance variable or method.
      *  @param member       The represented symbol.
      *  @param nonvirtual   Is the reference not virtual? (true for constructors
@@ -387,7 +380,7 @@
 
         LocalItem(Type type, int reg) {
             super(Code.typecode(type));
-            assert reg >= 0;
+            Assert.check(reg >= 0);
             this.type = type;
             this.reg = reg;
         }
@@ -464,38 +457,6 @@
         }
     }
 
-    /** An item representing a dynamic call site.
-     */
-    class DynamicItem extends StaticItem {
-        DynamicItem(Symbol member) {
-            super(member);
-            assert member.owner == syms.invokeDynamicType.tsym;
-        }
-
-        Item load() {
-            assert false;
-            return null;
-        }
-
-        void store() {
-            assert false;
-        }
-
-        Item invoke() {
-            // assert target.hasNativeInvokeDynamic();
-            MethodType mtype = (MethodType)member.erasure(types);
-            int rescode = Code.typecode(mtype.restype);
-            ClassFile.NameAndType descr = new ClassFile.NameAndType(member.name, mtype);
-            code.emitInvokedynamic(pool.put(descr), mtype);
-            return stackItem[rescode];
-        }
-
-        public String toString() {
-            return "dynamic(" + member + ")";
-        }
-    }
-
-
     /** An item representing an instance variable or method.
      */
     class MemberItem extends Item {
@@ -620,7 +581,7 @@
                 ldc();
                 break;
             default:
-                assert false;
+                Assert.error();
             }
             return stackItem[typecode];
         }
@@ -716,7 +677,7 @@
         }
 
         void stash(int toscode) {
-            assert false;
+            Assert.error();
         }
 
         int width() {
@@ -784,7 +745,7 @@
         }
 
         void stash(int toscode) {
-            assert false;
+            Assert.error();
         }
 
         CondItem mkCond() {
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -848,7 +848,7 @@
                 break;
 
             default:
-                assert false: "unknown compile policy";
+                Assert.error("unknown compile policy");
             }
         } catch (Abort ex) {
             if (devVerbose)
@@ -1066,7 +1066,7 @@
                                     classSymbols = classSymbols.prepend((ClassSymbol)sym);
                                 continue;
                             }
-                            assert sym.kind == Kinds.PCK;
+                            Assert.check(sym.kind == Kinds.PCK);
                             log.warning("proc.package.does.not.exist", nameStr);
                             pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                         } catch (CompletionFailure e) {
@@ -1086,8 +1086,8 @@
                 if (c != this)
                     annotationProcessingOccurred = c.annotationProcessingOccurred = true;
                 // doProcessing will have handled deferred diagnostics
-                assert c.log.deferDiagnostics == false;
-                assert c.log.deferredDiagnostics.size() == 0;
+                Assert.check(c.log.deferDiagnostics == false
+                        && c.log.deferredDiagnostics.size() == 0);
                 return c;
             } finally {
                 procEnvImpl.close();
@@ -1324,7 +1324,7 @@
                         return;
                     List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
                     if (pdef.head != null) {
-                        assert pdef.tail.isEmpty();
+                        Assert.check(pdef.tail.isEmpty());
                         results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
                     }
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Fri Feb 04 16:29:41 2011 -0800
@@ -284,13 +284,6 @@
             }
         }
 
-        // phase this out with JSR 292 PFD
-        if ("no".equals(options.get("allowTransitionalJSR292"))) {
-            options.put("allowTransitionalJSR292", null);
-        } else if (target.hasInvokedynamic() && options.isUnset("allowTransitionalJSR292")) {
-            options.put("allowTransitionalJSR292", "allowTransitionalJSR292");
-        }
-
         // handle this here so it works even if no other options given
         String showClass = options.get("showClass");
         if (showClass != null) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -547,7 +547,7 @@
                 null);
             break;
         default:
-            assert false;
+            Assert.error();
         }
         if (t == errorTree)
             t = F.at(pos).Erroneous();
@@ -724,7 +724,7 @@
                 topOpPos = posStack[top];
             }
         }
-        assert top == 0;
+        Assert.check(top == 0);
         t = odStack[0];
 
         if (t.getTag() == JCTree.PLUS) {
@@ -2168,8 +2168,11 @@
     JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
         int pos = S.pos();
         Name name = ident();
-        if ((mods.flags & Flags.VARARGS) == 0)
-            type = bracketsOpt(type);
+        if ((mods.flags & Flags.VARARGS) != 0 &&
+                S.token() == LBRACKET) {
+            log.error(S.pos(), "varargs.and.old.array.syntax");
+        }
+        type = bracketsOpt(type);
         return toP(F.at(pos).VarDef(mods, name, type, null));
     }
 
@@ -2569,6 +2572,12 @@
             } else {
                 pos = S.pos();
                 List<JCTypeParameter> typarams = typeParametersOpt();
+                // if there are type parameters but no modifiers, save the start
+                // position of the method in the modifiers.
+                if (typarams.nonEmpty() && mods.pos == Position.NOPOS) {
+                    mods.pos = pos;
+                    storeEnd(mods, pos);
+                }
                 Name name = S.name();
                 pos = S.pos();
                 JCExpression type;
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -445,7 +445,7 @@
      */
     private void scanHexFractionAndSuffix(boolean seendigit) {
         this.radix = 16;
-        assert ch == '.';
+        Assert.check(ch == '.');
         putChar(ch);
         scanChar();
         skipIllegalUnderscores();
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,6 @@
 import javax.tools.JavaFileObject;
 import javax.tools.DiagnosticListener;
 
-//308 import com.sun.source.util.AbstractTypeProcessor;
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.api.JavacTaskImpl;
@@ -66,6 +65,7 @@
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Abort;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
 import com.sun.tools.javac.util.FatalError;
@@ -712,7 +712,6 @@
             }
 
             if (matchedNames.size() > 0 || ps.contributed) {
-//308                foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor);
                 boolean processingResult = callProcessor(ps.processor, typeElements, renv);
                 ps.contributed = true;
                 ps.removeSupportedOptions(unmatchedProcessorOptions);
@@ -1048,17 +1047,17 @@
             Context next = new Context();
 
             Options options = Options.instance(context);
-            assert options != null;
+            Assert.checkNonNull(options);
             next.put(Options.optionsKey, options);
 
             PrintWriter out = context.get(Log.outKey);
-            assert out != null;
+            Assert.checkNonNull(out);
             next.put(Log.outKey, out);
 
             final boolean shareNames = true;
             if (shareNames) {
                 Names names = Names.instance(context);
-                assert names != null;
+                Assert.checkNonNull(names);
                 next.put(Names.namesKey, names);
             }
 
@@ -1071,18 +1070,18 @@
                 next.put(TaskListener.class, tl);
 
             JavaFileManager jfm = context.get(JavaFileManager.class);
-            assert jfm != null;
+            Assert.checkNonNull(jfm);
             next.put(JavaFileManager.class, jfm);
             if (jfm instanceof JavacFileManager) {
                 ((JavacFileManager)jfm).setContext(next);
             }
 
             Names names = Names.instance(context);
-            assert names != null;
+            Assert.checkNonNull(names);
             next.put(Names.namesKey, names);
 
             Keywords keywords = Keywords.instance(context);
-            assert(keywords != null);
+            Assert.checkNonNull(keywords);
             next.put(Keywords.keywordsKey, keywords);
 
             JavaCompiler oldCompiler = JavaCompiler.instance(context);
@@ -1241,7 +1240,7 @@
             for (JCTree node : unit.defs) {
                 if (node.getTag() == JCTree.CLASSDEF) {
                     ClassSymbol sym = ((JCClassDecl) node).sym;
-                    assert sym != null;
+                    Assert.checkNonNull(sym);
                     classes = classes.prepend(sym);
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -112,11 +112,9 @@
 compiler.err.catch.without.try=\
     ''catch'' without ''try''
 compiler.err.clash.with.pkg.of.same.name=\
-    {0} clashes with package of same name
+    {0} {1} clashes with package of same name
 compiler.err.const.expr.req=\
     constant expression required
-compiler.err.enum.const.req=\
-    unqualified enumeration constant name required
 compiler.err.cont.outside.loop=\
     continue outside of loop
 compiler.err.cyclic.inheritance=\
@@ -128,9 +126,7 @@
 compiler.err.no.superclass=\
     {0} has no superclass
 
-compiler.warn.type.parameter.on.polymorphic.signature=\
-    change obsolete notation for MethodHandle invocations from x.<T>invoke(y) to (T)x.invoke(y)
-compiler.warn.wrong.target.for.polymorphic.signature.definition=\
+compiler.err.wrong.target.for.polymorphic.signature.definition=\
     MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
 
 compiler.err.concrete.inheritance.conflict=\
@@ -186,7 +182,9 @@
 compiler.err.finally.without.try=\
     ''finally'' without ''try''
 compiler.err.foreach.not.applicable.to.type=\
-    foreach not applicable to expression type
+    for-each not applicable to expression type\n\
+    required: {1}\n\
+    found:    {0}
 compiler.err.fp.number.too.large=\
     floating point number too large
 compiler.err.fp.number.too.small=\
@@ -198,7 +196,8 @@
     a generic class may not extend java.lang.Throwable
 
 compiler.err.icls.cant.have.static.decl=\
-    inner classes cannot have static declarations
+    Illegal static declaration in inner class {0}\n\
+    modifier \''static\'' is only allowed in constant variable declarations
 compiler.err.illegal.char=\
     illegal character: \\{0}
 compiler.err.illegal.char.for.encoding=\
@@ -240,7 +239,7 @@
 compiler.err.improperly.formed.type.param.missing=\
     improperly formed type, some parameters are missing
 compiler.err.improperly.formed.type.inner.raw.param=\
-    improperly formed type, type parameters given on a raw type
+    improperly formed type, type arguments given on a raw type
 compiler.err.incomparable.types=\
     incomparable types: {0} and {1}
 compiler.err.int.number.too.large=\
@@ -267,6 +266,8 @@
     hexadecimal numbers must contain at least one hexadecimal digit
 compiler.err.invalid.meth.decl.ret.type.req=\
     invalid method declaration; return type required
+compiler.err.varargs.and.old.array.syntax=\
+    legacy array notation not allowed on variable-arity parameter
 
 compiler.err.label.already.in.use=\
     label {0} already in use
@@ -356,7 +357,11 @@
     not an enclosing class: {0}
 
 compiler.err.operator.cant.be.applied=\
-    operator {0} cannot be applied to {1}
+    bad operand type {1} for unary operator ''{0}''
+compiler.err.operator.cant.be.applied.1=\
+    bad operand types for binary operator ''{0}''\n\
+    first type:  {1}\n\
+    second type: {2}
 
 compiler.err.pkg.annotations.sb.in.package-info.java=\
     package annotations should be in file package-info.java
@@ -483,9 +488,10 @@
 compiler.err.undef.label=\
     undefined label: {0}
 compiler.err.undetermined.type=\
-    type parameters of {0} cannot be determined
+    cannot infer type arguments for {0}
 compiler.err.undetermined.type.1=\
-    type parameters of {0} cannot be determined; {1}
+    cannot infer type arguments for {0};\n\
+    reason: {1}
 compiler.err.invalid.inferred.types=\
     invalid inferred types for {0}; {1}
 compiler.err.cant.apply.diamond=\
@@ -865,7 +871,7 @@
 
 compiler.warn.raw.class.use=\
     found raw type: {0}\n\
-    missing type parameters for generic class {1}
+    missing type arguments for generic class {1}
 
 compiler.warn.diamond.redundant.args=\
     redundant type arguments in new expression (use diamond operator instead).
@@ -971,8 +977,6 @@
     bad constant pool tag: {0} at {1}
 compiler.misc.bad.signature=\
     bad signature: {0}
-compiler.misc.bad.type.annotation.value=\
-    bad type annotation target type value: {0}
 compiler.misc.class.file.wrong.class=\
     class file contains wrong class: {0}
 compiler.misc.class.file.not.found=\
@@ -995,10 +999,7 @@
 #####
 
 compiler.err.not.within.bounds=\
-    type parameter {0} is not within its bound
-
-compiler.err.not.within.bounds.explain=\
-    type parameter {0} is not within its bound; {1}
+    type argument {0} is not within bounds of type-variable {1}
 
 ## The following are all possible strings for the second argument ({1}) of the
 ## above string.
@@ -1065,6 +1066,8 @@
     class
 compiler.misc.type.req.class.array=\
     class or array
+compiler.misc.type.req.array.or.iterable=\
+    array or java.lang.Iterable
 compiler.misc.type.req.ref=\
     reference
 compiler.misc.type.req.exact=\
@@ -1148,22 +1151,31 @@
     symbol: {0} <{2}>{1}({3})
 
 ## arguments from {0} to {3} have the same meaning as above
-## The fifth argument {4} is the location "kindname" (e.g. 'constructor', 'field', etc.)
-## The sixth argument {5} is the location type
+## The fifth argument {4} is a location subdiagnostic (see below)
 compiler.err.cant.resolve.location=\
     cannot find symbol\n\
     symbol:   {0} {1}\n\
-    location: {4} {5}
+    location: {4}
 
 compiler.err.cant.resolve.location.args=\
     cannot find symbol\n\
     symbol:   {0} {1}({3})\n\
-    location: {4} {5}
+    location: {4}
 
 compiler.err.cant.resolve.location.args.params=\
     cannot find symbol\n\
     symbol:   {0} <{2}>{1}({3})\n\
-    location: {4} {5}
+    location: {4}
+
+##a location subdiagnostic is composed as follows:
+## The first argument {0} is the location "kindname" (e.g. 'constructor', 'field', etc.)
+## The second argument {1} is the location name
+## The third argument {2} is the location type (only when {1} is a variable name)
+
+compiler.misc.location=\
+    {0} {1}
+compiler.misc.location.1=\
+    {0} {1} of type {2}
 
 ## The following are all possible string for "kindname".
 ## They should be called whatever the JLS calls them after it been translated
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -640,7 +640,6 @@
         public JCExpression restype;
         public List<JCTypeParameter> typarams;
         public List<JCVariableDecl> params;
-        public List<JCTypeAnnotation> receiverAnnotations;
         public List<JCExpression> thrown;
         public JCBlock body;
         public JCExpression defaultValue; // for annotation types
@@ -650,7 +649,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue,
@@ -661,7 +659,6 @@
             this.restype = restype;
             this.typarams = typarams;
             this.params = params;
-            this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
             this.thrown = thrown;
             this.body = body;
             this.defaultValue = defaultValue;
@@ -680,7 +677,6 @@
         public List<JCVariableDecl> getParameters() {
             return params;
         }
-        public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
         public List<JCExpression> getThrows() {
             return thrown;
         }
@@ -1402,8 +1398,6 @@
     public static class JCNewArray extends JCExpression implements NewArrayTree {
         public JCExpression elemtype;
         public List<JCExpression> dims;
-        public List<JCTypeAnnotation> annotations;
-        public List<List<JCTypeAnnotation>> dimAnnotations;
         public List<JCExpression> elems;
         protected JCNewArray(JCExpression elemtype,
                            List<JCExpression> dims,
@@ -1411,8 +1405,6 @@
         {
             this.elemtype = elemtype;
             this.dims = dims;
-            this.annotations = List.nil();
-            this.dimAnnotations = List.nil();
             this.elems = elems;
         }
         @Override
@@ -1923,11 +1915,9 @@
     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
         public Name name;
         public List<JCExpression> bounds;
-        public List<JCTypeAnnotation> annotations;
-        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
+        protected JCTypeParameter(Name name, List<JCExpression> bounds) {
             this.name = name;
             this.bounds = bounds;
-            this.annotations = annotations;
         }
         @Override
         public void accept(Visitor v) { v.visitTypeParameter(this); }
@@ -1937,9 +1927,6 @@
         public List<JCExpression> getBounds() {
             return bounds;
         }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
         @Override
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeParameter(this, d);
@@ -2030,16 +2017,6 @@
         }
     }
 
-    public static class JCTypeAnnotation extends JCAnnotation {
-        public TypeAnnotationPosition annotation_position;
-        public Attribute.TypeCompound attribute_field;
-
-        protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-            super(annotationType, args);
-            this.annotation_position = new TypeAnnotationPosition();
-        }
-    }
-
     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
         public long flags;
         public List<JCAnnotation> annotations;
@@ -2067,40 +2044,6 @@
         }
     }
 
-    public static class JCAnnotatedType extends JCExpression
-//308            implements com.sun.source.tree.AnnotatedTypeTree
-    {
-        public List<JCTypeAnnotation> annotations;
-        public JCExpression underlyingType;
-        protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-            throw new UnsupportedOperationException();
-//308            this.annotations = annotations;
-//308            this.underlyingType = underlyingType;
-        }
-        @Override
-        public void accept(Visitor v) { v.visitAnnotatedType(this); }
-
-        public Kind getKind() {
-            throw new UnsupportedOperationException();
-//308            return Kind.ANNOTATED_TYPE;
-        }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
-        public JCExpression getUnderlyingType() {
-            return underlyingType;
-        }
-        @Override
-        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
-            throw new UnsupportedOperationException();
-//308            return v.visitAnnotatedType(this, d);
-        }
-        @Override
-        public int getTag() {
-            return ANNOTATED_TYPE;
-        }
-    }
-
     public static class JCErroneous extends JCExpression
             implements com.sun.source.tree.ErroneousTree {
         public List<? extends JCTree> errs;
@@ -2168,7 +2111,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue);
@@ -2290,11 +2232,10 @@
         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
         public void visitModifiers(JCModifiers that)         { visitTree(that); }
-        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
         public void visitErroneous(JCErroneous that)         { visitTree(that); }
         public void visitLetExpr(LetExpr that)               { visitTree(that); }
 
-        public void visitTree(JCTree that)                   { assert false; }
+        public void visitTree(JCTree that)                   { Assert.error(); }
     }
 
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -224,15 +224,6 @@
         }
     }
 
-    public void printTypeAnnotations(List<JCTypeAnnotation> trees) throws IOException {
-        if (trees.nonEmpty())
-            print(" ");
-        for (List<JCTypeAnnotation> l = trees; l.nonEmpty(); l = l.tail) {
-            printExpr(l.head);
-            print(" ");
-        }
-    }
-
     /** Print documentation comment, if it exists
      *  @param tree    The tree for which a documentation comment should be printed.
      */
@@ -890,33 +881,21 @@
         try {
             if (tree.elemtype != null) {
                 print("new ");
-                printTypeAnnotations(tree.annotations);
                 JCTree elem = tree.elemtype;
-                printBaseElementType(elem);
-                boolean isElemAnnoType = elem instanceof JCAnnotatedType;
-                int i = 0;
-                List<List<JCTypeAnnotation>> da = tree.dimAnnotations;
+                if (elem.getTag() == JCTree.TYPEARRAY)
+                    printBaseElementType((JCArrayTypeTree) elem);
+                else
+                    printExpr(elem);
                 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
-                    if (da.size() > i) {
-                        printTypeAnnotations(da.get(i));
-                    }
                     print("[");
-                    i++;
                     printExpr(l.head);
                     print("]");
                 }
-                if (tree.elems != null) {
-                    if (isElemAnnoType) {
-                        printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
-                    }
-                    print("[]");
-                }
-                if (isElemAnnoType)
-                    elem = ((JCAnnotatedType)elem).underlyingType;
                 if (elem instanceof JCArrayTypeTree)
                     printBrackets((JCArrayTypeTree) elem);
             }
             if (tree.elems != null) {
+                if (tree.elemtype != null) print("[]");
                 print("{");
                 printExprs(tree.elems);
                 print("}");
@@ -1173,11 +1152,6 @@
         JCTree elem;
         while (true) {
             elem = tree.elemtype;
-            if (elem.getTag() == JCTree.ANNOTATED_TYPE) {
-                JCAnnotatedType atype = (JCAnnotatedType) elem;
-                printTypeAnnotations(atype.annotations);
-                elem = atype.underlyingType;
-            }
             print("[]");
             if (elem.getTag() != JCTree.TYPEARRAY) break;
             tree = (JCArrayTypeTree) elem;
@@ -1272,15 +1246,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        try {
-            printTypeAnnotations(tree.annotations);
-            printExpr(tree.underlyingType);
-        } catch (IOException e) {
-            throw new UncheckedIOException(e);
-        }
-    }
-
     public void visitTree(JCTree tree) {
         try {
             print("(UNKNOWN: " + tree + ")");
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -71,13 +71,6 @@
         return lb.toList();
     }
 
-//308    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        JCAnnotatedType t = (JCAnnotatedType) node;
-//308        List<JCTypeAnnotation> annotations = copy(t.annotations, p);
-//308        JCExpression underlyingType = copy(t.underlyingType, p);
-//308        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
-//308    }
-
     public JCTree visitAnnotation(AnnotationTree node, P p) {
         JCAnnotation t = (JCAnnotation) node;
         JCTree annotationType = copy(t.annotationType, p);
@@ -240,11 +233,10 @@
         JCExpression restype = copy(t.restype, p);
         List<JCTypeParameter> typarams = copy(t.typarams, p);
         List<JCVariableDecl> params = copy(t.params, p);
-        List<JCTypeAnnotation> receiver = copy(t.receiverAnnotations, p);
         List<JCExpression> thrown = copy(t.thrown, p);
         JCBlock body = copy(t.body, p);
         JCExpression defaultValue = copy(t.defaultValue, p);
-        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, receiver, thrown, body, defaultValue);
+        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue);
     }
 
     public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
@@ -372,9 +364,8 @@
 
     public JCTree visitTypeParameter(TypeParameterTree node, P p) {
         JCTypeParameter t = (JCTypeParameter) node;
-        List<JCTypeAnnotation> annos = copy(t.annotations, p);
         List<JCExpression> bounds = copy(t.bounds, p);
-        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
+        return M.at(t.pos).TypeParameter(t.name, bounds);
     }
 
     public JCTree visitInstanceOf(InstanceOfTree node, P p) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -311,12 +311,6 @@
         case(JCTree.POSTINC):
         case(JCTree.POSTDEC):
             return getStartPos(((JCUnary) tree).arg);
-        case(JCTree.ANNOTATED_TYPE): {
-            JCAnnotatedType node = (JCAnnotatedType) tree;
-            if (node.annotations.nonEmpty())
-                return getStartPos(node.annotations.head);
-            return getStartPos(node.underlyingType);
-        }
         case(JCTree.NEWCLASS): {
             JCNewClass node = (JCNewClass)tree;
             if (node.encl != null)
@@ -420,8 +414,6 @@
             return getEndPos(((JCUnary) tree).arg, endPositions);
         case(JCTree.WHILELOOP):
             return getEndPos(((JCWhileLoop) tree).body, endPositions);
-        case(JCTree.ANNOTATED_TYPE):
-            return getEndPos(((JCAnnotatedType) tree).underlyingType, endPositions);
         case(JCTree.ERRONEOUS): {
             JCErroneous node = (JCErroneous)tree;
             if (node.errs != null && node.errs.nonEmpty())
@@ -453,7 +445,7 @@
     public static int finalizerPos(JCTree tree) {
         if (tree.getTag() == JCTree.TRY) {
             JCTry t = (JCTry) tree;
-            assert t.finalizer != null;
+            Assert.checkNonNull(t.finalizer);
             return firstStatPos(t.finalizer);
         } else if (tree.getTag() == JCTree.SYNCHRONIZED) {
             return endPos(((JCSynchronized) tree).body);
@@ -909,8 +901,6 @@
      */
     public static JCExpression typeIn(JCExpression tree) {
         switch (tree.getTag()) {
-        case JCTree.ANNOTATED_TYPE:
-            return ((JCAnnotatedType)tree).underlyingType;
         case JCTree.IDENT: /* simple names */
         case JCTree.TYPEIDENT: /* primitive name */
         case JCTree.SELECT: /* qualified name */
@@ -930,8 +920,6 @@
             return innermostType(((JCArrayTypeTree)type).elemtype);
         case JCTree.WILDCARD:
             return innermostType(((JCWildcard)type).inner);
-        case JCTree.ANNOTATED_TYPE:
-            return innermostType(((JCAnnotatedType)type).underlyingType);
         default:
             return type;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -122,15 +122,15 @@
     public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
                                       JCExpression pid,
                                       List<JCTree> defs) {
-        assert packageAnnotations != null;
+        Assert.checkNonNull(packageAnnotations);
         for (JCTree node : defs)
-            assert node instanceof JCClassDecl
+            Assert.check(node instanceof JCClassDecl
                 || node instanceof JCImport
                 || node instanceof JCSkip
                 || node instanceof JCErroneous
                 || (node instanceof JCExpressionStatement
-                    && ((JCExpressionStatement)node).expr instanceof JCErroneous)
-                 : node.getClass().getSimpleName();
+                    && ((JCExpressionStatement)node).expr instanceof JCErroneous),
+                node.getClass().getSimpleName());
         JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
                                      null, null, null, null);
         tree.pos = pos;
@@ -169,27 +169,11 @@
                                List<JCExpression> thrown,
                                JCBlock body,
                                JCExpression defaultValue) {
-        return MethodDef(
-                mods, name, restype, typarams, params,
-                null, thrown, body, defaultValue);
-    }
-
-    public JCMethodDecl MethodDef(JCModifiers mods,
-                               Name name,
-                               JCExpression restype,
-                               List<JCTypeParameter> typarams,
-                               List<JCVariableDecl> params,
-                               List<JCTypeAnnotation> receiver,
-                               List<JCExpression> thrown,
-                               JCBlock body,
-                               JCExpression defaultValue)
-    {
         JCMethodDecl tree = new JCMethodDecl(mods,
                                        name,
                                        restype,
                                        typarams,
                                        params,
-                                       receiver,
                                        thrown,
                                        body,
                                        defaultValue,
@@ -458,11 +442,7 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
-        return TypeParameter(name, bounds, List.<JCTypeAnnotation>nil());
-    }
-
-    public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
-        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
+        JCTypeParameter tree = new JCTypeParameter(name, bounds);
         tree.pos = pos;
         return tree;
     }
@@ -485,12 +465,6 @@
         return tree;
     }
 
-    public JCTypeAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-        JCTypeAnnotation tree = new JCTypeAnnotation(annotationType, args);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
         JCModifiers tree = new JCModifiers(flags, annotations);
         boolean noFlags = (flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0;
@@ -502,12 +476,6 @@
         return Modifiers(flags, List.<JCAnnotation>nil());
     }
 
-    public JCAnnotatedType AnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-        JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCErroneous Erroneous() {
         return Erroneous(List.<JCTree>nil());
     }
@@ -679,19 +647,14 @@
         }
         return tp.setType(t);
     }
-//where
-        private JCExpression Selectors(JCExpression base, Symbol sym, Symbol limit) {
-            if (sym == limit) return base;
-            else return Select(Selectors(base, sym.owner, limit), sym);
-        }
 
     /** Create a list of trees representing given list of types.
      */
     public List<JCExpression> Types(List<Type> ts) {
-        ListBuffer<JCExpression> types = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
         for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
-            types.append(Type(l.head));
-        return types.toList();
+            lb.append(Type(l.head));
+        return lb.toList();
     }
 
     /** Create a variable definition from a variable symbol and an initializer
@@ -821,7 +784,6 @@
                 Type(mtype.getReturnType()),
                 TypeParams(mtype.getTypeArguments()),
                 Params(mtype.getParameterTypes(), m),
-                null,
                 Types(mtype.getThrownTypes()),
                 body,
                 null,
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -85,7 +85,6 @@
         scan(tree.restype);
         scan(tree.typarams);
         scan(tree.params);
-        scan(tree.receiverAnnotations);
         scan(tree.thrown);
         scan(tree.defaultValue);
         scan(tree.body);
@@ -208,11 +207,8 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        scan(tree.annotations);
         scan(tree.elemtype);
         scan(tree.dims);
-        for (List<JCTypeAnnotation> annos : tree.dimAnnotations)
-            scan(annos);
         scan(tree.elems);
     }
 
@@ -281,7 +277,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        scan(tree.annotations);
         scan(tree.bounds);
     }
 
@@ -305,11 +300,6 @@
         scan(tree.args);
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        scan(tree.annotations);
-        scan(tree.underlyingType);
-    }
-
     public void visitErroneous(JCErroneous tree) {
     }
 
@@ -319,6 +309,6 @@
     }
 
     public void visitTree(JCTree tree) {
-        assert false;
+        Assert.error();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -283,11 +283,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        tree.annotations = translate(tree.annotations);
-        List<List<JCTypeAnnotation>> dimAnnos = List.nil();
-        for (List<JCTypeAnnotation> origDimAnnos : tree.dimAnnotations)
-            dimAnnos = dimAnnos.append(translate(origDimAnnos));
-        tree.dimAnnotations = dimAnnos;
         tree.elemtype = translate(tree.elemtype);
         tree.dims = translate(tree.dims);
         tree.elems = translate(tree.elems);
@@ -374,7 +369,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        tree.annotations = translate(tree.annotations);
         tree.bounds = translate(tree.bounds);
         result = tree;
     }
@@ -412,12 +406,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.annotations = translate(tree.annotations);
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree;
-    }
-
     public void visitTree(JCTree tree) {
         throw new AssertionError(tree);
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -117,7 +117,7 @@
     protected abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
 
     public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
-        assert (d.getPosition() != Position.NOPOS);
+        Assert.check(d.getPosition() != Position.NOPOS);
         return String.valueOf(getPosition(d, pk));
     }
     //where
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Assert.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 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.  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.javac.util;
+
+
+/**
+ * Simple facility for unconditional assertions.
+ * The methods in this class are described in terms of equivalent assert
+ * statements, assuming that assertions have been enabled.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class Assert {
+    /** Equivalent to
+     *   assert cond;
+     */
+    public static void check(boolean cond) {
+        if (!cond)
+            error();
+    }
+
+    /** Equivalent to
+     *   assert (o == null);
+     */
+    public static void checkNull(Object o) {
+        if (o != null)
+            error();
+    }
+
+    /** Equivalent to
+     *   assert (t != null); return t;
+     */
+    public static <T> T checkNonNull(T t) {
+        if (t == null)
+            error();
+        return t;
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, int value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, long value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, Object value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, String msg) {
+        if (!cond)
+            error(msg);
+    }
+
+    /** Equivalent to
+     *   assert (o == null) : value;
+     */
+    public static void checkNull(Object o, Object value) {
+        if (o != null)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert (o == null) : value;
+     */
+    public static void checkNull(Object o, String msg) {
+        if (o != null)
+            error(msg);
+    }
+
+    /** Equivalent to
+     *   assert (o != null) : value;
+     */
+    public static <T> T checkNonNull(T t, String msg) {
+        if (t == null)
+            error(msg);
+        return t;
+    }
+
+    /** Equivalent to
+     *   assert false;
+     */
+    public static void error() {
+        throw new AssertionError();
+    }
+
+    /** Equivalent to
+     *   assert false : msg;
+     */
+    public static void error(String msg) {
+        throw new AssertionError(msg);
+    }
+
+    /** Prevent instantiation. */
+    private Assert() { }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -85,7 +85,7 @@
     /** Include x in this set.
      */
     public void incl(int x) {
-        assert x >= 0;
+        Assert.check(x >= 0);
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] |
             (1 << (x & wordmask));
@@ -113,7 +113,7 @@
     /** Exclude x from this set.
      */
     public void excl(int x) {
-        assert x >= 0;
+        Assert.check(x >= 0);
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] &
             ~(1 << (x & wordmask));
@@ -169,7 +169,7 @@
      *  Delight" by Henry S. Warren Jr. (figure 5-13)
      */
     private static int trailingZeroBits(int x) {
-        assert wordlen == 32;
+        Assert.check(wordlen == 32);
         if (x == 0) return 32;
         int n = 1;
         if ((x & 0xffff) == 0) { n += 16; x >>>= 16; }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -145,7 +145,7 @@
             o = fac.make();
             if (o instanceof Factory<?>)
                 throw new AssertionError("T extends Context.Factory");
-            assert ht.get(key) == o;
+            Assert.check(ht.get(key) == o);
         }
 
         /* The following cast can't fail unless there was
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -184,7 +184,7 @@
         // return this.prependList(xs.tail).prepend(xs.head);
         List<A> result = this;
         List<A> rev = xs.reverse();
-        assert rev != xs;
+        Assert.check(rev != xs);
         // since xs.reverse() returned a new list, we can reuse the
         // individual List objects, instead of allocating new ones.
         while (rev.nonEmpty()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Feb 04 16:29:41 2011 -0800
@@ -74,7 +74,6 @@
     public final Name serialVersionUID;
     public final Name java_lang_Enum;
     public final Name java_dyn_MethodHandle;
-    public final Name java_dyn_InvokeDynamic;
     public final Name package_info;
     public final Name ConstantValue;
     public final Name LineNumberTable;
@@ -115,7 +114,6 @@
     public final Name value;
     public final Name getMessage;
     public final Name getClass;
-    public final Name invoke;  //allowTransitionalJSR292 only
     public final Name TYPE;
     public final Name TYPE_USE;
     public final Name TYPE_PARAMETER;
@@ -186,7 +184,6 @@
         java_io_Serializable = fromString("java.io.Serializable");
         java_lang_Enum = fromString("java.lang.Enum");
         java_dyn_MethodHandle = fromString("java.dyn.MethodHandle");
-        java_dyn_InvokeDynamic = fromString("java.dyn.InvokeDynamic");
         package_info = fromString("package-info");
         serialVersionUID = fromString("serialVersionUID");
         ConstantValue = fromString("ConstantValue");
@@ -230,7 +227,6 @@
         value = fromString("value");
         getMessage = fromString("getMessage");
         getClass = fromString("getClass");
-        invoke = fromString("invoke");  //allowTransitionalJSR292 only
 
         TYPE = fromString("TYPE");
         TYPE_USE = fromString("TYPE_USE");
--- a/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -107,7 +107,7 @@
                     hashes[h] = firstTableEntry = element.next;
                 }
                 else {
-                    assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
+                    Assert.checkNonNull(previousNonNullTableEntry, "previousNonNullTableEntry cannot be null here.");
                     previousNonNullTableEntry.next = element.next;
                 }
             }
@@ -133,7 +133,7 @@
             hashes[h] = newEntry;
         }
         else {
-            assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
+            Assert.checkNull(previousNonNullTableEntry.next, "previousNonNullTableEntry.next must be null.");
             previousNonNullTableEntry.next = newEntry;
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -26,7 +26,6 @@
 package com.sun.tools.javap;
 
 import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.ExtendedAnnotation;
 import com.sun.tools.classfile.Annotation.Annotation_element_value;
 import com.sun.tools.classfile.Annotation.Array_element_value;
 import com.sun.tools.classfile.Annotation.Class_element_value;
@@ -77,129 +76,6 @@
             print(")");
     }
 
-    public void write(ExtendedAnnotation annot) {
-        write(annot, true, false);
-    }
-
-    public void write(ExtendedAnnotation annot, boolean showOffsets, boolean resolveIndices) {
-        write(annot.annotation, resolveIndices);
-        print(": ");
-        write(annot.position, showOffsets);
-    }
-
-    public void write(ExtendedAnnotation.Position pos, boolean showOffsets) {
-        print(pos.type);
-
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            print(", {");
-            for (int i = 0; i < pos.lvarOffset.length; ++i) {
-                if (i != 0) print("; ");
-                if (showOffsets) {
-                    print(", start_pc=");
-                    print(pos.lvarOffset[i]);
-                }
-                print(", length=");
-                print(pos.lvarLength[i]);
-                print(", index=");
-                print(pos.lvarIndex[i]);
-            }
-            print("}");
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // type parameters bound
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            print(", bound_index=");
-            print(pos.bound_index);
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            print(", wild_card=");
-            print(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // throws
-        case THROWS:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + pos.type);
-        }
-
-        // Append location data for generics/arrays.
-        if (pos.type.hasLocation()) {
-            print(", location=");
-            print(pos.location);
-        }
-    }
-
     public void write(Annotation.element_value_pair pair) {
         write(pair, false);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,6 +31,7 @@
 import com.sun.tools.classfile.AnnotationDefault_attribute;
 import com.sun.tools.classfile.Attribute;
 import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
 import com.sun.tools.classfile.CharacterRangeTable_attribute;
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.CompilationID_attribute;
@@ -47,10 +48,8 @@
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.Signature_attribute;
 import com.sun.tools.classfile.SourceDebugExtension_attribute;
 import com.sun.tools.classfile.SourceFile_attribute;
@@ -153,6 +152,25 @@
         return null;
     }
 
+    public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
+        println(Attribute.BootstrapMethods + ":");
+        for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
+            BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
+            indent(+1);
+            print(i + ": #" + bsm.bootstrap_method_ref + " ");
+            println(constantWriter.stringValue(bsm.bootstrap_method_ref));
+            indent(+1);
+            println("Method arguments:");
+            indent(+1);
+            for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
+                print("#" + bsm.bootstrap_arguments[j] + " ");
+                println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
+            }
+            indent(-3);
+        }
+        return null;
+    }
+
     public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
         println("CharacterRangeTable:");
         indent(+1);
@@ -392,30 +410,6 @@
         return null;
     }
 
-    public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeVisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
-    public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeInvisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
     public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleParameterAnnotations:");
         indent(+1);
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -64,7 +64,6 @@
         stackMapWriter = StackMapWriter.instance(context);
         localVariableTableWriter = LocalVariableTableWriter.instance(context);
         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
-        typeAnnotationWriter = TypeAnnotationWriter.instance(context);
         options = Options.instance(context);
     }
 
@@ -266,11 +265,6 @@
             detailWriters.add(tryBlockWriter);
         }
 
-        if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
-            typeAnnotationWriter.reset(attr);
-            detailWriters.add(typeAnnotationWriter);
-        }
-
         return detailWriters;
     }
 
@@ -279,7 +273,6 @@
     private ConstantWriter constantWriter;
     private LocalVariableTableWriter localVariableTableWriter;
     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
-    private TypeAnnotationWriter typeAnnotationWriter;
     private SourceWriter sourceWriter;
     private StackMapWriter stackMapWriter;
     private TryBlockWriter tryBlockWriter;
--- a/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -97,6 +97,13 @@
                 return 1;
             }
 
+            public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+                print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
             public Integer visitLong(CONSTANT_Long_info info, Void p) {
                 println(stringValue(info));
                 return 2;
@@ -116,6 +123,20 @@
                 return 1;
             }
 
+            public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+                print("#" + info.reference_kind.tag + ":#" + info.reference_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
+            public Integer visitMethodType(CONSTANT_MethodType_info info, Void p) {
+                print("#" + info.descriptor_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
             public Integer visitString(CONSTANT_String_info info, Void p) {
                 print("#" + info.string_index);
                 tab();
@@ -201,14 +222,20 @@
                 return "String";
             case CONSTANT_Fieldref:
                 return "Field";
+            case CONSTANT_MethodHandle:
+                return "MethodHandle";
+            case CONSTANT_MethodType:
+                return "MethodType";
             case CONSTANT_Methodref:
                 return "Method";
             case CONSTANT_InterfaceMethodref:
                 return "InterfaceMethod";
+            case CONSTANT_InvokeDynamic:
+                return "InvokeDynamic";
             case CONSTANT_NameAndType:
                 return "NameAndType";
             default:
-                return "(unknown tag)";
+                return "(unknown tag " + tag + ")";
         }
     }
 
@@ -264,6 +291,15 @@
             return visitRef(info, p);
         }
 
+        public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+            try {
+                String callee = stringValue(info.getNameAndTypeInfo());
+                return "#" + info.bootstrap_method_attr_index + ":" + callee;
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         public String visitLong(CONSTANT_Long_info info, Void p) {
             return info.value + "l";
         }
@@ -288,6 +324,22 @@
             }
         }
 
+        public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+            try {
+                return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
+        public String visitMethodType(CONSTANT_MethodType_info info, Void p) {
+            try {
+                return info.getType();
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
             return visitRef(info, p);
         }
@@ -347,7 +399,6 @@
         }
     }
 
-
     /* If name is a valid binary name, return it; otherwise quote it. */
     private static String checkName(String name) {
         if (name == null)
--- a/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -42,13 +42,13 @@
         LOCAL_VAR_TYPES("localVariableTypes"),
         SOURCE("source"),
         STACKMAPS("stackMaps"),
-        TRY_BLOCKS("tryBlocks"),
-        TYPE_ANNOS("typeAnnotations");
+        TRY_BLOCKS("tryBlocks");
         Kind(String option) {
             this.option = option;
         }
         final String option;
     }
+
     InstructionDetailWriter(Context context) {
         super(context);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * 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.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ExtendedAnnotation;
-import com.sun.tools.classfile.ExtendedAnnotation.Position;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about type annotations.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class TypeAnnotationWriter extends InstructionDetailWriter {
-    public enum NoteKind { VISIBLE, INVISIBLE };
-    public static class Note {
-        Note(NoteKind kind, ExtendedAnnotation anno) {
-            this.kind = kind;
-            this.anno = anno;
-        }
-        public final NoteKind kind;
-        public final ExtendedAnnotation anno;
-    }
-
-    static TypeAnnotationWriter instance(Context context) {
-        TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
-        if (instance == null)
-            instance = new TypeAnnotationWriter(context);
-        return instance;
-    }
-
-    protected TypeAnnotationWriter(Context context) {
-        super(context);
-        context.put(TypeAnnotationWriter.class, this);
-        annotationWriter = AnnotationWriter.instance(context);
-        classWriter = ClassWriter.instance(context);
-    }
-
-    public void reset(Code_attribute attr) {
-        Method m = classWriter.getMethod();
-        pcMap = new HashMap<Integer, List<Note>>();
-        check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
-        check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
-    }
-
-    private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
-        if (attr == null)
-            return;
-
-        for (ExtendedAnnotation anno: attr.annotations) {
-            Position p = anno.position;
-            Note note = null;
-            if (p.offset != -1)
-                addNote(p.offset, note = new Note(kind, anno));
-            if (p.lvarOffset != null) {
-                for (int i = 0; i < p.lvarOffset.length; i++) {
-                    if (note == null)
-                        note = new Note(kind, anno);
-                    addNote(p.lvarOffset[i], note);
-                }
-            }
-        }
-    }
-
-    private void addNote(int pc, Note note) {
-        List<Note> list = pcMap.get(pc);
-        if (list == null)
-            pcMap.put(pc, list = new ArrayList<Note>());
-        list.add(note);
-    }
-
-    @Override
-    void writeDetails(Instruction instr) {
-        String indent = space(2); // get from Options?
-        int pc = instr.getPC();
-        List<Note> notes = pcMap.get(pc);
-        if (notes != null) {
-            for (Note n: notes) {
-                print(indent);
-                print("@");
-                annotationWriter.write(n.anno, false, true);
-                print(", ");
-                println(n.kind.toString().toLowerCase());
-            }
-        }
-    }
-
-    private AnnotationWriter annotationWriter;
-    private ClassWriter classWriter;
-    private Map<Integer, List<Note>> pcMap;
-}
--- a/langtools/src/share/classes/javax/tools/JavaCompiler.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/javax/tools/JavaCompiler.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -137,9 +137,9 @@
  *       StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
  *       compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits).call();
  *
- *       for (Diagnostic diagnostic : diagnostics.getDiagnostics())
- *           System.out.format("Error on line %d in %d%n",
- *                             diagnostic.getLineNumber()
+ *       for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics())
+ *           System.out.format("Error on line %d in %s%n",
+ *                             diagnostic.getLineNumber(),
  *                             diagnostic.getSource().toUri());
  *
  *       fileManager.close();</pre>
--- a/langtools/src/share/classes/javax/tools/ToolProvider.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/src/share/classes/javax/tools/ToolProvider.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -172,7 +172,7 @@
     {
         // try loading class directly, in case tool is on the bootclasspath
         try {
-            return enableAsserts(Class.forName(toolClassName, false, null));
+            return Class.forName(toolClassName, false, null);
         } catch (ClassNotFoundException e) {
             trace(FINE, e);
 
@@ -194,27 +194,10 @@
                 trace(FINE, urls[0].toString());
 
                 cl = URLClassLoader.newInstance(urls);
-                cl.setPackageAssertionStatus("com.sun.tools.javac", true);
                 refToolClassLoader = new WeakReference<ClassLoader>(cl);
             }
 
             return Class.forName(toolClassName, false, cl);
         }
-
     }
-
-    private static Class<?> enableAsserts(Class<?> cls) {
-        try {
-            ClassLoader loader = cls.getClassLoader();
-            if (loader != null)
-                loader.setPackageAssertionStatus("com.sun.tools.javac", true);
-            else
-                trace(FINE, "loader == null");
-        } catch (SecurityException ex) {
-            trace(FINE, ex);
-        }
-        return cls;
-    }
-
-
 }
--- a/langtools/test/tools/javac/6304921/T6304921.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6304921/T6304921.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,7 +1,7 @@
 T6304921.java:29:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
 T6304921.java:29:30: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.ArrayList, java.util.List<java.lang.Integer>
 - compiler.err.warnings.and.werror
-T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , kindname.class, java.lang.System
-T6304921.java:38:20: compiler.err.operator.cant.be.applied: +, int,boolean
+T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , (compiler.misc.location: kindname.class, java.lang.System, null)
+T6304921.java:38:20: compiler.err.operator.cant.be.applied.1: +, int, boolean
 3 errors
 2 warnings
--- a/langtools/test/tools/javac/6330920/T6330920.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6330920/T6330920.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,2 +1,2 @@
-T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , kindname.class, T6330920
+T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , (compiler.misc.location: kindname.class, T6330920, null)
 1 error
--- a/langtools/test/tools/javac/6717241/T6717241a.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6717241/T6717241a.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,4 +1,4 @@
-T6717241a.java:13:21: compiler.err.cant.resolve: kindname.variable, v, , 
-T6717241a.java:15:10: compiler.err.cant.resolve.args: kindname.method, m1, , int,java.lang.String
-T6717241a.java:17:10: compiler.err.cant.resolve.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String
+T6717241a.java:13:21: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location.1: kindname.variable, x, X)
+T6717241a.java:15:10: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, (compiler.misc.location.1: kindname.variable, x, X)
+T6717241a.java:17:10: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, (compiler.misc.location.1: kindname.variable, x, X)
 3 errors
--- a/langtools/test/tools/javac/6717241/T6717241b.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6717241/T6717241b.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,4 +1,4 @@
-T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , kindname.class, T6717241b
-T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, kindname.class, T6717241b
-T6717241b.java:16:18: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, kindname.class, T6717241b
+T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location: kindname.class, T6717241b, null)
+T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, (compiler.misc.location: kindname.class, T6717241b, null)
+T6717241b.java:16:18: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, (compiler.misc.location: kindname.class, T6717241b, null)
 3 errors
--- a/langtools/test/tools/javac/6857948/T6857948.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6857948/T6857948.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
-T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
+T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , (compiler.misc.location: kindname.class, Test, null)
 T6857948.java:16:50: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, (compiler.misc.arg.length.mismatch)
 2 errors
--- a/langtools/test/tools/javac/6863465/T6863465c.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6863465/T6863465c.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
-T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , kindname.class, T6863465c.z
+T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , (compiler.misc.location: kindname.class, T6863465c.z, null)
 T6863465c.java:11:12: compiler.err.cyclic.inheritance: T6863465c.z
 2 errors
--- a/langtools/test/tools/javac/6863465/T6863465d.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/6863465/T6863465d.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
-T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , kindname.class, T6863465d.c
+T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , (compiler.misc.location: kindname.class, T6863465d.c, null)
 T6863465d.java:11:12: compiler.err.cyclic.inheritance: T6863465d.c
 2 errors
--- a/langtools/test/tools/javac/InnerNamedConstant_2.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/InnerNamedConstant_2.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
-InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl
-InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
+InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
 InnerNamedConstant_2.java:25:13: compiler.err.cant.assign.val.to.final.var: z
-InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
 4 errors
--- a/langtools/test/tools/javac/T6247324.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/T6247324.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,2 +1,2 @@
-T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , kindname.class, Pair<X,Y>
+T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , (compiler.misc.location: kindname.class, Pair, null)
 1 error
--- a/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
-ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
-ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
+ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
+ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/T6419926.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 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     6419926
+ * @summary JSR 199: FileObject.toUri() generates URI without schema (Solaris)
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.tools.*;
+
+public class T6419926 {
+    public static void main(String[] argv) throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>(), null, null);
+        System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
+        mgr.setLocation(StandardLocation.CLASS_OUTPUT,
+                            Collections.singleton(new File(".")));
+
+        FileObject fo = mgr.getFileForOutput(StandardLocation.CLASS_OUTPUT,
+                                "", "file.to.delete", null);
+        URI uri = fo.toUri();
+        System.out.println( uri );
+
+        if (!"file".equals(uri.getScheme()))
+            throw new Exception("unexpected scheme for uri: " + uri.getScheme());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/T6430241.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,237 @@
+    /*
+     * Copyright (c) 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 6430241
+     * @summary Hard to disable symbol file feature through API
+     */
+
+    import java.io.*;
+    import java.util.*;
+    import javax.tools.*;
+
+    import com.sun.source.util.JavacTask;
+    import com.sun.tools.javac.api.JavacTool;
+
+    public class T6430241 {
+        public static void main(String... args) throws Exception {
+            new T6430241().run();
+        }
+
+        void run() throws Exception {
+            setup();
+            testCommandLine();
+            testSimpleAPI();
+            testTaskAPI();
+
+            if (errors > 0)
+                throw new Exception(errors + " errors found");
+        }
+
+        void setup() throws Exception {
+            classesDir = new File("classes");
+            classesDir.mkdirs();
+
+            emptyDir = new File("empty");
+            emptyDir.mkdirs();
+
+            bootClassPath = System.getProperty("sun.boot.class.path");
+
+            File srcDir = new File("src");
+            String test = "import sun.misc.Unsafe; class Test { }";
+            testFile = writeFile(srcDir, "Test.java", test);
+        }
+
+        //----- tests for command line invocation
+
+        void testCommandLine() throws Exception {
+            testCommandLine(true);
+            testCommandLine(true,  "-Xbootclasspath/p:" + emptyDir);
+            testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
+            testCommandLine(true,  "-Xbootclasspath/a:" + emptyDir);
+            testCommandLine(false, "-XDignore.symbol.file");
+            System.err.println();
+        }
+
+        void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
+            System.err.println("test command line: " + Arrays.asList(opts));
+
+            String[] args = initArgs(opts);
+
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            int rc = com.sun.tools.javac.Main.compile(args, pw);
+            String out = showOutput(sw.toString());
+
+            checkCompilationOK(rc);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- tests for simple API invocation
+
+        void testSimpleAPI() {
+            testSimpleAPI(true);
+            testSimpleAPI(true,  "-Xbootclasspath/p:" + emptyDir);
+            testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
+            testSimpleAPI(true,  "-Xbootclasspath/a:" + emptyDir);
+            testSimpleAPI(false, "-XDignore.symbol.file");
+            System.err.println();
+        }
+
+        void testSimpleAPI(boolean expectWarnings, String... opts) {
+            System.err.println("test simple API: " + Arrays.asList(opts));
+
+            String[] args = initArgs(opts);
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            PrintStream ps = new PrintStream(baos);
+
+            JavacTool tool = JavacTool.create();
+            int rc = tool.run(null, null, ps, args);
+
+            String out = showOutput(baos.toString());
+
+            checkCompilationOK(rc);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- tests for CompilationTask API invocation
+
+        void testTaskAPI() throws Exception {
+            List<File> bcp = new ArrayList<File>();
+            for (String f: bootClassPath.split(File.pathSeparator)) {
+                if (!f.isEmpty())
+                    bcp.add(new File(f));
+            }
+
+            testTaskAPI(true, null);
+            testTaskAPI(false, bcp);
+            System.err.println();
+        }
+
+        void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
+            System.err.println("test task API: " + pcp);
+
+            JavacTool tool = JavacTool.create();
+            StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+            if (pcp != null)
+                fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
+
+            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
+
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
+            boolean ok = task.call();
+            String out = showOutput(sw.toString());
+
+            checkCompilationOK(ok);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- utility methods
+
+        /**
+         * Create a file with given content.
+         */
+        File writeFile(File dir, String path, String content) throws IOException {
+            File f = new File(dir, path);
+            f.getParentFile().mkdirs();
+            FileWriter out = new FileWriter(f);
+            try {
+                out.write(content);
+            } finally {
+                out.close();
+            }
+            return f;
+        }
+
+        /**
+         * Initialize args for compilation with given opts.
+         * @return opts -d classesDir testFile
+         */
+        String[] initArgs(String[] opts) {
+            List<String> args = new ArrayList<String>();
+            args.addAll(Arrays.asList(opts));
+            args.add("-d");
+            args.add(classesDir.getPath());
+            args.add(testFile.getPath());
+            return args.toArray(new String[args.size()]);
+        }
+
+        /**
+         * Show output from compilation if non empty.
+         */
+        String showOutput(String out) {
+            if (!out.isEmpty())
+                System.err.println(out);
+            return out;
+        }
+
+        /**
+         * Verify compilation succeeeded.
+         */
+        void checkCompilationOK(boolean ok) {
+            if (!ok)
+                error("compilation failed");
+        }
+
+        /**
+         * Verify compilation succeeeded.
+         */
+        void checkCompilationOK(int rc) {
+            if (rc != 0)
+                error("compilation failed, rc: " + rc);
+        }
+
+        /**
+         * Check whether output contains warnings if and only if warnings
+         * are expected.
+         */
+        void checkOutput(String out, boolean expectWarnings) {
+            boolean foundWarnings = out.contains("warning");
+            if (foundWarnings) {
+                if (!expectWarnings)
+                    error("unexpected warnings found");
+            } else {
+                if (expectWarnings)
+                    error("expected warnings not found");
+            }
+        }
+
+        /**
+         * Report an error.
+         */
+        void error(String msg) {
+            System.err.println("error: " + msg);
+            errors++;
+        }
+
+        String bootClassPath;
+        File classesDir;
+        File emptyDir;
+        File testFile;
+        int errors;
+    }
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Fri Feb 04 16:29:41 2011 -0800
@@ -24,7 +24,6 @@
 compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
 compiler.err.no.match.entry                             # UNUSED?
 compiler.err.not.annotation.type                        # cannot occur given preceding checkType
-compiler.err.not.within.bounds.explain                  # UNUSED?
 compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
 compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
 compiler.err.proc.cant.access                           # completion failure
@@ -43,6 +42,7 @@
 compiler.err.unexpected.type
 compiler.err.unknown.enum.constant                      # in bad class file
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
+compiler.err.wrong.target.for.polymorphic.signature.definition     # Transitional 292
 compiler.misc.assignment.from.super-bound
 compiler.misc.assignment.to.extends-bound
 compiler.misc.bad.class.file.header                     # bad class file
@@ -52,7 +52,6 @@
 compiler.misc.bad.enclosing.method                      # bad class file
 compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
 compiler.misc.bad.signature                             # bad class file
-compiler.misc.bad.type.annotation.value
 compiler.misc.base.membership                           # UNUSED
 compiler.misc.ccf.found.later.version
 compiler.misc.ccf.unrecognized.attribute
@@ -113,4 +112,3 @@
 compiler.warn.unchecked.assign                          # DEAD, replaced by compiler.misc.unchecked.assign
 compiler.warn.unchecked.cast.to.type                    # DEAD, replaced by compiler.misc.unchecked.cast.to.type
 compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
-compiler.warn.wrong.target.for.polymorphic.signature.definition     # Transitional 292
--- a/langtools/test/tools/javac/diags/examples/CantResolve.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/CantResolve.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,9 +23,8 @@
 
 // key: compiler.err.cant.resolve
 
-class CantResolve<T extends Object & java.io.Serializable> {
-    T t;
-    void m() {
-        Object o = t.v;
-    }
+class CantResolve {
+    Object o = new Object() {
+        int i = f;
+    };
 }
--- a/langtools/test/tools/javac/diags/examples/CantResolveArgsParams.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/CantResolveArgsParams.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,9 +23,8 @@
 
 // key: compiler.err.cant.resolve.args.params
 
-class CantResolveArgsParams<T extends Object & java.io.Serializable> {
-    T t;
-    void m() {
-        t.<Integer,Double>m2(1, "");
-    }
+class CantResolveArgsParams {
+    Object o = new Object() {
+        { this.<Integer,Double>m2(1, ""); }
+    };
 }
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocation.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocation.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 
 class CantResolveLocation {
     Unknown y;
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location.args
+// key: compiler.misc.location
 
 class X {
     void m() {
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location.args.params
+// key: compiler.misc.location
 
 import java.util.*;
 
--- a/langtools/test/tools/javac/diags/examples/EnumConstRequired.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.enum.const.req
-
-class EnumConstRequired {
-    enum E { A, B, C };
-
-    void m(E e) {
-        switch (e) {
-            case e:
-                System.err.println("It's me!");
-        }
-    }
-}
--- a/langtools/test/tools/javac/diags/examples/ForeachNotApplicable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/ForeachNotApplicable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.foreach.not.applicable.to.type
+// key: compiler.misc.type.req.array.or.iterable
 
 class ForeachNotApplicable {
     void m(String arg) {
--- a/langtools/test/tools/javac/diags/examples/KindnameClass.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/KindnameClass.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- a/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,6 +24,7 @@
 // key: compiler.misc.kindname.method
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location.args
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- a/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,6 +24,7 @@
 // key: compiler.misc.kindname.variable
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Location.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 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.
+ */
+
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
+
+class Location {
+    { Object o = v; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Location1.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 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.
+ */
+
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.location.1
+
+class Location1 {
+    Object o = null;
+    { Object o2 = o.v; }
+}
--- a/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,5 +24,6 @@
 // key: compiler.err.operator.cant.be.applied
 
 class OperatorCantBeApplied {
-    String s = ("a" - "b");
+    String s = null;
+    { s++; }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied1.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 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.
+ */
+
+// key: compiler.err.operator.cant.be.applied.1
+
+class OperatorCantBeApplied1 {
+    String s = ("a" - "b");
+}
--- a/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.static.imp.only.classes.and.interfaces
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 
 import static p.Other.array.length;
 
--- a/langtools/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.type.parameter.on.polymorphic.signature
-// key: compiler.err.unreported.exception.need.to.catch.or.throw
-
-import java.dyn.MethodHandle;
-
-class TypeParameterOnPolymorphicSignature {
-    void test(MethodHandle mh) {
-        mh.<void>invokeExact("",123);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsAndOldArraySyntax.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 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.
+ */
+
+// key: compiler.err.varargs.and.old.array.syntax
+
+class VarargsAndOldArraySyntax {
+    void  m1 (Integer... i[]) { }
+}
--- a/langtools/test/tools/javac/failover/FailOver01.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/failover/FailOver01.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
 FailOver01.java:10:22: compiler.err.expected: ';'
-FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, Test
+FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, Test, null)
 2 errors
--- a/langtools/test/tools/javac/failover/FailOver02.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/failover/FailOver02.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
 FailOver02.java:10:1: compiler.err.does.not.override.abstract: Test, close(), java.lang.AutoCloseable
-FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , kindname.class, Test
+FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , (compiler.misc.location: kindname.class, Test, null)
 2 errors
--- a/langtools/test/tools/javac/failover/FailOver04.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/failover/FailOver04.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,2 +1,2 @@
-FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , kindname.class, Test
+FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , (compiler.misc.location: kindname.class, Test, null)
 1 error
--- a/langtools/test/tools/javac/generics/6711619/T6711619a.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/6711619/T6711619a.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,5 +1,5 @@
-T6711619a.java:40:14: compiler.err.cant.resolve.args: kindname.method, a, , 
-T6711619a.java:41:14: compiler.err.cant.resolve.args: kindname.method, b, , 
+T6711619a.java:40:14: compiler.err.cant.resolve.location.args: kindname.method, a, , , (compiler.misc.location.1: kindname.variable, t, T)
+T6711619a.java:41:14: compiler.err.cant.resolve.location.args: kindname.method, b, , , (compiler.misc.location.1: kindname.variable, t, T)
 T6711619a.java:46:19: compiler.err.report.access: a, private, T6711619a.A
 T6711619a.java:47:19: compiler.err.report.access: b, private, T6711619a.B
 T6711619a.java:48:19: compiler.err.report.access: a, private, T6711619a.A
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg01.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,29 +1,29 @@
-Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X>
+Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01, null)
 Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 28 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg02.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,57 +1,57 @@
-Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 56 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg03.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,85 +1,85 @@
-Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 84 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg04.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,29 +1,29 @@
-Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 28 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg11.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg11.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,3 +1,3 @@
-Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
-Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
+Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
+Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6943278/T6943278.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,12 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 6943278
+ * @summary spurious error message for inference and type-variable with erroneous bound
+ * @compile/fail/ref=T6943278.out -XDrawDiagnostics -Xlint:unchecked T6943278.java
+ */
+class T6943278<X extends Number & NonExistentInterface> {
+    <X> T6943278<X> m() { return null;}
+    <X extends Number & NonExistentInterface> T6943278<X> m(X x) { return null;}
+    T6943278<?> f1 = m();
+    T6943278<?> f2 = m("");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6943278/T6943278.out	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,3 @@
+T6943278.java:7:35: compiler.err.cant.resolve: kindname.class, NonExistentInterface, , 
+T6943278.java:9:25: compiler.err.cant.resolve.location: kindname.class, NonExistentInterface, , , (compiler.misc.location: kindname.class, T6943278, null)
+2 errors
--- a/langtools/test/tools/javac/generics/typevars/5060485/Compatibility.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/typevars/5060485/Compatibility.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,2 +1,2 @@
-Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
+Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
 1 error
--- a/langtools/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Fri Feb 04 16:29:41 2011 -0800
@@ -1,2 +1,2 @@
-Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
+Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6968793/T6968793.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6968793
+ * @summary javac generates spourious diagnostics for ill-formed type-variable bounds
+ * @author  mcimadamore
+ * @compile/fail/ref=T6968793.out -XDrawDiagnostics T6968793.java
+ */
+
+class T6968793<X extends Number, Y extends X, Z extends Object & Comparable<Y>> {
+    T6968793<Object, Object, Object> o;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6968793/T6968793.out	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,4 @@
+T6968793.java:10:14: compiler.err.not.within.bounds: java.lang.Object, X
+T6968793.java:10:22: compiler.err.not.within.bounds: java.lang.Object, Y
+T6968793.java:10:30: compiler.err.not.within.bounds: java.lang.Object, Z
+3 errors
--- a/langtools/test/tools/javac/meth/InvokeDynTrans.out	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-InvokeDynTrans.java:55:39: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeDynTrans.java:57:34: compiler.warn.type.parameter.on.polymorphic.signature
-- compiler.err.warnings.and.werror
-1 error
-2 warnings
--- a/langtools/test/tools/javac/meth/InvokeMHTrans.java	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * 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 6754038 6979327
- * @summary Generate call sites for method handle
- * @author jrose
- *
- * @compile/fail/ref=InvokeMHTrans.out -Werror -XDrawDiagnostics -source 7 -target 7 InvokeMHTrans.java
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH.java
- * $ javap -c -classpath dist meth.InvokeMH
- * </code>
- */
-
-package meth;
-
-import java.dyn.MethodHandle;
-
-public class InvokeMHTrans {
-    void test(MethodHandle mh_SiO,
-              MethodHandle mh_vS,
-              MethodHandle mh_vi,
-              MethodHandle mh_vv) throws Throwable {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (String,int)Object
-        mh_SiO.invokeExact("world", 123);
-        mh_SiO.invokeExact("mundus", 456);
-        Object k = "kosmos";
-        mh_SiO.invokeExact((String)k, 789);
-        o = mh_SiO.invokeExact((String)null, 000);
-        o = mh_SiO.<Object>invokeExact("arda", -123);
-
-        // sig = ()String
-        s = mh_vS.<String>invokeExact();
-
-        // sig = ()int
-        i = mh_vi.<int>invokeExact();
-        o = mh_vi.<int>invokeExact();
-        //s = mh_vi.<int>invokeExact(); //BAD
-        mh_vi.<int>invokeExact();
-
-        // sig = ()void
-        //o = mh_vv.<void>invokeExact(); //BAD
-        mh_vv.<void>invokeExact();
-    }
-
-    void testGen(MethodHandle mh_SiO,
-                 MethodHandle mh_vS,
-                 MethodHandle mh_vi,
-                 MethodHandle mh_vv) throws Throwable {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (*,*)*
-        mh_SiO.invokeGeneric((Object)"world", (Object)123);
-        mh_SiO.<void>invokeGeneric((Object)"mundus", (Object)456);
-        Object k = "kosmos";
-        mh_SiO.invokeGeneric(k, 789);
-        o = mh_SiO.invokeGeneric(null, 000);
-        o = mh_SiO.<Object>invokeGeneric("arda", -123);
-
-        // sig = ()String
-        o = mh_vS.invokeGeneric();
-
-        // sig = ()int
-        i = mh_vi.<int>invokeGeneric();
-        o = mh_vi.invokeGeneric();
-        //s = mh_vi.<int>invokeGeneric(); //BAD
-        mh_vi.<void>invokeGeneric();
-
-        // sig = ()void
-        //o = mh_vv.<void>invokeGeneric(); //BAD
-        o = mh_vv.invokeGeneric();
-    }
-}
--- a/langtools/test/tools/javac/meth/InvokeMHTrans.out	Thu Feb 03 16:06:01 2011 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-InvokeMHTrans.java:59:39: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:62:38: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:65:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:66:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:68:31: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:72:32: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:83:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:87:41: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:93:37: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:96:34: compiler.warn.type.parameter.on.polymorphic.signature
-- compiler.err.warnings.and.werror
-1 error
-10 warnings
--- a/langtools/test/tools/javac/meth/TestCP.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/meth/TestCP.java	Fri Feb 04 16:29:41 2011 -0800
@@ -42,13 +42,15 @@
 
     static class TestClass {
         void test(MethodHandle mh) throws Throwable {
-            Number n = mh.<Number>invokeExact("daddy",1,'n');
+            Number n = (Number)mh.invokeExact("daddy",1,'n');
             n = (Number)mh.invokeExact("bunny",1,'d');
+            n = (Number)(mh.invokeExact("foo",1,'d'));
+            n = (Number)((mh.invokeExact("bar",1,'d')));
         }
     }
 
     static final String PS_TYPE = "(Ljava/lang/String;IC)Ljava/lang/Number;";
-    static final int PS_CALLS_COUNT = 2;
+    static final int PS_CALLS_COUNT = 4;
     static final String SUBTEST_NAME = TestClass.class.getName() + ".class";
     static final String TEST_METHOD_NAME = "test";
 
--- a/langtools/test/tools/javac/meth/XlintWarn.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/meth/XlintWarn.java	Fri Feb 04 16:29:41 2011 -0800
@@ -35,6 +35,19 @@
 class XlintWarn {
     void test(MethodHandle mh) throws Throwable {
         int i1 = (int)mh.invokeExact();
-        int i2 = (int)mh.invokeVarargs();
+        int i2 = (int)mh.invokeGeneric();
+        int i3 = (int)mh.invokeWithArguments();
+    }
+
+    void test2(MethodHandle mh) throws Throwable {
+        int i1 = (int)(mh.invokeExact());
+        int i2 = (int)(mh.invokeGeneric());
+        int i3 = (int)(mh.invokeWithArguments());
+    }
+
+    void test3(MethodHandle mh) throws Throwable {
+        int i1 = (int)((mh.invokeExact()));
+        int i2 = (int)((mh.invokeGeneric()));
+        int i3 = (int)((mh.invokeWithArguments()));
     }
 }
--- a/langtools/test/tools/javac/policy/test1/byfile.ABD.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/policy/test1/byfile.ABD.out	Fri Feb 04 16:29:41 2011 -0800
@@ -12,6 +12,6 @@
 [generate code A2]
 [attribute B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 1 error
--- a/langtools/test/tools/javac/policy/test1/bytodo.ABD.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/policy/test1/bytodo.ABD.out	Fri Feb 04 16:29:41 2011 -0800
@@ -15,7 +15,7 @@
 [desugar B]
 [generate code B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 [attribute D]
 [attribute D1]
--- a/langtools/test/tools/javac/policy/test1/simple.ABD.out	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/policy/test1/simple.ABD.out	Fri Feb 04 16:29:41 2011 -0800
@@ -3,7 +3,7 @@
 [attribute A2]
 [attribute B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 [attribute D]
 [attribute D1]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/T6993305.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 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 6993305
+ * @summary starting position of a method without modifiers and with type parameters is incorrect
+ */
+
+import java.io.File;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTool;
+import java.io.IOException;
+
+/*
+ * Test verifies the starting position of all methods by computing the start position
+ * of each method as the first non-white character on the first line containing
+ * (" " + methodName + "("), and then comparing this value against the reported
+ * value in the SourcePositions table.
+ */
+public class T6993305 {
+    <T> void test1(T t) { }  // this is the primary case to be tested
+    public <T> void test2(T t) { }
+    @Deprecated <T> void test3(T t) { }
+
+    public static void main(String... args) throws Exception {
+        new T6993305().run();
+    }
+
+    void run() throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+        File f = new File(testSrc, T6993305.class.getSimpleName() + ".java");
+        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(f);
+        JavacTask task = tool.getTask(null, fm, null, null, null, fos);
+        Iterable<? extends CompilationUnitTree> cus = task.parse();
+
+        TestScanner s = new TestScanner();
+        s.scan(cus, task);
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    class TestScanner extends TreeScanner<Void, JavacTask> {
+        CompilationUnitTree cu;
+        SourcePositions sourcePositions;
+        String source;
+
+        void show(String label, int pos) {
+            System.err.println(label + ": " +
+                    source.substring(pos, Math.min(source.length(), pos + 10)));
+        }
+
+        @Override public Void visitCompilationUnit(CompilationUnitTree tree, JavacTask task) {
+            cu = tree;
+            Trees trees = Trees.instance(task);
+            sourcePositions = trees.getSourcePositions();
+            try {
+                source = String.valueOf(tree.getSourceFile().getCharContent(true));
+            } catch (IOException e) {
+                throw new Error(e);
+            }
+            return super.visitCompilationUnit(tree, task);
+        }
+
+        // this is the core of the test
+        @Override public Void visitMethod(MethodTree tree, JavacTask task) {
+            String name = String.valueOf(tree.getName());
+            int pos = source.indexOf(" " + name + "(");
+            while (source.charAt(pos - 1) != '\n') pos--;
+            while (source.charAt(pos) == ' ') pos++;
+            int expectedStart = pos;
+            int reportedStart = (int) sourcePositions.getStartPosition(cu, tree);
+            System.err.println("Method " + name
+                    + " expectedStart:" + expectedStart
+                    + " reportedStart:" + reportedStart);
+            if (expectedStart != reportedStart) {
+                error("Unexpected value for " + name);
+                show("expected", expectedStart);
+                show("reported", reportedStart);
+            }
+            return super.visitMethod(tree, task);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/types/GenericTypeWellFormednessTest.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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 7007432 7006109
+ * @summary Test generic types well-formedness
+ * @author mcimadamore
+ * @library .
+ * @run main GenericTypeWellFormednessTest
+ */
+
+import com.sun.tools.javac.code.BoundKind;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import java.lang.reflect.Array;
+
+/**
+ * Check parameterized type well-formedness. This test executes a number of checks
+ * in order to establish as to whether an instantiation of a generic type conforms
+ * to the generic class' declared bounds.
+ */
+public class GenericTypeWellFormednessTest extends TypeHarness {
+
+    static int executedCount = 0;
+    static int ignoredCount = 0;
+
+    InstantiableType[] rows;
+    Type[] columns;
+
+    static class InstantiableType {
+        protected Type type;
+
+        public InstantiableType(Type type) {
+            this.type = type;
+        }
+
+        Type inst(Type clazz) {
+            return type;
+        }
+    }
+
+    enum Result {
+        /* generic type is well-formed w.r.t. declared bounds */
+        OK(true),
+        /* generic type is not well-formed w.r.t. declared bounds */
+        FAIL(false),
+        /* generic type is not well-formed w.r.t. declared bounds according to the JLS 3rd,
+         * but javac allows it (spec for generic type well-formedness is overly restrictive)
+         * See regression test test/tools/generics/wildcards/T5097548.java
+         */
+        IGNORE(false);
+
+        boolean value;
+
+        Result(boolean value) {
+            this.value = value;
+        }
+    }
+
+    static final Result T = Result.OK;
+    static final Result F = Result.FAIL;
+    static final Result I = Result.IGNORE;
+
+    /*is a type in 'rows' a valid instantiation for the generic class in 'col' ? */
+    Result[][] isValidInstantiation = {
+                     //Foo<X>, Foo<X ext Object>, Foo<X ext Number>, Foo<X ext Foo<X>>, Foo<X ext Foo<+X>>, Foo<X ext Foo<-X>>, Foo<X ext Foo<?>>
+    /*Foo<Object>*/  { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<Number>*/  { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<Integer>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<Double>*/  { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<String>*/  { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X1>*/      { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X2>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X3>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X4>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X5>*/      { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X6>*/      { T     , T                , F                , T                , T                 , T                 , T },
+    /*Foo<+Object>*/ { T     , T                , I                , I                , I                 , I                 , I },
+    /*Foo<+Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+String>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X1>*/     { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X2>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X3>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X4>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X5>*/     { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X6>*/     { T     , T                , F                , T                , T                 , I                 , T },
+    /*Foo<-Object>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<-Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-String>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<-X1>*/     { T     , T                , I                , I                , I                 , I                 , I },
+    /*Foo<-X2>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X3>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X4>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X5>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X6>*/     { T     , T                , F                , T                , I                 , I                 , T },
+    /*Foo<?>*/       { T     , T                , T                , T                , T                 , T                 , T }};
+
+    GenericTypeWellFormednessTest() {
+        InstantiableType[] basicTypes = {
+            new InstantiableType(predef.objectType),
+            new InstantiableType(NumberType()),
+            new InstantiableType(box(predef.intType)),
+            new InstantiableType(box(predef.doubleType)),
+            new InstantiableType(predef.stringType) };
+
+        InstantiableType[] typeVars = new InstantiableType[basicTypes.length + 1];
+        for (int i = 0 ; i < basicTypes.length ; i++) {
+           typeVars[i] = new InstantiableType(fac.TypeVariable(basicTypes[i].type));
+        }
+        typeVars[typeVars.length - 1] = new InstantiableType(null) {
+            Type inst(Type clazz) {
+                TypeVar tvar = fac.TypeVariable();
+                tvar.bound = subst(clazz, Mapping(clazz.getTypeArguments().head, tvar));
+                return tvar;
+            }
+        };
+
+        InstantiableType[] typeArgs = join(InstantiableType.class, basicTypes, typeVars);
+
+        InstantiableType[] invariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           invariantTypes[i] = new InstantiableType(typeArgs[i].type) {
+               Type inst(Type clazz) {
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type1.inst(clazz)));
+               }
+            };
+        }
+
+        InstantiableType[] covariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           covariantTypes[i] = new InstantiableType(null) {
+               Type inst(Type clazz) {
+                   Type t = fac.Wildcard(BoundKind.EXTENDS, type1.inst(clazz));
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
+               }
+            };
+        }
+
+        InstantiableType[] contravariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           contravariantTypes[i] = new InstantiableType(null) {
+               Type inst(Type clazz) {
+                   Type t = fac.Wildcard(BoundKind.SUPER, type1.inst(clazz));
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
+               }
+            };
+        }
+
+        InstantiableType[] bivariantTypes = {
+            new InstantiableType(fac.Wildcard(BoundKind.UNBOUND, predef.objectType)) {
+               Type inst(Type clazz) {
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type));
+               }
+            }
+        };
+
+        rows = join(InstantiableType.class, invariantTypes, covariantTypes, contravariantTypes, bivariantTypes);
+
+        Type tv1 = fac.TypeVariable();
+        Type decl1 = fac.Class(tv1);
+
+        Type tv2 = fac.TypeVariable(predef.objectType);
+        Type decl2 = fac.Class(tv2);
+
+        Type tv3 = fac.TypeVariable(NumberType());
+        Type decl3 = fac.Class(tv3);
+
+        TypeVar tv4 = fac.TypeVariable();
+        Type decl4 = fac.Class(tv4);
+        tv4.bound = decl4;
+        tv4.tsym.name = predef.exceptionType.tsym.name;
+
+        TypeVar tv5 = fac.TypeVariable();
+        Type decl5 = fac.Class(tv5);
+        tv5.bound = subst(decl5, Mapping(tv5, fac.Wildcard(BoundKind.EXTENDS, tv5)));
+
+        TypeVar tv6 = fac.TypeVariable();
+        Type decl6 = fac.Class(tv6);
+        tv6.bound = subst(decl6, Mapping(tv6, fac.Wildcard(BoundKind.SUPER, tv6)));
+
+        TypeVar tv7 = fac.TypeVariable();
+        Type decl7 = fac.Class(tv7);
+        tv7.bound = subst(decl7, Mapping(tv7, fac.Wildcard(BoundKind.UNBOUND, predef.objectType)));
+
+        columns = new Type[] {
+            decl1, decl2, decl3, decl4, decl5, decl6, decl7
+        };
+    }
+
+    void test() {
+        for (int i = 0; i < rows.length ; i++) {
+            for (int j = 0; j < columns.length ; j++) {
+                Type decl = columns[j];
+                Type inst = rows[i].inst(decl);
+                if (isValidInstantiation[i][j] != Result.IGNORE) {
+                    executedCount++;
+                    assertValidGenericType(inst, isValidInstantiation[i][j].value);
+                } else {
+                    ignoredCount++;
+                }
+            }
+        }
+    }
+
+    Type NumberType() {
+        Symbol s = box(predef.intType).tsym;
+        s.complete();
+        return ((ClassType)s.type).supertype_field;
+    }
+
+    @SuppressWarnings("unchecked")
+    <T> T[] join(Class<T> type, T[]... args) {
+        int totalLength = 0;
+        for (T[] arr : args) {
+            totalLength += arr.length;
+        }
+        T[] new_arr = (T[])Array.newInstance(type, totalLength);
+        int idx = 0;
+        for (T[] arr : args) {
+            System.arraycopy(arr, 0, new_arr, idx, arr.length);
+            idx += arr.length;
+        }
+        return new_arr;
+    }
+
+    public static void main(String[] args) {
+        new GenericTypeWellFormednessTest().test();
+        System.out.println("Executed checks : " + executedCount);
+        System.out.println("Ignored checks : " + ignoredCount);
+    }
+}
--- a/langtools/test/tools/javac/types/TypeHarness.java	Thu Feb 03 16:06:01 2011 -0500
+++ b/langtools/test/tools/javac/types/TypeHarness.java	Fri Feb 04 16:29:41 2011 -0800
@@ -29,6 +29,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Name;
@@ -68,6 +69,7 @@
 public class TypeHarness {
 
     protected Types types;
+    protected Check chk;
     protected Symtab predef;
     protected Names names;
     protected Factory fac;
@@ -76,6 +78,7 @@
         Context ctx = new Context();
         JavacFileManager.preRegister(ctx);
         types = Types.instance(ctx);
+        chk = Check.instance(ctx);
         predef = Symtab.instance(ctx);
         names = Names.instance(ctx);
         fac = new Factory();
@@ -157,6 +160,21 @@
             error(s + msg + t);
         }
     }
+
+    /** assert that generic type 't' is well-formed */
+    public void assertValidGenericType(Type t) {
+        assertValidGenericType(t, true);
+    }
+
+    /** assert that 's' is/is not assignable to 't' */
+    public void assertValidGenericType(Type t, boolean expected) {
+        if (chk.checkValidGenericType(t) != expected) {
+            String msg = expected ?
+                " is not a valid generic type" :
+                " is a valid generic type";
+            error(t + msg + "   " + t.tsym.type);
+        }
+    }
     // </editor-fold>
 
     private void error(String msg) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6569633/T6569633.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6569633
+ * @author mcimadamore
+ * @summary  Varargs: parser error when varargs element type is an array
+ * @compile/fail/ref=T6569633.out -XDrawDiagnostics T6569633.java
+ */
+
+class T6569633 {
+    void  m1 (Integer... i[]) { }
+    void  m2 (Integer[]... i) { }
+    void  m3 (Integer[]... i[]) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6569633/T6569633.out	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,3 @@
+T6569633.java:10:27: compiler.err.varargs.and.old.array.syntax
+T6569633.java:12:29: compiler.err.varargs.and.old.array.syntax
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/T7013865.java	Fri Feb 04 16:29:41 2011 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 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     7013865
+ * @summary varargs: javac crashes during overload resolution with generic varargs
+ * @compile T7013865.java
+ */
+
+class T7013865 {
+    public <X extends Number> void m(X... args) { }
+    public void m(Object... args) { }
+
+    { m(null, null); }
+}
--- a/make/Defs-internal.gmk	Thu Feb 03 16:06:01 2011 -0500
+++ b/make/Defs-internal.gmk	Fri Feb 04 16:29:41 2011 -0800
@@ -147,7 +147,7 @@
 endif
 
 
-# Do we build the source and openjdk binary plug bundles?
+# Do we build the source bundles?
 BUNDLE_RULES = $(JDK_TOPDIR)/make/closed/bundles.gmk
 ifeq ($(SKIP_BUNDLES_BUILD), true)
   BUNDLE_RULES_AVAILABLE := false
@@ -171,7 +171,6 @@
   ifndef SKIP_COMPARE_IMAGES
     SKIP_COMPARE_IMAGES = true
   endif
-  SKIP_OPENJDK_BUILD = true
 else
   
   # Various non-OPENJDK reasons to NOT build the deploy repository
@@ -187,21 +186,11 @@
     endif
   endif
 
-  ifndef SKIP_OPENJDK_BUILD
-    #SKIP_OPENJDK_BUILD = false
-    # Until 6675289 is resolved, or this feature is removed.
-    SKIP_OPENJDK_BUILD = true
-  endif
 endif
 ifndef SKIP_PRODUCT_BUILD
   SKIP_PRODUCT_BUILD = false
 endif
 
-# Solaris 64 bit builds are not complete enough to ever do this
-ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
-  SKIP_OPENJDK_BUILD = true
-endif
-
 # Many reasons why we would want to skip the comparison to previous jdk
 ifndef SKIP_COMPARE_IMAGES
   ifeq ($(BUILD_JDK), false)
@@ -223,7 +212,7 @@
   SKIP_DEBUG_BUILD=true
 endif
 ifndef SKIP_FASTDEBUG_BUILD
-  SKIP_FASTDEBUG_BUILD=false
+  SKIP_FASTDEBUG_BUILD=true
 endif
 
 # Select javadoc setting GENERATE_DOCS
--- a/test/Makefile	Thu Feb 03 16:06:01 2011 -0500
+++ b/test/Makefile	Fri Feb 04 16:29:41 2011 -0800
@@ -79,7 +79,7 @@
 # Test targets
 $(LANGTOOLS_TEST_LIST):
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
-$(JDK_TEST_LIST):
+$(JDK_TEST_LIST) $(JDK_TEST_LIST2):
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@)
 
 clean: