Merge
authormduigou
Mon, 09 May 2011 08:58:00 -0700
changeset 9677 638762c0263e
parent 9676 5663e62f8d7e (current diff)
parent 9675 5aaa241a1c44 (diff)
child 9678 d6444a4639ba
child 9679 d98ae8bc45fc
Merge
hotspot/make/linux/makefiles/cscope.make
hotspot/make/solaris/makefiles/cscope.make
--- a/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -2,3 +2,4 @@
 ^dist/
 /nbproject/private/
 ^webrev
+^.hgtip
--- a/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 d1cf7d4ee16c341f5b8c7e7f1d68a8c412b6c693 jdk7-b137
 62b8e328f8c8c66c14b0713222116f2add473f3f jdk7-b138
 955488f34ca418f6cdab843d61c20d2c615637d9 jdk7-b139
+f4298bc3f4b6baa315643be06966f09684290068 jdk7-b140
--- a/.hgtags-top-repo	Tue May 03 16:32:47 2011 -0700
+++ b/.hgtags-top-repo	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 7654afc6a29e43cb0a1343ce7f1287bf690d5e5f jdk7-b137
 fc47c97bbbd91b1f774d855c48a7e285eb1a351a jdk7-b138
 7ed6d0b9aaa12320832a7ddadb88d6d8d0dda4c1 jdk7-b139
+dcfe74f1c6553c556e7d361c30b0b614eb5e40f6 jdk7-b140
--- a/Makefile	Tue May 03 16:32:47 2011 -0700
+++ b/Makefile	Mon May 09 08:58:00 2011 -0700
@@ -97,7 +97,7 @@
 endef
 
 # Generic build of basic repo series
-generic_build_repo_series::
+generic_build_repo_series:: $(SOURCE_TIPS)
 	$(MKDIR) -p $(OUTPUTDIR)
 	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
 	@$(call StartTimer)
@@ -243,6 +243,14 @@
 debug_build:: build_debug_image
 fastdebug_build:: build_fastdebug_image
 
+# The source tips are stored with the relative path to the repo.
+#   This file will be used when constructing the jdk image.
+source_tips: $(SOURCE_TIPS)
+	$(CAT) $<
+$(SOURCE_TIPS): FRC
+	@$(prep-target)
+	@$(call GetSourceTips)
+
 clobber:: REPORT_BUILD_TIMES=
 clobber:: 
 	$(RM) -r $(OUTPUTDIR)/*
--- a/corba/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/corba/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -1,3 +1,4 @@
 ^build/
 ^dist/
 /nbproject/private/
+^.hgtip
--- a/corba/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/corba/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
 78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138
 60b074ec6fcf5cdf9efce22fdfb02326ed8fa2d3 jdk7-b139
+cdf5d19ec142424489549025e9c42e51f32cf688 jdk7-b140
--- a/hotspot/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -5,3 +5,4 @@
 ^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
 ^src/share/tools/IdealGraphVisualizer/build/
 ^src/share/tools/IdealGraphVisualizer/dist/
+^.hgtip
--- a/hotspot/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -166,3 +166,5 @@
 0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08
 611e19a16519d6fb5deea9ab565336e6e6ee475d jdk7-b139
 611e19a16519d6fb5deea9ab565336e6e6ee475d hs21-b09
+d283b82966712b353fa307845a1316da42a355f4 jdk7-b140
+d283b82966712b353fa307845a1316da42a355f4 hs21-b10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/cscope.make	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,141 @@
+#
+# Copyright (c) 2000, 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.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#  
+#
+
+# The cscope.out file is generated in the current directory.  The old cscope.out
+# file is *not* removed because cscope is smart enough to only build what has
+# changed.  cscope can be confused if files are renamed or removed, so it may be
+# necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization
+# has occurred.
+
+include $(GAMMADIR)/make/scm.make
+
+RM	= rm -f
+HG	= hg
+CS_TOP	= $(GAMMADIR)
+
+CSDIRS	= $(CS_TOP)/src $(CS_TOP)/make
+CSINCS	= $(CSDIRS:%=-I%)
+
+CSCOPE		= cscope
+CSCOPE_OUT	= cscope.out
+CSCOPE_FLAGS	= -b
+
+# Allow .java files to be added from the environment (CSCLASSES=yes).
+ifdef	CSCLASSES
+ADDCLASSES=	-o -name '*.java'
+endif
+
+# Adding CClassHeaders also pushes the file count of a full workspace up about
+# 200 files (these files also don't exist in a new workspace, and thus will
+# cause the recreation of the database as they get created, which might seem
+# a little confusing).  Thus allow these files to be added from the environment
+# (CSHEADERS=yes).
+ifndef	CSHEADERS
+RMCCHEADERS=	-o -name CClassHeaders
+endif
+
+# Ignore build products.
+CS_PRUNE_GENERATED	= -o -name '${OSNAME}_*_core' -o \
+			     -name '${OSNAME}_*_compiler?'
+
+# O/S-specific files for all systems are included by default.  Set CS_OS to a
+# space-separated list of identifiers to include only those systems.
+ifdef	CS_OS
+CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',\
+		    $(filter-out ${CS_OS},linux macos solaris windows))
+endif
+
+# CPU-specific files for all processors are included by default.  Set CS_CPU 
+# space-separated list identifiers to include only those CPUs.
+ifdef	CS_CPU
+CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',\
+		    $(filter-out ${CS_CPU},arm ppc sparc x86 zero))
+endif
+
+# What files should we include?  A simple rule might be just those files under
+# SCCS control, however this would miss files we create like the opcodes and
+# CClassHeaders.  The following attempts to find everything that is *useful*.
+# (.del files are created by sccsrm, demo directories contain many .java files
+# that probably aren't useful for development, and the pkgarchive may contain
+# duplicates of files within the source hierarchy).
+
+# Directories to exclude.
+CS_PRUNE_STD	= $(SCM_DIRS) \
+		  -o -name '.del-*' \
+		  -o -name '*demo' \
+		  -o -name pkgarchive
+
+# Placeholder for user-defined excludes.
+CS_PRUNE_EX	=
+
+CS_PRUNE	= $(CS_PRUNE_STD) \
+		  $(CS_PRUNE_OS) \
+		  $(CS_PRUNE_CPU) \
+		  $(CS_PRUNE_GENERATED) \
+		  $(CS_PRUNE_EX) \
+		  $(RMCCHEADERS)
+
+# File names to include.
+CSFILENAMES	= -name '*.[ch]pp' \
+		  -o -name '*.[Ccshlxy]' \
+		  $(CS_ADD_GENERATED) \
+		  -o -name '*.d' \
+		  -o -name '*.il' \
+		  -o -name '*.cc' \
+		  -o -name '*[Mm]akefile*' \
+		  -o -name '*.gmk' \
+		  -o -name '*.make' \
+		  -o -name '*.ad' \
+		  $(ADDCLASSES)
+
+.PHONY:		cscope cscope.clean cscope.scratch TAGS.clean FORCE
+.PRECIOUS:	cscope.out
+
+cscope $(CSCOPE_OUT): cscope.files FORCE
+	$(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS)
+
+cscope.clean:
+	$(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files
+
+cscope.scratch:  cscope.clean cscope
+
+# The raw list is reordered so cscope displays the most relevant files first.
+cscope.files:
+	$(QUIETLY)						\
+	raw=cscope.$$$$;					\
+	find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o	\
+	    -type f \( $(CSFILENAMES) \) -print > $$raw;	\
+	{							\
+	echo "$(CSINCS)";					\
+	egrep -v "\.java|/make/" $$raw;				\
+	fgrep ".java" $$raw;					\
+	fgrep "/make/" $$raw;					\
+	} > $@;							\
+	rm -f $$raw
+
+TAGS:  cscope.files FORCE
+	egrep -v '^-|^$$' $< | etags --members -
+
+TAGS.clean:
+	$(RM) TAGS
--- a/hotspot/make/hotspot_version	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/make/hotspot_version	Mon May 09 08:58:00 2011 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=10
+HS_BUILD_NUMBER=11
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/make/linux/Makefile	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/make/linux/Makefile	Mon May 09 08:58:00 2011 -0700
@@ -359,7 +359,7 @@
 
 clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_docs
 
-include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make
+include $(GAMMADIR)/make/cscope.make
 
 #-------------------------------------------------------------------------------
 
--- a/hotspot/make/linux/makefiles/cscope.make	Tue May 03 16:32:47 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-#
-# Copyright (c) 2005, 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.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-#
-# The cscope.out file is made in the current directory and spans the entire
-# source tree.
-#
-# Things to note:
-#	1. We use relative names for cscope.
-#	2. We *don't* remove the old cscope.out file, because cscope is smart
-#	   enough to only build what has changed.  It can be confused, however,
-#	   if files are renamed or removed, so it may be necessary to manually
-#	   remove cscope.out if a lot of reorganization has occurred.
-#
-
-include $(GAMMADIR)/make/scm.make
-
-NAWK	= awk
-RM	= rm -f
-HG	= hg
-CS_TOP	= ../..
-
-CSDIRS	= $(CS_TOP)/src $(CS_TOP)/build
-CSINCS	= $(CSDIRS:%=-I%)
-
-CSCOPE		= cscope
-CSCOPE_FLAGS	= -b
-
-# Allow .java files to be added from the environment (CSCLASSES=yes).
-ifdef	CSCLASSES
-ADDCLASSES=	-o -name '*.java'
-endif
-
-# Adding CClassHeaders also pushes the file count of a full workspace up about
-# 200 files (these files also don't exist in a new workspace, and thus will
-# cause the recreation of the database as they get created, which might seem
-# a little confusing).  Thus allow these files to be added from the environment
-# (CSHEADERS=yes).
-ifndef	CSHEADERS
-RMCCHEADERS=	-o -name CClassHeaders
-endif
-
-# Use CS_GENERATED=x to include auto-generated files in the build directories.
-ifdef	CS_GENERATED
-CS_ADD_GENERATED	= -o -name '*.incl'
-else
-CS_PRUNE_GENERATED	= -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
-endif
-
-# OS-specific files for other systems are excluded by default.  Use CS_OS=yes
-# to include platform-specific files for other platforms.
-ifndef	CS_OS
-CS_OS		= linux macos solaris win32
-CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
-endif
-
-# Processor-specific files for other processors are excluded by default.  Use
-# CS_CPU=x to include platform-specific files for other platforms.
-ifndef	CS_CPU
-CS_CPU		= i486 sparc amd64 ia64
-CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
-endif
-
-# What files should we include?  A simple rule might be just those files under
-# SCCS control, however this would miss files we create like the opcodes and
-# CClassHeaders.  The following attempts to find everything that is *useful*.
-# (.del files are created by sccsrm, demo directories contain many .java files
-# that probably aren't useful for development, and the pkgarchive may contain
-# duplicates of files within the source hierarchy).
-
-# Directories to exclude.
-CS_PRUNE_STD	= $(SCM_DIRS) \
-		  -o -name '.del-*' \
-		  -o -name '*demo' \
-		  -o -name pkgarchive
-
-CS_PRUNE	= $(CS_PRUNE_STD) \
-		  $(CS_PRUNE_OS) \
-		  $(CS_PRUNE_CPU) \
-		  $(CS_PRUNE_GENERATED) \
-		  $(RMCCHEADERS)
-
-# File names to include.
-CSFILENAMES	= -name '*.[ch]pp' \
-		  -o -name '*.[Ccshlxy]' \
-		  $(CS_ADD_GENERATED) \
-		  -o -name '*.il' \
-		  -o -name '*.cc' \
-		  -o -name '*[Mm]akefile*' \
-		  -o -name '*.gmk' \
-		  -o -name '*.make' \
-		  -o -name '*.ad' \
-		  $(ADDCLASSES)
-
-.PRECIOUS:	cscope.out
-
-cscope cscope.out: cscope.files FORCE
-	$(CSCOPE) $(CSCOPE_FLAGS)
-
-# The .raw file is reordered here in an attempt to make cscope display the most
-# relevant files first.
-cscope.files: .cscope.files.raw
-	echo "$(CSINCS)" > $@
-	-egrep -v "\.java|\/make\/"	$< >> $@
-	-fgrep ".java"			$< >> $@
-	-fgrep "/make/"		$< >> $@
-
-.cscope.files.raw:  .nametable.files
-	-find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
-	    -type f \( $(CSFILENAMES) \) -print > $@
-
-cscope.clean:  nametable.clean
-	-$(RM) cscope.out cscope.files .cscope.files.raw
-
-TAGS:  cscope.files FORCE
-	egrep -v '^-|^$$' $< | etags --members -
-
-TAGS.clean:  nametable.clean
-	-$(RM) TAGS
-
-# .nametable.files and .nametable.files.tmp are used to determine if any files
-# were added to/deleted from/renamed in the workspace.  If not, then there's
-# normally no need to rebuild the cscope database. To force a rebuild of
-# the cscope database: gmake nametable.clean.
-.nametable.files:  .nametable.files.tmp
-	( cmp -s $@ $< ) || ( cp $< $@ )
-	-$(RM) $<
-
-# `hg status' is slightly faster than `hg fstatus'. Both are
-# quite a bit slower on an NFS mounted file system, so this is
-# really geared towards repos on local file systems.
-.nametable.files.tmp:
-	-$(HG) fstatus -acmn > $@
-nametable.clean:
-	-$(RM) .nametable.files .nametable.files.tmp
-
-FORCE:
-
-.PHONY:		cscope cscope.clean TAGS.clean nametable.clean FORCE
--- a/hotspot/make/solaris/Makefile	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/make/solaris/Makefile	Mon May 09 08:58:00 2011 -0700
@@ -296,7 +296,7 @@
 
 clean:  clean_compiler2 clean_compiler1 clean_core clean_docs clean_kernel
 
-include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make
+include $(GAMMADIR)/make/cscope.make
 
 #-------------------------------------------------------------------------------
 
--- a/hotspot/make/solaris/makefiles/cscope.make	Tue May 03 16:32:47 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-#
-# Copyright (c) 2000, 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.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-#
-# The cscope.out file is made in the current directory and spans the entire
-# source tree.
-#
-# Things to note:
-#	1. We use relative names for cscope.
-#	2. We *don't* remove the old cscope.out file, because cscope is smart
-#	   enough to only build what has changed.  It can be confused, however,
-#	   if files are renamed or removed, so it may be necessary to manually
-#	   remove cscope.out if a lot of reorganization has occurred.
-#
-
-include $(GAMMADIR)/make/scm.make
-
-NAWK	= /usr/xpg4/bin/awk
-RM	= rm -f
-HG	= hg
-CS_TOP	= ../..
-
-CSDIRS	= $(CS_TOP)/src $(CS_TOP)/make
-CSINCS	= $(CSDIRS:%=-I%)
-
-CSCOPE		= cscope
-CSCOPE_FLAGS	= -b
-
-# Allow .java files to be added from the environment (CSCLASSES=yes).
-ifdef	CSCLASSES
-ADDCLASSES=	-o -name '*.java'
-endif
-
-# Adding CClassHeaders also pushes the file count of a full workspace up about
-# 200 files (these files also don't exist in a new workspace, and thus will
-# cause the recreation of the database as they get created, which might seem
-# a little confusing).  Thus allow these files to be added from the environment
-# (CSHEADERS=yes).
-ifndef	CSHEADERS
-RMCCHEADERS=	-o -name CClassHeaders
-endif
-
-# Use CS_GENERATED=x to include auto-generated files in the make directories.
-ifdef	CS_GENERATED
-CS_ADD_GENERATED	= -o -name '*.incl'
-else
-CS_PRUNE_GENERATED	= -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?'
-endif
-
-# OS-specific files for other systems are excluded by default.  Use CS_OS=yes
-# to include platform-specific files for other platforms.
-ifndef	CS_OS
-CS_OS		= linux macos solaris win32
-CS_PRUNE_OS	= $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS}))
-endif
-
-# Processor-specific files for other processors are excluded by default.  Use
-# CS_CPU=x to include platform-specific files for other platforms.
-ifndef	CS_CPU
-CS_CPU		= i486 sparc amd64 ia64
-CS_PRUNE_CPU	= $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU}))
-endif
-
-# What files should we include?  A simple rule might be just those files under
-# SCCS control, however this would miss files we create like the opcodes and
-# CClassHeaders.  The following attempts to find everything that is *useful*.
-# (.del files are created by sccsrm, demo directories contain many .java files
-# that probably aren't useful for development, and the pkgarchive may contain
-# duplicates of files within the source hierarchy).
-
-# Directories to exclude.
-CS_PRUNE_STD	= $(SCM_DIRS) \
-		  -o -name '.del-*' \
-		  -o -name '*demo' \
-		  -o -name pkgarchive
-
-CS_PRUNE	= $(CS_PRUNE_STD) \
-		  $(CS_PRUNE_OS) \
-		  $(CS_PRUNE_CPU) \
-		  $(CS_PRUNE_GENERATED) \
-		  $(RMCCHEADERS)
-
-# File names to include.
-CSFILENAMES	= -name '*.[ch]pp' \
-		  -o -name '*.[Ccshlxy]' \
-		  $(CS_ADD_GENERATED) \
-		  -o -name '*.d' \
-		  -o -name '*.il' \
-		  -o -name '*.cc' \
-		  -o -name '*[Mm]akefile*' \
-		  -o -name '*.gmk' \
-		  -o -name '*.make' \
-		  -o -name '*.ad' \
-		  $(ADDCLASSES)
-
-.PRECIOUS:	cscope.out
-
-cscope cscope.out: cscope.files FORCE
-	$(CSCOPE) $(CSCOPE_FLAGS)
-
-# The .raw file is reordered here in an attempt to make cscope display the most
-# relevant files first.
-cscope.files: .cscope.files.raw
-	echo "$(CSINCS)" > $@
-	-egrep -v "\.java|\/make\/"	$< >> $@
-	-fgrep ".java"			$< >> $@
-	-fgrep "/make/"		$< >> $@
-
-.cscope.files.raw:  .nametable.files
-	-find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \
-	    -type f \( $(CSFILENAMES) \) -print > $@
-
-cscope.clean:  nametable.clean
-	-$(RM) cscope.out cscope.files .cscope.files.raw
-
-TAGS:  cscope.files FORCE
-	egrep -v '^-|^$$' $< | etags --members -
-
-TAGS.clean:  nametable.clean
-	-$(RM) TAGS
-
-# .nametable.files and .nametable.files.tmp are used to determine if any files
-# were added to/deleted from/renamed in the workspace.  If not, then there's
-# normally no need to rebuild the cscope database. To force a rebuild of
-# the cscope database: gmake nametable.clean.
-.nametable.files:  .nametable.files.tmp
-	( cmp -s $@ $< ) || ( cp $< $@ )
-	-$(RM) $<
-
-# `hg status' is slightly faster than `hg fstatus'. Both are
-# quite a bit slower on an NFS mounted file system, so this is
-# really geared towards repos on local file systems.
-.nametable.files.tmp:
-	-$(HG) fstatus -acmn > $@
-
-nametable.clean:
-	-$(RM) .nametable.files .nametable.files.tmp
-
-FORCE:
-
-.PHONY:		cscope cscope.clean TAGS.clean nametable.clean FORCE
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Mon May 09 08:58:00 2011 -0700
@@ -486,7 +486,7 @@
       if (ek == _invokespecial_mh) {
         // Must load & check the first argument before entering the target method.
         __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch);
-        __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle);
+        __ ld_ptr(__ argument_address(O0_argslot, -1), G3_method_handle);
         __ null_check(G3_method_handle);
         __ verify_oop(G3_method_handle);
       }
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Mon May 09 08:58:00 2011 -0700
@@ -3293,8 +3293,6 @@
                              /*virtual*/ false, /*vfinal*/ false, /*indy*/ true);
   __ mov(SP, O5_savedSP);  // record SP that we wanted the callee to restore
 
-  __ verify_oop(G5_callsite);
-
   // profile this call
   __ profile_call(O4);
 
@@ -3307,8 +3305,10 @@
   __ sll(Rret, LogBytesPerWord, Rret);
   __ ld_ptr(Rtemp, Rret, Rret);  // get return address
 
+  __ verify_oop(G5_callsite);
   __ load_heap_oop(G5_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
   __ null_check(G3_method_handle);
+  __ verify_oop(G3_method_handle);
 
   // Adjust Rret first so Llast_SP can be same as Rret
   __ add(Rret, -frame::pc_return_offset, O7);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Mon May 09 08:58:00 2011 -0700
@@ -422,7 +422,7 @@
 
   Label L_done, L_throw_exception;
   const Register con_klass_temp = rcx;  // same as Rcache
-  __ movptr(con_klass_temp, Address(rax, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(con_klass_temp, rax);
   __ cmpptr(con_klass_temp, ExternalAddress((address)Universe::systemObjArrayKlassObj_addr()));
   __ jcc(Assembler::notEqual, L_done);
   __ cmpl(Address(rax, arrayOopDesc::length_offset_in_bytes()), 0);
@@ -432,7 +432,7 @@
 
   // Load the exception from the system-array which wraps it:
   __ bind(L_throw_exception);
-  __ movptr(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
+  __ load_heap_oop(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
   __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
 
   __ bind(L_done);
@@ -946,9 +946,9 @@
   __ jcc(Assembler::zero, is_null);
 
   // Move subklass into EBX
-  __ movptr(rbx, Address(rax, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rbx, rax);
   // Move superklass into EAX
-  __ movptr(rax, Address(rdx, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rax, rdx);
   __ movptr(rax, Address(rax, sizeof(oopDesc) + objArrayKlass::element_klass_offset_in_bytes()));
   // Compress array+index*wordSize+12 into a single register.  Frees ECX.
   __ lea(rdx, element_address);
@@ -2001,7 +2001,7 @@
   if (_desc->bytecode() == Bytecodes::_return_register_finalizer) {
     assert(state == vtos, "only valid state");
     __ movptr(rax, aaddress(0));
-    __ movptr(rdi, Address(rax, oopDesc::klass_offset_in_bytes()));
+    __ load_klass(rdi, rax);
     __ movl(rdi, Address(rdi, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc)));
     __ testl(rdi, JVM_ACC_HAS_FINALIZER);
     Label skip_register_finalizer;
@@ -2948,7 +2948,7 @@
   // get receiver klass
   __ null_check(recv, oopDesc::klass_offset_in_bytes());
   // Keep recv in rcx for callee expects it there
-  __ movptr(rax, Address(recv, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rax, recv);
   __ verify_oop(rax);
 
   // profile this call
@@ -3028,7 +3028,7 @@
 
   // Get receiver klass into rdx - also a null check
   __ restore_locals();  // restore rdi
-  __ movptr(rdx, Address(rcx, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rdx, rcx);
   __ verify_oop(rdx);
 
   // profile this call
@@ -3083,6 +3083,7 @@
 
 void TemplateTable::invokedynamic(int byte_no) {
   transition(vtos, vtos);
+  assert(byte_no == f1_oop, "use this argument");
 
   if (!EnableInvokeDynamic) {
     // We should not encounter this bytecode if !EnableInvokeDynamic.
@@ -3095,7 +3096,6 @@
     return;
   }
 
-  assert(byte_no == f1_oop, "use this argument");
   prepare_invoke(rax, rbx, byte_no);
 
   // rax: CallSite object (f1)
@@ -3106,14 +3106,14 @@
   Register rax_callsite      = rax;
   Register rcx_method_handle = rcx;
 
-  if (ProfileInterpreter) {
-    // %%% should make a type profile for any invokedynamic that takes a ref argument
-    // profile this call
-    __ profile_call(rsi);
-  }
-
-  __ movptr(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx)));
+  // %%% should make a type profile for any invokedynamic that takes a ref argument
+  // profile this call
+  __ profile_call(rsi);
+
+  __ verify_oop(rax_callsite);
+  __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rdx)));
   __ null_check(rcx_method_handle);
+  __ verify_oop(rcx_method_handle);
   __ prepare_to_jump_from_interpreted();
   __ jump_to_method_handle_entry(rcx_method_handle, rdx);
 }
@@ -3258,7 +3258,7 @@
                 (int32_t)markOopDesc::prototype()); // header
       __ pop(rcx);   // get saved klass back in the register.
     }
-    __ movptr(Address(rax, oopDesc::klass_offset_in_bytes()), rcx);  // klass
+    __ store_klass(rax, rcx);  // klass
 
     {
       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
@@ -3333,7 +3333,7 @@
   __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc)));
 
   __ bind(resolved);
-  __ movptr(rbx, Address(rdx, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rbx, rdx);
 
   // Generate subtype check.  Blows ECX.  Resets EDI.  Object in EDX.
   // Superklass in EAX.  Subklass in EBX.
@@ -3376,12 +3376,12 @@
   __ push(atos);
   call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
   __ pop_ptr(rdx);
-  __ movptr(rdx, Address(rdx, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rdx, rdx);
   __ jmp(resolved);
 
   // Get superklass in EAX and subklass in EDX
   __ bind(quicked);
-  __ movptr(rdx, Address(rax, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(rdx, rax);
   __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc)));
 
   __ bind(resolved);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon May 09 08:58:00 2011 -0700
@@ -436,7 +436,7 @@
   Label L_done, L_throw_exception;
   const Register con_klass_temp = rcx;  // same as cache
   const Register array_klass_temp = rdx;  // same as index
-  __ movptr(con_klass_temp, Address(rax, oopDesc::klass_offset_in_bytes()));
+  __ load_klass(con_klass_temp, rax);
   __ lea(array_klass_temp, ExternalAddress((address)Universe::systemObjArrayKlassObj_addr()));
   __ cmpptr(con_klass_temp, Address(array_klass_temp, 0));
   __ jcc(Assembler::notEqual, L_done);
@@ -447,7 +447,7 @@
 
   // Load the exception from the system-array which wraps it:
   __ bind(L_throw_exception);
-  __ movptr(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
+  __ load_heap_oop(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
   __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
 
   __ bind(L_done);
@@ -3137,7 +3137,6 @@
     return;
   }
 
-  assert(byte_no == f1_oop, "use this argument");
   prepare_invoke(rax, rbx, byte_no);
 
   // rax: CallSite object (f1)
@@ -3148,14 +3147,14 @@
   Register rax_callsite      = rax;
   Register rcx_method_handle = rcx;
 
-  if (ProfileInterpreter) {
-    // %%% should make a type profile for any invokedynamic that takes a ref argument
-    // profile this call
-    __ profile_call(r13);
-  }
-
-  __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx)));
+  // %%% should make a type profile for any invokedynamic that takes a ref argument
+  // profile this call
+  __ profile_call(r13);
+
+  __ verify_oop(rax_callsite);
+  __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rdx)));
   __ null_check(rcx_method_handle);
+  __ verify_oop(rcx_method_handle);
   __ prepare_to_jump_from_interpreted();
   __ jump_to_method_handle_entry(rcx_method_handle, rdx);
 }
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Mon May 09 08:58:00 2011 -0700
@@ -441,12 +441,25 @@
       }
     }
 
-    // On family 21 processors default is no sw prefetch
-    if ( cpu_family() == 21 ) {
+    // some defaults for AMD family 15h
+    if ( cpu_family() == 0x15 ) {
+      // On family 15h processors default is no sw prefetch
       if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
         AllocatePrefetchStyle = 0;
       }
+      // Also, if some other prefetch style is specified, default instruction type is PREFETCHW
+      if (FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
+        AllocatePrefetchInstr = 3;
+      }
+      // On family 15h processors use XMM and UnalignedLoadStores for Array Copy
+      if( FLAG_IS_DEFAULT(UseXMMForArrayCopy) ) {
+        UseXMMForArrayCopy = true;
+      }
+      if( FLAG_IS_DEFAULT(UseUnalignedLoadStores) && UseXMMForArrayCopy ) {
+        UseUnalignedLoadStores = true;
+      }
     }
+
   }
 
   if( is_intel() ) { // Intel cpus specific settings
--- a/hotspot/src/os/linux/vm/globals_linux.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/os/linux/vm/globals_linux.hpp	Mon May 09 08:58:00 2011 -0700
@@ -29,13 +29,19 @@
 // Defines Linux specific flags. They are not available on other platforms.
 //
 #define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
-  product(bool, UseOprofile, false,                                 \
-        "enable support for Oprofile profiler")                     \
-                                                                    \
-  product(bool, UseLinuxPosixThreadCPUClocks, true,                 \
-          "enable fast Linux Posix clocks where available")
-// NB: The default value of UseLinuxPosixThreadCPUClocks may be
-// overridden in Arguments::parse_each_vm_init_arg.
+  product(bool, UseOprofile, false,                                     \
+        "enable support for Oprofile profiler")                         \
+                                                                        \
+  product(bool, UseLinuxPosixThreadCPUClocks, true,                     \
+          "enable fast Linux Posix clocks where available")             \
+/*  NB: The default value of UseLinuxPosixThreadCPUClocks may be        \
+    overridden in Arguments::parse_each_vm_init_arg.  */                \
+                                                                        \
+  product(bool, UseHugeTLBFS, false,                                    \
+          "Use MAP_HUGETLB for large pages")                            \
+                                                                        \
+  product(bool, UseSHM, false,                                          \
+          "Use SYSV shared memory for large pages")
 
 //
 // Defines Linux-specific default values. The flags are available on all
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Mon May 09 08:58:00 2011 -0700
@@ -2465,16 +2465,40 @@
   return res != (uintptr_t) MAP_FAILED;
 }
 
+// Define MAP_HUGETLB here so we can build HotSpot on old systems.
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB 0x40000
+#endif
+
+// Define MADV_HUGEPAGE here so we can build HotSpot on old systems.
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 14
+#endif
+
 bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
                        bool exec) {
+  if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
+    int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
+    uintptr_t res =
+      (uintptr_t) ::mmap(addr, size, prot,
+                         MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_HUGETLB,
+                         -1, 0);
+    return res != (uintptr_t) MAP_FAILED;
+  }
+
   return commit_memory(addr, size, exec);
 }
 
-void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
+void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
+  if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
+    // We don't check the return value: madvise(MADV_HUGEPAGE) may not
+    // be supported or the memory may already be backed by huge pages.
+    ::madvise(addr, bytes, MADV_HUGEPAGE);
+  }
+}
 
 void os::free_memory(char *addr, size_t bytes) {
-  ::mmap(addr, bytes, PROT_READ | PROT_WRITE,
-         MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
+  ::madvise(addr, bytes, MADV_DONTNEED);
 }
 
 void os::numa_make_global(char *addr, size_t bytes) {
@@ -2812,6 +2836,43 @@
   return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
 }
 
+bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
+  bool result = false;
+  void *p = mmap (NULL, page_size, PROT_READ|PROT_WRITE,
+                  MAP_ANONYMOUS|MAP_PRIVATE|MAP_HUGETLB,
+                  -1, 0);
+
+  if (p != (void *) -1) {
+    // We don't know if this really is a huge page or not.
+    FILE *fp = fopen("/proc/self/maps", "r");
+    if (fp) {
+      while (!feof(fp)) {
+        char chars[257];
+        long x = 0;
+        if (fgets(chars, sizeof(chars), fp)) {
+          if (sscanf(chars, "%lx-%*lx", &x) == 1
+              && x == (long)p) {
+            if (strstr (chars, "hugepage")) {
+              result = true;
+              break;
+            }
+          }
+        }
+      }
+      fclose(fp);
+    }
+    munmap (p, page_size);
+    if (result)
+      return true;
+  }
+
+  if (warn) {
+    warning("HugeTLBFS is not supported by the operating system.");
+  }
+
+  return result;
+}
+
 /*
 * Set the coredump_filter bits to include largepages in core dump (bit 6)
 *
@@ -2854,7 +2915,16 @@
 static size_t _large_page_size = 0;
 
 bool os::large_page_init() {
-  if (!UseLargePages) return false;
+  if (!UseLargePages) {
+    UseHugeTLBFS = false;
+    UseSHM = false;
+    return false;
+  }
+
+  if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM)) {
+    // Our user has not expressed a preference, so we'll try both.
+    UseHugeTLBFS = UseSHM = true;
+  }
 
   if (LargePageSizeInBytes) {
     _large_page_size = LargePageSizeInBytes;
@@ -2899,6 +2969,9 @@
     }
   }
 
+  // print a warning if any large page related flag is specified on command line
+  bool warn_on_failure = !FLAG_IS_DEFAULT(UseHugeTLBFS);
+
   const size_t default_page_size = (size_t)Linux::page_size();
   if (_large_page_size > default_page_size) {
     _page_sizes[0] = _large_page_size;
@@ -2906,6 +2979,14 @@
     _page_sizes[2] = 0;
   }
 
+  UseHugeTLBFS = UseHugeTLBFS &&
+                 Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size);
+
+  if (UseHugeTLBFS)
+    UseSHM = false;
+
+  UseLargePages = UseHugeTLBFS || UseSHM;
+
   set_coredump_filter();
 
   // Large page support is available on 2.6 or newer kernel, some vendors
@@ -2922,7 +3003,7 @@
 char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
   // "exec" is passed in but not used.  Creating the shared image for
   // the code cache doesn't have an SHM_X executable permission to check.
-  assert(UseLargePages, "only for large pages");
+  assert(UseLargePages && UseSHM, "only for SHM large pages");
 
   key_t key = IPC_PRIVATE;
   char *addr;
@@ -2989,16 +3070,15 @@
   return _large_page_size;
 }
 
-// Linux does not support anonymous mmap with large page memory. The only way
-// to reserve large page memory without file backing is through SysV shared
-// memory API. The entire memory region is committed and pinned upfront.
-// Hopefully this will change in the future...
+// HugeTLBFS allows application to commit large page memory on demand;
+// with SysV SHM the entire memory region must be allocated as shared
+// memory.
 bool os::can_commit_large_page_memory() {
-  return false;
+  return UseHugeTLBFS;
 }
 
 bool os::can_execute_large_page_memory() {
-  return false;
+  return UseHugeTLBFS;
 }
 
 // Reserve memory at an arbitrary address, only if that area is
@@ -4090,6 +4170,23 @@
         UseNUMA = false;
       }
     }
+    // With SHM large pages we cannot uncommit a page, so there's not way
+    // we can make the adaptive lgrp chunk resizing work. If the user specified
+    // both UseNUMA and UseLargePages (or UseSHM) on the command line - warn and
+    // disable adaptive resizing.
+    if (UseNUMA && UseLargePages && UseSHM) {
+      if (!FLAG_IS_DEFAULT(UseNUMA)) {
+        if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseSHM)) {
+          UseLargePages = false;
+        } else {
+          warning("UseNUMA is not fully compatible with SHM large pages, disabling adaptive resizing");
+          UseAdaptiveSizePolicy = false;
+          UseAdaptiveNUMAChunkSizing = false;
+        }
+      } else {
+        UseNUMA = false;
+      }
+    }
     if (!UseNUMA && ForceNUMA) {
       UseNUMA = true;
     }
--- a/hotspot/src/os/linux/vm/os_linux.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.hpp	Mon May 09 08:58:00 2011 -0700
@@ -86,6 +86,9 @@
 
   static void rebuild_cpu_to_node_map();
   static GrowableArray<int>* cpu_to_node()    { return _cpu_to_node; }
+
+  static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
+
  public:
   static void init_thread_fpu_state();
   static int  get_fpu_control_word();
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon May 09 08:58:00 2011 -0700
@@ -2826,7 +2826,9 @@
 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
   assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
   assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
-  Solaris::set_mpss_range(addr, bytes, alignment_hint);
+  if (UseLargePages && UseMPSS) {
+    Solaris::set_mpss_range(addr, bytes, alignment_hint);
+  }
 }
 
 // Tell the OS to make the range local to the first-touching LWP
@@ -5044,6 +5046,20 @@
         UseNUMA = false;
       }
     }
+    // ISM is not compatible with the NUMA allocator - it always allocates
+    // pages round-robin across the lgroups.
+    if (UseNUMA && UseLargePages && UseISM) {
+      if (!FLAG_IS_DEFAULT(UseNUMA)) {
+        if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseISM)) {
+          UseLargePages = false;
+        } else {
+          warning("UseNUMA is not compatible with ISM large pages, disabling NUMA allocator");
+          UseNUMA = false;
+        }
+      } else {
+        UseNUMA = false;
+      }
+    }
     if (!UseNUMA && ForceNUMA) {
       UseNUMA = true;
     }
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1026,9 +1026,21 @@
           // first replace the tail, then the call
 #ifdef ARM
           if(stub_id == Runtime1::load_klass_patching_id && !VM_Version::supports_movw()) {
+            nmethod* nm = CodeCache::find_nmethod(instr_pc);
+            oop* oop_addr = NULL;
+            assert(nm != NULL, "invalid nmethod_pc");
+            RelocIterator oops(nm, copy_buff, copy_buff + 1);
+            while (oops.next()) {
+              if (oops.type() == relocInfo::oop_type) {
+                oop_Relocation* r = oops.oop_reloc();
+                oop_addr = r->oop_addr();
+                break;
+              }
+            }
+            assert(oop_addr != NULL, "oop relocation must exist");
             copy_buff -= *byte_count;
             NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
-            n_copy2->set_data((intx) (load_klass()), instr_pc);
+            n_copy2->set_pc_relative_offset((address)oop_addr, instr_pc);
           }
 #endif
 
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Mon May 09 08:58:00 2011 -0700
@@ -232,14 +232,7 @@
   }
 
   // compute size of arguments
-  int arg_size = target->arg_size();
-  if (code == Bytecodes::_invokedynamic) {
-    assert(!target->is_static(), "receiver explicit in method");
-    arg_size--;  // implicit, not really on stack
-  }
-  if (!target->is_loaded() && code == Bytecodes::_invokestatic) {
-    arg_size--;
-  }
+  int arg_size = target->invoke_arg_size(code);
   int arg_base = MAX2(state._stack_height - arg_size, 0);
 
   // direct recursive calls are skipped if they can be bound statically without introducing
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Mon May 09 08:58:00 2011 -0700
@@ -756,7 +756,7 @@
   assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic");
 
   bool is_resolved = cpool->cache()->main_entry_at(index)->is_resolved(bc);
-  if (is_resolved && (oop) cpool->cache()->secondary_entry_at(index)->f1() == NULL)
+  if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null())
     // FIXME: code generation could allow for null (unlinked) call site
     is_resolved = false;
 
@@ -770,7 +770,7 @@
 
   // Get the invoker methodOop from the constant pool.
   oop f1_value = cpool->cache()->main_entry_at(index)->f1();
-  methodOop signature_invoker = methodOop(f1_value);
+  methodOop signature_invoker = (methodOop) f1_value;
   assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
          "correct result from LinkResolver::resolve_invokedynamic");
 
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Mon May 09 08:58:00 2011 -0700
@@ -127,7 +127,24 @@
   ciSignature* signature() const                 { return _signature; }
   ciType*      return_type() const               { return _signature->return_type(); }
   int          arg_size_no_receiver() const      { return _signature->size(); }
-  int          arg_size() const                  { return _signature->size() + (_flags.is_static() ? 0 : 1); }
+  // Can only be used on loaded ciMethods
+  int          arg_size() const                  {
+    check_is_loaded();
+    return _signature->size() + (_flags.is_static() ? 0 : 1);
+  }
+  // Report the number of elements on stack when invoking this method.
+  // This is different than the regular arg_size because invokdynamic
+  // has an implicit receiver.
+  int invoke_arg_size(Bytecodes::Code code) const {
+    int arg_size = _signature->size();
+    // Add a receiver argument, maybe:
+    if (code != Bytecodes::_invokestatic &&
+        code != Bytecodes::_invokedynamic) {
+      arg_size++;
+    }
+    return arg_size;
+  }
+
 
   // Method code and related information.
   address code()                                 { if (_code == NULL) load_code(); return _code; }
@@ -276,9 +293,9 @@
   void print_short_name(outputStream* st = tty);
 
   methodOop get_method_handle_target() {
-    klassOop receiver_limit_oop = NULL;
-    int flags = 0;
-    return MethodHandles::decode_method(get_oop(), receiver_limit_oop, flags);
+    KlassHandle receiver_limit; int flags = 0;
+    methodHandle m = MethodHandles::decode_method(get_oop(), receiver_limit, flags);
+    return m();
   }
 };
 
--- a/hotspot/src/share/vm/ci/ciObject.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciObject.cpp	Mon May 09 08:58:00 2011 -0700
@@ -194,6 +194,16 @@
 // ciObject::should_be_constant()
 bool ciObject::should_be_constant() {
   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
+  if (!JavaObjectsInPerm && !is_null_object()) {
+    // We want Strings and Classes to be embeddable by default since
+    // they used to be in the perm world.  Not all Strings used to be
+    // embeddable but there's no easy way to distinguish the interned
+    // from the regulars ones so just treat them all that way.
+    ciEnv* env = CURRENT_ENV;
+    if (klass() == env->String_klass() || klass() == env->Class_klass()) {
+      return true;
+    }
+  }
   return handle() == NULL || !is_scavengable();
 }
 
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1357,7 +1357,7 @@
 };
 
 
-void java_lang_Throwable::fill_in_stack_trace(Handle throwable, TRAPS) {
+void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS) {
   if (!StackTraceInThrowable) return;
   ResourceMark rm(THREAD);
 
@@ -1374,6 +1374,16 @@
   JavaThread* thread = (JavaThread*)THREAD;
   BacktraceBuilder bt(CHECK);
 
+  // If there is no Java frame just return the method that was being called
+  // with bci 0
+  if (!thread->has_last_Java_frame()) {
+    if (max_depth >= 1 && method() != NULL) {
+      bt.push(method(), 0, CHECK);
+      set_backtrace(throwable(), bt.backtrace());
+    }
+    return;
+  }
+
   // Instead of using vframe directly, this version of fill_in_stack_trace
   // basically handles everything by hand. This significantly improved the
   // speed of this method call up to 28.5% on Solaris sparc. 27.1% on Windows.
@@ -1477,7 +1487,7 @@
   set_backtrace(throwable(), bt.backtrace());
 }
 
-void java_lang_Throwable::fill_in_stack_trace(Handle throwable) {
+void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method) {
   // No-op if stack trace is disabled
   if (!StackTraceInThrowable) {
     return;
@@ -1491,7 +1501,7 @@
   PRESERVE_EXCEPTION_MARK;
 
   JavaThread* thread = JavaThread::active();
-  fill_in_stack_trace(throwable, thread);
+  fill_in_stack_trace(throwable, method, thread);
   // ignore exceptions thrown during stack trace filling
   CLEAR_PENDING_EXCEPTION;
 }
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Mon May 09 08:58:00 2011 -0700
@@ -440,8 +440,8 @@
   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 
   // Fill in current stack trace, can cause GC
-  static void fill_in_stack_trace(Handle throwable, TRAPS);
-  static void fill_in_stack_trace(Handle throwable);
+  static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS);
+  static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle());
   // Programmatic access to stack trace
   static oop  get_stack_trace_element(oop throwable, int index, TRAPS);
   static int  get_stack_trace_depth(oop throwable, TRAPS);
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon May 09 08:58:00 2011 -0700
@@ -976,6 +976,15 @@
     return;
   }
 
+  // If the requesting thread is holding the pending list lock
+  // then we just return. We can't risk blocking while holding
+  // the pending list lock or a 3-way deadlock may occur
+  // between the reference handler thread, a GC (instigated
+  // by a compiler thread), and compiled method registration.
+  if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) {
+    return;
+  }
+
   // Outputs from the following MutexLocker block:
   CompileTask* task     = NULL;
   bool         blocking = false;
@@ -1304,17 +1313,8 @@
 // Should the current thread be blocked until this compilation request
 // has been fulfilled?
 bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) {
-  if (!BackgroundCompilation) {
-    Symbol* class_name = method->method_holder()->klass_part()->name();
-    if (class_name->starts_with("java/lang/ref/Reference", 23)) {
-      // The reference handler thread can dead lock with the GC if compilation is blocking,
-      // so we avoid blocking compiles for anything in the java.lang.ref.Reference class,
-      // including inner classes such as ReferenceHandler.
-      return false;
-    }
-    return true;
-  }
-  return false;
+  assert(!instanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock");
+  return !BackgroundCompilation;
 }
 
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1963,10 +1963,21 @@
 // Iteration support, mostly delegated from a CMS generation
 
 void CompactibleFreeListSpace::save_marks() {
-  // mark the "end" of the used space at the time of this call;
+  assert(Thread::current()->is_VM_thread(),
+         "Global variable should only be set when single-threaded");
+  // Mark the "end" of the used space at the time of this call;
   // note, however, that promoted objects from this point
   // on are tracked in the _promoInfo below.
   set_saved_mark_word(unallocated_block());
+#ifdef ASSERT
+  // Check the sanity of save_marks() etc.
+  MemRegion ur    = used_region();
+  MemRegion urasm = used_region_at_save_marks();
+  assert(ur.contains(urasm),
+         err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")"
+                 " should contain [" PTR_FORMAT "," PTR_FORMAT ")",
+                 ur.start(), ur.end(), urasm.start(), urasm.end()));
+#endif
   // inform allocator that promotions should be tracked.
   assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");
   _promoInfo.startTrackingPromotions();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon May 09 08:58:00 2011 -0700
@@ -3189,10 +3189,9 @@
 }
 
 void CMSCollector::setup_cms_unloading_and_verification_state() {
-  const  bool should_verify =    VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
+  const  bool should_verify =   VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
                              || VerifyBeforeExit;
-  const  int  rso           =    SharedHeap::SO_Symbols | SharedHeap::SO_Strings
-                             |   SharedHeap::SO_CodeCache;
+  const  int  rso           =   SharedHeap::SO_Strings | SharedHeap::SO_CodeCache;
 
   if (should_unload_classes()) {   // Should unload classes this cycle
     remove_root_scanning_option(rso);  // Shrink the root set appropriately
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1161,6 +1161,7 @@
     TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC",
                 PrintGC, true, gclog_or_tty);
 
+    TraceCollectorStats tcs(g1mm()->full_collection_counters());
     TraceMemoryManagerStats tms(true /* fullGC */);
 
     double start = os::elapsedTime();
@@ -1339,6 +1340,7 @@
   if (PrintHeapAtGC) {
     Universe::print_heap_after_gc();
   }
+  g1mm()->update_counters();
 
   return true;
 }
@@ -1971,6 +1973,10 @@
 
   init_mutator_alloc_region();
 
+  // Do create of the monitoring and management support so that
+  // values in the heap have been properly initialized.
+  _g1mm = new G1MonitoringSupport(this, &_g1_storage);
+
   return JNI_OK;
 }
 
@@ -2113,6 +2119,28 @@
      (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent));
 }
 
+#ifndef PRODUCT
+void G1CollectedHeap::allocate_dummy_regions() {
+  // Let's fill up most of the region
+  size_t word_size = HeapRegion::GrainWords - 1024;
+  // And as a result the region we'll allocate will be humongous.
+  guarantee(isHumongous(word_size), "sanity");
+
+  for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
+    // Let's use the existing mechanism for the allocation
+    HeapWord* dummy_obj = humongous_obj_allocate(word_size);
+    if (dummy_obj != NULL) {
+      MemRegion mr(dummy_obj, word_size);
+      CollectedHeap::fill_with_object(mr);
+    } else {
+      // If we can't allocate once, we probably cannot allocate
+      // again. Let's get out of the loop.
+      break;
+    }
+  }
+}
+#endif // !PRODUCT
+
 void G1CollectedHeap::increment_full_collections_completed(bool concurrent) {
   MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 
@@ -2777,17 +2805,26 @@
                              bool silent,
                              bool use_prev_marking) {
   if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) {
-    if (!silent) { gclog_or_tty->print("roots "); }
+    if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); }
     VerifyRootsClosure rootsCl(use_prev_marking);
     CodeBlobToOopClosure blobsCl(&rootsCl, /*do_marking=*/ false);
-    process_strong_roots(true,  // activate StrongRootsScope
-                         false,
-                         SharedHeap::SO_AllClasses,
+    // We apply the relevant closures to all the oops in the
+    // system dictionary, the string table and the code cache.
+    const int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_CodeCache;
+    process_strong_roots(true,      // activate StrongRootsScope
+                         true,      // we set "collecting perm gen" to true,
+                                    // so we don't reset the dirty cards in the perm gen.
+                         SharedHeap::ScanningOption(so),  // roots scanning options
                          &rootsCl,
                          &blobsCl,
                          &rootsCl);
+    // Since we used "collecting_perm_gen" == true above, we will not have
+    // checked the refs from perm into the G1-collected heap. We check those
+    // references explicitly below. Whether the relevant cards are dirty
+    // is checked further below in the rem set verification.
+    if (!silent) { gclog_or_tty->print("Permgen roots "); }
+    perm_gen()->oop_iterate(&rootsCl);
     bool failures = rootsCl.failures();
-    rem_set()->invalidate(perm_gen()->used_region(), false);
     if (!silent) { gclog_or_tty->print("HeapRegionSets "); }
     verify_region_sets();
     if (!silent) { gclog_or_tty->print("HeapRegions "); }
@@ -3164,6 +3201,7 @@
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty);
 
+    TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
     TraceMemoryManagerStats tms(false /* fullGC */);
 
     // If the secondary_free_list is not empty, append it to the
@@ -3338,6 +3376,8 @@
         doConcurrentMark();
       }
 
+      allocate_dummy_regions();
+
 #if YOUNG_LIST_VERBOSE
       gclog_or_tty->print_cr("\nEnd of the pause.\nYoung_list:");
       _young_list->print();
@@ -3401,6 +3441,8 @@
   if (PrintHeapAtGC) {
     Universe::print_heap_after_gc();
   }
+  g1mm()->update_counters();
+
   if (G1SummarizeRSetStats &&
       (G1SummarizeRSetStatsPeriod > 0) &&
       (total_collections() % G1SummarizeRSetStatsPeriod == 0)) {
@@ -5314,6 +5356,7 @@
     if (new_alloc_region != NULL) {
       g1_policy()->update_region_num(true /* next_is_young */);
       set_region_short_lived_locked(new_alloc_region);
+      g1mm()->update_eden_counters();
       return new_alloc_region;
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon May 09 08:58:00 2011 -0700
@@ -28,7 +28,9 @@
 #include "gc_implementation/g1/concurrentMark.hpp"
 #include "gc_implementation/g1/g1AllocRegion.hpp"
 #include "gc_implementation/g1/g1RemSet.hpp"
+#include "gc_implementation/g1/g1MonitoringSupport.hpp"
 #include "gc_implementation/g1/heapRegionSets.hpp"
+#include "gc_implementation/shared/hSpaceCounters.hpp"
 #include "gc_implementation/parNew/parGCAllocBuffer.hpp"
 #include "memory/barrierSet.hpp"
 #include "memory/memRegion.hpp"
@@ -57,6 +59,7 @@
 class ConcurrentMark;
 class ConcurrentMarkThread;
 class ConcurrentG1Refine;
+class GenerationCounters;
 
 typedef OverflowTaskQueue<StarTask>         RefToScanQueue;
 typedef GenericTaskQueueSet<RefToScanQueue> RefToScanQueueSet;
@@ -236,6 +239,9 @@
   // current collection.
   HeapRegion* _gc_alloc_region_list;
 
+  // Helper for monitoring and management support.
+  G1MonitoringSupport* _g1mm;
+
   // Determines PLAB size for a particular allocation purpose.
   static size_t desired_plab_sz(GCAllocPurpose purpose);
 
@@ -298,6 +304,14 @@
   // started is maintained in _total_full_collections in CollectedHeap.
   volatile unsigned int _full_collections_completed;
 
+  // This is a non-product method that is helpful for testing. It is
+  // called at the end of a GC and artificially expands the heap by
+  // allocating a number of dead regions. This way we can induce very
+  // frequent marking cycles and stress the cleanup / concurrent
+  // cleanup code more (as all the regions that will be allocated by
+  // this method will be found dead by the marking cycle).
+  void allocate_dummy_regions() PRODUCT_RETURN;
+
   // These are macros so that, if the assert fires, we get the correct
   // line number, file, etc.
 
@@ -542,6 +556,9 @@
   HeapWord* expand_and_allocate(size_t word_size);
 
 public:
+
+  G1MonitoringSupport* g1mm() { return _g1mm; }
+
   // Expand the garbage-first heap by at least the given size (in bytes!).
   // Returns true if the heap was expanded by the requested amount;
   // false otherwise.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc_implementation/g1/g1MonitoringSupport.hpp"
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+
+G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h,
+                                         VirtualSpace* g1_storage_addr) :
+  _g1h(g1h),
+  _incremental_collection_counters(NULL),
+  _full_collection_counters(NULL),
+  _non_young_collection_counters(NULL),
+  _old_space_counters(NULL),
+  _young_collection_counters(NULL),
+  _eden_counters(NULL),
+  _from_counters(NULL),
+  _to_counters(NULL),
+  _g1_storage_addr(g1_storage_addr)
+{
+  // Counters for GC collections
+  //
+  //  name "collector.0".  In a generational collector this would be the
+  // young generation collection.
+  _incremental_collection_counters =
+    new CollectorCounters("G1 incremental collections", 0);
+  //   name "collector.1".  In a generational collector this would be the
+  // old generation collection.
+  _full_collection_counters =
+    new CollectorCounters("G1 stop-the-world full collections", 1);
+
+  // timer sampling for all counters supporting sampling only update the
+  // used value.  See the take_sample() method.  G1 requires both used and
+  // capacity updated so sampling is not currently used.  It might
+  // be sufficient to update all counters in take_sample() even though
+  // take_sample() only returns "used".  When sampling was used, there
+  // were some anomolous values emitted which may have been the consequence
+  // of not updating all values simultaneously (i.e., see the calculation done
+  // in eden_space_used(), is it possbile that the values used to
+  // calculate either eden_used or survivor_used are being updated by
+  // the collector when the sample is being done?).
+  const bool sampled = false;
+
+  // "Generation" and "Space" counters.
+  //
+  //  name "generation.1" This is logically the old generation in
+  // generational GC terms.  The "1, 1" parameters are for
+  // the n-th generation (=1) with 1 space.
+  // Counters are created from minCapacity, maxCapacity, and capacity
+  _non_young_collection_counters =
+    new GenerationCounters("whole heap", 1, 1, _g1_storage_addr);
+
+  //  name  "generation.1.space.0"
+  // Counters are created from maxCapacity, capacity, initCapacity,
+  // and used.
+  _old_space_counters = new HSpaceCounters("space", 0,
+    _g1h->max_capacity(), _g1h->capacity(), _non_young_collection_counters);
+
+  //   Young collection set
+  //  name "generation.0".  This is logically the young generation.
+  //  The "0, 3" are paremeters for the n-th genertaion (=0) with 3 spaces.
+  // See  _non_young_collection_counters for additional counters
+  _young_collection_counters = new GenerationCounters("young", 0, 3, NULL);
+
+  // Replace "max_heap_byte_size() with maximum young gen size for
+  // g1Collectedheap
+  //  name "generation.0.space.0"
+  // See _old_space_counters for additional counters
+  _eden_counters = new HSpaceCounters("eden", 0,
+    _g1h->max_capacity(), eden_space_committed(),
+    _young_collection_counters);
+
+  //  name "generation.0.space.1"
+  // See _old_space_counters for additional counters
+  // Set the arguments to indicate that this survivor space is not used.
+  _from_counters = new HSpaceCounters("s0", 1, (long) 0, (long) 0,
+    _young_collection_counters);
+
+  //  name "generation.0.space.2"
+  // See _old_space_counters for additional counters
+  _to_counters = new HSpaceCounters("s1", 2,
+    _g1h->max_capacity(),
+    survivor_space_committed(),
+    _young_collection_counters);
+}
+
+size_t G1MonitoringSupport::overall_committed() {
+  return g1h()->capacity();
+}
+
+size_t G1MonitoringSupport::overall_used() {
+  return g1h()->used_unlocked();
+}
+
+size_t G1MonitoringSupport::eden_space_committed() {
+  return MAX2(eden_space_used(), (size_t) HeapRegion::GrainBytes);
+}
+
+size_t G1MonitoringSupport::eden_space_used() {
+  size_t young_list_length = g1h()->young_list()->length();
+  size_t eden_used = young_list_length * HeapRegion::GrainBytes;
+  size_t survivor_used = survivor_space_used();
+  eden_used = subtract_up_to_zero(eden_used, survivor_used);
+  return eden_used;
+}
+
+size_t G1MonitoringSupport::survivor_space_committed() {
+  return MAX2(survivor_space_used(),
+              (size_t) HeapRegion::GrainBytes);
+}
+
+size_t G1MonitoringSupport::survivor_space_used() {
+  size_t survivor_num = g1h()->g1_policy()->recorded_survivor_regions();
+  size_t survivor_used = survivor_num * HeapRegion::GrainBytes;
+  return survivor_used;
+}
+
+size_t G1MonitoringSupport::old_space_committed() {
+  size_t committed = overall_committed();
+  size_t eden_committed = eden_space_committed();
+  size_t survivor_committed = survivor_space_committed();
+  committed = subtract_up_to_zero(committed, eden_committed);
+  committed = subtract_up_to_zero(committed, survivor_committed);
+  committed = MAX2(committed, (size_t) HeapRegion::GrainBytes);
+  return committed;
+}
+
+// See the comment near the top of g1MonitoringSupport.hpp for
+// an explanation of these calculations for "used" and "capacity".
+size_t G1MonitoringSupport::old_space_used() {
+  size_t used = overall_used();
+  size_t eden_used = eden_space_used();
+  size_t survivor_used = survivor_space_used();
+  used = subtract_up_to_zero(used, eden_used);
+  used = subtract_up_to_zero(used, survivor_used);
+  return used;
+}
+
+void G1MonitoringSupport::update_counters() {
+  if (UsePerfData) {
+    eden_counters()->update_capacity(eden_space_committed());
+    eden_counters()->update_used(eden_space_used());
+    to_counters()->update_capacity(survivor_space_committed());
+    to_counters()->update_used(survivor_space_used());
+    old_space_counters()->update_capacity(old_space_committed());
+    old_space_counters()->update_used(old_space_used());
+    non_young_collection_counters()->update_all();
+  }
+}
+
+void G1MonitoringSupport::update_eden_counters() {
+  if (UsePerfData) {
+    eden_counters()->update_capacity(eden_space_committed());
+    eden_counters()->update_used(eden_space_used());
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP
+
+#include "gc_implementation/shared/hSpaceCounters.hpp"
+
+class G1CollectedHeap;
+class G1SpaceMonitoringSupport;
+
+// Class for monitoring logical spaces in G1.
+// G1 defines a set of regions as a young
+// collection (analogous to a young generation).
+// The young collection is a logical generation
+// with no fixed chunk (see space.hpp) reflecting
+// the address space for the generation.  In addition
+// to the young collection there is its complement
+// the non-young collection that is simply the regions
+// not in the young collection.  The non-young collection
+// is treated here as a logical old generation only
+// because the monitoring tools expect a generational
+// heap.  The monitoring tools expect that a Space
+// (see space.hpp) exists that describe the
+// address space of young collection and non-young
+// collection and such a view is provided here.
+//
+// This class provides interfaces to access
+// the value of variables for the young collection
+// that include the "capacity" and "used" of the
+// young collection along with constant values
+// for the minimum and maximum capacities for
+// the logical spaces.  Similarly for the non-young
+// collection.
+//
+// Also provided are counters for G1 concurrent collections
+// and stop-the-world full heap collecitons.
+//
+// Below is a description of how "used" and "capactiy"
+// (or committed) is calculated for the logical spaces.
+//
+// 1) The used space calculation for a pool is not necessarily
+// independent of the others. We can easily get from G1 the overall
+// used space in the entire heap, the number of regions in the young
+// generation (includes both eden and survivors), and the number of
+// survivor regions. So, from that we calculate:
+//
+//  survivor_used = survivor_num * region_size
+//  eden_used     = young_region_num * region_size - survivor_used
+//  old_gen_used  = overall_used - eden_used - survivor_used
+//
+// Note that survivor_used and eden_used are upper bounds. To get the
+// actual value we would have to iterate over the regions and add up
+// ->used(). But that'd be expensive. So, we'll accept some lack of
+// accuracy for those two. But, we have to be careful when calculating
+// old_gen_used, in case we subtract from overall_used more then the
+// actual number and our result goes negative.
+//
+// 2) Calculating the used space is straightforward, as described
+// above. However, how do we calculate the committed space, given that
+// we allocate space for the eden, survivor, and old gen out of the
+// same pool of regions? One way to do this is to use the used value
+// as also the committed value for the eden and survivor spaces and
+// then calculate the old gen committed space as follows:
+//
+//  old_gen_committed = overall_committed - eden_committed - survivor_committed
+//
+// Maybe a better way to do that would be to calculate used for eden
+// and survivor as a sum of ->used() over their regions and then
+// calculate committed as region_num * region_size (i.e., what we use
+// to calculate the used space now). This is something to consider
+// in the future.
+//
+// 3) Another decision that is again not straightforward is what is
+// the max size that each memory pool can grow to. One way to do this
+// would be to use the committed size for the max for the eden and
+// survivors and calculate the old gen max as follows (basically, it's
+// a similar pattern to what we use for the committed space, as
+// described above):
+//
+//  old_gen_max = overall_max - eden_max - survivor_max
+//
+// Unfortunately, the above makes the max of each pool fluctuate over
+// time and, even though this is allowed according to the spec, it
+// broke several assumptions in the M&M framework (there were cases
+// where used would reach a value greater than max). So, for max we
+// use -1, which means "undefined" according to the spec.
+//
+// 4) Now, there is a very subtle issue with all the above. The
+// framework will call get_memory_usage() on the three pools
+// asynchronously. As a result, each call might get a different value
+// for, say, survivor_num which will yield inconsistent values for
+// eden_used, survivor_used, and old_gen_used (as survivor_num is used
+// in the calculation of all three). This would normally be
+// ok. However, it's possible that this might cause the sum of
+// eden_used, survivor_used, and old_gen_used to go over the max heap
+// size and this seems to sometimes cause JConsole (and maybe other
+// clients) to get confused. There's not a really an easy / clean
+// solution to this problem, due to the asynchrounous nature of the
+// framework.
+
+class G1MonitoringSupport : public CHeapObj {
+  G1CollectedHeap* _g1h;
+  VirtualSpace* _g1_storage_addr;
+
+  // jstat performance counters
+  //  incremental collections both fully and partially young
+  CollectorCounters*   _incremental_collection_counters;
+  //  full stop-the-world collections
+  CollectorCounters*   _full_collection_counters;
+  //  young collection set counters.  The _eden_counters,
+  // _from_counters, and _to_counters are associated with
+  // this "generational" counter.
+  GenerationCounters*  _young_collection_counters;
+  //  non-young collection set counters. The _old_space_counters
+  // below are associated with this "generational" counter.
+  GenerationCounters*  _non_young_collection_counters;
+  // Counters for the capacity and used for
+  //   the whole heap
+  HSpaceCounters*      _old_space_counters;
+  //   the young collection
+  HSpaceCounters*      _eden_counters;
+  //   the survivor collection (only one, _to_counters, is actively used)
+  HSpaceCounters*      _from_counters;
+  HSpaceCounters*      _to_counters;
+
+  // It returns x - y if x > y, 0 otherwise.
+  // As described in the comment above, some of the inputs to the
+  // calculations we have to do are obtained concurrently and hence
+  // may be inconsistent with each other. So, this provides a
+  // defensive way of performing the subtraction and avoids the value
+  // going negative (which would mean a very large result, given that
+  // the parameter are size_t).
+  static size_t subtract_up_to_zero(size_t x, size_t y) {
+    if (x > y) {
+      return x - y;
+    } else {
+      return 0;
+    }
+  }
+
+ public:
+  G1MonitoringSupport(G1CollectedHeap* g1h, VirtualSpace* g1_storage_addr);
+
+  G1CollectedHeap* g1h() { return _g1h; }
+  VirtualSpace* g1_storage_addr() { return _g1_storage_addr; }
+
+  // Performance Counter accessors
+  void update_counters();
+  void update_eden_counters();
+
+  CollectorCounters* incremental_collection_counters() {
+    return _incremental_collection_counters;
+  }
+  CollectorCounters* full_collection_counters() {
+    return _full_collection_counters;
+  }
+  GenerationCounters* non_young_collection_counters() {
+    return _non_young_collection_counters;
+  }
+  HSpaceCounters*      old_space_counters() { return _old_space_counters; }
+  HSpaceCounters*      eden_counters() { return _eden_counters; }
+  HSpaceCounters*      from_counters() { return _from_counters; }
+  HSpaceCounters*      to_counters() { return _to_counters; }
+
+  // Monitoring support used by
+  //   MemoryService
+  //   jstat counters
+  size_t overall_committed();
+  size_t overall_used();
+
+  size_t eden_space_committed();
+  size_t eden_space_used();
+
+  size_t survivor_space_committed();
+  size_t survivor_space_used();
+
+  size_t old_space_committed();
+  size_t old_space_used();
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Mon May 09 08:58:00 2011 -0700
@@ -300,6 +300,11 @@
   develop(uintx, G1StressConcRegionFreeingDelayMillis, 0,                   \
           "Artificial delay during concurrent region freeing")              \
                                                                             \
+  develop(uintx, G1DummyRegionsPerGC, 0,                                    \
+          "The number of dummy regions G1 will allocate at the end of "     \
+          "each evacuation pause in order to artificially fill up the "     \
+          "heap and stress the marking implementation.")                    \
+                                                                            \
   develop(bool, ReduceInitialCardMarksForG1, false,                         \
           "When ReduceInitialCardMarks is true, this flag setting "         \
           " controls whether G1 allows the RICM optimization")              \
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Mon May 09 08:58:00 2011 -0700
@@ -33,44 +33,43 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/virtualspace.hpp"
 
-void CardTableModRefBS::par_non_clean_card_iterate_work(Space* sp, MemRegion mr,
-                                                        DirtyCardToOopClosure* dcto_cl,
-                                                        MemRegionClosure* cl,
-                                                        int n_threads) {
-  if (n_threads > 0) {
-    assert((n_threads == 1 && ParallelGCThreads == 0) ||
-           n_threads <= (int)ParallelGCThreads,
-           "# worker threads != # requested!");
-    // Make sure the LNC array is valid for the space.
-    jbyte**   lowest_non_clean;
-    uintptr_t lowest_non_clean_base_chunk_index;
-    size_t    lowest_non_clean_chunk_size;
-    get_LNC_array_for_space(sp, lowest_non_clean,
-                            lowest_non_clean_base_chunk_index,
-                            lowest_non_clean_chunk_size);
+void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
+                                                             DirtyCardToOopClosure* dcto_cl,
+                                                             ClearNoncleanCardWrapper* cl,
+                                                             int n_threads) {
+  assert(n_threads > 0, "Error: expected n_threads > 0");
+  assert((n_threads == 1 && ParallelGCThreads == 0) ||
+         n_threads <= (int)ParallelGCThreads,
+         "# worker threads != # requested!");
+  // Make sure the LNC array is valid for the space.
+  jbyte**   lowest_non_clean;
+  uintptr_t lowest_non_clean_base_chunk_index;
+  size_t    lowest_non_clean_chunk_size;
+  get_LNC_array_for_space(sp, lowest_non_clean,
+                          lowest_non_clean_base_chunk_index,
+                          lowest_non_clean_chunk_size);
 
-    int n_strides = n_threads * StridesPerThread;
-    SequentialSubTasksDone* pst = sp->par_seq_tasks();
-    pst->set_n_threads(n_threads);
-    pst->set_n_tasks(n_strides);
+  int n_strides = n_threads * StridesPerThread;
+  SequentialSubTasksDone* pst = sp->par_seq_tasks();
+  pst->set_n_threads(n_threads);
+  pst->set_n_tasks(n_strides);
 
-    int stride = 0;
-    while (!pst->is_task_claimed(/* reference */ stride)) {
-      process_stride(sp, mr, stride, n_strides, dcto_cl, cl,
-                     lowest_non_clean,
-                     lowest_non_clean_base_chunk_index,
-                     lowest_non_clean_chunk_size);
-    }
-    if (pst->all_tasks_completed()) {
-      // Clear lowest_non_clean array for next time.
-      intptr_t first_chunk_index = addr_to_chunk_index(mr.start());
-      uintptr_t last_chunk_index  = addr_to_chunk_index(mr.last());
-      for (uintptr_t ch = first_chunk_index; ch <= last_chunk_index; ch++) {
-        intptr_t ind = ch - lowest_non_clean_base_chunk_index;
-        assert(0 <= ind && ind < (intptr_t)lowest_non_clean_chunk_size,
-               "Bounds error");
-        lowest_non_clean[ind] = NULL;
-      }
+  int stride = 0;
+  while (!pst->is_task_claimed(/* reference */ stride)) {
+    process_stride(sp, mr, stride, n_strides, dcto_cl, cl,
+                   lowest_non_clean,
+                   lowest_non_clean_base_chunk_index,
+                   lowest_non_clean_chunk_size);
+  }
+  if (pst->all_tasks_completed()) {
+    // Clear lowest_non_clean array for next time.
+    intptr_t first_chunk_index = addr_to_chunk_index(mr.start());
+    uintptr_t last_chunk_index  = addr_to_chunk_index(mr.last());
+    for (uintptr_t ch = first_chunk_index; ch <= last_chunk_index; ch++) {
+      intptr_t ind = ch - lowest_non_clean_base_chunk_index;
+      assert(0 <= ind && ind < (intptr_t)lowest_non_clean_chunk_size,
+             "Bounds error");
+      lowest_non_clean[ind] = NULL;
     }
   }
 }
@@ -81,7 +80,7 @@
                MemRegion used,
                jint stride, int n_strides,
                DirtyCardToOopClosure* dcto_cl,
-               MemRegionClosure* cl,
+               ClearNoncleanCardWrapper* cl,
                jbyte** lowest_non_clean,
                uintptr_t lowest_non_clean_base_chunk_index,
                size_t    lowest_non_clean_chunk_size) {
@@ -127,7 +126,11 @@
                              lowest_non_clean_base_chunk_index,
                              lowest_non_clean_chunk_size);
 
-    non_clean_card_iterate_work(chunk_mr, cl);
+    // We do not call the non_clean_card_iterate_serial() version because
+    // we want to clear the cards, and the ClearNoncleanCardWrapper closure
+    // itself does the work of finding contiguous dirty ranges of cards to
+    // process (and clear).
+    cl->do_MemRegion(chunk_mr);
 
     // Find the next chunk of the stride.
     chunk_card_start += CardsPerStrideChunk * n_strides;
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,15 +51,18 @@
 
     cname = PerfDataManager::counter_name(_name_space, "minCapacity");
     PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
+                                     _virtual_space == NULL ? 0 :
                                      _virtual_space->committed_size(), CHECK);
 
     cname = PerfDataManager::counter_name(_name_space, "maxCapacity");
     PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
+                                     _virtual_space == NULL ? 0 :
                                      _virtual_space->reserved_size(), CHECK);
 
     cname = PerfDataManager::counter_name(_name_space, "capacity");
     _current_size = PerfDataManager::create_variable(SUN_GC, cname,
-                                      PerfData::U_Bytes,
+                                     PerfData::U_Bytes,
+                                     _virtual_space == NULL ? 0 :
                                      _virtual_space->committed_size(), CHECK);
   }
 }
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,10 +61,11 @@
   }
 
   virtual void update_all() {
-    _current_size->set_value(_virtual_space->committed_size());
+    _current_size->set_value(_virtual_space == NULL ? 0 :
+                             _virtual_space->committed_size());
   }
 
   const char* name_space() const        { return _name_space; }
+
 };
-
 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GENERATIONCOUNTERS_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.cpp	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc_implementation/shared/hSpaceCounters.hpp"
+#include "memory/generation.hpp"
+#include "memory/resourceArea.hpp"
+
+HSpaceCounters::HSpaceCounters(const char* name,
+                               int ordinal,
+                               size_t max_size,
+                               size_t initial_capacity,
+                               GenerationCounters* gc) {
+
+  if (UsePerfData) {
+    EXCEPTION_MARK;
+    ResourceMark rm;
+
+    const char* cns =
+      PerfDataManager::name_space(gc->name_space(), "space", ordinal);
+
+    _name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
+    strcpy(_name_space, cns);
+
+    const char* cname = PerfDataManager::counter_name(_name_space, "name");
+    PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK);
+
+    cname = PerfDataManager::counter_name(_name_space, "maxCapacity");
+    PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
+                                     (jlong)max_size, CHECK);
+
+    cname = PerfDataManager::counter_name(_name_space, "capacity");
+    _capacity = PerfDataManager::create_variable(SUN_GC, cname,
+                                                 PerfData::U_Bytes,
+                                                 initial_capacity, CHECK);
+
+    cname = PerfDataManager::counter_name(_name_space, "used");
+    _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
+                                             (jlong) 0, CHECK);
+
+    cname = PerfDataManager::counter_name(_name_space, "initCapacity");
+    PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
+                                     initial_capacity, CHECK);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP
+
+#ifndef SERIALGC
+#include "gc_implementation/shared/generationCounters.hpp"
+#include "memory/generation.hpp"
+#include "runtime/perfData.hpp"
+#endif
+
+// A HSpaceCounter is a holder class for performance counters
+// that track a collections (logical spaces) in a heap;
+
+class HeapSpaceUsedHelper;
+class G1SpaceMonitoringSupport;
+
+class HSpaceCounters: public CHeapObj {
+  friend class VMStructs;
+
+ private:
+  PerfVariable*        _capacity;
+  PerfVariable*        _used;
+
+  // Constant PerfData types don't need to retain a reference.
+  // However, it's a good idea to document them here.
+
+  char*             _name_space;
+
+ public:
+
+  HSpaceCounters(const char* name, int ordinal, size_t max_size,
+                 size_t initial_capacity, GenerationCounters* gc);
+
+  ~HSpaceCounters() {
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
+  }
+
+  inline void update_capacity(size_t v) {
+    _capacity->set_value(v);
+  }
+
+  inline void update_used(size_t v) {
+    _used->set_value(v);
+  }
+
+  debug_only(
+    // for security reasons, we do not allow arbitrary reads from
+    // the counters as they may live in shared memory.
+    jlong used() {
+      return _used->get_value();
+    }
+    jlong capacity() {
+      return _used->get_value();
+    }
+  )
+
+  inline void update_all(size_t capacity, size_t used) {
+    update_capacity(capacity);
+    update_used(used);
+  }
+
+  const char* name_space() const        { return _name_space; }
+};
+#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Mon May 09 08:58:00 2011 -0700
@@ -456,31 +456,35 @@
 }
 
 
-void CardTableModRefBS::non_clean_card_iterate(Space* sp,
-                                               MemRegion mr,
-                                               DirtyCardToOopClosure* dcto_cl,
-                                               MemRegionClosure* cl) {
+void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
+                                                                 MemRegion mr,
+                                                                 DirtyCardToOopClosure* dcto_cl,
+                                                                 ClearNoncleanCardWrapper* cl) {
   if (!mr.is_empty()) {
     int n_threads = SharedHeap::heap()->n_par_threads();
     if (n_threads > 0) {
 #ifndef SERIALGC
-      par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads);
+      non_clean_card_iterate_parallel_work(sp, mr, dcto_cl, cl, n_threads);
 #else  // SERIALGC
       fatal("Parallel gc not supported here.");
 #endif // SERIALGC
     } else {
-      non_clean_card_iterate_work(mr, cl);
+      // We do not call the non_clean_card_iterate_serial() version below because
+      // we want to clear the cards (which non_clean_card_iterate_serial() does not
+      // do for us), and the ClearNoncleanCardWrapper closure itself does the work
+      // of finding contiguous dirty ranges of cards to process (and clear).
+      cl->do_MemRegion(mr);
     }
   }
 }
 
-// NOTE: For this to work correctly, it is important that
-// we look for non-clean cards below (so as to catch those
-// marked precleaned), rather than look explicitly for dirty
-// cards (and miss those marked precleaned). In that sense,
-// the name precleaned is currently somewhat of a misnomer.
-void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr,
-                                                    MemRegionClosure* cl) {
+// The iterator itself is not MT-aware, but
+// MT-aware callers and closures can use this to
+// accomplish dirty card iteration in parallel. The
+// iterator itself does not clear the dirty cards, or
+// change their values in any manner.
+void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr,
+                                                      MemRegionClosure* cl) {
   for (int i = 0; i < _cur_covered_regions; i++) {
     MemRegion mri = mr.intersection(_covered[i]);
     if (mri.word_size() > 0) {
@@ -661,7 +665,7 @@
 
 void CardTableModRefBS::verify_clean_region(MemRegion mr) {
   GuaranteeNotModClosure blk(this);
-  non_clean_card_iterate_work(mr, &blk);
+  non_clean_card_iterate_serial(mr, &blk);
 }
 
 // To verify a MemRegion is entirely dirty this closure is passed to
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Mon May 09 08:58:00 2011 -0700
@@ -44,6 +44,7 @@
 class Generation;
 class OopsInGenClosure;
 class DirtyCardToOopClosure;
+class ClearNoncleanCardWrapper;
 
 class CardTableModRefBS: public ModRefBarrierSet {
   // Some classes get to look at some private stuff.
@@ -165,22 +166,28 @@
 
   // Iterate over the portion of the card-table which covers the given
   // region mr in the given space and apply cl to any dirty sub-regions
-  // of mr. cl and dcto_cl must either be the same closure or cl must
-  // wrap dcto_cl. Both are required - neither may be NULL. Also, dcto_cl
-  // may be modified. Note that this function will operate in a parallel
-  // mode if worker threads are available.
-  void non_clean_card_iterate(Space* sp, MemRegion mr,
-                              DirtyCardToOopClosure* dcto_cl,
-                              MemRegionClosure* cl);
+  // of mr. Dirty cards are _not_ cleared by the iterator method itself,
+  // but closures may arrange to do so on their own should they so wish.
+  void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl);
 
-  // Utility function used to implement the other versions below.
-  void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl);
+  // A variant of the above that will operate in a parallel mode if
+  // worker threads are available, and clear the dirty cards as it
+  // processes them.
+  // ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl,
+  // which may itself be modified by the method.
+  void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
+                                                DirtyCardToOopClosure* dcto_cl,
+                                                ClearNoncleanCardWrapper* cl);
 
-  void par_non_clean_card_iterate_work(Space* sp, MemRegion mr,
-                                       DirtyCardToOopClosure* dcto_cl,
-                                       MemRegionClosure* cl,
-                                       int n_threads);
+ private:
+  // Work method used to implement non_clean_card_iterate_possibly_parallel()
+  // above in the parallel case.
+  void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
+                                            DirtyCardToOopClosure* dcto_cl,
+                                            ClearNoncleanCardWrapper* cl,
+                                            int n_threads);
 
+ protected:
   // Dirty the bytes corresponding to "mr" (not all of which must be
   // covered.)
   void dirty_MemRegion(MemRegion mr);
@@ -237,7 +244,7 @@
                       MemRegion used,
                       jint stride, int n_strides,
                       DirtyCardToOopClosure* dcto_cl,
-                      MemRegionClosure* cl,
+                      ClearNoncleanCardWrapper* cl,
                       jbyte** lowest_non_clean,
                       uintptr_t lowest_non_clean_base_chunk_index,
                       size_t lowest_non_clean_chunk_size);
@@ -409,14 +416,14 @@
   // marking, where a dirty card may cause scanning, and summarization
   // marking, of objects that extend onto subsequent cards.)
   void mod_card_iterate(MemRegionClosure* cl) {
-    non_clean_card_iterate_work(_whole_heap, cl);
+    non_clean_card_iterate_serial(_whole_heap, cl);
   }
 
   // Like the "mod_cards_iterate" above, except only invokes the closure
   // for cards within the MemRegion "mr" (which is required to be
   // card-aligned and sized.)
   void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) {
-    non_clean_card_iterate_work(mr, cl);
+    non_clean_card_iterate_serial(mr, cl);
   }
 
   static uintx ct_max_alignment_constraint();
@@ -493,4 +500,5 @@
   void set_CTRS(CardTableRS* rs) { _rs = rs; }
 };
 
+
 #endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Mon May 09 08:58:00 2011 -0700
@@ -105,107 +105,111 @@
   g->younger_refs_iterate(blk);
 }
 
-class ClearNoncleanCardWrapper: public MemRegionClosure {
-  MemRegionClosure* _dirty_card_closure;
-  CardTableRS* _ct;
-  bool _is_par;
-private:
-  // Clears the given card, return true if the corresponding card should be
-  // processed.
-  bool clear_card(jbyte* entry) {
-    if (_is_par) {
-      while (true) {
-        // In the parallel case, we may have to do this several times.
-        jbyte entry_val = *entry;
-        assert(entry_val != CardTableRS::clean_card_val(),
-               "We shouldn't be looking at clean cards, and this should "
-               "be the only place they get cleaned.");
-        if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val)
-            || _ct->is_prev_youngergen_card_val(entry_val)) {
-          jbyte res =
-            Atomic::cmpxchg(CardTableRS::clean_card_val(), entry, entry_val);
-          if (res == entry_val) {
-            break;
-          } else {
-            assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card,
-                   "The CAS above should only fail if another thread did "
-                   "a GC write barrier.");
-          }
-        } else if (entry_val ==
-                   CardTableRS::cur_youngergen_and_prev_nonclean_card) {
-          // Parallelism shouldn't matter in this case.  Only the thread
-          // assigned to scan the card should change this value.
-          *entry = _ct->cur_youngergen_card_val();
-          break;
-        } else {
-          assert(entry_val == _ct->cur_youngergen_card_val(),
-                 "Should be the only possibility.");
-          // In this case, the card was clean before, and become
-          // cur_youngergen only because of processing of a promoted object.
-          // We don't have to look at the card.
-          return false;
-        }
+inline bool ClearNoncleanCardWrapper::clear_card(jbyte* entry) {
+  if (_is_par) {
+    return clear_card_parallel(entry);
+  } else {
+    return clear_card_serial(entry);
+  }
+}
+
+inline bool ClearNoncleanCardWrapper::clear_card_parallel(jbyte* entry) {
+  while (true) {
+    // In the parallel case, we may have to do this several times.
+    jbyte entry_val = *entry;
+    assert(entry_val != CardTableRS::clean_card_val(),
+           "We shouldn't be looking at clean cards, and this should "
+           "be the only place they get cleaned.");
+    if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val)
+        || _ct->is_prev_youngergen_card_val(entry_val)) {
+      jbyte res =
+        Atomic::cmpxchg(CardTableRS::clean_card_val(), entry, entry_val);
+      if (res == entry_val) {
+        break;
+      } else {
+        assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card,
+               "The CAS above should only fail if another thread did "
+               "a GC write barrier.");
       }
-      return true;
+    } else if (entry_val ==
+               CardTableRS::cur_youngergen_and_prev_nonclean_card) {
+      // Parallelism shouldn't matter in this case.  Only the thread
+      // assigned to scan the card should change this value.
+      *entry = _ct->cur_youngergen_card_val();
+      break;
     } else {
-      jbyte entry_val = *entry;
-      assert(entry_val != CardTableRS::clean_card_val(),
-             "We shouldn't be looking at clean cards, and this should "
-             "be the only place they get cleaned.");
-      assert(entry_val != CardTableRS::cur_youngergen_and_prev_nonclean_card,
-             "This should be possible in the sequential case.");
-      *entry = CardTableRS::clean_card_val();
-      return true;
+      assert(entry_val == _ct->cur_youngergen_card_val(),
+             "Should be the only possibility.");
+      // In this case, the card was clean before, and become
+      // cur_youngergen only because of processing of a promoted object.
+      // We don't have to look at the card.
+      return false;
     }
   }
+  return true;
+}
 
-public:
-  ClearNoncleanCardWrapper(MemRegionClosure* dirty_card_closure,
-                           CardTableRS* ct) :
+
+inline bool ClearNoncleanCardWrapper::clear_card_serial(jbyte* entry) {
+  jbyte entry_val = *entry;
+  assert(entry_val != CardTableRS::clean_card_val(),
+         "We shouldn't be looking at clean cards, and this should "
+         "be the only place they get cleaned.");
+  assert(entry_val != CardTableRS::cur_youngergen_and_prev_nonclean_card,
+         "This should be possible in the sequential case.");
+  *entry = CardTableRS::clean_card_val();
+  return true;
+}
+
+ClearNoncleanCardWrapper::ClearNoncleanCardWrapper(
+  MemRegionClosure* dirty_card_closure, CardTableRS* ct) :
     _dirty_card_closure(dirty_card_closure), _ct(ct) {
     _is_par = (SharedHeap::heap()->n_par_threads() > 0);
+}
+
+void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) {
+  assert(mr.word_size() > 0, "Error");
+  assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned");
+  // mr.end() may not necessarily be card aligned.
+  jbyte* cur_entry = _ct->byte_for(mr.last());
+  const jbyte* limit = _ct->byte_for(mr.start());
+  HeapWord* end_of_non_clean = mr.end();
+  HeapWord* start_of_non_clean = end_of_non_clean;
+  while (cur_entry >= limit) {
+    HeapWord* cur_hw = _ct->addr_for(cur_entry);
+    if ((*cur_entry != CardTableRS::clean_card_val()) && clear_card(cur_entry)) {
+      // Continue the dirty range by opening the
+      // dirty window one card to the left.
+      start_of_non_clean = cur_hw;
+    } else {
+      // We hit a "clean" card; process any non-empty
+      // "dirty" range accumulated so far.
+      if (start_of_non_clean < end_of_non_clean) {
+        const MemRegion mrd(start_of_non_clean, end_of_non_clean);
+        _dirty_card_closure->do_MemRegion(mrd);
+      }
+      // Reset the dirty window, while continuing to look
+      // for the next dirty card that will start a
+      // new dirty window.
+      end_of_non_clean = cur_hw;
+      start_of_non_clean = cur_hw;
+    }
+    // Note that "cur_entry" leads "start_of_non_clean" in
+    // its leftward excursion after this point
+    // in the loop and, when we hit the left end of "mr",
+    // will point off of the left end of the card-table
+    // for "mr".
+    cur_entry--;
   }
-  void do_MemRegion(MemRegion mr) {
-    // We start at the high end of "mr", walking backwards
-    // while accumulating a contiguous dirty range of cards in
-    // [start_of_non_clean, end_of_non_clean) which we then
-    // process en masse.
-    HeapWord* end_of_non_clean = mr.end();
-    HeapWord* start_of_non_clean = end_of_non_clean;
-    jbyte*       entry = _ct->byte_for(mr.last());
-    const jbyte* first_entry = _ct->byte_for(mr.start());
-    while (entry >= first_entry) {
-      HeapWord* cur = _ct->addr_for(entry);
-      if (!clear_card(entry)) {
-        // We hit a clean card; process any non-empty
-        // dirty range accumulated so far.
-        if (start_of_non_clean < end_of_non_clean) {
-          MemRegion mr2(start_of_non_clean, end_of_non_clean);
-          _dirty_card_closure->do_MemRegion(mr2);
-        }
-        // Reset the dirty window while continuing to
-        // look for the next dirty window to process.
-        end_of_non_clean = cur;
-        start_of_non_clean = end_of_non_clean;
-      }
-      // Open the left end of the window one card to the left.
-      start_of_non_clean = cur;
-      // Note that "entry" leads "start_of_non_clean" in
-      // its leftward excursion after this point
-      // in the loop and, when we hit the left end of "mr",
-      // will point off of the left end of the card-table
-      // for "mr".
-      entry--;
-    }
-    // If the first card of "mr" was dirty, we will have
-    // been left with a dirty window, co-initial with "mr",
-    // which we now process.
-    if (start_of_non_clean < end_of_non_clean) {
-      MemRegion mr2(start_of_non_clean, end_of_non_clean);
-      _dirty_card_closure->do_MemRegion(mr2);
-    }
+  // If the first card of "mr" was dirty, we will have
+  // been left with a dirty window, co-initial with "mr",
+  // which we now process.
+  if (start_of_non_clean < end_of_non_clean) {
+    const MemRegion mrd(start_of_non_clean, end_of_non_clean);
+    _dirty_card_closure->do_MemRegion(mrd);
   }
-};
+}
+
 // clean (by dirty->clean before) ==> cur_younger_gen
 // dirty                          ==> cur_youngergen_and_prev_nonclean_card
 // precleaned                     ==> cur_youngergen_and_prev_nonclean_card
@@ -246,8 +250,35 @@
                                                    cl->gen_boundary());
   ClearNoncleanCardWrapper clear_cl(dcto_cl, this);
 
-  _ct_bs->non_clean_card_iterate(sp, sp->used_region_at_save_marks(),
-                                dcto_cl, &clear_cl);
+  const MemRegion urasm = sp->used_region_at_save_marks();
+#ifdef ASSERT
+  // Convert the assertion check to a warning if we are running
+  // CMS+ParNew until related bug is fixed.
+  MemRegion ur    = sp->used_region();
+  assert(ur.contains(urasm) || (UseConcMarkSweepGC && UseParNewGC),
+         err_msg("Did you forget to call save_marks()? "
+                 "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
+                 "[" PTR_FORMAT ", " PTR_FORMAT ")",
+                 urasm.start(), urasm.end(), ur.start(), ur.end()));
+  // In the case of CMS+ParNew, issue a warning
+  if (!ur.contains(urasm)) {
+    assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
+    warning("CMS+ParNew: Did you forget to call save_marks()? "
+            "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
+            "[" PTR_FORMAT ", " PTR_FORMAT ")",
+             urasm.start(), urasm.end(), ur.start(), ur.end());
+    MemRegion ur2 = sp->used_region();
+    MemRegion urasm2 = sp->used_region_at_save_marks();
+    if (!ur.equals(ur2)) {
+      warning("CMS+ParNew: Flickering used_region()!!");
+    }
+    if (!urasm.equals(urasm2)) {
+      warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
+    }
+  }
+#endif
+  _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm,
+                                                   dcto_cl, &clear_cl);
 }
 
 void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
--- a/hotspot/src/share/vm/memory/cardTableRS.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp	Mon May 09 08:58:00 2011 -0700
@@ -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
@@ -166,4 +166,21 @@
 
 };
 
+class ClearNoncleanCardWrapper: public MemRegionClosure {
+  MemRegionClosure* _dirty_card_closure;
+  CardTableRS* _ct;
+  bool _is_par;
+private:
+  // Clears the given card, return true if the corresponding card should be
+  // processed.
+  inline bool clear_card(jbyte* entry);
+  // Work methods called by the clear_card()
+  inline bool clear_card_serial(jbyte* entry);
+  inline bool clear_card_parallel(jbyte* entry);
+
+public:
+  ClearNoncleanCardWrapper(MemRegionClosure* dirty_card_closure, CardTableRS* ct);
+  void do_MemRegion(MemRegion mr);
+};
+
 #endif // SHARE_VM_MEMORY_CARDTABLERS_HPP
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Mon May 09 08:58:00 2011 -0700
@@ -427,13 +427,13 @@
   // explicitly mark reachable objects in younger generations, to avoid
   // excess storage retention.)  If "collecting_perm_gen" is false, then
   // roots that may only contain references to permGen objects are not
-  // scanned. The "so" argument determines which of the roots
+  // scanned; instead, the older_gens closure is applied to all outgoing
+  // references in the perm gen.  The "so" argument determines which of the roots
   // the closure is applied to:
   // "SO_None" does none;
   // "SO_AllClasses" applies the closure to all entries in the SystemDictionary;
   // "SO_SystemClasses" to all the "system" classes and loaders;
-  // "SO_Symbols_and_Strings" applies the closure to all entries in
-  // SymbolsTable and StringTable.
+  // "SO_Strings" applies the closure to all entries in the StringTable.
   void gen_process_strong_roots(int level,
                                 bool younger_gens_as_roots,
                                 // The remaining arguments are in an order
--- a/hotspot/src/share/vm/memory/genOopClosures.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp	Mon May 09 08:58:00 2011 -0700
@@ -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
@@ -175,7 +175,7 @@
  protected:
   template <class T> inline void do_oop_work(T* p) {
     oop obj = oopDesc::load_decode_heap_oop(p);
-    guarantee(obj->is_oop_or_null(), "invalid oop");
+    guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, obj));
   }
  public:
   virtual void do_oop(oop* p);
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Mon May 09 08:58:00 2011 -0700
@@ -46,7 +46,6 @@
   SH_PS_Management_oops_do,
   SH_PS_SystemDictionary_oops_do,
   SH_PS_jvmti_oops_do,
-  SH_PS_SymbolTable_oops_do,
   SH_PS_StringTable_oops_do,
   SH_PS_CodeCache_oops_do,
   // Leave this one last.
@@ -161,13 +160,9 @@
   if (!_process_strong_tasks->is_task_claimed(SH_PS_SystemDictionary_oops_do)) {
     if (so & SO_AllClasses) {
       SystemDictionary::oops_do(roots);
-    } else
-      if (so & SO_SystemClasses) {
-        SystemDictionary::always_strong_oops_do(roots);
-      }
-  }
-
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_SymbolTable_oops_do)) {
+    } else if (so & SO_SystemClasses) {
+      SystemDictionary::always_strong_oops_do(roots);
+    }
   }
 
   if (!_process_strong_tasks->is_task_claimed(SH_PS_StringTable_oops_do)) {
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Mon May 09 08:58:00 2011 -0700
@@ -192,9 +192,8 @@
     SO_None                = 0x0,
     SO_AllClasses          = 0x1,
     SO_SystemClasses       = 0x2,
-    SO_Symbols             = 0x4,
-    SO_Strings             = 0x8,
-    SO_CodeCache           = 0x10
+    SO_Strings             = 0x4,
+    SO_CodeCache           = 0x8
   };
 
   FlexibleWorkGang* workers() const { return _workers; }
@@ -208,14 +207,13 @@
 
   // Invoke the "do_oop" method the closure "roots" on all root locations.
   // If "collecting_perm_gen" is false, then roots that may only contain
-  // references to permGen objects are not scanned.  If true, the
-  // "perm_gen" closure is applied to all older-to-younger refs in the
+  // references to permGen objects are not scanned; instead, in that case,
+  // the "perm_blk" closure is applied to all outgoing refs in the
   // permanent generation.  The "so" argument determines which of roots
   // the closure is applied to:
   // "SO_None" does none;
   // "SO_AllClasses" applies the closure to all entries in the SystemDictionary;
   // "SO_SystemClasses" to all the "system" classes and loaders;
-  // "SO_Symbols" applies the closure to all entries in SymbolsTable;
   // "SO_Strings" applies the closure to all entries in StringTable;
   // "SO_CodeCache" applies the closure to all elements of the CodeCache.
   void process_strong_roots(bool activate_scope,
--- a/hotspot/src/share/vm/oops/cpCacheOop.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp	Mon May 09 08:58:00 2011 -0700
@@ -104,7 +104,7 @@
   void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL);
   bool success = (result == NULL);
   if (success) {
-    update_barrier_set(f1_addr, f1);
+    update_barrier_set((void*) f1_addr, f1);
   }
 }
 
@@ -275,21 +275,23 @@
   return (int) bsm_cache_index;
 }
 
-void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site,
-                                              methodHandle signature_invoker) {
+void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site, methodHandle signature_invoker) {
   assert(is_secondary_entry(), "");
+  // NOTE: it's important that all other values are set before f1 is
+  // set since some users short circuit on f1 being set
+  // (i.e. non-null) and that may result in uninitialized values for
+  // other racing threads (e.g. flags).
   int param_size = signature_invoker->size_of_parameters();
   assert(param_size >= 1, "method argument size must include MH.this");
-  param_size -= 1;              // do not count MH.this; it is not stacked for invokedynamic
-  if (Atomic::cmpxchg_ptr(call_site(), &_f1, NULL) == NULL) {
-    // racing threads might be trying to install their own favorites
-    set_f1(call_site());
-  }
+  param_size -= 1;  // do not count MH.this; it is not stacked for invokedynamic
   bool is_final = true;
   assert(signature_invoker->is_final_method(), "is_final");
-  set_flags(as_flags(as_TosState(signature_invoker->result_type()), is_final, false, false, false, true) | param_size);
+  int flags = as_flags(as_TosState(signature_invoker->result_type()), is_final, false, false, false, true) | param_size;
+  assert(_flags == 0 || _flags == flags, "flags should be the same");
+  set_flags(flags);
   // do not do set_bytecode on a secondary CP cache entry
   //set_bytecode_1(Bytecodes::_invokedynamic);
+  set_f1_if_null_atomic(call_site());  // This must be the last one to set (see NOTE above)!
 }
 
 
--- a/hotspot/src/share/vm/opto/escape.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/escape.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1437,7 +1437,10 @@
 
   // Update the memory inputs of MemNodes with the value we computed
   // in Phase 2 and move stores memory users to corresponding memory slices.
-#ifdef ASSERT
+
+  // Disable memory split verification code until the fix for 6984348.
+  // Currently it produces false negative results since it does not cover all cases.
+#if 0 // ifdef ASSERT
   visited.Reset();
   Node_Stack old_mems(arena, _compile->unique() >> 2);
 #endif
@@ -1447,7 +1450,7 @@
       Node *n = ptnode_adr(i)->_node;
       assert(n != NULL, "sanity");
       if (n->is_Mem()) {
-#ifdef ASSERT
+#if 0 // ifdef ASSERT
         Node* old_mem = n->in(MemNode::Memory);
         if (!visited.test_set(old_mem->_idx)) {
           old_mems.push(old_mem, old_mem->outcnt());
@@ -1469,13 +1472,13 @@
       }
     }
   }
-#ifdef ASSERT
+#if 0 // ifdef ASSERT
   // Verify that memory was split correctly
   while (old_mems.is_nonempty()) {
     Node* old_mem = old_mems.node();
     uint  old_cnt = old_mems.index();
     old_mems.pop();
-    assert(old_cnt = old_mem->outcnt(), "old mem could be lost");
+    assert(old_cnt == old_mem->outcnt(), "old mem could be lost");
   }
 #endif
 }
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1033,14 +1033,10 @@
       iter.reset_to_bci(bci());
       iter.next();
       ciMethod* method = iter.get_method(ignore);
-      inputs = method->arg_size_no_receiver();
-      // Add a receiver argument, maybe:
-      if (code != Bytecodes::_invokestatic &&
-          code != Bytecodes::_invokedynamic)
-        inputs += 1;
       // (Do not use ciMethod::arg_size(), because
       // it might be an unloaded method, which doesn't
       // know whether it is static or not.)
+      inputs = method->invoke_arg_size(code);
       int size = method->return_type()->size();
       depth = size - inputs;
     }
@@ -2957,8 +2953,7 @@
 
 //---------------------------set_output_for_allocation-------------------------
 Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
-                                          const TypeOopPtr* oop_type,
-                                          bool raw_mem_only) {
+                                          const TypeOopPtr* oop_type) {
   int rawidx = Compile::AliasIdxRaw;
   alloc->set_req( TypeFunc::FramePtr, frameptr() );
   add_safepoint_edges(alloc);
@@ -2982,7 +2977,7 @@
                                                  rawoop)->as_Initialize();
   assert(alloc->initialization() == init,  "2-way macro link must work");
   assert(init ->allocation()     == alloc, "2-way macro link must work");
-  if (ReduceFieldZeroing && !raw_mem_only) {
+  {
     // Extract memory strands which may participate in the new object's
     // initialization, and source them from the new InitializeNode.
     // This will allow us to observe initializations when they occur,
@@ -3043,11 +3038,9 @@
 // the type to a constant.
 // The optional arguments are for specialized use by intrinsics:
 //  - If 'extra_slow_test' if not null is an extra condition for the slow-path.
-//  - If 'raw_mem_only', do not cast the result to an oop.
 //  - If 'return_size_val', report the the total object size to the caller.
 Node* GraphKit::new_instance(Node* klass_node,
                              Node* extra_slow_test,
-                             bool raw_mem_only, // affect only raw memory
                              Node* *return_size_val) {
   // Compute size in doublewords
   // The size is always an integral number of doublewords, represented
@@ -3118,7 +3111,7 @@
                      size, klass_node,
                      initial_slow_test);
 
-  return set_output_for_allocation(alloc, oop_type, raw_mem_only);
+  return set_output_for_allocation(alloc, oop_type);
 }
 
 //-------------------------------new_array-------------------------------------
@@ -3128,7 +3121,6 @@
 Node* GraphKit::new_array(Node* klass_node,     // array klass (maybe variable)
                           Node* length,         // number of array elements
                           int   nargs,          // number of arguments to push back for uncommon trap
-                          bool raw_mem_only,    // affect only raw memory
                           Node* *return_size_val) {
   jint  layout_con = Klass::_lh_neutral_value;
   Node* layout_val = get_layout_helper(klass_node, layout_con);
@@ -3273,7 +3265,7 @@
     ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
   }
 
-  Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only);
+  Node* javaoop = set_output_for_allocation(alloc, ary_type);
 
   // Cast length on remaining path to be as narrow as possible
   if (map()->find_edge(length) >= 0) {
@@ -3462,9 +3454,22 @@
 
   // Get the alias_index for raw card-mark memory
   int adr_type = Compile::AliasIdxRaw;
+  Node*   zero = __ ConI(0); // Dirty card value
+  BasicType bt = T_BYTE;
+
+  if (UseCondCardMark) {
+    // The classic GC reference write barrier is typically implemented
+    // as a store into the global card mark table.  Unfortunately
+    // unconditional stores can result in false sharing and excessive
+    // coherence traffic as well as false transactional aborts.
+    // UseCondCardMark enables MP "polite" conditional card mark
+    // stores.  In theory we could relax the load from ctrl() to
+    // no_ctrl, but that doesn't buy much latitude.
+    Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, bt, adr_type);
+    __ if_then(card_val, BoolTest::ne, zero);
+  }
+
   // Smash zero into card
-  Node*   zero = __ ConI(0);
-  BasicType bt = T_BYTE;
   if( !UseConcMarkSweepGC ) {
     __ store(__ ctrl(), card_adr, zero, bt, adr_type);
   } else {
@@ -3472,6 +3477,10 @@
     __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type);
   }
 
+  if (UseCondCardMark) {
+    __ end_if();
+  }
+
   // Final sync IdealKit and GraphKit.
   final_sync(ideal);
 }
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Mon May 09 08:58:00 2011 -0700
@@ -773,15 +773,13 @@
 
   // implementation of object creation
   Node* set_output_for_allocation(AllocateNode* alloc,
-                                  const TypeOopPtr* oop_type,
-                                  bool raw_mem_only);
+                                  const TypeOopPtr* oop_type);
   Node* get_layout_helper(Node* klass_node, jint& constant_value);
   Node* new_instance(Node* klass_node,
                      Node* slow_test = NULL,
-                     bool raw_mem_only = false,
                      Node* *return_size_val = NULL);
   Node* new_array(Node* klass_node, Node* count_val, int nargs,
-                  bool raw_mem_only = false, Node* *return_size_val = NULL);
+                  Node* *return_size_val = NULL);
 
   // Handy for making control flow
   IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) {
--- a/hotspot/src/share/vm/opto/library_call.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Mon May 09 08:58:00 2011 -0700
@@ -3527,8 +3527,7 @@
       Node* orig_tail = _gvn.transform( new(C, 3) SubINode(orig_length, start) );
       Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
 
-      const bool raw_mem_only = true;
-      newcopy = new_array(klass_node, length, 0, raw_mem_only);
+      newcopy = new_array(klass_node, length, 0);
 
       // Generate a direct call to the right arraycopy function(s).
       // We know the copy is disjoint but we might not know if the
@@ -4325,8 +4324,6 @@
 
     const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
     int raw_adr_idx = Compile::AliasIdxRaw;
-    const bool raw_mem_only = true;
-
 
     Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL);
     if (array_ctl != NULL) {
@@ -4335,8 +4332,7 @@
       set_control(array_ctl);
       Node* obj_length = load_array_length(obj);
       Node* obj_size  = NULL;
-      Node* alloc_obj = new_array(obj_klass, obj_length, 0,
-                                  raw_mem_only, &obj_size);
+      Node* alloc_obj = new_array(obj_klass, obj_length, 0, &obj_size);
 
       if (!use_ReduceInitialCardMarks()) {
         // If it is an oop array, it requires very special treatment,
@@ -4408,7 +4404,7 @@
       // It's an instance, and it passed the slow-path tests.
       PreserveJVMState pjvms(this);
       Node* obj_size  = NULL;
-      Node* alloc_obj = new_instance(obj_klass, NULL, raw_mem_only, &obj_size);
+      Node* alloc_obj = new_instance(obj_klass, NULL, &obj_size);
 
       copy_to_clone(obj, alloc_obj, obj_size, false, !use_ReduceInitialCardMarks());
 
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Mon May 09 08:58:00 2011 -0700
@@ -2262,6 +2262,9 @@
 //                  stmt1
 //                    |
 //                    v
+//               loop predicate
+//                    |
+//                    v
 //                  stmt2 clone
 //                    |
 //                    v
@@ -2272,9 +2275,6 @@
 //         :  false   true
 //         :  |       |
 //         :  |       v
-//         :  | loop predicate
-//         :  |       |
-//         :  |       v
 //         :  |    newloop<-----+
 //         :  |        |        |
 //         :  |     stmt3 clone |
@@ -2330,7 +2330,6 @@
     }
   }
 
-  Node* entry = head->in(LoopNode::EntryControl);
   int dd = dom_depth(head);
 
   // Step 1: find cut point
@@ -2627,8 +2626,6 @@
 
   // Backedge of the surviving new_head (the clone) is original last_peel
   _igvn.hash_delete(new_head_clone);
-  Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl));
-  new_head_clone->set_req(LoopNode::EntryControl, new_entry);
   new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
   _igvn._worklist.push(new_head_clone);
 
--- a/hotspot/src/share/vm/opto/macro.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/macro.cpp	Mon May 09 08:58:00 2011 -0700
@@ -221,9 +221,16 @@
     Node *shift = p2x->unique_out();
     Node *addp = shift->unique_out();
     for (DUIterator_Last jmin, j = addp->last_outs(jmin); j >= jmin; --j) {
-      Node *st = addp->last_out(j);
-      assert(st->is_Store(), "store required");
-      _igvn.replace_node(st, st->in(MemNode::Memory));
+      Node *mem = addp->last_out(j);
+      if (UseCondCardMark && mem->is_Load()) {
+        assert(mem->Opcode() == Op_LoadB, "unexpected code shape");
+        // The load is checking if the card has been written so
+        // replace it with zero to fold the test.
+        _igvn.replace_node(mem, intcon(0));
+        continue;
+      }
+      assert(mem->is_Store(), "store required");
+      _igvn.replace_node(mem, mem->in(MemNode::Memory));
     }
   } else {
     // G1 pre/post barriers
--- a/hotspot/src/share/vm/opto/memnode.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1259,15 +1259,18 @@
     return NULL; // Wait stable graph
   }
   uint cnt = mem->req();
-  for( uint i = 1; i < cnt; i++ ) {
+  for (uint i = 1; i < cnt; i++) {
+    Node* rc = region->in(i);
+    if (rc == NULL || phase->type(rc) == Type::TOP)
+      return NULL; // Wait stable graph
     Node *in = mem->in(i);
-    if( in == NULL ) {
+    if (in == NULL) {
       return NULL; // Wait stable graph
     }
   }
   // Check for loop invariant.
   if (cnt == 3) {
-    for( uint i = 1; i < cnt; i++ ) {
+    for (uint i = 1; i < cnt; i++) {
       Node *in = mem->in(i);
       Node* m = MemNode::optimize_memory_chain(in, addr_t, phase);
       if (m == mem) {
@@ -1281,38 +1284,37 @@
 
   // Do nothing here if Identity will find a value
   // (to avoid infinite chain of value phis generation).
-  if ( !phase->eqv(this, this->Identity(phase)) )
+  if (!phase->eqv(this, this->Identity(phase)))
     return NULL;
 
   // Skip the split if the region dominates some control edge of the address.
-  if (cnt == 3 && !MemNode::all_controls_dominate(address, region))
+  if (!MemNode::all_controls_dominate(address, region))
     return NULL;
 
   const Type* this_type = this->bottom_type();
   int this_index  = phase->C->get_alias_index(addr_t);
   int this_offset = addr_t->offset();
   int this_iid    = addr_t->is_oopptr()->instance_id();
-  int wins = 0;
   PhaseIterGVN *igvn = phase->is_IterGVN();
   Node *phi = new (igvn->C, region->req()) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
-  for( uint i = 1; i < region->req(); i++ ) {
+  for (uint i = 1; i < region->req(); i++) {
     Node *x;
     Node* the_clone = NULL;
-    if( region->in(i) == phase->C->top() ) {
+    if (region->in(i) == phase->C->top()) {
       x = phase->C->top();      // Dead path?  Use a dead data op
     } else {
       x = this->clone();        // Else clone up the data op
       the_clone = x;            // Remember for possible deletion.
       // Alter data node to use pre-phi inputs
-      if( this->in(0) == region ) {
-        x->set_req( 0, region->in(i) );
+      if (this->in(0) == region) {
+        x->set_req(0, region->in(i));
       } else {
-        x->set_req( 0, NULL );
+        x->set_req(0, NULL);
       }
-      for( uint j = 1; j < this->req(); j++ ) {
+      for (uint j = 1; j < this->req(); j++) {
         Node *in = this->in(j);
-        if( in->is_Phi() && in->in(0) == region )
-          x->set_req( j, in->in(i) ); // Use pre-Phi input for the clone
+        if (in->is_Phi() && in->in(0) == region)
+          x->set_req(j, in->in(i)); // Use pre-Phi input for the clone
       }
     }
     // Check for a 'win' on some paths
@@ -1321,12 +1323,11 @@
     bool singleton = t->singleton();
 
     // See comments in PhaseIdealLoop::split_thru_phi().
-    if( singleton && t == Type::TOP ) {
+    if (singleton && t == Type::TOP) {
       singleton &= region->is_Loop() && (i != LoopNode::EntryControl);
     }
 
-    if( singleton ) {
-      wins++;
+    if (singleton) {
       x = igvn->makecon(t);
     } else {
       // We now call Identity to try to simplify the cloned node.
@@ -1340,13 +1341,11 @@
       // igvn->type(x) is set to x->Value() already.
       x->raise_bottom_type(t);
       Node *y = x->Identity(igvn);
-      if( y != x ) {
-        wins++;
+      if (y != x) {
         x = y;
       } else {
         y = igvn->hash_find(x);
-        if( y ) {
-          wins++;
+        if (y) {
           x = y;
         } else {
           // Else x is a new node we are keeping
@@ -1360,13 +1359,9 @@
       igvn->remove_dead_node(the_clone);
     phi->set_req(i, x);
   }
-  if( wins > 0 ) {
-    // Record Phi
-    igvn->register_new_node_with_optimizer(phi);
-    return phi;
-  }
-  igvn->remove_dead_node(phi);
-  return NULL;
+  // Record Phi
+  igvn->register_new_node_with_optimizer(phi);
+  return phi;
 }
 
 //------------------------------Ideal------------------------------------------
@@ -1677,14 +1672,15 @@
   // If we are loading from a freshly-allocated object, produce a zero,
   // if the load is provably beyond the header of the object.
   // (Also allow a variable load from a fresh array to produce zero.)
-  if (ReduceFieldZeroing) {
+  const TypeOopPtr *tinst = tp->isa_oopptr();
+  bool is_instance = (tinst != NULL) && tinst->is_known_instance_field();
+  if (ReduceFieldZeroing || is_instance) {
     Node* value = can_see_stored_value(mem,phase);
     if (value != NULL && value->is_Con())
       return value->bottom_type();
   }
 
-  const TypeOopPtr *tinst = tp->isa_oopptr();
-  if (tinst != NULL && tinst->is_known_instance_field()) {
+  if (is_instance) {
     // If we have an instance type and our memory input is the
     // programs's initial memory state, there is no matching store,
     // so just return a zero of the appropriate type
--- a/hotspot/src/share/vm/opto/stringopts.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/opto/stringopts.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1172,16 +1172,16 @@
 
 Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) {
   Node* string = str;
-  Node* offset = kit.make_load(NULL,
+  Node* offset = kit.make_load(kit.control(),
                                kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()),
                                TypeInt::INT, T_INT, offset_field_idx);
-  Node* count = kit.make_load(NULL,
+  Node* count = kit.make_load(kit.control(),
                               kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()),
                               TypeInt::INT, T_INT, count_field_idx);
   const TypeAryPtr*  value_type = TypeAryPtr::make(TypePtr::NotNull,
                                                    TypeAry::make(TypeInt::CHAR,TypeInt::POS),
                                                    ciTypeArrayKlass::make(T_CHAR), true, 0);
-  Node* value = kit.make_load(NULL,
+  Node* value = kit.make_load(kit.control(),
                               kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()),
                               value_type, T_OBJECT, value_field_idx);
 
@@ -1342,7 +1342,7 @@
         }
         //         Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset),
         //                                      TypeInt::INT, T_INT, offset_field_idx);
-        Node* count = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()),
+        Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()),
                                     TypeInt::INT, T_INT, count_field_idx);
         length = __ AddI(length, count);
         string_sizes->init_req(argi, NULL);
--- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Mon May 09 08:58:00 2011 -0700
@@ -82,10 +82,8 @@
 
 void MethodHandleChain::set_last_method(oop target, TRAPS) {
   _is_last = true;
-  klassOop receiver_limit_oop = NULL;
-  int flags = 0;
-  methodOop m = MethodHandles::decode_method(target, receiver_limit_oop, flags);
-  _last_method = methodHandle(THREAD, m);
+  KlassHandle receiver_limit; int flags = 0;
+  _last_method = MethodHandles::decode_method(target, receiver_limit, flags);
   if ((flags & MethodHandles::_dmf_has_receiver) == 0)
     _last_invoke = Bytecodes::_invokestatic;
   else if ((flags & MethodHandles::_dmf_does_dispatch) == 0)
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Mon May 09 08:58:00 2011 -0700
@@ -153,9 +153,9 @@
 // and local, like parse a data structure.  For speed, such methods work on plain
 // oops, not handles.  Trapping methods uniformly operate on handles.
 
-methodOop MethodHandles::decode_vmtarget(oop vmtarget, int vmindex, oop mtype,
-                                         klassOop& receiver_limit_result, int& decode_flags_result) {
-  if (vmtarget == NULL)  return NULL;
+methodHandle MethodHandles::decode_vmtarget(oop vmtarget, int vmindex, oop mtype,
+                                            KlassHandle& receiver_limit_result, int& decode_flags_result) {
+  if (vmtarget == NULL)  return methodHandle();
   assert(methodOopDesc::nonvirtual_vtable_index < 0, "encoding");
   if (vmindex < 0) {
     // this DMH performs no dispatch; it is directly bound to a methodOop
@@ -198,20 +198,20 @@
 // MemberName and DirectMethodHandle have the same linkage to the JVM internals.
 // (MemberName is the non-operational name used for queries and setup.)
 
-methodOop MethodHandles::decode_DirectMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
+methodHandle MethodHandles::decode_DirectMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) {
   oop vmtarget = java_lang_invoke_DirectMethodHandle::vmtarget(mh);
   int vmindex  = java_lang_invoke_DirectMethodHandle::vmindex(mh);
   oop mtype    = java_lang_invoke_DirectMethodHandle::type(mh);
   return decode_vmtarget(vmtarget, vmindex, mtype, receiver_limit_result, decode_flags_result);
 }
 
-methodOop MethodHandles::decode_BoundMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
+methodHandle MethodHandles::decode_BoundMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) {
   assert(java_lang_invoke_BoundMethodHandle::is_instance(mh), "");
   assert(mh->klass() != SystemDictionary::AdapterMethodHandle_klass(), "");
   for (oop bmh = mh;;) {
     // Bound MHs can be stacked to bind several arguments.
     oop target = java_lang_invoke_MethodHandle::vmtarget(bmh);
-    if (target == NULL)  return NULL;
+    if (target == NULL)  return methodHandle();
     decode_flags_result |= MethodHandles::_dmf_binds_argument;
     klassOop tk = target->klass();
     if (tk == SystemDictionary::BoundMethodHandle_klass()) {
@@ -236,14 +236,14 @@
   }
 }
 
-methodOop MethodHandles::decode_AdapterMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
+methodHandle MethodHandles::decode_AdapterMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) {
   assert(mh->klass() == SystemDictionary::AdapterMethodHandle_klass(), "");
   for (oop amh = mh;;) {
     // Adapter MHs can be stacked to convert several arguments.
     int conv_op = adapter_conversion_op(java_lang_invoke_AdapterMethodHandle::conversion(amh));
     decode_flags_result |= (_dmf_adapter_lsb << conv_op) & _DMF_ADAPTER_MASK;
     oop target = java_lang_invoke_MethodHandle::vmtarget(amh);
-    if (target == NULL)  return NULL;
+    if (target == NULL)  return methodHandle();
     klassOop tk = target->klass();
     if (tk == SystemDictionary::AdapterMethodHandle_klass()) {
       amh = target;
@@ -255,8 +255,8 @@
   }
 }
 
-methodOop MethodHandles::decode_MethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) {
-  if (mh == NULL)  return NULL;
+methodHandle MethodHandles::decode_MethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) {
+  if (mh == NULL)  return methodHandle();
   klassOop mhk = mh->klass();
   assert(java_lang_invoke_MethodHandle::is_subclass(mhk), "must be a MethodHandle");
   if (mhk == SystemDictionary::DirectMethodHandle_klass()) {
@@ -270,7 +270,7 @@
     return decode_BoundMethodHandle(mh, receiver_limit_result, decode_flags_result);
   } else {
     assert(false, "cannot parse this MH");
-    return NULL;              // random MH?
+    return methodHandle();  // random MH?
   }
 }
 
@@ -299,9 +299,9 @@
 
 // A trusted party is handing us a cookie to determine a method.
 // Let's boil it down to the method oop they really want.
-methodOop MethodHandles::decode_method(oop x, klassOop& receiver_limit_result, int& decode_flags_result) {
+methodHandle MethodHandles::decode_method(oop x, KlassHandle& receiver_limit_result, int& decode_flags_result) {
   decode_flags_result = 0;
-  receiver_limit_result = NULL;
+  receiver_limit_result = KlassHandle();
   klassOop xk = x->klass();
   if (xk == Universe::methodKlassObj()) {
     return decode_methodOop((methodOop) x, decode_flags_result);
@@ -329,7 +329,7 @@
     assert(!x->is_method(), "already checked");
     assert(!java_lang_invoke_MemberName::is_instance(x), "already checked");
   }
-  return NULL;
+  return methodHandle();
 }
 
 
@@ -389,11 +389,10 @@
     int offset = instanceKlass::cast(k)->offset_from_fields(slot);
     init_MemberName(mname_oop, k, accessFlags_from(mods), offset);
   } else {
-    int decode_flags = 0; klassOop receiver_limit = NULL;
-    methodOop m = MethodHandles::decode_method(target_oop,
-                                               receiver_limit, decode_flags);
+    KlassHandle receiver_limit; int decode_flags = 0;
+    methodHandle m = MethodHandles::decode_method(target_oop, receiver_limit, decode_flags);
     bool do_dispatch = ((decode_flags & MethodHandles::_dmf_does_dispatch) != 0);
-    init_MemberName(mname_oop, m, do_dispatch);
+    init_MemberName(mname_oop, m(), do_dispatch);
   }
 }
 
@@ -423,13 +422,14 @@
 }
 
 
-methodOop MethodHandles::decode_MemberName(oop mname, klassOop& receiver_limit_result, int& decode_flags_result) {
+methodHandle MethodHandles::decode_MemberName(oop mname, KlassHandle& receiver_limit_result, int& decode_flags_result) {
+  methodHandle empty;
   int flags  = java_lang_invoke_MemberName::flags(mname);
-  if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) == 0)  return NULL;  // not invocable
+  if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) == 0)  return empty;  // not invocable
   oop vmtarget = java_lang_invoke_MemberName::vmtarget(mname);
   int vmindex  = java_lang_invoke_MemberName::vmindex(mname);
-  if (vmindex == VM_INDEX_UNINITIALIZED)  return NULL; // not resolved
-  methodOop m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit_result, decode_flags_result);
+  if (vmindex == VM_INDEX_UNINITIALIZED)  return empty;  // not resolved
+  methodHandle m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit_result, decode_flags_result);
   oop clazz = java_lang_invoke_MemberName::clazz(mname);
   if (clazz != NULL && java_lang_Class::is_instance(clazz)) {
     klassOop klass = java_lang_Class::as_klassOop(clazz);
@@ -439,9 +439,7 @@
 }
 
 // convert the external string or reflective type to an internal signature
-Symbol* MethodHandles::convert_to_signature(oop type_str,
-                                            bool polymorphic,
-                                            TRAPS) {
+Symbol* MethodHandles::convert_to_signature(oop type_str, bool polymorphic, TRAPS) {
   if (java_lang_invoke_MethodType::is_instance(type_str)) {
     return java_lang_invoke_MethodType::as_signature(type_str, polymorphic, CHECK_NULL);
   } else if (java_lang_Class::is_instance(type_str)) {
@@ -474,48 +472,48 @@
 #endif
   if (java_lang_invoke_MemberName::vmindex(mname()) != VM_INDEX_UNINITIALIZED)
     return;  // already resolved
-  oop defc_oop = java_lang_invoke_MemberName::clazz(mname());
-  oop name_str = java_lang_invoke_MemberName::name(mname());
-  oop type_str = java_lang_invoke_MemberName::type(mname());
-  int flags    = java_lang_invoke_MemberName::flags(mname());
+  Handle defc_oop(THREAD, java_lang_invoke_MemberName::clazz(mname()));
+  Handle name_str(THREAD, java_lang_invoke_MemberName::name( mname()));
+  Handle type_str(THREAD, java_lang_invoke_MemberName::type( mname()));
+  int    flags    =       java_lang_invoke_MemberName::flags(mname());
 
-  if (defc_oop == NULL || name_str == NULL || type_str == NULL) {
+  if (defc_oop.is_null() || name_str.is_null() || type_str.is_null()) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "nothing to resolve");
   }
-  klassOop defc_klassOop = java_lang_Class::as_klassOop(defc_oop);
-  defc_oop = NULL;  // safety
-  if (defc_klassOop == NULL)  return;  // a primitive; no resolution possible
-  if (!Klass::cast(defc_klassOop)->oop_is_instance()) {
-    if (!Klass::cast(defc_klassOop)->oop_is_array())  return;
-    defc_klassOop = SystemDictionary::Object_klass();
+
+  instanceKlassHandle defc;
+  {
+    klassOop defc_klassOop = java_lang_Class::as_klassOop(defc_oop());
+    if (defc_klassOop == NULL)  return;  // a primitive; no resolution possible
+    if (!Klass::cast(defc_klassOop)->oop_is_instance()) {
+      if (!Klass::cast(defc_klassOop)->oop_is_array())  return;
+      defc_klassOop = SystemDictionary::Object_klass();
+    }
+    defc = instanceKlassHandle(THREAD, defc_klassOop);
   }
-  instanceKlassHandle defc(THREAD, defc_klassOop);
-  defc_klassOop = NULL;  // safety
   if (defc.is_null()) {
     THROW_MSG(vmSymbols::java_lang_InternalError(), "primitive class");
   }
-  defc->link_class(CHECK);
+  defc->link_class(CHECK);  // possible safepoint
 
   // convert the external string name to an internal symbol
-  TempNewSymbol name = java_lang_String::as_symbol_or_null(name_str);
+  TempNewSymbol name = java_lang_String::as_symbol_or_null(name_str());
   if (name == NULL)  return;  // no such name
-  name_str = NULL;  // safety
 
   Handle polymorphic_method_type;
   bool polymorphic_signature = false;
   if ((flags & ALL_KINDS) == IS_METHOD &&
       (defc() == SystemDictionary::MethodHandle_klass() &&
-       methodOopDesc::is_method_handle_invoke_name(name)))
+       methodOopDesc::is_method_handle_invoke_name(name))) {
     polymorphic_signature = true;
+  }
 
   // convert the external string or reflective type to an internal signature
-  TempNewSymbol type = convert_to_signature(type_str, polymorphic_signature, CHECK);
-  if (java_lang_invoke_MethodType::is_instance(type_str) && polymorphic_signature) {
-    polymorphic_method_type = Handle(THREAD, type_str);  //preserve exactly
+  TempNewSymbol type = convert_to_signature(type_str(), polymorphic_signature, CHECK);
+  if (java_lang_invoke_MethodType::is_instance(type_str()) && polymorphic_signature) {
+    polymorphic_method_type = type_str;  // preserve exactly
   }
-
   if (type == NULL)  return;  // no such signature exists in the VM
-  type_str = NULL; // safety
 
   // Time to do the lookup.
   switch (flags & ALL_KINDS) {
@@ -560,8 +558,8 @@
       java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget);
       java_lang_invoke_MemberName::set_vmindex(mname(),  vmindex);
       java_lang_invoke_MemberName::set_modifiers(mname(), mods);
-      DEBUG_ONLY(int junk; klassOop junk2);
-      assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(),
+      DEBUG_ONLY(KlassHandle junk1; int junk2);
+      assert(decode_MemberName(mname(), junk1, junk2) == result.resolved_method(),
              "properly stored for later decoding");
       return;
     }
@@ -589,8 +587,8 @@
       java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget);
       java_lang_invoke_MemberName::set_vmindex(mname(),  vmindex);
       java_lang_invoke_MemberName::set_modifiers(mname(), mods);
-      DEBUG_ONLY(int junk; klassOop junk2);
-      assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(),
+      DEBUG_ONLY(KlassHandle junk1; int junk2);
+      assert(decode_MemberName(mname(), junk1, junk2) == result.resolved_method(),
              "properly stored for later decoding");
       return;
     }
@@ -677,16 +675,14 @@
   case IS_METHOD:
   case IS_CONSTRUCTOR:
     {
-      klassOop receiver_limit = NULL;
-      int      decode_flags   = 0;
-      methodHandle m(THREAD, decode_vmtarget(vmtarget, vmindex, NULL,
-                                             receiver_limit, decode_flags));
+      KlassHandle receiver_limit; int decode_flags = 0;
+      methodHandle m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit, decode_flags);
       if (m.is_null())  break;
       if (!have_defc) {
         klassOop defc = m->method_holder();
-        if (receiver_limit != NULL && receiver_limit != defc
-            && Klass::cast(receiver_limit)->is_subtype_of(defc))
-          defc = receiver_limit;
+        if (receiver_limit.not_null() && receiver_limit() != defc
+            && Klass::cast(receiver_limit())->is_subtype_of(defc))
+          defc = receiver_limit();
         java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror());
       }
       if (!have_name) {
@@ -884,10 +880,9 @@
   // - AMH can have methodOop for static invoke with bound receiver
   // - DMH can have methodOop for static invoke (on variable receiver)
   // - DMH can have klassOop for dispatched (non-static) invoke
-  klassOop receiver_limit = NULL;
-  int decode_flags = 0;
-  methodOop m = decode_MethodHandle(mh(), receiver_limit, decode_flags);
-  if (m == NULL)  return NULL;
+  KlassHandle receiver_limit; int decode_flags = 0;
+  methodHandle m = decode_MethodHandle(mh(), receiver_limit, decode_flags);
+  if (m.is_null())  return NULL;
   switch (format) {
   case ETF_REFLECT_METHOD:
     // same as jni_ToReflectedMethod:
@@ -903,10 +898,10 @@
       if (SystemDictionary::MemberName_klass() == NULL)  break;
       instanceKlassHandle mname_klass(THREAD, SystemDictionary::MemberName_klass());
       mname_klass->initialize(CHECK_NULL);
-      Handle mname = mname_klass->allocate_instance_handle(CHECK_NULL);
+      Handle mname = mname_klass->allocate_instance_handle(CHECK_NULL);  // possible safepoint
       java_lang_invoke_MemberName::set_vmindex(mname(), VM_INDEX_UNINITIALIZED);
       bool do_dispatch = ((decode_flags & MethodHandles::_dmf_does_dispatch) != 0);
-      init_MemberName(mname(), m, do_dispatch);
+      init_MemberName(mname(), m(), do_dispatch);
       expand_MemberName(mname, 0, CHECK_NULL);
       return mname();
     }
@@ -1459,8 +1454,8 @@
   // that links the interpreter calls to the method.  We need the same
   // bits, and will use the same calling sequence code.
 
-  int vmindex = methodOopDesc::garbage_vtable_index;
-  oop vmtarget = NULL;
+  int    vmindex = methodOopDesc::garbage_vtable_index;
+  Handle vmtarget;
 
   instanceKlass::cast(m->method_holder())->link_class(CHECK);
 
@@ -1478,7 +1473,7 @@
   } else if (!do_dispatch || m->can_be_statically_bound()) {
     // We are simulating an invokestatic or invokespecial instruction.
     // Set up the method pointer, just like ConstantPoolCacheEntry::set_method().
-    vmtarget = m();
+    vmtarget = m;
     // this does not help dispatch, but it will make it possible to parse this MH:
     vmindex  = methodOopDesc::nonvirtual_vtable_index;
     assert(vmindex < 0, "(>=0) == do_dispatch");
@@ -1490,7 +1485,7 @@
       // For a DMH, it is done now, when the handle is created.
       Klass* k = Klass::cast(m->method_holder());
       if (k->should_be_initialized()) {
-        k->initialize(CHECK);
+        k->initialize(CHECK);  // possible safepoint
       }
     }
   } else {
@@ -1504,10 +1499,10 @@
 
   if (me == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
 
-  java_lang_invoke_DirectMethodHandle::set_vmtarget(mh(), vmtarget);
-  java_lang_invoke_DirectMethodHandle::set_vmindex(mh(),  vmindex);
-  DEBUG_ONLY(int flags; klassOop rlimit);
-  assert(MethodHandles::decode_method(mh(), rlimit, flags) == m(),
+  java_lang_invoke_DirectMethodHandle::set_vmtarget(mh(), vmtarget());
+  java_lang_invoke_DirectMethodHandle::set_vmindex( mh(), vmindex);
+  DEBUG_ONLY(KlassHandle rlimit; int flags);
+  assert(MethodHandles::decode_method(mh(), rlimit, flags) == m,
          "properly stored for later decoding");
   DEBUG_ONLY(bool actual_do_dispatch = ((flags & _dmf_does_dispatch) != 0));
   assert(!(actual_do_dispatch && !do_dispatch),
@@ -1523,10 +1518,13 @@
                                                            methodHandle m,
                                                            TRAPS) {
   // Verify type.
-  oop receiver = java_lang_invoke_BoundMethodHandle::argument(mh());
+  KlassHandle bound_recv_type;
+  {
+    oop receiver = java_lang_invoke_BoundMethodHandle::argument(mh());
+    if (receiver != NULL)
+      bound_recv_type = KlassHandle(THREAD, receiver->klass());
+  }
   Handle mtype(THREAD, java_lang_invoke_MethodHandle::type(mh()));
-  KlassHandle bound_recv_type;
-  if (receiver != NULL)  bound_recv_type = KlassHandle(THREAD, receiver->klass());
   verify_method_type(m, mtype, true, bound_recv_type, CHECK);
 
   int receiver_pos = m->size_of_parameters() - 1;
@@ -1573,8 +1571,8 @@
 
   java_lang_invoke_BoundMethodHandle::set_vmtarget(mh(), m());
 
-  DEBUG_ONLY(int junk; klassOop junk2);
-  assert(MethodHandles::decode_method(mh(), junk2, junk) == m(), "properly stored for later decoding");
+  DEBUG_ONLY(KlassHandle junk1; int junk2);
+  assert(MethodHandles::decode_method(mh(), junk1, junk2) == m, "properly stored for later decoding");
   assert(decode_MethodHandle_stack_pushes(mh()) == 1, "BMH pushes one stack slot");
 
   // Done!
@@ -1682,8 +1680,11 @@
   }
 
   // Get bound type and required slots.
-  oop ptype_oop = java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum);
-  BasicType ptype = java_lang_Class::as_BasicType(ptype_oop);
+  BasicType ptype;
+  {
+    oop ptype_oop = java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum);
+    ptype = java_lang_Class::as_BasicType(ptype_oop);
+  }
   int slots_pushed = type2size[ptype];
 
   // If (a) the target is a direct non-dispatched method handle,
@@ -1694,13 +1695,12 @@
   if (OptimizeMethodHandles &&
       target->klass() == SystemDictionary::DirectMethodHandle_klass() &&
       (argnum == 0 || java_lang_invoke_DirectMethodHandle::vmindex(target()) < 0)) {
-    int decode_flags = 0; klassOop receiver_limit_oop = NULL;
-    methodHandle m(THREAD, decode_method(target(), receiver_limit_oop, decode_flags));
+    KlassHandle receiver_limit; int decode_flags = 0;
+    methodHandle m = decode_method(target(), receiver_limit, decode_flags);
     if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "DMH failed to decode"); }
     DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - slots_pushed); // pos. of 1st arg.
     assert(java_lang_invoke_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig");
     if (argnum == 0 && (decode_flags & _dmf_has_receiver) != 0) {
-      KlassHandle receiver_limit(THREAD, receiver_limit_oop);
       init_BoundMethodHandle_with_receiver(mh, m,
                                            receiver_limit, decode_flags,
                                            CHECK);
@@ -2019,7 +2019,6 @@
 }
 
 void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnum, TRAPS) {
-  oop  argument   = java_lang_invoke_AdapterMethodHandle::argument(mh());
   int  argslot    = java_lang_invoke_AdapterMethodHandle::vmargslot(mh());
   jint conversion = java_lang_invoke_AdapterMethodHandle::conversion(mh());
   jint conv_op    = adapter_conversion_op(conversion);
@@ -2215,18 +2214,14 @@
 
   // which method are we really talking about?
   if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); }
-  oop target_oop = JNIHandles::resolve_non_null(target_jh);
-  if (java_lang_invoke_MemberName::is_instance(target_oop) &&
-      java_lang_invoke_MemberName::vmindex(target_oop) == VM_INDEX_UNINITIALIZED) {
-    Handle mname(THREAD, target_oop);
-    MethodHandles::resolve_MemberName(mname, CHECK);
-    target_oop = mname(); // in case of GC
+  Handle target(THREAD, JNIHandles::resolve_non_null(target_jh));
+  if (java_lang_invoke_MemberName::is_instance(target()) &&
+      java_lang_invoke_MemberName::vmindex(target()) == VM_INDEX_UNINITIALIZED) {
+    MethodHandles::resolve_MemberName(target, CHECK);
   }
 
-  int decode_flags = 0; klassOop receiver_limit = NULL;
-  methodHandle m(THREAD,
-                 MethodHandles::decode_method(target_oop,
-                                              receiver_limit, decode_flags));
+  KlassHandle receiver_limit; int decode_flags = 0;
+  methodHandle m = MethodHandles::decode_method(target(), receiver_limit, decode_flags);
   if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "no such method"); }
 
   // The trusted Java code that calls this method should already have performed
@@ -2284,12 +2279,8 @@
     // Target object is a reflective method.  (%%% Do we need this alternate path?)
     Untested("init_BMH of non-MH");
     if (argnum != 0) { THROW(vmSymbols::java_lang_InternalError()); }
-    int decode_flags = 0; klassOop receiver_limit_oop = NULL;
-    methodHandle m(THREAD,
-                   MethodHandles::decode_method(target(),
-                                                receiver_limit_oop,
-                                                decode_flags));
-    KlassHandle receiver_limit(THREAD, receiver_limit_oop);
+    KlassHandle receiver_limit; int decode_flags = 0;
+    methodHandle m = MethodHandles::decode_method(target(), receiver_limit, decode_flags);
     MethodHandles::init_BoundMethodHandle_with_receiver(mh, m,
                                                        receiver_limit,
                                                        decode_flags,
@@ -2424,12 +2415,12 @@
 #ifndef PRODUCT
   if (which >= 0 && which < con_value_count) {
     int con = con_values[which];
-    objArrayOop box = (objArrayOop) JNIHandles::resolve(box_jh);
-    if (box != NULL && box->klass() == Universe::objectArrayKlassObj() && box->length() > 0) {
+    objArrayHandle box(THREAD, (objArrayOop) JNIHandles::resolve(box_jh));
+    if (box.not_null() && box->klass() == Universe::objectArrayKlassObj() && box->length() > 0) {
       const char* str = &con_names[0];
       for (int i = 0; i < which; i++)
         str += strlen(str) + 1;   // skip name and null
-      oop name = java_lang_String::create_oop_from_str(str, CHECK_0);
+      oop name = java_lang_String::create_oop_from_str(str, CHECK_0);  // possible safepoint
       box->obj_at_put(0, name);
     }
     return con;
@@ -2486,10 +2477,10 @@
                                jclass clazz_jh, jstring name_jh, jstring sig_jh,
                                int mflags, jclass caller_jh, jint skip, jobjectArray results_jh)) {
   if (clazz_jh == NULL || results_jh == NULL)  return -1;
-  klassOop k_oop = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz_jh));
+  KlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz_jh)));
 
-  objArrayOop results = (objArrayOop) JNIHandles::resolve(results_jh);
-  if (results == NULL || !results->is_objArray())       return -1;
+  objArrayHandle results(THREAD, (objArrayOop) JNIHandles::resolve(results_jh));
+  if (results.is_null() || !results->is_objArray())  return -1;
 
   TempNewSymbol name = NULL;
   TempNewSymbol sig = NULL;
@@ -2502,20 +2493,20 @@
     if (sig == NULL)  return 0; // a match is not possible
   }
 
-  klassOop caller = NULL;
+  KlassHandle caller;
   if (caller_jh != NULL) {
     oop caller_oop = JNIHandles::resolve_non_null(caller_jh);
     if (!java_lang_Class::is_instance(caller_oop))  return -1;
-    caller = java_lang_Class::as_klassOop(caller_oop);
+    caller = KlassHandle(THREAD, java_lang_Class::as_klassOop(caller_oop));
   }
 
-  if (name != NULL && sig != NULL && results != NULL) {
+  if (name != NULL && sig != NULL && results.not_null()) {
     // try a direct resolve
     // %%% TO DO
   }
 
-  int res = MethodHandles::find_MemberNames(k_oop, name, sig, mflags,
-                                            caller, skip, results);
+  int res = MethodHandles::find_MemberNames(k(), name, sig, mflags,
+                                            caller(), skip, results());
   // TO DO: expand at least some of the MemberNames, to avoid massive callbacks
   return res;
 }
--- a/hotspot/src/share/vm/prims/methodHandles.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp	Mon May 09 08:58:00 2011 -0700
@@ -265,13 +265,13 @@
   static inline address from_interpreted_entry(EntryKind ek);
 
   // helpers for decode_method.
-  static methodOop decode_methodOop(methodOop m, int& decode_flags_result);
-  static methodOop decode_vmtarget(oop vmtarget, int vmindex, oop mtype, klassOop& receiver_limit_result, int& decode_flags_result);
-  static methodOop decode_MemberName(oop mname, klassOop& receiver_limit_result, int& decode_flags_result);
-  static methodOop decode_MethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result);
-  static methodOop decode_DirectMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result);
-  static methodOop decode_BoundMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result);
-  static methodOop decode_AdapterMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result);
+  static methodOop    decode_methodOop(methodOop m, int& decode_flags_result);
+  static methodHandle decode_vmtarget(oop vmtarget, int vmindex, oop mtype, KlassHandle& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_MemberName(oop mname, KlassHandle& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_MethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_DirectMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_BoundMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_AdapterMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result);
 
   // Find out how many stack slots an mh pushes or pops.
   // The result is *not* reported as a multiple of stack_move_unit();
@@ -317,7 +317,7 @@
     _dmf_adapter_lsb    = 0x20,
     _DMF_ADAPTER_MASK   = (_dmf_adapter_lsb << CONV_OP_LIMIT) - _dmf_adapter_lsb
   };
-  static methodOop decode_method(oop x, klassOop& receiver_limit_result, int& decode_flags_result);
+  static methodHandle decode_method(oop x, KlassHandle& receiver_limit_result, int& decode_flags_result);
   enum {
     // format of query to getConstant:
     GC_JVM_PUSH_LIMIT = 0,
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon May 09 08:58:00 2011 -0700
@@ -620,6 +620,9 @@
   product(bool, UseSSE42Intrinsics, false,                                  \
           "SSE4.2 versions of intrinsics")                                  \
                                                                             \
+  product(bool, UseCondCardMark, false,                                     \
+          "Check for already marked card before updating card table")       \
+                                                                            \
   develop(bool, TraceCallFixup, false,                                      \
           "traces all call fixups")                                         \
                                                                             \
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Mon May 09 08:58:00 2011 -0700
@@ -389,7 +389,7 @@
   // to Java
   if (!os::stack_shadow_pages_available(THREAD, method)) {
     // Throw stack overflow exception with preinitialized exception.
-    Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__);
+    Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__, method);
     return;
   } else {
     // Touch pages checked if the OS needs them to be touched to be mapped.
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Mon May 09 08:58:00 2011 -0700
@@ -1721,14 +1721,14 @@
         targetArity = ArgumentCount(target->signature()).size();
       }
     }
-    klassOop kignore; int dmf_flags = 0;
-    methodOop actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags);
+    KlassHandle kignore; int dmf_flags = 0;
+    methodHandle actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags);
     if ((dmf_flags & ~(MethodHandles::_dmf_has_receiver |
                        MethodHandles::_dmf_does_dispatch |
                        MethodHandles::_dmf_from_interface)) != 0)
-      actual_method = NULL;  // MH does extra binds, drops, etc.
+      actual_method = methodHandle();  // MH does extra binds, drops, etc.
     bool has_receiver = ((dmf_flags & MethodHandles::_dmf_has_receiver) != 0);
-    if (actual_method != NULL) {
+    if (actual_method.not_null()) {
       mhName = actual_method->signature()->as_C_string();
       mhArity = ArgumentCount(actual_method->signature()).size();
       if (!actual_method->is_static())  mhArity += 1;
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Mon May 09 08:58:00 2011 -0700
@@ -291,7 +291,9 @@
     // Among other things, this ensures that Eden top is correct.
     Universe::heap()->prepare_for_verify();
     os::check_heap();
-    Universe::verify(true, true); // Silent verification to not polute normal output
+    // Silent verification so as not to pollute normal output,
+    // unless we really asked for it.
+    Universe::verify(true, !(PrintGCDetails || Verbose));
   }
 
   CompileBroker::set_should_block();
--- a/hotspot/src/share/vm/services/g1MemoryPool.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/services/g1MemoryPool.cpp	Mon May 09 08:58:00 2011 -0700
@@ -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
@@ -34,10 +34,10 @@
                                      size_t init_size,
                                      bool support_usage_threshold) :
   _g1h(g1h), CollectedMemoryPool(name,
-                                 MemoryPool::Heap,
-                                 init_size,
-                                 undefined_max(),
-                                 support_usage_threshold) {
+                                   MemoryPool::Heap,
+                                   init_size,
+                                   undefined_max(),
+                                   support_usage_threshold) {
   assert(UseG1GC, "sanity");
 }
 
@@ -48,44 +48,27 @@
 
 // See the comment at the top of g1MemoryPool.hpp
 size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) {
-  size_t young_list_length = g1h->young_list()->length();
-  size_t eden_used = young_list_length * HeapRegion::GrainBytes;
-  size_t survivor_used = survivor_space_used(g1h);
-  eden_used = subtract_up_to_zero(eden_used, survivor_used);
-  return eden_used;
+  return g1h->g1mm()->eden_space_used();
 }
 
 // See the comment at the top of g1MemoryPool.hpp
 size_t G1MemoryPoolSuper::survivor_space_committed(G1CollectedHeap* g1h) {
-  return MAX2(survivor_space_used(g1h), (size_t) HeapRegion::GrainBytes);
+  return g1h->g1mm()->survivor_space_committed();
 }
 
 // See the comment at the top of g1MemoryPool.hpp
 size_t G1MemoryPoolSuper::survivor_space_used(G1CollectedHeap* g1h) {
-  size_t survivor_num = g1h->g1_policy()->recorded_survivor_regions();
-  size_t survivor_used = survivor_num * HeapRegion::GrainBytes;
-  return survivor_used;
+  return g1h->g1mm()->survivor_space_used();
 }
 
 // See the comment at the top of g1MemoryPool.hpp
 size_t G1MemoryPoolSuper::old_space_committed(G1CollectedHeap* g1h) {
-  size_t committed = overall_committed(g1h);
-  size_t eden_committed = eden_space_committed(g1h);
-  size_t survivor_committed = survivor_space_committed(g1h);
-  committed = subtract_up_to_zero(committed, eden_committed);
-  committed = subtract_up_to_zero(committed, survivor_committed);
-  committed = MAX2(committed, (size_t) HeapRegion::GrainBytes);
-  return committed;
+  return g1h->g1mm()->old_space_committed();
 }
 
 // See the comment at the top of g1MemoryPool.hpp
 size_t G1MemoryPoolSuper::old_space_used(G1CollectedHeap* g1h) {
-  size_t used = overall_used(g1h);
-  size_t eden_used = eden_space_used(g1h);
-  size_t survivor_used = survivor_space_used(g1h);
-  used = subtract_up_to_zero(used, eden_used);
-  used = subtract_up_to_zero(used, survivor_used);
-  return used;
+  return g1h->g1mm()->old_space_used();
 }
 
 G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :
--- a/hotspot/src/share/vm/services/g1MemoryPool.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/services/g1MemoryPool.hpp	Mon May 09 08:58:00 2011 -0700
@@ -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
@@ -46,68 +46,9 @@
 // get, as this does affect the performance and behavior of G1. Which
 // is why we introduce the three memory pools implemented here.
 //
-// The above approach inroduces a couple of challenging issues in the
-// implementation of the three memory pools:
-//
-// 1) The used space calculation for a pool is not necessarily
-// independent of the others. We can easily get from G1 the overall
-// used space in the entire heap, the number of regions in the young
-// generation (includes both eden and survivors), and the number of
-// survivor regions. So, from that we calculate:
-//
-//  survivor_used = survivor_num * region_size
-//  eden_used     = young_region_num * region_size - survivor_used
-//  old_gen_used  = overall_used - eden_used - survivor_used
-//
-// Note that survivor_used and eden_used are upper bounds. To get the
-// actual value we would have to iterate over the regions and add up
-// ->used(). But that'd be expensive. So, we'll accept some lack of
-// accuracy for those two. But, we have to be careful when calculating
-// old_gen_used, in case we subtract from overall_used more then the
-// actual number and our result goes negative.
-//
-// 2) Calculating the used space is straightforward, as described
-// above. However, how do we calculate the committed space, given that
-// we allocate space for the eden, survivor, and old gen out of the
-// same pool of regions? One way to do this is to use the used value
-// as also the committed value for the eden and survivor spaces and
-// then calculate the old gen committed space as follows:
-//
-//  old_gen_committed = overall_committed - eden_committed - survivor_committed
+// See comments in g1MonitoringSupport.hpp for additional details
+// on this model.
 //
-// Maybe a better way to do that would be to calculate used for eden
-// and survivor as a sum of ->used() over their regions and then
-// calculate committed as region_num * region_size (i.e., what we use
-// to calculate the used space now). This is something to consider
-// in the future.
-//
-// 3) Another decision that is again not straightforward is what is
-// the max size that each memory pool can grow to. One way to do this
-// would be to use the committed size for the max for the eden and
-// survivors and calculate the old gen max as follows (basically, it's
-// a similar pattern to what we use for the committed space, as
-// described above):
-//
-//  old_gen_max = overall_max - eden_max - survivor_max
-//
-// Unfortunately, the above makes the max of each pool fluctuate over
-// time and, even though this is allowed according to the spec, it
-// broke several assumptions in the M&M framework (there were cases
-// where used would reach a value greater than max). So, for max we
-// use -1, which means "undefined" according to the spec.
-//
-// 4) Now, there is a very subtle issue with all the above. The
-// framework will call get_memory_usage() on the three pools
-// asynchronously. As a result, each call might get a different value
-// for, say, survivor_num which will yield inconsistent values for
-// eden_used, survivor_used, and old_gen_used (as survivor_num is used
-// in the calculation of all three). This would normally be
-// ok. However, it's possible that this might cause the sum of
-// eden_used, survivor_used, and old_gen_used to go over the max heap
-// size and this seems to sometimes cause JConsole (and maybe other
-// clients) to get confused. There's not a really an easy / clean
-// solution to this problem, due to the asynchrounous nature of the
-// framework.
 
 
 // This class is shared by the three G1 memory pool classes
@@ -116,22 +57,6 @@
 // (see comment above), we put the calculations in this class so that
 // we can easily share them among the subclasses.
 class G1MemoryPoolSuper : public CollectedMemoryPool {
-private:
-  // It returns x - y if x > y, 0 otherwise.
-  // As described in the comment above, some of the inputs to the
-  // calculations we have to do are obtained concurrently and hence
-  // may be inconsistent with each other. So, this provides a
-  // defensive way of performing the subtraction and avoids the value
-  // going negative (which would mean a very large result, given that
-  // the parameter are size_t).
-  static size_t subtract_up_to_zero(size_t x, size_t y) {
-    if (x > y) {
-      return x - y;
-    } else {
-      return 0;
-    }
-  }
-
 protected:
   G1CollectedHeap* _g1h;
 
@@ -148,13 +73,6 @@
     return (size_t) -1;
   }
 
-  static size_t overall_committed(G1CollectedHeap* g1h) {
-    return g1h->capacity();
-  }
-  static size_t overall_used(G1CollectedHeap* g1h) {
-    return g1h->used_unlocked();
-  }
-
   static size_t eden_space_committed(G1CollectedHeap* g1h);
   static size_t eden_space_used(G1CollectedHeap* g1h);
 
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Mon May 09 08:58:00 2011 -0700
@@ -207,7 +207,7 @@
 }
 
 
-void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line) {
+void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, methodHandle method) {
   Handle exception;
   if (!THREAD->has_pending_exception()) {
     klassOop k = SystemDictionary::StackOverflowError_klass();
@@ -215,13 +215,13 @@
     exception = Handle(THREAD, e);  // fill_in_stack trace does gc
     assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation");
     if (StackTraceInThrowable) {
-      java_lang_Throwable::fill_in_stack_trace(exception);
+      java_lang_Throwable::fill_in_stack_trace(exception, method());
     }
   } else {
     // if prior exception, throw that one instead
     exception = Handle(THREAD, THREAD->pending_exception());
   }
-  _throw_oop(THREAD, file, line, exception());
+  _throw(THREAD, file, line, exception);
 }
 
 void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Tue May 03 16:32:47 2011 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Mon May 09 08:58:00 2011 -0700
@@ -144,7 +144,7 @@
                              const char* message,
                              ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
 
-  static void throw_stack_overflow_exception(Thread* thread, const char* file, int line);
+  static void throw_stack_overflow_exception(Thread* thread, const char* file, int line, methodHandle method);
 
   // for AbortVMOnException flag
   NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);)
--- a/jaxp/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/jaxp/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -4,3 +4,4 @@
 ^drop_included/
 ^webrev/
 /nbproject/private/
+^.hgtip
--- a/jaxp/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/jaxp/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 1d87f7460cde7f8f30af668490f82b52b879bfd8 jdk7-b137
 be3758943770a0a3dd4be6a1cb4063507c4d7062 jdk7-b138
 28c7c0ed2444607829ba11ad827f8d52197a2830 jdk7-b139
+c8136fd161c83917f87e93b14fa2ba3483f9be83 jdk7-b140
--- a/jaxws/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/jaxws/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -4,3 +4,4 @@
 ^drop_included/
 ^webrev/
 /nbproject/private/
+^.hgtip
--- a/jaxws/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/jaxws/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 ccea3282991ce8b678e188cf32a8239f76ff3bfa jdk7-b137
 cc956c8a8255583535597e9a63db23c510e9a063 jdk7-b138
 c025078c8362076503bb83b8e4da14ba7b347940 jdk7-b139
+82a9022c4f21b1313023c8303b557a17c4106701 jdk7-b140
--- a/jdk/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,5 @@
 29296ea6529a418037ccce95903249665ef31c11 jdk7-b137
 60d3d55dcc9c31a30ced9caa6ef5c0dcd7db031d jdk7-b138
 d80954a89b49fda47c0c5cace65a17f5a758b8bd jdk7-b139
+9315c733fb17ddfb9fb44be7e0ffea37bf3c727d jdk7-b140
+63eeefe118da18c75ba3d36266768cd1ccaaca6b jdk7-b141
--- a/jdk/make/common/Defs-linux.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/Defs-linux.gmk	Mon May 09 08:58:00 2011 -0700
@@ -354,7 +354,7 @@
 # Japanese manpages
 #
 JA_SOURCE_ENCODING = eucJP
-JA_TARGET_ENCODINGS = eucJP
+JA_TARGET_ENCODINGS = UTF-8
 
 # Settings for the JDI - Serviceability Agent binding.
 HOTSPOT_SALIB_PATH   = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
--- a/jdk/make/common/Program.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/Program.gmk	Mon May 09 08:58:00 2011 -0700
@@ -55,10 +55,13 @@
 
 program: $(ACTUAL_PROGRAM)
 
-# reuse the mapfiles in the launcher's directory, the same should
-# be applicable to the tool launchers as well.
-FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
-include $(BUILDDIR)/common/Mapfile-vers.gmk
+# Work-around for missing processor specific mapfiles
+ifndef CROSS_COMPILE_ARCH
+  # reuse the mapfiles in the launcher's directory, the same should
+  # be applicable to the tool launchers as well.
+  FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
+  include $(BUILDDIR)/common/Mapfile-vers.gmk
+endif
 
 include $(JDK_TOPDIR)/make/common/Rules.gmk
 
--- a/jdk/make/common/Release.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/Release.gmk	Mon May 09 08:58:00 2011 -0700
@@ -164,7 +164,7 @@
 ifeq ($(PLATFORM), linux)
   MANBASEDIRS=$(JDK_TOPDIR)/src/linux/doc $(IMPORTDOCDIR)
   MAN1SUBDIR=man
-  JA_DIRNAME=ja_JP.$(JA_SOURCE_ENCODING)
+  JA_DIRNAME=ja_JP.UTF-8
 endif # linux
 
 define copy-man-pages
@@ -190,8 +190,7 @@
 done
 $(java-vm-cleanup)
 if [ "$(JA_DIRNAME)" != "" ] ; then \
-  $(MV) $1/man/ja $1/man/$(JA_DIRNAME); \
-  $(CD) $1/man && $(LN) -s $(JA_DIRNAME) ja; \
+  $(CD) $1/man && $(RM) ja && $(LN) -s $(JA_DIRNAME) ja; \
 fi
 endef
 
--- a/jdk/make/common/shared/Defs-utils.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/shared/Defs-utils.gmk	Mon May 09 08:58:00 2011 -0700
@@ -109,6 +109,8 @@
 GDB            = $(UTILS_USR_BIN_PATH)gdb
 GREP           = $(UTILS_COMMAND_PATH)grep
 GUNZIP         = $(UTILS_COMMAND_PATH)gunzip
+# GZIP is used for solaris. Linux and windows use tar czf
+GZIP           = $(UTILS_COMMAND_PATH)gzip
 HEAD           = $(UTILS_USR_BIN_PATH)head
 HG             = hg
 ID             = $(UTILS_COMMAND_PATH)id
--- a/jdk/make/common/shared/Defs-versions.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/shared/Defs-versions.gmk	Mon May 09 08:58:00 2011 -0700
@@ -72,10 +72,6 @@
 # REQUIRED_DXSDK_VER
 #   Windows only: The version of DirectX SDK expected.
 #
-# REQUIRED_FREE_SPACE
-#   The minimum disk space needed as determined by running 'du -sk' on a fully
-#   built workspace.
-#
 # REQUIRED_FREETYPE_VERSION
 #   If we are using freetype, the freetype version expected.
 #
@@ -131,11 +127,6 @@
   REQUIRED_OS_VERSION         = 5.10
   REQUIRED_OS_VARIANT_NAME    = Solaris
   REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION)
-  ifeq ($(ARCH_FAMILY), sparc)
-    REQUIRED_FREE_SPACE       = 1300000
-  else
-    REQUIRED_FREE_SPACE       = 1040000
-  endif
   REQUIRED_COMPILER_NAME      = Sun Studio 12 Update 1
   REQUIRED_COMPILER_VERSION   = SS12u1
   # Cross-compilation compiler versions are target specific
@@ -157,7 +148,6 @@
   REQUIRED_OS_VERSION         = 2.6
   REQUIRED_OS_VARIANT_NAME    = Fedora
   REQUIRED_OS_VARIANT_VERSION = 9
-  REQUIRED_FREE_SPACE         = 1460000
   REQUIRED_ALSA_VERSION       = 0.9.1
   REQUIRED_COMPILER_NAME      = GCC4
   REQUIRED_COMPILER_VERSION   = GCC4
@@ -187,7 +177,6 @@
   REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION)
   REQUIRED_CYGWIN_VER         = 4.0
   REQUIRED_MKS_VER            = 6.1
-  REQUIRED_FREE_SPACE         = 500000
   REQUIRED_DXSDK_VER          = 0x0900
   ifeq ($(CC_VERSION),msvc)
     REQUIRED_COMPILER_NAME    = Visual Studio 10
--- a/jdk/make/common/shared/Sanity-Settings.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Mon May 09 08:58:00 2011 -0700
@@ -192,8 +192,6 @@
 ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION)
 ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME)
 ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_VERSION)
-ALL_SETTINGS+=$(call addRequiredSetting,TEMP_FREE_SPACE)
-ALL_SETTINGS+=$(call addRequiredSetting,FREE_SPACE)
 ALL_SETTINGS+=$(call addRequiredSetting,MB_OF_MEMORY)
 
 
--- a/jdk/make/common/shared/Sanity.gmk	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/common/shared/Sanity.gmk	Mon May 09 08:58:00 2011 -0700
@@ -69,8 +69,6 @@
 # Settings and rules to validate the JDK build environment.
 
 ifeq ($(PLATFORM), solaris)
-  FREE_SPACE := $(shell $(DF) -b $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
-  TEMP_FREE_SPACE := $(shell $(DF) -b $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$2;}')
   # What kind of system we are using (Variations are Solaris and OpenSolaris)
   OS_VERSION := $(shell uname -r)
   OS_VARIANT_NAME := $(strip $(shell head -1 /etc/release | awk '{print $$1;}') )
@@ -88,8 +86,6 @@
 endif
 
 ifeq ($(PLATFORM), linux)
-  FREE_SPACE := $(shell $(DF) --sync -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
-  TEMP_FREE_SPACE := $(shell $(DF) --sync -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
   # What kind of system we are using (Variation is the Linux vendor)
   OS_VERSION := $(shell uname -r)
   OS_VARIANT_NAME := $(shell \
@@ -118,8 +114,6 @@
 endif
 
 ifeq ($(PLATFORM), windows)
-  FREE_SPACE := $(shell $(DF) -kP $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
-  TEMP_FREE_SPACE := $(shell $(DF) -kP $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$4;}')
   # Windows 2000 is 5.0, Windows XP is 5.1, Windows 2003 is 5.2
   #    Assume 5.0 (Windows 2000) if systeminfo does not help
   WINDOWS_MAPPING-5.0 := Windows2000
@@ -715,18 +709,6 @@
 	    "      Either obtain these permissions or set ALT_OUTPUTDIR. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
-	@#
-	@# OUTPUTDIR must have enough free space...
-	@#
-	@if [ $(FREE_SPACE) -lt $(REQUIRED_FREE_SPACE) ]; then \
-	  $(ECHO) "WARNING: You may not have enough free space in your OUTPUTDIR. The \n" \
-	    "        current value of OUTPUTDIR is \n" \
-	    "            $(OUTPUTDIR) \n" \
-	    "        You need "$(REQUIRED_FREE_SPACE)" Kbytes free on this device to build \n" \
-	    "        and it appears that only "$(FREE_SPACE)" Kbytes are free. \n" \
-	    "        Either obtain more space or set ALT_OUTPUTDIR to a larger disk. \n" \
-	    "" >> $(WARNING_FILE) ; \
-	fi
 
 ######################################################
 # if specified, ALT_BOOTDIR must point to non-relative path if set
--- a/jdk/make/sun/javazic/tzdata/VERSION	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/VERSION	Mon May 09 08:58:00 2011 -0700
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2011e
+tzdata2011g
--- a/jdk/make/sun/javazic/tzdata/africa	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/africa	Mon May 09 08:58:00 2011 -0700
@@ -234,7 +234,21 @@
 Rule	Egypt	1990	1994	-	May	 1	1:00	1:00	S
 # IATA (after 1990) says transitions are at 0:00.
 # Go with IATA starting in 1995, except correct 1995 entry from 09-30 to 09-29.
-Rule	Egypt	1995	max	-	Apr	lastFri	 0:00s	1:00	S
+
+# From Alexander Krivenyshev (2011-04-20):
+# "...Egypt's interim cabinet decided on Wednesday to cancel daylight
+# saving time after a poll posted on its website showed the majority of
+# Egyptians would approve the cancellation."
+#
+# Egypt to cancel daylight saving time
+# <a href="http://www.almasryalyoum.com/en/node/407168">
+# http://www.almasryalyoum.com/en/node/407168
+# </a>
+# or
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_egypt04.html">
+# http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
+# </a>
+Rule	Egypt	1995	2010	-	Apr	lastFri	 0:00s	1:00	S
 Rule	Egypt	1995	2005	-	Sep	lastThu	23:00s	0	-
 # From Steffen Thorsen (2006-09-19):
 # The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports:
@@ -335,7 +349,7 @@
 Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
 Rule	Egypt	2010	only	-	Aug	11	0:00	0	-
 Rule	Egypt	2010	only	-	Sep	10	0:00	1:00	S
-Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2010	only	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct
--- a/jdk/make/sun/javazic/tzdata/europe	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/europe	Mon May 09 08:58:00 2011 -0700
@@ -168,7 +168,7 @@
 # A monument to Willett was unveiled on 1927-05-21, in an open space in
 # a 45-acre wood near Chislehurst, Kent that was purchased by popular
 # subscription and open to the public.  On the south face of the monolith,
-# designed by G. W. Miller, is the the William Willett Memorial Sundial,
+# designed by G. W. Miller, is the...William Willett Memorial Sundial,
 # which is permanently set to Summer Time.
 
 # From Winston Churchill (1934-04-28):
@@ -1808,7 +1808,7 @@
 #
 # All these events predate our cutoff date of 1970.  Unless we can
 # come up with more definitive info about the timekeeping during the
-# war years it's probably best just do do the following for now:
+# war years it's probably best just do...the following for now:
 Link	Europe/Oslo	Arctic/Longyearbyen
 
 # Poland
--- a/jdk/make/sun/javazic/tzdata/southamerica	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/southamerica	Mon May 09 08:58:00 2011 -0700
@@ -767,7 +767,7 @@
 #
 # As a result of the above Decree I believe the America/Rio_Branco
 # timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall
-# be created to represent the the west side of the Para State. I
+# be created to represent the...west side of the Para State. I
 # suggest this new timezone be called Santarem as the most
 # important/populated city in the affected area.
 #
@@ -1365,6 +1365,24 @@
 # For now, we'll just record the time in Stanley, since we have no
 # better info.
 
+# From Steffen Thorsen (2011-04-01):
+# The Falkland Islands will not turn back clocks this winter, but stay on
+# daylight saving time.
+#
+# One source:
+# <a href="http://www.falklandnews.com/public/story.cfm?get=5914&source=3">
+# http://www.falklandnews.com/public/story.cfm?get=5914&source=3
+# </a>
+#
+# We have gotten this confirmed by a clerk of the legislative assembly:
+# Normally the clocks revert to Local Mean Time (UTC/GMT -4 hours) on the
+# third Sunday of April at 0200hrs and advance to Summer Time (UTC/GMT -3
+# hours) on the first Sunday of September at 0200hrs.
+#
+# IMPORTANT NOTE: During 2011, on a trial basis, the Falkland Islands
+# will not revert to local mean time, but clocks will remain on Summer
+# time (UTC/GMT - 3 hours) throughout the whole of 2011.  Any long term
+# change to local time following the trial period will be notified.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Falk	1937	1938	-	Sep	lastSun	0:00	1:00	S
 Rule	Falk	1938	1942	-	Mar	Sun>=19	0:00	0	-
@@ -1376,7 +1394,8 @@
 Rule	Falk	1984	only	-	Sep	16	0:00	1:00	S
 Rule	Falk	1985	2000	-	Sep	Sun>=9	0:00	1:00	S
 Rule	Falk	1986	2000	-	Apr	Sun>=16	0:00	0	-
-Rule	Falk	2001	max	-	Apr	Sun>=15	2:00	0	-
+Rule	Falk	2001	2010	-	Apr	Sun>=15	2:00	0	-
+Rule	Falk	2012	max	-	Apr	Sun>=15	2:00	0	-
 Rule	Falk	2001	max	-	Sep	Sun>=1	2:00	1:00	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Atlantic/Stanley	-3:51:24 -	LMT	1890
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Mon May 09 08:58:00 2011 -0700
@@ -56,9 +56,9 @@
 FileChooser.renameFileButtonText=Rename File
 FileChooser.renameFileButtonMnemonic=82
 FileChooser.cancelButtonText=Cancel
-FileChooser.cancelButtonMnemonic=67
+#FileChooser.cancelButtonMnemonic=67
 FileChooser.saveButtonText=OK
-FileChooser.saveButtonMnemonic=79
+#FileChooser.saveButtonMnemonic=79
 FileChooser.openButtonText=OK
 FileChooser.openButtonMnemonic=79
 FileChooser.saveDialogTitleText=Save
@@ -79,9 +79,5 @@
 FileChooser.renameFileErrorTitle=Error 
 FileChooser.renameFileErrorText=Error renaming file "{0}" to "{1}"
 
-# dummy resource added for translation automation
-OptionPane.okButtonText=OK
-OptionPane.okButtonMnemonic=79
-# dummy resource added for translation automation
-OptionPane.cancelButtonText=Cancel
-OptionPane.cancelButtonMnemonic=67
+#OptionPane.okButtonMnemonic=79
+#OptionPane.cancelButtonMnemonic=67
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Mon May 09 08:58:00 2011 -0700
@@ -24,7 +24,7 @@
 GTKColorChooserPanel.hueMnemonic=70
 
 GTKColorChooserPanel.redText=Rot:
-GTKColorChooserPanel.redMnemonic=79
+GTKColorChooserPanel.redMnemonic=82
 
 GTKColorChooserPanel.saturationText=S\u00E4ttigung:
 GTKColorChooserPanel.saturationMnemonic=83
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties	Mon May 09 08:58:00 2011 -0700
@@ -30,7 +30,7 @@
 GTKColorChooserPanel.saturationMnemonic=83
 
 GTKColorChooserPanel.greenText=Verde:
-GTKColorChooserPanel.greenMnemonic=86
+GTKColorChooserPanel.greenMnemonic=69
 
 GTKColorChooserPanel.valueText=Valor:
 GTKColorChooserPanel.valueMnemonic=86
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties	Mon May 09 08:58:00 2011 -0700
@@ -30,7 +30,7 @@
 GTKColorChooserPanel.saturationMnemonic=83
 
 GTKColorChooserPanel.greenText=Vert :
-GTKColorChooserPanel.greenMnemonic=86
+GTKColorChooserPanel.greenMnemonic=69
 
 GTKColorChooserPanel.valueText=Valeur :
 GTKColorChooserPanel.valueMnemonic=86
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties	Mon May 09 08:58:00 2011 -0700
@@ -30,7 +30,7 @@
 GTKColorChooserPanel.saturationMnemonic=83
 
 GTKColorChooserPanel.greenText=Verde:
-GTKColorChooserPanel.greenMnemonic=86
+GTKColorChooserPanel.greenMnemonic=69
 
 GTKColorChooserPanel.valueText=Valore:
 GTKColorChooserPanel.valueMnemonic=86
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,11 +55,11 @@
 FileChooser.deleteFileButtonMnemonic=76
 FileChooser.renameFileButtonText=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(R)
 FileChooser.renameFileButtonMnemonic=82
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
-FileChooser.saveButtonText=OK(O)
+FileChooser.saveButtonText=OK
 FileChooser.saveButtonMnemonic=79
-FileChooser.openButtonText=OK(O)
+FileChooser.openButtonText=OK
 FileChooser.openButtonMnemonic=79
 FileChooser.saveDialogTitleText=\u4FDD\u5B58
 FileChooser.openDialogTitleText=\u958B\u304F
@@ -79,10 +79,6 @@
 FileChooser.renameFileErrorTitle=\u30A8\u30E9\u30FC
 FileChooser.renameFileErrorText=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
 
-# dummy resource added for translation automation
-OptionPane.okButtonText=OK(O)
-OptionPane.okButtonMnemonic=79
-# dummy resource added for translation automation
-OptionPane.cancelButtonText=\u53D6\u6D88(C)
-OptionPane.cancelButtonMnemonic=67
+#OptionPane.okButtonMnemonic=79
+#OptionPane.cancelButtonMnemonic=67
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,11 +55,11 @@
 FileChooser.deleteFileButtonMnemonic=76
 FileChooser.renameFileButtonText=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(R)
 FileChooser.renameFileButtonMnemonic=82
-FileChooser.cancelButtonText=\uCDE8\uC18C(C)
+FileChooser.cancelButtonText=\uCDE8\uC18C
 FileChooser.cancelButtonMnemonic=67
-FileChooser.saveButtonText=\uD655\uC778(O)
+FileChooser.saveButtonText=\uD655\uC778
 FileChooser.saveButtonMnemonic=79
-FileChooser.openButtonText=\uD655\uC778(O)
+FileChooser.openButtonText=\uD655\uC778
 FileChooser.openButtonMnemonic=79
 FileChooser.saveDialogTitleText=\uC800\uC7A5
 FileChooser.openDialogTitleText=\uC5F4\uAE30
@@ -79,10 +79,6 @@
 FileChooser.renameFileErrorTitle=\uC624\uB958
 FileChooser.renameFileErrorText="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
 
-# dummy resource added for translation automation
-OptionPane.okButtonText=\uD655\uC778(O)
-OptionPane.okButtonMnemonic=79
-# dummy resource added for translation automation
-OptionPane.cancelButtonText=\uCDE8\uC18C(C)
-OptionPane.cancelButtonMnemonic=67
+#OptionPane.okButtonMnemonic=79
+#OptionPane.cancelButtonMnemonic=67
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties	Mon May 09 08:58:00 2011 -0700
@@ -30,7 +30,7 @@
 GTKColorChooserPanel.saturationMnemonic=83
 
 GTKColorChooserPanel.greenText=Verde:
-GTKColorChooserPanel.greenMnemonic=86
+GTKColorChooserPanel.greenMnemonic=68
 
 GTKColorChooserPanel.valueText=Valor:
 GTKColorChooserPanel.valueMnemonic=86
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties	Mon May 09 08:58:00 2011 -0700
@@ -39,7 +39,7 @@
 GTKColorChooserPanel.blueMnemonic=66
 
 GTKColorChooserPanel.colorNameText=F\u00E4rgnamn:
-GTKColorChooserPanel.colorNameMnemonic=78
+GTKColorChooserPanel.colorNameMnemonic=70
 
 
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,11 +55,11 @@
 FileChooser.deleteFileButtonMnemonic=76
 FileChooser.renameFileButtonText=\u91CD\u547D\u540D\u6587\u4EF6(R)
 FileChooser.renameFileButtonMnemonic=82
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
-FileChooser.saveButtonText=\u786E\u5B9A(O)
+FileChooser.saveButtonText=\u786E\u5B9A
 FileChooser.saveButtonMnemonic=79
-FileChooser.openButtonText=\u786E\u5B9A(O)
+FileChooser.openButtonText=\u786E\u5B9A
 FileChooser.openButtonMnemonic=79
 FileChooser.saveDialogTitleText=\u4FDD\u5B58
 FileChooser.openDialogTitleText=\u6253\u5F00
@@ -79,10 +79,6 @@
 FileChooser.renameFileErrorTitle=\u9519\u8BEF
 FileChooser.renameFileErrorText=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519
 
-# dummy resource added for translation automation
-OptionPane.okButtonText=\u786E\u5B9A(O)
-OptionPane.okButtonMnemonic=79
-# dummy resource added for translation automation
-OptionPane.cancelButtonText=\u53D6\u6D88(C)
-OptionPane.cancelButtonMnemonic=67
+#OptionPane.okButtonMnemonic=79
+#OptionPane.cancelButtonMnemonic=67
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,11 +55,11 @@
 FileChooser.deleteFileButtonMnemonic=76
 FileChooser.renameFileButtonText=\u91CD\u65B0\u547D\u540D\u6A94\u6848(R)
 FileChooser.renameFileButtonMnemonic=82
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
-FileChooser.saveButtonText=\u78BA\u5B9A(O)
+FileChooser.saveButtonText=\u78BA\u5B9A
 FileChooser.saveButtonMnemonic=79
-FileChooser.openButtonText=\u78BA\u5B9A(O)
+FileChooser.openButtonText=\u78BA\u5B9A
 FileChooser.openButtonMnemonic=79
 FileChooser.saveDialogTitleText=\u5132\u5B58
 FileChooser.openDialogTitleText=\u958B\u555F
@@ -79,10 +79,6 @@
 FileChooser.renameFileErrorTitle=\u932F\u8AA4
 FileChooser.renameFileErrorText=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4
 
-# dummy resource added for translation automation
-OptionPane.okButtonText=\u78BA\u5B9A(O)
-OptionPane.okButtonMnemonic=79
-# dummy resource added for translation automation
-OptionPane.cancelButtonText=\u53D6\u6D88(C)
-OptionPane.cancelButtonMnemonic=67
+#OptionPane.okButtonMnemonic=79
+#OptionPane.cancelButtonMnemonic=67
 
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Mon May 09 08:58:00 2011 -0700
@@ -57,7 +57,7 @@
   Specify a different file name. 
 FileChooser.acceptAllFileFilterText=All Files
 FileChooser.cancelButtonText=Cancel
-FileChooser.cancelButtonMnemonic=67
+#FileChooser.cancelButtonMnemonic=67 // not needed?
 FileChooser.saveButtonText=Save
 FileChooser.saveButtonMnemonic=83 // not needed?
 FileChooser.openButtonText=Open
@@ -146,9 +146,9 @@
 OptionPane.noButtonText=No
 OptionPane.noButtonMnemonic=78
 OptionPane.okButtonText=OK
-OptionPane.okButtonMnemonic=0
+#OptionPane.okButtonMnemonic=0
 OptionPane.cancelButtonText=Cancel
-OptionPane.cancelButtonMnemonic=0
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.titleText=Select an Option
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,7 +55,7 @@
 FileChooser.renameErrorText={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093
 FileChooser.renameErrorFileExistsText={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 FileChooser.acceptAllFileFilterText=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
 FileChooser.saveButtonText=\u4FDD\u5B58
 FileChooser.saveButtonMnemonic=83
@@ -146,7 +146,7 @@
 OptionPane.noButtonMnemonic=78
 OptionPane.okButtonText=OK
 OptionPane.okButtonMnemonic=O
-OptionPane.cancelButtonText=\u53D6\u6D88(0)
+OptionPane.cancelButtonText=\u53D6\u6D88
 OptionPane.cancelButtonMnemonic=0
 OptionPane.titleText=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E
 # Title for the dialog for the showInputDialog methods. Only used if
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,7 +55,7 @@
 FileChooser.renameErrorText={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
 FileChooser.renameErrorFileExistsText={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC74C: \uC9C0\uC815\uD55C \uC774\uB984\uC744 \uC0AC\uC6A9\uD558\uB294 \uD30C\uC77C\uC774 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uB2E4\uB978 \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC2ED\uC2DC\uC624.
 FileChooser.acceptAllFileFilterText=\uBAA8\uB4E0 \uD30C\uC77C
-FileChooser.cancelButtonText=\uCDE8\uC18C(C)
+FileChooser.cancelButtonText=\uCDE8\uC18C
 FileChooser.cancelButtonMnemonic=67
 FileChooser.saveButtonText=\uC800\uC7A5
 FileChooser.saveButtonMnemonic=83
@@ -146,7 +146,7 @@
 OptionPane.noButtonMnemonic=78
 OptionPane.okButtonText=OK
 OptionPane.okButtonMnemonic=O
-OptionPane.cancelButtonText=\uCDE8\uC18C(0)
+OptionPane.cancelButtonText=\uCDE8\uC18C
 OptionPane.cancelButtonMnemonic=0
 OptionPane.titleText=\uC635\uC158 \uC120\uD0DD
 # Title for the dialog for the showInputDialog methods. Only used if
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Mon May 09 08:58:00 2011 -0700
@@ -96,7 +96,7 @@
 ColorChooser.cancelText=Avbryt
 ColorChooser.resetText=\u00C5terst\u00E4ll
 # VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic
-ColorChooser.resetMnemonic=82
+ColorChooser.resetMnemonic=84
 ColorChooser.sampleText=Exempeltext  Exempeltext
 ColorChooser.swatchesNameText=Prov
 ColorChooser.swatchesMnemonic=80
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,7 +55,7 @@
 FileChooser.renameErrorText=\u65E0\u6CD5\u91CD\u547D\u540D{0}
 FileChooser.renameErrorFileExistsText=\u65E0\u6CD5\u91CD\u547D\u540D{0}: \u5DF2\u5B58\u5728\u5177\u6709\u6240\u6307\u5B9A\u540D\u79F0\u7684\u6587\u4EF6\u3002\u8BF7\u6307\u5B9A\u5176\u4ED6\u6587\u4EF6\u540D\u3002
 FileChooser.acceptAllFileFilterText=\u6240\u6709\u6587\u4EF6
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
 FileChooser.saveButtonText=\u4FDD\u5B58
 FileChooser.saveButtonMnemonic=83
@@ -146,7 +146,7 @@
 OptionPane.noButtonMnemonic=78
 OptionPane.okButtonText=OK
 OptionPane.okButtonMnemonic=O
-OptionPane.cancelButtonText=\u53D6\u6D88(0)
+OptionPane.cancelButtonText=\u53D6\u6D88
 OptionPane.cancelButtonMnemonic=0
 OptionPane.titleText=\u9009\u62E9\u4E00\u4E2A\u9009\u9879
 # Title for the dialog for the showInputDialog methods. Only used if
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Mon May 09 08:58:00 2011 -0700
@@ -55,7 +55,7 @@
 FileChooser.renameErrorText=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0}
 FileChooser.renameErrorFileExistsText=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0}: \u5DF2\u7D93\u5B58\u5728\u60A8\u6240\u6307\u5B9A\u540D\u7A31\u7684\u6A94\u6848\u3002\u8ACB\u6307\u5B9A\u4E0D\u540C\u7684\u540D\u7A31\u3002
 FileChooser.acceptAllFileFilterText=\u6240\u6709\u6A94\u6848
-FileChooser.cancelButtonText=\u53D6\u6D88(C)
+FileChooser.cancelButtonText=\u53D6\u6D88
 FileChooser.cancelButtonMnemonic=67
 FileChooser.saveButtonText=\u5132\u5B58
 FileChooser.saveButtonMnemonic=83
@@ -146,7 +146,7 @@
 OptionPane.noButtonMnemonic=78
 OptionPane.okButtonText=OK
 OptionPane.okButtonMnemonic=O
-OptionPane.cancelButtonText=\u53D6\u6D88(0)
+OptionPane.cancelButtonText=\u53D6\u6D88
 OptionPane.cancelButtonMnemonic=0
 OptionPane.titleText=\u9078\u53D6\u4E00\u500B\u9078\u9805
 # Title for the dialog for the showInputDialog methods. Only used if
--- a/jdk/src/share/classes/java/awt/Component.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Mon May 09 08:58:00 2011 -0700
@@ -2945,6 +2945,46 @@
     }
 
     /**
+     * Revalidates the component hierarchy up to the nearest validate root.
+     * <p>
+     * This method first invalidates the component hierarchy starting from this
+     * component up to the nearest validate root. Afterwards, the component
+     * hierarchy is validated starting from the nearest validate root.
+     * <p>
+     * This is a convenience method supposed to help application developers
+     * avoid looking for validate roots manually. Basically, it's equivalent to
+     * first calling the {@link #invalidate()} method on this component, and
+     * then calling the {@link #validate()} method on the nearest validate
+     * root.
+     *
+     * @see Container#isValidateRoot
+     * @since 1.7
+     */
+    public void revalidate() {
+        synchronized (getTreeLock()) {
+            invalidate();
+
+            Container root = getContainer();
+            if (root == null) {
+                // There's no parents. Just validate itself.
+                validate();
+            } else {
+                while (!root.isValidateRoot()) {
+                    if (root.getContainer() == null) {
+                        // If there's no validate roots, we'll validate the
+                        // topmost container
+                        break;
+                    }
+
+                    root = root.getContainer();
+                }
+
+                root.validate();
+            }
+        }
+    }
+
+    /**
      * Creates a graphics context for this component. This method will
      * return <code>null</code> if this component is currently not
      * displayable.
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java	Mon May 09 08:58:00 2011 -0700
@@ -257,6 +257,11 @@
      * 1.0f, and the background color alpha is set to 255 (completely opaque).
      * These values are not restored when returning to windowed mode.
      * <p>
+     * It is unspecified and platform-dependent how decorated windows operate
+     * in full-screen mode. For this reason, it is recommended to turn off
+     * the decorations in a {@code Frame} or {@code Dialog} object by using the
+     * {@code setUndecorated} method.
+     * <p>
      * When returning to windowed mode from an exclusive full-screen window,
      * any display changes made by calling {@code setDisplayMode} are
      * automatically restored to their original state.
@@ -272,6 +277,8 @@
      * @see #setDisplayMode
      * @see Component#enableInputMethods
      * @see Component#setVisible
+     * @see Frame#setUndecorated
+     * @see Dialog#setUndecorated
      *
      * @since 1.4
      */
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Mon May 09 08:58:00 2011 -0700
@@ -49,9 +49,11 @@
  * from the focus point to the circumference will thus span all the gradient
  * colors.
  * <p>
- * Specifying a focus point outside of the circle's radius will result in the
- * focus being set to the intersection point of the focus-center line and the
- * perimeter of the circle.
+ * Specifying a focus point outside of the radius of the circle will cause
+ * the rings of the gradient pattern to be centered on the point just inside
+ * the edge of the circle in the direction of the focus point.
+ * The rendering will internally use this modified location as if it were
+ * the specified focus point.
  * <p>
  * The user must provide an array of floats specifying how to distribute the
  * colors along the gradient.  These values should range from 0.0 to 1.0 and
@@ -621,6 +623,11 @@
 
     /**
      * Returns a copy of the focus point of the radial gradient.
+     * Note that if the focus point specified when the radial gradient
+     * was constructed lies outside of the radius of the circle, this
+     * method will still return the original focus point even though
+     * the rendering may center the rings of color on a different
+     * point that lies inside the radius.
      *
      * @return a {@code Point2D} object that is a copy of the focus point
      */
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Mon May 09 08:58:00 2011 -0700
@@ -1870,11 +1870,15 @@
 
     /**
      * Adds the specified property change listener for the named desktop
-     * property.
-     * If pcl is null, no exception is thrown and no action is performed.
+     * property. When a {@link PropertyChangeListenerProxy} object is added,
+     * its property name is ignored, and the wrapped listener is added.
+     * If {@code name} is {@code null} or {@code pcl} is {@code null},
+     * no exception is thrown and no action is performed.
      *
      * @param   name The name of the property to listen for
      * @param   pcl The property change listener
+     * @see PropertyChangeSupport#addPropertyChangeListener(String,
+                PropertyChangeListener)
      * @since   1.2
      */
     public void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
@@ -1883,11 +1887,16 @@
 
     /**
      * Removes the specified property change listener for the named
-     * desktop property.
-     * If pcl is null, no exception is thrown and no action is performed.
+     * desktop property. When a {@link PropertyChangeListenerProxy} object
+     * is removed, its property name is ignored, and
+     * the wrapped listener is removed.
+     * If {@code name} is {@code null} or {@code pcl} is {@code null},
+     * no exception is thrown and no action is performed.
      *
      * @param   name The name of the property to remove
      * @param   pcl The property change listener
+     * @see PropertyChangeSupport#removePropertyChangeListener(String,
+                PropertyChangeListener)
      * @since   1.2
      */
     public void removePropertyChangeListener(String name, PropertyChangeListener pcl) {
@@ -1896,12 +1905,15 @@
 
     /**
      * Returns an array of all the property change listeners
-     * registered on this toolkit.
+     * registered on this toolkit. The returned array
+     * contains {@code PropertyChangeListenerProxy} objects
+     * that associate listeners with the names of desktop properties.
      *
-     * @return all of this toolkit's <code>PropertyChangeListener</code>s
-     *         or an empty array if no property change
-     *         listeners are currently registered
+     * @return all of this toolkit's {@ code PropertyChangeListener}
+     *         objects wrapped in {@code PropertyChangeListenerProxy} objects
+     *         or an empty array  if no listeners are added
      *
+     * @see PropertyChangeSupport#getPropertyChangeListeners()
      * @since 1.4
      */
     public PropertyChangeListener[] getPropertyChangeListeners() {
@@ -1909,13 +1921,15 @@
     }
 
     /**
-     * Returns an array of all the <code>PropertyChangeListener</code>s
-     * associated with the named property.
+     * Returns an array of all property change listeners
+     * associated with the specified name of a desktop property.
      *
      * @param  propertyName the named property
-     * @return all of the <code>PropertyChangeListener</code>s associated with
-     *         the named property or an empty array if no such listeners have
-     *         been added
+     * @return all of the {@code PropertyChangeListener} objects
+     *         associated with the specified name of a desktop property
+     *         or an empty array if no such listeners are added
+     *
+     * @see PropertyChangeSupport#getPropertyChangeListeners(String)
      * @since 1.4
      */
     public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
--- a/jdk/src/share/classes/java/awt/geom/Arc2D.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Arc2D.java	Mon May 09 08:58:00 2011 -0700
@@ -681,7 +681,7 @@
      * @see java.awt.geom.Arc2D.Float
      * @see java.awt.geom.Arc2D.Double
      */
-    Arc2D() {
+    protected Arc2D() {
         this(OPEN);
     }
 
--- a/jdk/src/share/classes/java/awt/geom/Path2D.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Path2D.java	Mon May 09 08:58:00 2011 -0700
@@ -732,7 +732,7 @@
          *
          * @since 1.6
          */
-        public PathIterator getPathIterator(AffineTransform at) {
+        public final PathIterator getPathIterator(AffineTransform at) {
             if (at == null) {
                 return new CopyIterator(this);
             } else {
@@ -1461,7 +1461,7 @@
          *         of this {@code Shape}'s outline
          * @since 1.6
          */
-        public PathIterator getPathIterator(AffineTransform at) {
+        public final PathIterator getPathIterator(AffineTransform at) {
             if (at == null) {
                 return new CopyIterator(this);
             } else {
@@ -2342,8 +2342,8 @@
      *
      * @since 1.6
      */
-    public PathIterator getPathIterator(AffineTransform at,
-                                        double flatness)
+    public final PathIterator getPathIterator(AffineTransform at,
+                                              double flatness)
     {
         return new FlatteningPathIterator(getPathIterator(at), flatness);
     }
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java	Mon May 09 08:58:00 2011 -0700
@@ -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
@@ -32,7 +32,7 @@
  * constructor does not perform potentially unsafe operations on its
  * varargs parameter.  Applying this annotation to a method or
  * constructor suppresses unchecked warnings about a
- * <i>non-reifiable</i> variable-arity (vararg) type and suppresses
+ * <i>non-reifiable</i> variable arity (vararg) type and suppresses
  * unchecked warnings about parameterized array creation at call
  * sites.
  *
@@ -41,11 +41,10 @@
  * additional usage restrictions on this annotation type; it is a
  * compile-time error if a method or constructor declaration is
  * annotated with a {@code @SafeVarargs} annotation, and either:
-
  * <ul>
- * <li>  the declaration is a fixed-arity method or constructor
+ * <li>  the declaration is a fixed arity method or constructor
  *
- * <li> the declaration is a variable-arity method that is neither
+ * <li> the declaration is a variable arity method that is neither
  * {@code static} nor {@code final}.
  *
  * </ul>
@@ -55,15 +54,28 @@
  *
  * <ul>
  *
- * <li> The variable-arity parameter has a reifiable element type,
+ * <li> The variable arity parameter has a reifiable element type,
  * which includes primitive types, {@code Object}, and {@code String}.
  * (The unchecked warnings this annotation type suppresses already do
  * not occur for a reifiable element type.)
  *
  * <li> The body of the method or constructor declaration performs
  * potentially unsafe operations, such as an assignment to an element
- * of the variable-arity parameter's array that generates an unchecked
- * warning.
+ * of the variable arity parameter's array that generates an unchecked
+ * warning.  Some unsafe operations do not trigger an unchecked
+ * warning.  For example, the aliasing in
+ *
+ * <blockquote><pre>
+ * &#64;SafeVarargs // Not actually safe!
+ * static void m(List&lt;String&gt;... stringLists) {
+ *   Object[] array = stringLists;
+ *   List&lt;Integer&gt; tmpList = Arrays.asList(42);
+ *   array[0] = tmpList; // Semantically invalid, but compiles without warnings
+ *   String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
+ * }
+ * </pre></blockquote>
+ *
+ * leads to a {@code ClassCastException} at runtime.
  *
  * <p>Future versions of the platform may mandate compiler errors for
  * such unsafe operations.
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon May 09 08:58:00 2011 -0700
@@ -275,10 +275,14 @@
      * snapshot -- the thread may have since unblocked or blocked on a
      * different blocker object.
      *
+     * @param t the thread
      * @return the blocker
+     * @throws NullPointerException if argument is null
      * @since 1.6
      */
     public static Object getBlocker(Thread t) {
+        if (t == null)
+            throw new NullPointerException();
         return unsafe.getObjectVolatile(t, parkBlockerOffset);
     }
 
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java	Mon May 09 08:58:00 2011 -0700
@@ -342,8 +342,8 @@
 
         // Calculate the screen size that popup should fit
         Dimension popupSize = JPopupMenu.this.getPreferredSize();
-        int popupRightX = popupLocation.x + popupSize.width;
-        int popupBottomY = popupLocation.y + popupSize.height;
+        long popupRightX = (long)popupLocation.x + (long)popupSize.width;
+        long popupBottomY = (long)popupLocation.y + (long)popupSize.height;
         int scrWidth = scrBounds.width;
         int scrHeight = scrBounds.height;
         if (!canPopupOverlapTaskBar()) {
@@ -358,13 +358,13 @@
         int scrBottomY = scrBounds.y + scrHeight;
 
         // Ensure that popup menu fits the screen
-        if (popupRightX > scrRightX) {
+        if (popupRightX > (long)scrRightX) {
             popupLocation.x = scrRightX - popupSize.width;
             if( popupLocation.x < scrBounds.x ) {
                 popupLocation.x = scrBounds.x ;
             }
         }
-        if (popupBottomY > scrBottomY) {
+        if (popupBottomY > (long)scrBottomY) {
             popupLocation.y = scrBottomY - popupSize.height;
             if( popupLocation.y < scrBounds.y ) {
                 popupLocation.y = scrBounds.y;
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java	Mon May 09 08:58:00 2011 -0700
@@ -671,7 +671,7 @@
      * which must be <code>true</code> for the child components
      * to be continuously
      * redisplayed and laid out during user intervention.
-     * The default value of this property is <code>false</code>.
+     * The default value of this property is look and feel dependent.
      * Some look and feels might not support continuous layout;
      * they will ignore this property.
      *
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java	Mon May 09 08:58:00 2011 -0700
@@ -154,7 +154,7 @@
         setBackground(UIManager.getColor("SplitPane.background"));
     }
 
-    private void revalidate() {
+    private void revalidateSplitPane() {
         invalidate();
         if (splitPane != null) {
             splitPane.revalidate();
@@ -315,7 +315,7 @@
                 setCursor((orientation == JSplitPane.HORIZONTAL_SPLIT) ?
                           Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) :
                           Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
-                revalidate();
+                revalidateSplitPane();
             }
             else if (e.getPropertyName() == JSplitPane.
                       ONE_TOUCH_EXPANDABLE_PROPERTY) {
@@ -376,7 +376,7 @@
                 add(rightButton);
             }
         }
-        revalidate();
+        revalidateSplitPane();
     }
 
 
--- a/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java	Mon May 09 08:58:00 2011 -0700
@@ -13,7 +13,7 @@
      */
      // Keycodes declared in KeyEvent.java with corresponding Unicode values.
      private final static HashMap<Integer, Integer>  regularKeyCodesMap =
-                                          new HashMap<Integer,Integer>(83, 1.0f);
+                                          new HashMap<Integer,Integer>(98, 1.0f);
 
      // Keycodes derived from Unicode values. Here should be collected codes
      // for characters appearing on the primary layer of at least one
@@ -108,6 +108,21 @@
          regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX);
          regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE);
          regularKeyCodesMap.put(0x60, KeyEvent.VK_BACK_QUOTE);
+         regularKeyCodesMap.put(0x61, KeyEvent.VK_A);
+         regularKeyCodesMap.put(0x62, KeyEvent.VK_B);
+         regularKeyCodesMap.put(0x63, KeyEvent.VK_C);
+         regularKeyCodesMap.put(0x64, KeyEvent.VK_D);
+         regularKeyCodesMap.put(0x65, KeyEvent.VK_E);
+         regularKeyCodesMap.put(0x66, KeyEvent.VK_F);
+         regularKeyCodesMap.put(0x67, KeyEvent.VK_G);
+         regularKeyCodesMap.put(0x68, KeyEvent.VK_H);
+         regularKeyCodesMap.put(0x69, KeyEvent.VK_I);
+         regularKeyCodesMap.put(0x6A, KeyEvent.VK_J);
+         regularKeyCodesMap.put(0x6B, KeyEvent.VK_K);
+         regularKeyCodesMap.put(0x6C, KeyEvent.VK_L);
+         regularKeyCodesMap.put(0x6D, KeyEvent.VK_M);
+         regularKeyCodesMap.put(0x6E, KeyEvent.VK_N);
+         regularKeyCodesMap.put(0x6F, KeyEvent.VK_O);
          regularKeyCodesMap.put(0x70, KeyEvent.VK_P);
          regularKeyCodesMap.put(0x71, KeyEvent.VK_Q);
          regularKeyCodesMap.put(0x72, KeyEvent.VK_R);
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Mon May 09 08:58:00 2011 -0700
@@ -29,12 +29,10 @@
 import java.awt.EventQueue;
 import java.awt.Image;
 import java.awt.Graphics;
-import java.awt.Toolkit;
 
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.FlavorMap;
 import java.awt.datatransfer.FlavorTable;
-import java.awt.datatransfer.StringSelection;
 import java.awt.datatransfer.Transferable;
 import java.awt.datatransfer.UnsupportedFlavorException;
 
@@ -66,8 +64,6 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
-import java.security.AccessControlContext;
-import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
@@ -171,7 +167,26 @@
      */
     public static final DataFlavor javaTextEncodingFlavor;
 
-    private static SortedSet standardEncodings;
+    /**
+     * Lazy initialization of Standard Encodings.
+     */
+    private static class StandardEncodingsHolder {
+        private static final SortedSet standardEncodings = load();
+
+        private static SortedSet load() {
+            final Comparator comparator =
+                    new CharsetComparator(IndexedComparator.SELECT_WORST);
+            final SortedSet tempSet = new TreeSet(comparator);
+            tempSet.add("US-ASCII");
+            tempSet.add("ISO-8859-1");
+            tempSet.add("UTF-8");
+            tempSet.add("UTF-16BE");
+            tempSet.add("UTF-16LE");
+            tempSet.add("UTF-16");
+            tempSet.add(getDefaultTextCharset());
+            return Collections.unmodifiableSortedSet(tempSet);
+        }
+    }
 
     /**
      * Tracks whether a particular text/* MIME type supports the charset
@@ -509,18 +524,7 @@
      * non-standard, character sets are not included.
      */
     public static Iterator standardEncodings() {
-        if (standardEncodings == null) {
-            TreeSet tempSet = new TreeSet(defaultCharsetComparator);
-            tempSet.add("US-ASCII");
-            tempSet.add("ISO-8859-1");
-            tempSet.add("UTF-8");
-            tempSet.add("UTF-16BE");
-            tempSet.add("UTF-16LE");
-            tempSet.add("UTF-16");
-            tempSet.add(getDefaultTextCharset());
-            standardEncodings = Collections.unmodifiableSortedSet(tempSet);
-        }
-        return standardEncodings.iterator();
+        return StandardEncodingsHolder.standardEncodings.iterator();
     }
 
     /**
@@ -2398,7 +2402,9 @@
     public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
         DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
         flavorsSet.toArray(flavors);
-        Arrays.sort(flavors, defaultFlavorComparator);
+        final Comparator comparator =
+                new DataFlavorComparator(IndexedComparator.SELECT_WORST);
+        Arrays.sort(flavors, comparator);
         return flavors;
     }
 
@@ -2455,11 +2461,6 @@
         return new ArrayList();
     }
 
-    private static CharsetComparator defaultCharsetComparator =
-        new CharsetComparator(IndexedComparator.SELECT_WORST);
-    private static DataFlavorComparator defaultFlavorComparator =
-        new DataFlavorComparator(IndexedComparator.SELECT_WORST);
-
     /**
      * A Comparator which includes a helper function for comparing two Objects
      * which are likely to be keys in the specified Map.
--- a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java	Mon May 09 08:58:00 2011 -0700
@@ -27,6 +27,8 @@
 
 import java.util.Arrays;
 import java.util.Iterator;
+import static java.lang.Math.ulp;
+import static java.lang.Math.sqrt;
 
 import sun.awt.geom.PathConsumer2D;
 
@@ -130,7 +132,7 @@
     private static void computeOffset(final float lx, final float ly,
                                       final float w, final float[] m)
     {
-        final float len = (float)Math.sqrt(lx*lx + ly*ly);
+        final float len = (float) sqrt(lx*lx + ly*ly);
         if (len == 0) {
             m[0] = m[1] = 0;
         } else {
@@ -217,7 +219,7 @@
             // this normal's length is at least 0.5 and at most sqrt(2)/2 (because
             // we know the angle of the arc is > 90 degrees).
             float nx = my - omy, ny = omx - mx;
-            float nlen = (float)Math.sqrt(nx*nx + ny*ny);
+            float nlen = (float) sqrt(nx*nx + ny*ny);
             float scale = lineWidth2/nlen;
             float mmx = nx * scale, mmy = ny * scale;
 
@@ -246,8 +248,8 @@
         // define the bezier curve we're computing.
         // It is computed using the constraints that P1-P0 and P3-P2 are parallel
         // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
-        float cv = (float)((4.0 / 3.0) * Math.sqrt(0.5-cosext2) /
-                           (1.0 + Math.sqrt(cosext2+0.5)));
+        float cv = (float) ((4.0 / 3.0) * sqrt(0.5-cosext2) /
+                            (1.0 + sqrt(cosext2+0.5)));
         // if clockwise, we need to negate cv.
         if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
             cv = -cv;
@@ -284,28 +286,20 @@
                     false);
     }
 
-    // Return the intersection point of the lines (x0, y0) -> (x1, y1)
-    // and (x0p, y0p) -> (x1p, y1p) in m[0] and m[1]
-    private void computeMiter(final float x0, final float y0,
-                              final float x1, final float y1,
-                              final float x0p, final float y0p,
-                              final float x1p, final float y1p,
-                              final float[] m, int off)
+    // Put the intersection point of the lines (x0, y0) -> (x1, y1)
+    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1].
+    // If the lines are parallel, it will put a non finite number in m.
+    private void computeIntersection(final float x0, final float y0,
+                                     final float x1, final float y1,
+                                     final float x0p, final float y0p,
+                                     final float x1p, final float y1p,
+                                     final float[] m, int off)
     {
         float x10 = x1 - x0;
         float y10 = y1 - y0;
         float x10p = x1p - x0p;
         float y10p = y1p - y0p;
 
-        // if this is 0, the lines are parallel. If they go in the
-        // same direction, there is no intersection so m[off] and
-        // m[off+1] will contain infinity, so no miter will be drawn.
-        // If they go in the same direction that means that the start of the
-        // current segment and the end of the previous segment have the same
-        // tangent, in which case this method won't even be involved in
-        // miter drawing because it won't be called by drawMiter (because
-        // (mx == omx && my == omy) will be true, and drawMiter will return
-        // immediately).
         float den = x10*y10p - x10p*y10;
         float t = x10p*(y0-y0p) - y10p*(x0-x0p);
         t /= den;
@@ -321,7 +315,8 @@
     {
         if ((mx == omx && my == omy) ||
             (pdx == 0 && pdy == 0) ||
-            (dx == 0 && dy == 0)) {
+            (dx == 0 && dy == 0))
+        {
             return;
         }
 
@@ -332,12 +327,17 @@
             my = -my;
         }
 
-        computeMiter((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
-                     (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
-                     miter, 0);
+        computeIntersection((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
+                            (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
+                            miter, 0);
 
         float lenSq = (miter[0]-x0)*(miter[0]-x0) + (miter[1]-y0)*(miter[1]-y0);
 
+        // If the lines are parallel, lenSq will be either NaN or +inf
+        // (actually, I'm not sure if the latter is possible. The important
+        // thing is that -inf is not possible, because lenSq is a square).
+        // For both of those values, the comparison below will fail and
+        // no miter will be drawn, which is correct.
         if (lenSq < miterLimitSq) {
             emitLineTo(miter[0], miter[1], rev);
         }
@@ -566,8 +566,8 @@
 
         // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
         // in which case ignore if p1 == p2
-        final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2));
-        final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * Math.ulp(y4));
+        final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * ulp(y2));
+        final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * ulp(y4));
         if (p1eqp2 && p3eqp4) {
             getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
             return 4;
@@ -583,7 +583,7 @@
         float dotsq = (dx1 * dx4 + dy1 * dy4);
         dotsq = dotsq * dotsq;
         float l1sq = dx1 * dx1 + dy1 * dy1, l4sq = dx4 * dx4 + dy4 * dy4;
-        if (Helpers.within(dotsq, l1sq * l4sq, 4 * Math.ulp(dotsq))) {
+        if (Helpers.within(dotsq, l1sq * l4sq, 4 * ulp(dotsq))) {
             getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
             return 4;
         }
@@ -693,8 +693,6 @@
         return 8;
     }
 
-    // compute offset curves using bezier spline through t=0.5 (i.e.
-    // ComputedCurve(0.5) == IdealParallelCurve(0.5))
     // return the kind of curve in the right and left arrays.
     private int computeOffsetQuad(float[] pts, final int off,
                                   float[] leftOff, float[] rightOff)
@@ -703,56 +701,67 @@
         final float x2 = pts[off + 2], y2 = pts[off + 3];
         final float x3 = pts[off + 4], y3 = pts[off + 5];
 
-        float dx3 = x3 - x2;
-        float dy3 = y3 - y2;
-        float dx1 = x2 - x1;
-        float dy1 = y2 - y1;
+        final float dx3 = x3 - x2;
+        final float dy3 = y3 - y2;
+        final float dx1 = x2 - x1;
+        final float dy1 = y2 - y1;
+
+        // this computes the offsets at t = 0, 1
+        computeOffset(dx1, dy1, lineWidth2, offset[0]);
+        computeOffset(dx3, dy3, lineWidth2, offset[1]);
+
+        leftOff[0]  = x1 + offset[0][0];  leftOff[1] = y1 + offset[0][1];
+        leftOff[4]  = x3 + offset[1][0];  leftOff[5] = y3 + offset[1][1];
+        rightOff[0] = x1 - offset[0][0]; rightOff[1] = y1 - offset[0][1];
+        rightOff[4] = x3 - offset[1][0]; rightOff[5] = y3 - offset[1][1];
+
+        float x1p = leftOff[0]; // start
+        float y1p = leftOff[1]; // point
+        float x3p = leftOff[4]; // end
+        float y3p = leftOff[5]; // point
 
-        // if p1=p2 or p3=p4 it means that the derivative at the endpoint
-        // vanishes, which creates problems with computeOffset. Usually
-        // this happens when this stroker object is trying to winden
-        // a curve with a cusp. What happens is that curveTo splits
-        // the input curve at the cusp, and passes it to this function.
-        // because of inaccuracies in the splitting, we consider points
-        // equal if they're very close to each other.
+        // Corner cases:
+        // 1. If the two control vectors are parallel, we'll end up with NaN's
+        //    in leftOff (and rightOff in the body of the if below), so we'll
+        //    do getLineOffsets, which is right.
+        // 2. If the first or second two points are equal, then (dx1,dy1)==(0,0)
+        //    or (dx3,dy3)==(0,0), so (x1p, y1p)==(x1p+dx1, y1p+dy1)
+        //    or (x3p, y3p)==(x3p-dx3, y3p-dy3), which means that
+        //    computeIntersection will put NaN's in leftOff and right off, and
+        //    we will do getLineOffsets, which is right.
+        computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
+        float cx = leftOff[2];
+        float cy = leftOff[3];
 
-        // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
-        // in which case ignore.
-        final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2));
-        final boolean p2eqp3 = within(x2,y2,x3,y3, 6 * Math.ulp(y3));
-        if (p1eqp2 || p2eqp3) {
-            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
-            return 4;
+        if (!(isFinite(cx) && isFinite(cy))) {
+            // maybe the right path is not degenerate.
+            x1p = rightOff[0];
+            y1p = rightOff[1];
+            x3p = rightOff[4];
+            y3p = rightOff[5];
+            computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
+            cx = rightOff[2];
+            cy = rightOff[3];
+            if (!(isFinite(cx) && isFinite(cy))) {
+                // both are degenerate. This curve is a line.
+                getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+                return 4;
+            }
+            // {left,right}Off[0,1,4,5] are already set to the correct values.
+            leftOff[2] = 2*x2 - cx;
+            leftOff[3] = 2*y2 - cy;
+            return 6;
         }
 
-        // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line
-        float dotsq = (dx1 * dx3 + dy1 * dy3);
-        dotsq = dotsq * dotsq;
-        float l1sq = dx1 * dx1 + dy1 * dy1, l3sq = dx3 * dx3 + dy3 * dy3;
-        if (Helpers.within(dotsq, l1sq * l3sq, 4 * Math.ulp(dotsq))) {
-            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
-            return 4;
-        }
+        // rightOff[2,3] = (x2,y2) - ((left_x2, left_y2) - (x2, y2))
+        // == 2*(x2, y2) - (left_x2, left_y2)
+        rightOff[2] = 2*x2 - cx;
+        rightOff[3] = 2*y2 - cy;
+        return 6;
+    }
 
-        // this computes the offsets at t=0, 0.5, 1, using the property that
-        // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to
-        // the (dx/dt, dy/dt) vectors at the endpoints.
-        computeOffset(dx1, dy1, lineWidth2, offset[0]);
-        computeOffset(dx3, dy3, lineWidth2, offset[1]);
-        float x1p = x1 + offset[0][0]; // start
-        float y1p = y1 + offset[0][1]; // point
-        float x3p = x3 + offset[1][0]; // end
-        float y3p = y3 + offset[1][1]; // point
-
-        computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
-        leftOff[0] = x1p; leftOff[1] = y1p;
-        leftOff[4] = x3p; leftOff[5] = y3p;
-        x1p = x1 - offset[0][0]; y1p = y1 - offset[0][1];
-        x3p = x3 - offset[1][0]; y3p = y3 - offset[1][1];
-        computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
-        rightOff[0] = x1p; rightOff[1] = y1p;
-        rightOff[4] = x3p; rightOff[5] = y3p;
-        return 6;
+    private static boolean isFinite(float x) {
+        return (Float.NEGATIVE_INFINITY < x && x < Float.POSITIVE_INFINITY);
     }
 
     // This is where the curve to be processed is put. We give it
@@ -812,12 +821,12 @@
         // if these vectors are too small, normalize them, to avoid future
         // precision problems.
         if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+            float len = (float) sqrt(dxs*dxs + dys*dys);
             dxs /= len;
             dys /= len;
         }
         if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+            float len = (float) sqrt(dxf*dxf + dyf*dyf);
             dxf /= len;
             dyf /= len;
         }
@@ -834,7 +843,6 @@
         while(it.hasNext()) {
             int curCurveOff = it.next();
 
-            kind = 0;
             switch (type) {
             case 8:
                 kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
@@ -843,24 +851,22 @@
                 kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
                 break;
             }
-            if (kind != 0) {
-                emitLineTo(lp[0], lp[1]);
-                switch(kind) {
-                case 8:
-                    emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
-                    emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
-                    break;
-                case 6:
-                    emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
-                    emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
-                    break;
-                case 4:
-                    emitLineTo(lp[2], lp[3]);
-                    emitLineTo(rp[0], rp[1], true);
-                    break;
-                }
-                emitLineTo(rp[kind - 2], rp[kind - 1], true);
+            emitLineTo(lp[0], lp[1]);
+            switch(kind) {
+            case 8:
+                emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
+                emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
+                break;
+            case 6:
+                emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
+                emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
+                break;
+            case 4:
+                emitLineTo(lp[2], lp[3]);
+                emitLineTo(rp[0], rp[1], true);
+                break;
             }
+            emitLineTo(rp[kind - 2], rp[kind - 1], true);
         }
 
         this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
@@ -887,7 +893,7 @@
             // we rotate it so that the first vector in the control polygon is
             // parallel to the x-axis. This will ensure that rotated quarter
             // circles won't be subdivided.
-            final float hypot = (float)Math.sqrt(x12 * x12 + y12 * y12);
+            final float hypot = (float) sqrt(x12 * x12 + y12 * y12);
             final float cos = x12 / hypot;
             final float sin = y12 / hypot;
             final float x1 = cos * pts[0] + sin * pts[1];
@@ -976,12 +982,12 @@
         // if these vectors are too small, normalize them, to avoid future
         // precision problems.
         if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+            float len = (float) sqrt(dxs*dxs + dys*dys);
             dxs /= len;
             dys /= len;
         }
         if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+            float len = (float) sqrt(dxf*dxf + dyf*dyf);
             dxf /= len;
             dyf /= len;
         }
@@ -999,20 +1005,18 @@
             int curCurveOff = it.next();
 
             kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
-            if (kind != 0) {
-                emitLineTo(lp[0], lp[1]);
-                switch(kind) {
-                case 8:
-                    emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
-                    emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
-                    break;
-                case 4:
-                    emitLineTo(lp[2], lp[3]);
-                    emitLineTo(rp[0], rp[1], true);
-                    break;
-                }
-                emitLineTo(rp[kind - 2], rp[kind - 1], true);
+            emitLineTo(lp[0], lp[1]);
+            switch(kind) {
+            case 8:
+                emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
+                emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
+                break;
+            case 4:
+                emitLineTo(lp[2], lp[3]);
+                emitLineTo(rp[0], rp[1], true);
+                break;
             }
+            emitLineTo(rp[kind - 2], rp[kind - 1], true);
         }
 
         this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
@@ -1050,12 +1054,12 @@
         // if these vectors are too small, normalize them, to avoid future
         // precision problems.
         if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+            float len = (float) sqrt(dxs*dxs + dys*dys);
             dxs /= len;
             dys /= len;
         }
         if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+            float len = (float) sqrt(dxf*dxf + dyf*dyf);
             dxf /= len;
             dyf /= len;
         }
@@ -1073,20 +1077,18 @@
             int curCurveOff = it.next();
 
             kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
-            if (kind != 0) {
-                emitLineTo(lp[0], lp[1]);
-                switch(kind) {
-                case 6:
-                    emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
-                    emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
-                    break;
-                case 4:
-                    emitLineTo(lp[2], lp[3]);
-                    emitLineTo(rp[0], rp[1], true);
-                    break;
-                }
-                emitLineTo(rp[kind - 2], rp[kind - 1], true);
+            emitLineTo(lp[0], lp[1]);
+            switch(kind) {
+            case 6:
+                emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
+                emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
+                break;
+            case 4:
+                emitLineTo(lp[2], lp[3]);
+                emitLineTo(rp[0], rp[1], true);
+                break;
             }
+            emitLineTo(rp[kind - 2], rp[kind - 1], true);
         }
 
         this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
--- a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties	Mon May 09 08:58:00 2011 -0700
@@ -49,7 +49,7 @@
 label.source.mnemonic=C
 label.status=Statut :
 label.username=Nom utilisateur :
-label.username.mnemonic=U
+label.username.mnemonic=O
 label.millimetres=(mm)
 label.inches=(po)
 label.topmargin=haut
@@ -62,7 +62,7 @@
 label.rightmargin.mnemonic=D
 #
 radiobutton.color=Couleur
-radiobutton.color.mnemonic=U
+radiobutton.color.mnemonic=C
 radiobutton.draftq=Brouillon
 radiobutton.draftq.mnemonic=L
 radiobutton.duplex=Duplex
@@ -70,7 +70,7 @@
 radiobutton.highq=Max.
 radiobutton.highq.mnemonic=X
 radiobutton.landscape=Paysage
-radiobutton.landscape.mnemonic=S
+radiobutton.landscape.mnemonic=Y
 radiobutton.monochrome=Monochrome
 radiobutton.monochrome.mnemonic=M
 radiobutton.normalq=Normal
--- a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties	Mon May 09 08:58:00 2011 -0700
@@ -15,10 +15,10 @@
 button.ok=OK
 button.print=Imprimir
 button.properties=Propriedades...
-button.properties.mnemonic=R
+button.properties.mnemonic=D
 #
 checkbox.collate=Agrupar
-checkbox.collate.mnemonic=A
+checkbox.collate.mnemonic=R
 checkbox.jobsheets=P\u00E1gina com Banner
 checkbox.jobsheets.mnemonic=B
 checkbox.printtofile=Imprimir em Arquivo
@@ -38,7 +38,7 @@
 label.numcopies=N\u00FAmero de c\u00F3pias:
 label.numcopies.mnemonic=O
 label.priority=Prioridade:
-label.priority.mnemonic=R
+label.priority.mnemonic=P
 label.psname=Nome:
 label.psname.mnemonic=N
 label.pstype=Tipo:
@@ -59,7 +59,7 @@
 label.leftmargin=esquerda:
 label.leftmargin.mnemonic=Q
 label.rightmargin=direita
-label.rightmargin.mnemonic=R
+label.rightmargin.mnemonic=D
 #
 radiobutton.color=Cor
 radiobutton.color.mnemonic=O
@@ -68,7 +68,7 @@
 radiobutton.duplex=Duplex
 radiobutton.duplex.mnemonic=D
 radiobutton.highq=Alta
-radiobutton.highq.mnemonic=A
+radiobutton.highq.mnemonic=T
 radiobutton.landscape=Paisagem
 radiobutton.landscape.mnemonic=P
 radiobutton.monochrome=Monocrom\u00E1tico
@@ -76,7 +76,7 @@
 radiobutton.normalq=Normal
 radiobutton.normalq.mnemonic=N
 radiobutton.oneside=Um Lado
-radiobutton.oneside.mnemonic=O
+radiobutton.oneside.mnemonic=L
 radiobutton.portrait=Retrato
 radiobutton.portrait.mnemonic=R
 radiobutton.rangeall=Tudo
@@ -86,7 +86,7 @@
 radiobutton.revlandscape=Paisagem Invertida
 radiobutton.revlandscape.mnemonic=N
 radiobutton.revportrait=Retrato Invertido
-radiobutton.revportrait.mnemonic=I
+radiobutton.revportrait.mnemonic=E
 radiobutton.tumble=Virar
 radiobutton.tumble.mnemonic=V
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
@@ -96,7 +96,7 @@
 tab.general=Geral
 tab.general.vkMnemonic=71
 tab.pagesetup=Configura\u00E7\u00E3o de P\u00E1gina
-tab.pagesetup.vkMnemonic=80
+tab.pagesetup.vkMnemonic=67
 #
 error.pagerange=Faixa de p\u00E1ginas inv\u00E1lida; insira novamente os valores (por exemplo, 1-3,5,7-10)
 error.destination=Nome de arquivo inv\u00E1lido; tente novamente
--- a/jdk/src/share/classes/sun/swing/FilePane.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/swing/FilePane.java	Mon May 09 08:58:00 2011 -0700
@@ -763,7 +763,7 @@
 
         public void setValueAt(Object value, int row, int col) {
             if (col == COLUMN_FILENAME) {
-                JFileChooser chooser = getFileChooser();
+                final JFileChooser chooser = getFileChooser();
                 File f = (File)getValueAt(row, col);
                 if (f != null) {
                     String oldDisplayName = chooser.getName(f);
@@ -782,18 +782,25 @@
 
                         // rename
                         FileSystemView fsv = chooser.getFileSystemView();
-                        File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
+                        final File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
                         if (f2.exists()) {
                             JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText,
                                     oldFileName), renameErrorTitleText, JOptionPane.ERROR_MESSAGE);
                         } else {
                             if (FilePane.this.getModel().renameFile(f, f2)) {
                                 if (fsv.isParent(chooser.getCurrentDirectory(), f2)) {
-                                    if (chooser.isMultiSelectionEnabled()) {
-                                        chooser.setSelectedFiles(new File[]{f2});
-                                    } else {
-                                        chooser.setSelectedFile(f2);
-                                    }
+                                    // The setSelectedFile method produces a new setValueAt invocation while the JTable
+                                    // is editing. Postpone file selection to be sure that edit mode of the JTable
+                                    // is completed
+                                    SwingUtilities.invokeLater(new Runnable() {
+                                        public void run() {
+                                            if (chooser.isMultiSelectionEnabled()) {
+                                                chooser.setSelectedFiles(new File[]{f2});
+                                            } else {
+                                                chooser.setSelectedFile(f2);
+                                            }
+                                        }
+                                    });
                                 } else {
                                     // Could be because of delay in updating Desktop folder
                                     // chooser.setSelectedFile(null);
--- a/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java	Mon May 09 08:58:00 2011 -0700
@@ -29,6 +29,8 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import javax.swing.*;
 import javax.swing.border.*;
@@ -79,7 +81,12 @@
         setBackground(bgColor);
         FileSystemView fsv = fc.getFileSystemView();
 
-        files = (File[])ShellFolder.get("fileChooserShortcutPanelFolders");
+        files = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
+            public File[] run() {
+                return (File[]) ShellFolder.get("fileChooserShortcutPanelFolders");
+            }
+        });
+
         buttons = new JToggleButton[files.length];
         buttonGroup = new ButtonGroup();
         for (int i = 0; i < files.length; i++) {
--- a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c	Mon May 09 08:58:00 2011 -0700
@@ -70,7 +70,7 @@
 /* avoid extra function call in case we use fread (TVT) */
 #define READ(_gif,_buf,_len)                                     \
   (((GifFilePrivateType*)_gif->Private)->Read ?                   \
-    ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
+    (size_t)((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
     fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File))
 
 static int DGifGetWord(GifFileType *GifFile, int *Word);
--- a/jdk/src/share/native/sun/font/fontscalerdefs.h	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/native/sun/font/fontscalerdefs.h	Mon May 09 08:58:00 2011 -0700
@@ -55,13 +55,15 @@
 typedef Int32                   hsFract;
 typedef UInt32                  Bool32;
 
+#ifndef  __cplusplus
 #ifndef false
-        #define false           0
+         #define false           0
 #endif
 
 #ifndef true
         #define true            1
 #endif
+#endif
 
 #define kPosInfinity32          (0x7fffffff)
 #define kNegInfinity32          (0x80000000)
--- a/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp	Mon May 09 08:58:00 2011 -0700
@@ -162,7 +162,7 @@
         return 0;
     }
 
-    lead  = LJMO_FIRST + (sIndex / HSYL_LVCNT);
+    lead  = (LEUnicode)(LJMO_FIRST + (sIndex / HSYL_LVCNT));
     vowel = VJMO_FIRST + (sIndex % HSYL_LVCNT) / TJMO_COUNT;
     trail = TJMO_FIRST + (sIndex % TJMO_COUNT);
 
--- a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp	Mon May 09 08:58:00 2011 -0700
@@ -65,9 +65,9 @@
     }
 }
 
-void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success)
+void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& leSuccess)
 {
-    if (LE_FAILURE(success)) {
+    if (LE_FAILURE(leSuccess)) {
         return;
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Mon May 09 08:58:00 2011 -0700
@@ -1479,16 +1479,19 @@
         int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
         hsb.setValue(hsb.getValue() + x);
 
+        int options = PAINT_ITEMS | PAINT_HSCROLL;
+
         Rectangle source = null;
         Point distance = null;
         if (x < 0) {
             source = new Rectangle(MARGIN + SPACE, MARGIN, w + x, h);
             distance = new Point(-x, 0);
+            options |= COPY_AREA;
         } else if (x > 0) {
             source = new Rectangle(MARGIN + SPACE + x, MARGIN, w - x, h);
             distance = new Point(-x, 0);
+            options |= COPY_AREA;
         }
-        int options = COPY_AREA | PAINT_ITEMS | PAINT_HSCROLL;
         repaint(vsb.getValue(), lastItemDisplayed(), options, source, distance);
     }
 
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Mon May 09 08:58:00 2011 -0700
@@ -256,9 +256,9 @@
                 }
 
                 if (installedFallbackFontFiles != null) {
-                    System.arraycopy(fileNames, index,
-                                     installedFallbackFontFiles,
-                                     0, installedFallbackFontFiles.length);
+                    System.arraycopy(installedFallbackFontFiles, 0,
+                                     fileNames, fcFonts.length,
+                                     installedFallbackFontFiles.length);
                 }
 
                 result[fontIndex * NUM_STYLES + styleIndex]
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Mon May 09 08:58:00 2011 -0700
@@ -239,6 +239,13 @@
     snd_pcm_close(handle);
 }
 
+/** Workaround for cr 7033899, 7030629:
+ * dmix plugin doesn't like flush (snd_pcm_drop) when the buffer is empty
+ * (just opened, underruned or already flushed).
+ * Sometimes it causes PCM falls to -EBADFD error,
+ * sometimes causes bufferSize change.
+ * To prevent unnecessary flushes AlsaPcmInfo::isRunning & isFlushed are used.
+ */
 /* ******* ALSA PCM INFO ******************** */
 typedef struct tag_AlsaPcmInfo {
     snd_pcm_t* handle;
@@ -248,6 +255,8 @@
     int frameSize; // storage size in Bytes
     unsigned int periods;
     snd_pcm_uframes_t periodSize;
+    short int isRunning;    // see comment above
+    short int isFlushed;    // see comment above
 #ifdef GET_POSITION_METHOD2
     // to be used exclusively by getBytePosition!
     snd_pcm_status_t* positionStatus;
@@ -432,6 +441,9 @@
         return NULL;
     }
     memset(info, 0, sizeof(AlsaPcmInfo));
+    // initial values are: stopped, flushed
+    info->isRunning = 0;
+    info->isFlushed = 1;
 
     ret = openPCMfromDeviceID(deviceID, &(info->handle), isSource, FALSE /* do open device*/);
     if (ret == 0) {
@@ -587,6 +599,14 @@
         || (state == SND_PCM_STATE_RUNNING)
         || (state == SND_PCM_STATE_XRUN)
         || (state == SND_PCM_STATE_SUSPENDED);
+    if (ret) {
+        info->isRunning = 1;
+        // source line should keep isFlushed value until Write() is called;
+        // for target data line reset it right now.
+        if (!isSource) {
+            info->isFlushed = 0;
+        }
+    }
     TRACE1("< DAUDIO_Start %s\n", ret?"success":"error");
     return ret?TRUE:FALSE;
 }
@@ -606,6 +626,7 @@
         ERROR1("ERROR in snd_pcm_pause: %s\n", snd_strerror(ret));
         return FALSE;
     }
+    info->isRunning = 0;
     TRACE0("< DAUDIO_Stop success\n");
     return TRUE;
 }
@@ -651,8 +672,7 @@
             return -1;
         }
         return 1;
-    }
-    else if (err == -ESTRPIPE) {
+    } else if (err == -ESTRPIPE) {
         TRACE0("xrun_recovery: suspended.\n");
         ret = snd_pcm_resume(info->handle);
         if (ret < 0) {
@@ -667,11 +687,11 @@
             return -1;
         }
         return 1;
-    }
-    else if (err == -EAGAIN) {
+    } else if (err == -EAGAIN) {
         TRACE0("xrun_recovery: EAGAIN try again flag.\n");
         return 0;
     }
+
     TRACE2("xrun_recovery: unexpected error %d: %s\n", err, snd_strerror(err));
     return -1;
 }
@@ -691,6 +711,7 @@
         TRACE0("< DAUDIO_Write returning -1\n");
         return -1;
     }
+
     count = 2; // maximum number of trials to recover from underrun
     //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
     frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
@@ -712,6 +733,12 @@
         }
     } while (TRUE);
     //ret =  snd_pcm_frames_to_bytes(info->handle, writtenFrames);
+
+    if (writtenFrames > 0) {
+        // reset "flushed" flag
+        info->isFlushed = 0;
+    }
+
     ret =  (int) (writtenFrames * info->frameSize);
     TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret);
     return ret;
@@ -736,6 +763,11 @@
         TRACE0("< DAUDIO_Read returning -1\n");
         return -1;
     }
+    if (!info->isRunning && info->isFlushed) {
+        // PCM has nothing to read
+        return 0;
+    }
+
     count = 2; // maximum number of trials to recover from error
     //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
     frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
@@ -784,12 +816,22 @@
     int ret;
 
     TRACE0("DAUDIO_Flush\n");
+
+    if (info->isFlushed) {
+        // nothing to drop
+        return 1;
+    }
+
     ret = snd_pcm_drop(info->handle);
     if (ret != 0) {
         ERROR1("ERROR in snd_pcm_drop: %s\n", snd_strerror(ret));
         return FALSE;
     }
-    ret = DAUDIO_Start(id, isSource);
+
+    info->isFlushed = 1;
+    if (info->isRunning) {
+        ret = DAUDIO_Start(id, isSource);
+    }
     return ret;
 }
 
@@ -800,7 +842,7 @@
     int ret;
 
     state = snd_pcm_state(info->handle);
-    if (state == SND_PCM_STATE_XRUN) {
+    if (info->isFlushed || state == SND_PCM_STATE_XRUN) {
         // if in xrun state then we have the entire buffer available,
         // not 0 as alsa reports
         ret = info->bufferSizeInBytes;
@@ -841,7 +883,7 @@
     snd_pcm_state_t state;
     state = snd_pcm_state(info->handle);
 
-    if (state != SND_PCM_STATE_XRUN) {
+    if (!info->isFlushed && state != SND_PCM_STATE_XRUN) {
 #ifdef GET_POSITION_METHOD2
         snd_timestamp_t* ts;
         snd_pcm_uframes_t framesAvail;
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Mon May 09 08:58:00 2011 -0700
@@ -1107,7 +1107,8 @@
     arrlen = (*env)->GetArrayLength(env, fcCompFontArray);
     for (i=0; i<arrlen; i++) {
         FcFontSet* fontset;
-        int fn, j, fontCount, nfonts, minGlyphs;
+        int fn, j, fontCount, nfonts;
+        unsigned int minGlyphs;
         FcChar8 **family, **styleStr, **fullname, **file;
         jarray fcFontArr;
 
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Mon May 09 08:58:00 2011 -0700
@@ -830,7 +830,14 @@
         if( -1 == iStartOffset ){
             throw new IOException(FAILURE_MSG + "invalid HTML format.");
         }
-        iReadCount = bufferedStream.skip(iStartOffset);
+
+        int curOffset = 0;
+        while (curOffset < iStartOffset){
+            curOffset += bufferedStream.skip(iStartOffset - curOffset);
+        }
+
+        iReadCount = curOffset;
+
         if( iStartOffset != iReadCount ){
             throw new IOException(FAILURE_MSG + "Byte stream ends in description.");
         }
--- a/jdk/src/windows/native/sun/font/fontpath.c	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/font/fontpath.c	Mon May 09 08:58:00 2011 -0700
@@ -235,7 +235,7 @@
     }
 
     fullname = (*env)->NewString(env, lpelfe->elfFullName,
-                                 wcslen((LPWSTR)lpelfe->elfFullName));
+                                 (jsize)wcslen((LPWSTR)lpelfe->elfFullName));
     fullnameLC = (*env)->CallObjectMethod(env, fullname,
                                           fmi->toLowerCaseMID, fmi->locale);
     (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
@@ -314,7 +314,7 @@
     GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam;
     JNIEnv *env = fmi->env;
     jstring familyLC;
-    int slen;
+    size_t slen;
     LOGFONTW lfw;
 
     /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
@@ -336,7 +336,7 @@
             return 1;
     }
     slen = wcslen(lpelfe->elfLogFont.lfFaceName);
-    fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, slen);
+    fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, (jsize)slen);
     familyLC = (*env)->CallObjectMethod(env, fmi->family,
                                         fmi->toLowerCaseMID, fmi->locale);
     /* check if already seen this family with a different charset */
@@ -386,10 +386,10 @@
 static BOOL RegistryToBaseTTNameA(LPSTR name) {
     static const char TTSUFFIX[] = " (TrueType)";
     static const char OTSUFFIX[] = " (OpenType)";
-    int TTSLEN = strlen(TTSUFFIX);
+    size_t TTSLEN = strlen(TTSUFFIX);
     char *suffix;
 
-    int len = strlen(name);
+    size_t len = strlen(name);
     if (len == 0) {
         return FALSE;
     }
@@ -412,10 +412,10 @@
 static BOOL RegistryToBaseTTNameW(LPWSTR name) {
     static const wchar_t TTSUFFIX[] = L" (TrueType)";
     static const wchar_t OTSUFFIX[] = L" (OpenType)";
-    int TTSLEN = wcslen(TTSUFFIX);
+    size_t TTSLEN = wcslen(TTSUFFIX);
     wchar_t *suffix;
 
-    int len = wcslen(name);
+    size_t len = wcslen(name);
     if (len == 0) {
         return FALSE;
     }
@@ -439,7 +439,7 @@
     LPSTR ptr1, ptr2;
     jstring fontStr;
     JNIEnv *env = fmi->env;
-    int dslen = strlen(data);
+    size_t dslen = strlen(data);
     jstring fileStr = JNU_NewStringPlatform(env, data);
 
     /* TTC or ttc means it may be a collection. Need to parse out
@@ -488,8 +488,8 @@
     wchar_t *ptr1, *ptr2;
     jstring fontStr;
     JNIEnv *env = fmi->env;
-    int dslen = wcslen(data);
-    jstring fileStr = (*env)->NewString(env, data, dslen);
+    size_t dslen = wcslen(data);
+    jstring fileStr = (*env)->NewString(env, data, (jsize)dslen);
 
     /* TTC or ttc means it may be a collection. Need to parse out
      * multiple font face names separated by " & "
@@ -510,7 +510,7 @@
             while ((ptr2 = wcsstr(ptr1, L" & ")) != NULL) {
                 ptr1 = ptr2+3;
             }
-            fontStr = (*env)->NewString(env, ptr1, wcslen(ptr1));
+            fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1));
             fontStr = (*env)->CallObjectMethod(env, fontStr,
                                                fmi->toLowerCaseMID,
                                                fmi->locale);
@@ -524,7 +524,7 @@
             }
         }
     } else {
-        fontStr = (*env)->NewString(env, name, wcslen(name));
+        fontStr = (*env)->NewString(env, name, (jsize)wcslen(name));
         fontStr = (*env)->CallObjectMethod(env, fontStr,
                                            fmi->toLowerCaseMID, fmi->locale);
         (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Mon May 09 08:58:00 2011 -0700
@@ -187,6 +187,7 @@
     }
 
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+    RETURN_IF_NULL(env);
 
     pMgr = D3DPipelineManager::GetInstance();
     RETURN_IF_NULL(pMgr);
--- a/jdk/src/windows/native/sun/security/mscapi/security.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp	Mon May 09 08:58:00 2011 -0700
@@ -705,7 +705,7 @@
     HCRYPTPROV hCryptProv = NULL;
     HCRYPTKEY hKeyPair;
     DWORD dwFlags = (keySize << 16) | CRYPT_EXPORTABLE;
-    jobject keypair;
+    jobject keypair = NULL;
     const char* pszKeyContainerName = NULL; // UUID
 
     __try
--- a/jdk/src/windows/native/sun/windows/ObjectList.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ObjectList.cpp	Mon May 09 08:58:00 2011 -0700
@@ -48,7 +48,7 @@
     m_head = item;
 }
 
-void AwtObjectList::Remove(AwtObject* obj)
+BOOL AwtObjectList::Remove(AwtObject* obj)
 {
     CriticalSection::Lock l(m_lock);
 
@@ -64,11 +64,14 @@
             }
             DASSERT(item != NULL);
             delete item;
-            return;
+            return TRUE;
         }
         lastItem = item;
         item = item->next;
     }
+
+    return FALSE;
+
 //    DASSERT(FALSE);  // should never get here...
                       // even if it does it shouldn't be fatal.
 }
--- a/jdk/src/windows/native/sun/windows/ObjectList.h	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ObjectList.h	Mon May 09 08:58:00 2011 -0700
@@ -46,7 +46,7 @@
     AwtObjectList();
 
     void Add(AwtObject* obj);
-    void Remove(AwtObject* obj);
+    BOOL Remove(AwtObject* obj);
 #ifdef DEBUG
     /* Used for sanity checks only. */
     AwtObject* LookUp(AwtObject* obj);
--- a/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp	Mon May 09 08:58:00 2011 -0700
@@ -294,7 +294,7 @@
     if (format == CF_HDROP) {
         DROPFILES *dropfiles = (DROPFILES *)dataout;
         dropfiles->pFiles = sizeof(DROPFILES);
-        dropfiles->fWide = FALSE; // good guess!
+        dropfiles->fWide = TRUE; // we publish only Unicode
         dataout += sizeof(DROPFILES);
     }
 
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Mon May 09 08:58:00 2011 -0700
@@ -549,8 +549,6 @@
 
     m_hwnd = hwnd;
 
-    ImmAssociateContext(NULL);
-
     SetDrawState((jint)JAWT_LOCK_SURFACE_CHANGED |
         (jint)JAWT_LOCK_BOUNDS_CHANGED |
         (jint)JAWT_LOCK_CLIP_CHANGED);
@@ -1203,7 +1201,7 @@
         WIN_MSG(WM_IME_COMPOSITIONFULL)
         WIN_MSG(WM_IME_SELECT)
         WIN_MSG(WM_IME_CHAR)
-        FMT_MSG(0x0288, "WM_IME_REQUEST")
+        FMT_MSG(WM_IME_REQUEST)
         WIN_MSG(WM_IME_KEYDOWN)
         WIN_MSG(WM_IME_KEYUP)
         FMT_MSG(0x02A1, "WM_MOUSEHOVER")
@@ -1733,7 +1731,7 @@
       case WM_IME_SELECT:
       case WM_IME_KEYUP:
       case WM_IME_KEYDOWN:
-      case 0x0288: // WM_IME_REQUEST
+      case WM_IME_REQUEST:
           CallProxyDefWindowProc(message, wParam, lParam, retValue, mr);
           break;
       case WM_CHAR:
@@ -1969,7 +1967,9 @@
 {
     // fix for 6259348: we should enter the SyncCall critical section before
     // disposing the native object, that is value 1 of lParam is intended for
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)this, (LPARAM)1);
+    if(m_peerObject != NULL) { // is not being terminating
+        AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)m_peerObject, (LPARAM)1);
+    }
 
     return mrConsume;
 }
@@ -2020,25 +2020,6 @@
 
 MsgRouting AwtComponent::WmShowWindow(BOOL show, UINT status)
 {
-    // NULL-InputContext is associated to all window just after they created.
-    // ( see CreateHWnd() )
-    // But to TextField and TextArea on Win95, valid InputContext is associated
-    // by system after that. This is not happen on NT4.0
-    // For workaround, force context to NULL here.
-
-    // Fix for 4730228
-    // Check if we already have Java-associated input method
-    HIMC context = 0;
-    if (m_InputMethod != NULL) {
-        // If so get the appropriate context from it and use it instead of empty context
-        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-        context = (HIMC)(UINT_PTR)(JNU_GetFieldByName(env, NULL, m_InputMethod, "context", "I").i);
-    }
-
-    if (ImmGetContext() != 0 && ImmGetContext() != context) {
-        ImmAssociateContext(context);
-    }
-
     return mrDoDefault;
 }
 
@@ -4655,10 +4636,6 @@
 ret:
     if (c && ::IsWindow(c->GetHWnd())) {
         sm_focusOwner = c->GetHWnd();
-        AwtFrame *owner = (AwtFrame*)GetComponent(c->GetProxyToplevelContainer());
-        if (owner) {
-            owner->SetLastProxiedFocusOwner(sm_focusOwner);
-        }
     } else {
         sm_focusOwner = NULL;
     }
@@ -6534,8 +6511,7 @@
 {
     TRY_NO_HANG;
 
-    PDATA pData = JNI_GET_PDATA(self);
-    AwtObject::_Dispose(pData);
+    AwtObject::_Dispose(self);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Mon May 09 08:58:00 2011 -0700
@@ -843,7 +843,7 @@
             dropfiles->pt.x = m_dropPoint.x;
             dropfiles->pt.y = m_dropPoint.y;
             dropfiles->fNC = m_fNC;
-            dropfiles->fWide = TRUE; // good guess!
+            dropfiles->fWide = TRUE; // we publish only Unicode
             dataout += sizeof(DROPFILES);
         }
 
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Mon May 09 08:58:00 2011 -0700
@@ -109,7 +109,7 @@
     m_isMenuDropped = FALSE;
     m_isInputMethodWindow = FALSE;
     m_isUndecorated = FALSE;
-    m_lastProxiedFocusOwner = NULL;
+    m_imeTargetComponent = NULL;
     m_actualFocusedWindow = NULL;
     m_iconic = FALSE;
     m_zoomed = FALSE;
@@ -311,6 +311,8 @@
     LRESULT retValue = 0L;
 
     AwtComponent *focusOwner = NULL;
+    AwtComponent *imeTargetComponent = NULL;
+
     // IME and input language related messages need to be sent to a window
     // which has the Java input focus
     switch (message) {
@@ -323,15 +325,29 @@
         case WM_IME_COMPOSITIONFULL:
         case WM_IME_SELECT:
         case WM_IME_CHAR:
-        case 0x0288: // WM_IME_REQUEST
+        case WM_IME_REQUEST:
         case WM_IME_KEYDOWN:
         case WM_IME_KEYUP:
         case WM_INPUTLANGCHANGEREQUEST:
         case WM_INPUTLANGCHANGE:
+            if (message == WM_IME_STARTCOMPOSITION) {
+                SetImeTargetComponent(sm_focusOwner);
+            }
+            imeTargetComponent = AwtComponent::GetComponent(GetImeTargetComponent());
+            if (imeTargetComponent != NULL &&
+                imeTargetComponent != this) // avoid recursive calls
+            {
+                retValue = imeTargetComponent->WindowProc(message, wParam, lParam);
+                mr = mrConsume;
+            }
+            if (message == WM_IME_ENDCOMPOSITION) {
+                SetImeTargetComponent(NULL);
+            }
+            break;
         // TODO: when a Choice's list is dropped down and we're scrolling in
         // the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
         case WM_MOUSEWHEEL:
-            focusOwner = AwtComponent::GetComponent(GetLastProxiedFocusOwner());
+            focusOwner = AwtComponent::GetComponent(sm_focusOwner);
             if  (focusOwner != NULL &&
                  focusOwner != this) // avoid recursive calls
             {
@@ -340,12 +356,16 @@
             }
             break;
         case WM_SETFOCUS:
+            if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
+
             if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
                 AwtSetActiveWindow();
             }
             mr = mrConsume;
             break;
         case WM_KILLFOCUS:
+            if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
+
             if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
                 AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
 
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h	Mon May 09 08:58:00 2011 -0700
@@ -150,8 +150,8 @@
     void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd);
     BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd);
 
-    INLINE HWND GetLastProxiedFocusOwner() { return m_lastProxiedFocusOwner; }
-    INLINE void SetLastProxiedFocusOwner(HWND hwnd) { m_lastProxiedFocusOwner = hwnd; }
+    INLINE HWND GetImeTargetComponent() { return m_imeTargetComponent; }
+    INLINE void SetImeTargetComponent(HWND hwnd) { m_imeTargetComponent = hwnd; }
 
 protected:
     /* The frame is undecorated. */
@@ -179,9 +179,8 @@
     /* The frame is an InputMethodWindow */
     BOOL m_isInputMethodWindow;
 
-    /* Retains the last/current sm_focusOwner proxied. Actually, it should be
-     * a component of an owned window last/currently active. */
-    HWND m_lastProxiedFocusOwner;
+    // retains the target component for the IME messages
+    HWND m_imeTargetComponent;
 
     /*
      * Fix for 4823903.
--- a/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp	Mon May 09 08:58:00 2011 -0700
@@ -974,8 +974,7 @@
 {
     TRY_NO_HANG;
 
-    PDATA pData = JNI_GET_PDATA(self);
-    AwtObject::_Dispose(pData);
+    AwtObject::_Dispose(self);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_Object.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Object.cpp	Mon May 09 08:58:00 2011 -0700
@@ -60,11 +60,20 @@
 
 void AwtObject::Dispose()
 {
-    theAwtObjectList.Remove(this);
+    AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0);
+}
+
+void AwtObject::_Dispose(jobject self)
+{
+    TRY_NO_VERIFY;
+
+    CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
 
     // value 0 of lParam means that we should not attempt to enter the
     // SyncCall critical section, as it was entered someshere earlier
-    AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0);
+    AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)self, (LPARAM)0);
+
+    CATCH_BAD_ALLOC;
 }
 
 void AwtObject::_Dispose(PDATA pData)
@@ -73,14 +82,10 @@
 
     CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
 
-    if (pData != NULL) {
-        AwtObject *o = (AwtObject *)pData;
-        AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)o, (LPARAM)0);
-    }
+    AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSEPDATA, (WPARAM)pData, (LPARAM)0);
 
     CATCH_BAD_ALLOC;
 }
-
 /*
  * Return the peer associated with some target.  This information is
  * maintained in a hashtable at the java level.
--- a/jdk/src/windows/native/sun/windows/awt_Object.h	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Object.h	Mon May 09 08:58:00 2011 -0700
@@ -67,6 +67,10 @@
     virtual void Dispose();
 
     // Static method to be called from JNI methods to dispose AwtObject
+    // specified by jobject
+    static void _Dispose(jobject self);
+
+    // Static method to be called from JNI methods to dispose AwtObject
     // specified by pData
     static void _Dispose(PDATA pData);
 
--- a/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Mon May 09 08:58:00 2011 -0700
@@ -353,8 +353,7 @@
 {
     TRY_NO_VERIFY;
 
-    PDATA pData = JNI_GET_PDATA(self);
-    AwtObject::_Dispose(pData);
+    AwtObject::_Dispose(self);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp	Mon May 09 08:58:00 2011 -0700
@@ -191,8 +191,11 @@
 {
     HIMC hIMC = ImmGetContext();
     // rc is not used for text component.
-    COMPOSITIONFORM cf = { CFS_POINT, {0,0}, {0,0,0,0} };
+    COMPOSITIONFORM cf = { CFS_FORCE_POSITION, {0,0}, {0,0,0,0} };
     GetCaretPos(&(cf.ptCurrentPos));
+    // the proxy is the native focus owner and it contains the composition window
+    // let's convert the position to a coordinate space relative to proxy
+    ::MapWindowPoints(GetHWnd(), GetProxyFocusOwner(), (LPPOINT)&cf.ptCurrentPos, 1);
     ImmSetCompositionWindow(hIMC, &cf);
 
     LOGFONT lf;
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Mon May 09 08:58:00 2011 -0700
@@ -740,18 +740,34 @@
               canDispose = syncCS.TryEnter();
           }
           if (canDispose) {
-              AwtObject *o = (AwtObject *)wParam;
-              o->Dispose();
-              if (shouldEnterCriticalSection) {
-                  syncCS.Leave();
+              if(wParam != NULL) {
+                  AwtObject *o = (AwtObject *) JNI_GET_PDATA((jobject)wParam);
+                  if(o != NULL && theAwtObjectList.Remove(o)) {
+                      o->Dispose();
+                  }
+                  if (shouldEnterCriticalSection) {
+                      syncCS.Leave();
+                  }
               }
           } else {
               AwtToolkit::GetInstance().PostMessage(WM_AWT_DISPOSE, wParam, lParam);
           }
           return 0;
       }
+      case WM_AWT_DISPOSEPDATA: {
+          /*
+           * NOTE: synchronization routine (like in WM_AWT_DISPOSE) was omitted because
+           * this handler is called ONLY while disposing Cursor and Font objects where
+           * synchronization takes place.
+           */
+          AwtObject *o = (AwtObject *) wParam;
+          if(o != NULL && theAwtObjectList.Remove(o)) {
+              o->Dispose();
+          }
+          return 0;
+      }
       case WM_AWT_DELETEOBJECT: {
-          AwtObject *p = (AwtObject *)wParam;
+          AwtObject *p = (AwtObject *) wParam;
           if (p->CanBeDeleted()) {
               // all the messages for this component are processed, so
               // it can be deleted
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Mon May 09 08:58:00 2011 -0700
@@ -926,8 +926,7 @@
 {
     TRY;
 
-    PDATA pData = JNI_GET_PDATA(self);
-    AwtObject::_Dispose(pData);
+    AwtObject::_Dispose(self);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awtmsg.h	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awtmsg.h	Mon May 09 08:58:00 2011 -0700
@@ -219,6 +219,7 @@
 
     WM_AWT_ENDCOMPOSITION,
     WM_AWT_DISPOSE,
+    WM_AWT_DISPOSEPDATA,
     WM_AWT_DELETEOBJECT,
     WM_AWT_SETCONVERSIONSTATUS,
     WM_AWT_GETCONVERSIONSTATUS,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Revalidate/Revalidate.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,122 @@
+/*
+ * 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 7036669
+  @summary Test Component.revalidate() method
+  @author anthony.petrov@oracle.com: area=awt.component
+  @run main Revalidate
+*/
+
+import java.awt.*;
+
+public class Revalidate {
+    private static Frame frame = new Frame();
+    private static Panel panel = new Panel() {
+        @Override
+        public boolean isValidateRoot() {
+            return true;
+        }
+    };
+    private static Button button = new Button("Test");
+
+    private static void sleep() {
+        try { Thread.sleep(500); } catch (Exception e) {}
+    }
+
+    private static void printState(String str) {
+        System.out.println(str + " isValid state: ");
+        System.out.println("         frame: " + frame.isValid());
+        System.out.println("         panel: " + panel.isValid());
+        System.out.println("        button: " + button.isValid());
+    }
+
+    private static void fail(String msg) {
+        frame.dispose();
+        throw new RuntimeException(msg);
+    }
+
+    private static void check(String n, Component c, boolean v) {
+        if (c.isValid() != v) {
+            fail(n + ".isValid() = " + c.isValid() + ";   expected: " + v);
+        }
+    }
+    private static void check(String str, boolean f, boolean p, boolean b) {
+        printState(str);
+
+        check("frame", frame, f);
+        check("panel", panel, p);
+        check("button", button, b);
+    }
+
+    public static void main(String[] args) {
+        // setup
+        frame.add(panel);
+        panel.add(button);
+        frame.setBounds(200, 200, 300, 200);
+        frame.setVisible(true);
+        sleep();
+        check("Upon showing", true, true, true);
+
+        button.setBounds(1, 1, 30, 30);
+        sleep();
+        check("button.setBounds():", true, false, false);
+
+        button.revalidate();
+        sleep();
+        check("button.revalidate():", true, true, true);
+
+        button.setBounds(1, 1, 30, 30);
+        sleep();
+        check("button.setBounds():", true, false, false);
+
+        panel.revalidate();
+        sleep();
+        // because the panel's validate root is actually OK
+        check("panel.revalidate():", true, false, false);
+
+        button.revalidate();
+        sleep();
+        check("button.revalidate():", true, true, true);
+
+        panel.setBounds(2, 2, 125, 130);
+        sleep();
+        check("panel.setBounds():", false, false, true);
+
+        button.revalidate();
+        sleep();
+        check("button.revalidate():", false, true, true);
+
+        panel.setBounds(3, 3, 152, 121);
+        sleep();
+        check("panel.setBounds():", false, false, true);
+
+        panel.revalidate();
+        sleep();
+        check("panel.revalidate():", true, true, true);
+
+        // cleanup
+        frame.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/MTGraphicsAccessTest/MTGraphicsAccessTest.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,361 @@
+/*
+ * 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 5089429 6982632
+  @summary Checks that we don't crash if rendering operations and state
+  changes are performed on a graphics context from different threads.
+
+  @author Dmitri.Trembovetski@sun.com area=Graphics
+  @run main MTGraphicsAccessTest
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import java.awt.geom.*;
+
+public class MTGraphicsAccessTest {
+
+    // in seconds
+    static final long STANDALONE_RUN_TIME = 20;
+    static final long JTREG_RUN_TIME = 7;
+
+    static boolean standaloneMode;
+    static boolean allowExceptions = true;
+    static long testRunTime;
+
+    volatile boolean done;
+    volatile int stillRunning;
+    volatile int numexceptions;
+
+    Graphics2D sharedGraphics;
+    BufferedImage sharedBI =
+            new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
+
+    static final Paint colors[] = {
+        Color.red,
+        new Color(0x7f, 0xff, 0x00, 0x7f),
+        new GradientPaint(0,  0, Color.red,
+                          50, 50, new Color(0x7f, 0xff, 0x00, 0x7f)),
+    };
+    static final Font fonts[] = {
+        new Font("Dialog", Font.PLAIN, 12),
+        new Font("Dialog", Font.BOLD, 16),
+        new Font("Dialog", Font.ITALIC, 18),
+    };
+    static final AlphaComposite comps[] = {
+        AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f),
+        AlphaComposite.Src,
+        AlphaComposite.Xor,
+        AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f),
+        null,
+    };
+    static final Stroke strokes[] = {
+        new BasicStroke(),
+        new BasicStroke(0.0f),
+        new BasicStroke(2.0f),
+        new BasicStroke(2.0f, BasicStroke.CAP_ROUND,
+                        BasicStroke.JOIN_BEVEL),
+        new BasicStroke(5.0f, BasicStroke.CAP_SQUARE,
+                        BasicStroke.JOIN_ROUND),
+        new BasicStroke(0.0f, BasicStroke.CAP_ROUND,
+                        BasicStroke.JOIN_ROUND, 0,
+                        new float[]{0,6,0,6}, 0),
+    };
+    static final AffineTransform transforms[] = {
+        new AffineTransform(),
+        AffineTransform.getRotateInstance(10.0),
+        AffineTransform.getShearInstance(10.0, 4.0),
+        AffineTransform.getScaleInstance(1.1, 1.2),
+        AffineTransform.getScaleInstance(3.0, 2.0),
+    };
+
+    public MTGraphicsAccessTest() {
+        BufferedImage bi =
+            new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
+        sharedGraphics = (Graphics2D)bi.getGraphics();
+
+        done = false;
+        numexceptions = 0;
+
+        for (int i = 0; i < (standaloneMode ? stateChangers.length : 3); i++) {
+            (new TesterThread(stateChangers[i])).start();
+        }
+        for (int i = 0; i < (standaloneMode ? renderTests.length : 5); i++) {
+            (new TesterThread(renderTests[i])).start();
+        }
+
+        mysleep(testRunTime);
+        done = true;
+        while (stillRunning > 0) { mysleep(500); }
+
+        if (numexceptions == 0) {
+            System.err.println("Test passed");
+        } else if (!allowExceptions) {
+            throw new RuntimeException("Test failed with "+
+                                       numexceptions+" exceptions");
+        } else {
+            System.err.println("Test finished with "+
+                               numexceptions+" exceptions");
+        }
+    }
+
+    private void mysleep(long time) {
+        try {
+            // add +/-5ms variance to increase randomness
+            Thread.sleep(time + (long)(5 - Math.random()*10));
+        } catch (InterruptedException e) {};
+    }
+
+    public static void usage(String message) {
+        if (message != null) {
+            System.err.println(message);
+        }
+        System.err.println("Usage: MTGraphicsAccessTest [-full] "+
+            "[-time N/forever] [-help]");
+        System.err.println(" -full: run full suite of tests "+
+            "(default: limited number of tests is run)");
+        System.err.println(" -time N: test duration in seconds/forever"+
+            " (default: "+JTREG_RUN_TIME+"s for the short suite, "+
+            STANDALONE_RUN_TIME+"s for the full suite)");
+        System.err.println(" -help: print this help page");
+        System.exit(1);
+    }
+
+    public static void main(String[] args) {
+        boolean testRunSet = false;
+        for (int i = 0; i < args.length; i++) {
+            if ("-full".equals(args[i])) {
+                standaloneMode = true;
+                System.err.println("Running complete list of tests");
+            } else if ("-noexc".equals(args[i])) {
+                allowExceptions = false;
+            } else if ("-time".equals(args[i])) {
+                try {
+                    String time = args[++i];
+                    if ("forever".equals(time)) {
+                        testRunTime = (Long.MAX_VALUE - 20)/1000;
+                    } else {
+                        testRunTime = 1000*Integer.parseInt(time);
+                    }
+                    testRunSet = true;
+                } catch (NumberFormatException e) {
+                    usage("Can't parse number of seconds: " + args[i]);
+                } catch (ArrayIndexOutOfBoundsException e1) {
+                    usage("Missing the 'seconds' argument for -time parameter");
+                }
+            } else if ("-help".equals(args[i])) {
+                usage(null);
+            } else {
+                usage("Unknown argument:" + args[i]);
+            }
+        }
+
+        if (!testRunSet) {
+            testRunTime = 1000 *
+                (standaloneMode ? STANDALONE_RUN_TIME : JTREG_RUN_TIME);
+        }
+
+        System.err.println("Approximate test run time: "+
+             testRunTime/1000+" seconds");
+
+        new MTGraphicsAccessTest();
+    }
+
+    class TesterThread extends Thread {
+        Runnable testRunnable;
+
+        public TesterThread(Runnable testRunnable) {
+            stillRunning++;
+            this.testRunnable = testRunnable;
+        }
+
+        public void run() {
+            try {
+                while (!done) {
+                    try {
+                        testRunnable.run();
+                        yield();
+                    } catch (Throwable t) {
+                        numexceptions++;
+                        t.printStackTrace();
+                    }
+                }
+            } finally {
+                stillRunning--;
+            }
+        }
+    }
+
+    final Runnable stateChangers[] = {
+        new Runnable() {
+            public void run() {
+                sharedGraphics.setClip(10, 10, 30, 30);
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.setClip(10, 10, 30, 30);
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            int c = 0;
+            public void run() {
+                sharedGraphics.setPaint(colors[c++ % colors.length]);
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            boolean AA = false;
+            public void run() {
+                if (AA) {
+                    sharedGraphics.setRenderingHint(
+                        RenderingHints.KEY_ANTIALIASING,
+                        RenderingHints.VALUE_ANTIALIAS_ON);
+                } else {
+                    sharedGraphics.setRenderingHint(
+                        RenderingHints.KEY_ANTIALIASING,
+                        RenderingHints.VALUE_ANTIALIAS_OFF);
+                }
+                AA = !AA;
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            int t = 0;
+            public void run() {
+                sharedGraphics.setTransform(
+                    transforms[t++ % transforms.length]);
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            int c = 0;
+            public void run() {
+                AlphaComposite comp = comps[c++ % comps.length];
+                if (comp == null) {
+                    sharedGraphics.setXORMode(Color.green);
+                } else {
+                    sharedGraphics.setComposite(comp);
+                }
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            int s = 0;
+            public void run() {
+                sharedGraphics.setStroke(strokes[s++ % strokes.length]);
+                mysleep(10);
+            }
+        },
+        new Runnable() {
+            int f = 0;
+            public void run() {
+                sharedGraphics.setFont(fonts[f++ % fonts.length]);
+                mysleep(10);
+            }
+        },
+    };
+
+    final Runnable renderTests[] = {
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawLine(10, 10, 30, 30);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawLine(10, 10, 30, 30);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawRect(10, 10, 30, 30);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.fillRect(10, 10, 30, 30);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawString("Stuff", 10, 10);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.draw3DRect(10, 10, 30, 30, true);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawImage(sharedBI, 10, 10, null);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.fill3DRect(10, 10, 30, 30, false);
+            }
+        },
+        // REMIND: copyArea doesn't work when transform is set..
+        //          new Runnable() {
+        //              public void run() {
+        //                  sharedGraphics.copyArea(10, 10, 30, 30, 20, 20);
+        //              }
+        //          },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawRoundRect(10, 10, 30, 30, 20, 20);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.fillRoundRect(10, 10, 30, 30, 20, 20);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawArc(10, 10, 30, 30, 0, 90);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.fillArc(10, 10, 30, 30, 0, 90);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.drawOval(10, 10, 30, 30);
+            }
+        },
+        new Runnable() {
+            public void run() {
+                sharedGraphics.fillOval(10, 10, 30, 30);
+            }
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,84 @@
+/*
+ * 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 7036733
+  @summary Regression : NullPointerException when scrolling horizontally on AWT List
+  @author Andrei Dmitriev area=awt-list
+  @library ../../regtesthelpers
+  @build Util
+  @run main ScrollOut
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import sun.awt.SunToolkit;
+import test.java.awt.regtesthelpers.Util;
+
+public class ScrollOut
+{
+    public static final void main(String args[])
+    {
+        final Frame frame = new Frame();
+        final List list = new List();
+        Robot robot = null;
+
+        for (int i = 0; i < 5; i++){
+            list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+        }
+
+        frame.add(list);
+
+        frame.pack();
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+        try{
+            robot = new Robot();
+        }catch(AWTException e){
+            throw new RuntimeException(e);
+        }
+
+        //Drag from center to the outside on left
+        Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
+                               list.getLocationOnScreen().y + list.getHeight()/2);
+        Point to = new Point(list.getLocationOnScreen().x - 30,
+                             from.y);
+
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
+
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+        //Drag from center to the outside on up
+        to = new Point(from.x,
+                       list.getLocationOnScreen().y - 50);
+
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
+
+    }//End  init()
+}
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -50,6 +50,11 @@
 public class InfiniteRecursion {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
+
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -96,8 +101,10 @@
 
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -50,6 +50,9 @@
 public class InfiniteRecursion_1 {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -95,8 +98,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -56,6 +56,9 @@
 public class InfiniteRecursion_2 extends Applet {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public void init()
@@ -107,8 +110,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }// start()
 }
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -50,6 +50,9 @@
 public class InfiniteRecursion_3 extends Applet {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public void init()
@@ -91,8 +94,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }// start()
 }
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java	Mon May 09 08:58:00 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -47,6 +47,8 @@
 public class InfiniteRecursion_4 {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions over a single frame without any siblings
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2;
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -80,8 +82,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,61 @@
+/*
+ * 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 6799551
+  @library ../../regtesthelpers
+  @build Util Sysout
+  @summary Extended key codes for small letters undefined
+  @author Andrei Dmitriev: area=awt.keyboard
+  @run main EqualKeyCode
+*/
+
+
+import sun.awt.*;
+import java.awt.*;
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class EqualKeyCode {
+
+    final static String LETTERS = "abcdefghijklmnopqrstuvwxyz";
+
+    public static void main(String []s) {
+        for (int i = 0; i < LETTERS.length(); i++){
+            char cSmall = LETTERS.charAt(i);
+            char cLarge = Character.toUpperCase(cSmall);
+
+            int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
+            int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+
+            System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
+            System.out.println(" " + cLarge + " : " + iLarge);
+            if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
+                ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+            {
+                throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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 7036025
+   @summary java.security.AccessControlException when creating JFileChooser in signed applet
+   @author Pavel Porvatov
+   @run main/othervm/policy=security.policy bug7036025
+*/
+
+import javax.swing.*;
+import java.io.File;
+
+public class bug7036025 {
+    public static final String DIR = "c:/temp";
+
+    public static void main(String[] args) throws Exception {
+        String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
+
+        if (!systemLookAndFeelClassName.toLowerCase().contains("windows")) {
+            System.out.println("The test is only for Windows OS.");
+
+            return;
+        }
+
+        File file = new File(DIR);
+
+        if (!file.exists()) {
+            if (!file.mkdir()) {
+                throw new RuntimeException("Cannot create " + DIR);
+            }
+
+            file.deleteOnExit();
+        }
+
+        UIManager.setLookAndFeel(systemLookAndFeelClassName);
+
+        new JFileChooser(file);
+
+        System.out.println("Test passed for LookAndFeel " + UIManager.getLookAndFeel().getName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7036025/security.policy	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,5 @@
+grant {
+    permission java.io.FilePermission "C:\\temp\\*", "read";
+    permission java.io.FilePermission "C:\\temp", "read,write,delete";
+    permission java.util.PropertyPermission "*", "read";
+};
--- a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java	Mon May 09 08:58:00 2011 -0700
@@ -24,13 +24,13 @@
 /* @test
    @bug 6596966
    @summary Some JFileChooser mnemonics do not work with sticky keys
- * @library ../../regtesthelpers
- * @build Util
    @run main bug6596966
    @author Pavel Porvatov
 */
 
 
+import sun.awt.SunToolkit;
+
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.KeyEvent;
@@ -44,6 +44,7 @@
 
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
+        SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -68,17 +69,17 @@
             }
         });
 
-        Util.blockTillDisplayed(frame);
+        toolkit.realSync();
 
         robot.keyPress(KeyEvent.VK_ALT);
         robot.keyPress(KeyEvent.VK_L);
 
-        robot.waitForIdle();
+        toolkit.realSync();
 
-        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
+        toolkit.getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
                 EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L'));
 
-        robot.waitForIdle();
+        toolkit.realSync();
 
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
--- a/jdk/test/sun/java2d/pipe/Test7027667.java	Tue May 03 16:32:47 2011 -0700
+++ b/jdk/test/sun/java2d/pipe/Test7027667.java	Mon May 09 08:58:00 2011 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug     7027667, 7023591
+ * @bug     7027667 7023591 7037091
  *
  * @summary Verifies that aa clipped rectangles are drawn, not filled.
  *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/pisces/Test7036754.java	Mon May 09 08:58:00 2011 -0700
@@ -0,0 +1,58 @@
+/*
+ * 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     7036754
+ *
+ * @summary Verifies that there are no non-finite numbers when stroking
+ *          certain quadratic curves.
+ *
+ * @author Jim Graham
+ * @run     main Test7036754
+ */
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Test7036754 {
+    public static void main(String argv[]) {
+        Shape s = new QuadCurve2D.Float(839.24677f, 508.97888f,
+                                        839.2953f, 508.97122f,
+                                        839.3438f, 508.96353f);
+        s = new BasicStroke(10f).createStrokedShape(s);
+        float nsegs[] = {2, 2, 4, 6, 0};
+        float coords[] = new float[6];
+        PathIterator pi = s.getPathIterator(null);
+        while (!pi.isDone()) {
+            int type = pi.currentSegment(coords);
+            for (int i = 0; i < nsegs[type]; i++) {
+                float c = coords[i];
+                if (Float.isNaN(c) || Float.isInfinite(c)) {
+                    throw new RuntimeException("bad value in stroke");
+                }
+            }
+            pi.next();
+        }
+    }
+}
--- a/langtools/.hgignore	Tue May 03 16:32:47 2011 -0700
+++ b/langtools/.hgignore	Mon May 09 08:58:00 2011 -0700
@@ -1,3 +1,4 @@
 ^build/
 ^dist/
 /nbproject/private/
+^.hgtip
--- a/langtools/.hgtags	Tue May 03 16:32:47 2011 -0700
+++ b/langtools/.hgtags	Mon May 09 08:58:00 2011 -0700
@@ -114,3 +114,4 @@
 a15c9b058ae007d4ccb7e35ce44e4dfa977f090b jdk7-b137
 53f212bed4f4304dce7f0bf0fa01c998c65bacd6 jdk7-b138
 853b6bb99f9b58eb7cf8211c67d3b6e4f1228a3e jdk7-b139
+258e6654aba25aab91c9ba3b4c53d05bc895a86c jdk7-b140
--- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Tue May 03 16:32:47 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Mon May 09 08:58:00 2011 -0700
@@ -43,7 +43,7 @@
 main.no_source_files_for_package=\u6CA1\u6709\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6
 main.fatal.error=\u81F4\u547D\u9519\u8BEF
 main.fatal.exception=\u81F4\u547D\u5F02\u5E38\u9519\u8BEF
-main.out.of.memory=java.lang.OutOfMemoryError: \u8BF7\u589E\u5927\u5185\u5B58\u3002\n\u4F8B\u5982, \u5BF9\u4E8E JDK \u7ECF\u5178\u6216\u70ED\u70B9 VM, \u8BF7\u589E\u5927\u9009\u9879 -J-Xmx,\n\u4F8B\u5982 -J-Xmx32m\u3002
+main.out.of.memory=java.lang.OutOfMemoryError: \u8BF7\u589E\u5927\u5185\u5B58\u3002\n\u4F8B\u5982, \u5BF9\u4E8E JDK \u7ECF\u5178\u6216 HotSpot VM, \u8BF7\u589E\u5927\u9009\u9879 -J-Xmx,\n\u4F8B\u5982 -J-Xmx32m\u3002
 main.done_in=[\u5728 {0} \u6BEB\u79D2\u5185\u5B8C\u6210]
 main.doclet_method_must_be_static=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u4E3A\u9759\u6001\u3002
 main.must_return_int=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u8FD4\u56DE\u6574\u578B\u503C\u3002