changeset 8762:c9ce69d12690

Merge
author lana
date Fri, 18 Mar 2011 15:44:48 -0700
parents 561d07549c0c 2173b8120b13
children 0719e6048a8e 36044fa404c6
files jdk/make/common/Modules.gmk jdk/make/java/nio/mxbean/Makefile jdk/make/modules/Makefile jdk/make/modules/bootmodule.roots jdk/make/modules/jdk7.depconfig jdk/make/modules/modules.config jdk/make/modules/modules.group jdk/make/modules/optional.depconfig jdk/make/modules/tools/Makefile jdk/make/modules/tools/build.xml jdk/make/modules/tools/nbproject/project.properties jdk/make/modules/tools/nbproject/project.xml jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java jdk/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java jdk/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java jdk/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java jdk/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java jdk/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java jdk/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java jdk/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java jdk/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java jdk/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java jdk/make/modules/tools/src/com/sun/classanalyzer/Klass.java jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java jdk/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java jdk/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java jdk/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java jdk/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java jdk/src/share/classes/sun/misc/BootClassLoaderHook.java jdk/src/share/classes/sun/misc/JavaSecurityCodeSignerAccess.java jdk/test/sun/misc/BootClassLoaderHook/TestHook.java langtools/test/tools/javac/T6900037.java langtools/test/tools/javac/T6900037.out langtools/test/tools/javac/diags/examples/DiamondInvalidArg.java langtools/test/tools/javac/diags/examples/DiamondInvalidArgs.java langtools/test/tools/javac/generics/diamond/neg/Neg12.java langtools/test/tools/javac/generics/diamond/neg/Neg12.out langtools/test/tools/javac/multicatch/Neg05.java langtools/test/tools/javac/multicatch/Neg05.out
diffstat 566 files changed, 12523 insertions(+), 13477 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -106,3 +106,5 @@
 6823ea7eb8eb6fab405d7edb7a5c2f690887a2fa jdk7-b129
 a36beda9b9de91231d92a2c529f21cc218fcf8d5 jdk7-b130
 d8af56da89bc0fc02a6b6ad78f51157a46d665ab jdk7-b131
+d61280d36755d1941fb487f554e8b7a6d0bca6a1 jdk7-b132
+fd444c61e7ed3d92b2a730da7c737b02191b682f jdk7-b133
--- a/.hgtags-top-repo	Fri Mar 18 08:42:05 2011 +0900
+++ b/.hgtags-top-repo	Fri Mar 18 15:44:48 2011 -0700
@@ -106,3 +106,5 @@
 a6b015b59fbc2518762c17ccc35702f03ef7713a jdk7-b129
 cc58c11af15411042719e9c82707fdbef60a9e0f jdk7-b130
 5d86d951426aaf340b1ba84ae2d5ab5da65a71e2 jdk7-b131
+0f62a65fb666b337caa585015ab6ea2e60e709ca jdk7-b132
+c6f380693342feadccc5fe2c5adf500e861361aa jdk7-b133
--- a/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -36,12 +36,6 @@
   JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
 endif
 
-# For start and finish echo lines
-TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
-DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
-START_ECHO  = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
-FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
-
 default: all
 
 include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
@@ -57,10 +51,6 @@
 include ./make/sponsors-rules.gmk
 include ./make/deploy-rules.gmk
 
-# What "all" means
-all::
-	@$(START_ECHO)
-
 all:: sanity
 
 ifeq ($(SKIP_FASTDEBUG_BUILD), false)
@@ -73,40 +63,44 @@
 
 all:: all_product_build 
 
-all:: 
-	@$(FINISH_ECHO)
+all_product_build::
 
 # Everything for a full product build
-all_product_build::
-	@$(START_ECHO)
+ifeq ($(SKIP_PRODUCT_BUILD), false)
 
-ifeq ($(SKIP_PRODUCT_BUILD), false)
-  
   all_product_build:: product_build
 
   ifeq ($(BUILD_INSTALL), true)
     all_product_build:: $(INSTALL)
     clobber:: install-clobber
   endif
-  
+
   ifeq ($(BUILD_SPONSORS), true)
     all_product_build:: $(SPONSORS)
     clobber:: sponsors-clobber
   endif
-  
+
   ifneq ($(SKIP_COMPARE_IMAGES), true)
     all_product_build:: compare-image
   endif
 
 endif
 
-all_product_build:: 
-	@$(FINISH_ECHO)
+define StartTimer
+	$(MKDIR) -p $(BUILDTIMESDIR)
+	$(RM) $(BUILDTIMESDIR)/build_time_*
+	$(call RecordStartTime,TOTAL)
+endef
+
+define StopTimer
+	$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
+endef
 
 # Generic build of basic repo series
 generic_build_repo_series::
 	$(MKDIR) -p $(OUTPUTDIR)
 	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
+	@$(call StartTimer)
 
 ifeq ($(BUILD_LANGTOOLS), true)
   generic_build_repo_series:: langtools
@@ -143,6 +137,9 @@
   clobber:: deploy-clobber
 endif
 
+generic_build_repo_series::
+	@$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build))
+
 # The debug build, fastdebug or debug. Needs special handling.
 #  Note that debug builds do NOT do INSTALL steps, but must be done
 #  after the product build and before the INSTALL step of the product build.
@@ -167,28 +164,22 @@
 FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
   
 create_fresh_product_bootdir: FRC
-	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
 		GENERATE_DOCS=false \
 		BOOT_CYCLE_SETTINGS= \
 		build_product_image
-	@$(FINISH_ECHO)
 
 create_fresh_debug_bootdir: FRC
-	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
 		GENERATE_DOCS=false \
 		BOOT_CYCLE_DEBUG_SETTINGS= \
 		build_debug_image
-	@$(FINISH_ECHO)
 
 create_fresh_fastdebug_bootdir: FRC
-	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
 		GENERATE_DOCS=false \
 		BOOT_CYCLE_DEBUG_SETTINGS= \
 		build_fastdebug_image
-	@$(FINISH_ECHO)
 
 # Create boot image?
 ifeq ($(SKIP_BOOT_CYCLE),false)
@@ -197,6 +188,8 @@
   endif
 endif
 
+
+
 ifeq ($(DO_BOOT_CYCLE),true)
   
   # Create the bootdir to use in the build
@@ -221,27 +214,23 @@
 endif
 
 build_product_image:
-	@$(START_ECHO)
 	$(MAKE) \
 	        SKIP_FASTDEBUG_BUILD=true \
 	        SKIP_DEBUG_BUILD=true \
 	        $(BOOT_CYCLE_SETTINGS) \
 	        generic_build_repo_series
-	@$(FINISH_ECHO)
 
 #   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
 #         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
 #         not be the same location.
 
 generic_debug_build:
-	@$(START_ECHO)
 	$(MAKE) \
 		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
 	        DEBUG_NAME=$(DEBUG_NAME) \
 		GENERATE_DOCS=false \
 	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
 		generic_build_repo_series
-	@$(FINISH_ECHO)
 
 build_debug_image:
 	$(MAKE) DEBUG_NAME=debug generic_debug_build
@@ -254,7 +243,8 @@
 debug_build:: build_debug_image
 fastdebug_build:: build_fastdebug_image
 
-clobber::
+clobber:: REPORT_BUILD_TIMES=
+clobber:: 
 	$(RM) -r $(OUTPUTDIR)/*
 	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
 	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
--- a/corba/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/corba/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -106,3 +106,5 @@
 66fa0fcc779296c99746b09efce6109944f82f30 jdk7-b129
 563a8f8b5be3940e9346cffac4eff9ed02b3c69f jdk7-b130
 9d6dd2cdfcb92612dbd836ecded87770d52b49db jdk7-b131
+1b1e75e8f476e5c07f0d2b035993895e2603e1f0 jdk7-b132
+671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133
--- a/hotspot/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -151,3 +151,6 @@
 e9aa2ca89ad6c53420623d579765f9706ec523d7 jdk7-b130
 0aa3b49089112d5faa77902ad680c582ab53f651 jdk7-b131
 e9aa2ca89ad6c53420623d579765f9706ec523d7 hs21-b02
+0e531ab5ba04967a0e9aa6aef65e6eb3a0dcf632 jdk7-b132
+a8d643a4db47c7b58e0bcb49c77b5c3610de86a8 hs21-b03
+1b3a350709e4325d759bb453ff3fb6a463270488 jdk7-b133
--- a/hotspot/make/hotspot_version	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/make/hotspot_version	Fri Mar 18 15:44:48 2011 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=03
+HS_BUILD_NUMBER=04
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/make/windows/makefiles/compile.make	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/make/windows/makefiles/compile.make	Fri Mar 18 15:44:48 2011 -0700
@@ -207,6 +207,9 @@
 # Manifest Tool - used in VS2005 and later to adjust manifests stored
 # as resources inside build artifacts.
 MT=mt.exe
+!if "$(BUILDARCH)" == "i486"
+LINK_FLAGS = /SAFESEH $(LINK_FLAGS)
+!endif
 !endif
 
 # Compile for space above time.
--- a/hotspot/make/windows/makefiles/launcher.make	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/make/windows/makefiles/launcher.make	Fri Mar 18 15:44:48 2011 -0700
@@ -1,71 +1,73 @@
-#
-# 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.
-#  
-#
-
-
-LAUNCHER_FLAGS=$(CPP_FLAGS) $(ARCHFLAG) \
-	/D FULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
-	/D JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
-	/D JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
-	/D GAMMA \
-	/D LAUNCHER_TYPE=\"gamma\" \
-	/D _CRT_SECURE_NO_WARNINGS \
-	/D _CRT_SECURE_NO_DEPRECATE \
-	/D LINK_INTO_LIBJVM \
-	/I $(WorkSpace)\src\os\windows\launcher \
-	/I $(WorkSpace)\src\share\tools\launcher \
-	/I $(WorkSpace)\src\share\vm\prims \
-	/I $(WorkSpace)\src\share\vm \
-	/I $(WorkSpace)\src\cpu\$(Platform_arch)\vm \
-	/I $(WorkSpace)\src\os\windows\vm
-
-LINK_FLAGS=/manifest $(HS_INTERNAL_NAME).lib kernel32.lib user32.lib /nologo /machine:$(MACHINE) /map /debug /subsystem:console 
-
-!if "$(COMPILER_NAME)" == "VS2005"
-# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib
-#    on the link command line, otherwise we get missing __security_check_cookie
-#    externals at link time. Even with /GS-, you need bufferoverflowU.lib.
-BUFFEROVERFLOWLIB = bufferoverflowU.lib
-LINK_FLAGS = $(LINK_FLAGS) $(BUFFEROVERFLOWLIB)
-!endif
-
-LAUNCHERDIR = $(WorkSpace)/src/os/windows/launcher
-LAUNCHERDIR_SHARE = $(WorkSpace)/src/share/tools/launcher
-
-OUTDIR = launcher
-
-{$(LAUNCHERDIR)}.c{$(OUTDIR)}.obj:
-	-mkdir $(OUTDIR) 2>NUL >NUL
-        $(CPP) $(LAUNCHER_FLAGS) /c /Fo$@ $<
-
-{$(LAUNCHERDIR_SHARE)}.c{$(OUTDIR)}.obj:
-	-mkdir $(OUTDIR) 2>NUL >NUL
-        $(CPP) $(LAUNCHER_FLAGS) /c /Fo$@ $<
-
-$(OUTDIR)\*.obj: $(LAUNCHERDIR)\*.c $(LAUNCHERDIR)\*.h $(LAUNCHERDIR_SHARE)\*.c $(LAUNCHERDIR_SHARE)\*.h
-
-launcher: $(OUTDIR)\java.obj $(OUTDIR)\java_md.obj $(OUTDIR)\jli_util.obj
-	echo $(JAVA_HOME) > jdkpath.txt  
-	$(LINK) $(LINK_FLAGS) /out:hotspot.exe $**
-
-
+#
+# 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.
+#  
+#
+
+
+LAUNCHER_FLAGS=$(CPP_FLAGS) $(ARCHFLAG) \
+	/D FULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
+	/D JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
+	/D JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
+	/D GAMMA \
+	/D LAUNCHER_TYPE=\"gamma\" \
+	/D _CRT_SECURE_NO_WARNINGS \
+	/D _CRT_SECURE_NO_DEPRECATE \
+	/D LINK_INTO_LIBJVM \
+	/I $(WorkSpace)\src\os\windows\launcher \
+	/I $(WorkSpace)\src\share\tools\launcher \
+	/I $(WorkSpace)\src\share\vm\prims \
+	/I $(WorkSpace)\src\share\vm \
+	/I $(WorkSpace)\src\cpu\$(Platform_arch)\vm \
+	/I $(WorkSpace)\src\os\windows\vm
+
+LINK_FLAGS=/manifest $(HS_INTERNAL_NAME).lib kernel32.lib user32.lib /nologo /machine:$(MACHINE) /map /debug /subsystem:console 
+
+!if "$(COMPILER_NAME)" == "VS2005"
+# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib
+#    on the link command line, otherwise we get missing __security_check_cookie
+#    externals at link time. Even with /GS-, you need bufferoverflowU.lib.
+BUFFEROVERFLOWLIB = bufferoverflowU.lib
+LINK_FLAGS = $(LINK_FLAGS) $(BUFFEROVERFLOWLIB)
+!endif
+
+!if "$(COMPILER_NAME)" == "VS2010" && "$(BUILDARCH)" == "i486"
+LINK_FLAGS = /SAFESEH $(LINK_FLAGS)
+!endif
+
+LAUNCHERDIR = $(WorkSpace)/src/os/windows/launcher
+LAUNCHERDIR_SHARE = $(WorkSpace)/src/share/tools/launcher
+
+OUTDIR = launcher
+
+{$(LAUNCHERDIR)}.c{$(OUTDIR)}.obj:
+	-mkdir $(OUTDIR) 2>NUL >NUL
+        $(CPP) $(LAUNCHER_FLAGS) /c /Fo$@ $<
+
+{$(LAUNCHERDIR_SHARE)}.c{$(OUTDIR)}.obj:
+	-mkdir $(OUTDIR) 2>NUL >NUL
+        $(CPP) $(LAUNCHER_FLAGS) /c /Fo$@ $<
+
+$(OUTDIR)\*.obj: $(LAUNCHERDIR)\*.c $(LAUNCHERDIR)\*.h $(LAUNCHERDIR_SHARE)\*.c $(LAUNCHERDIR_SHARE)\*.h
+
+launcher: $(OUTDIR)\java.obj $(OUTDIR)\java_md.obj $(OUTDIR)\jli_util.obj
+	echo $(JAVA_HOME) > jdkpath.txt  
+	$(LINK) $(LINK_FLAGS) /out:hotspot.exe $**
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -395,9 +395,9 @@
 
   int offset = code_offset();
 
-  __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type);
+  __ call(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id), relocInfo::runtime_call_type);
   __ delayed()->nop();
-  debug_only(__ stop("should have gone to the caller");)
+  __ should_not_reach_here();
   assert(code_offset() - offset <= exception_handler_size, "overflow");
   __ end_a_stub();
 
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -148,7 +148,7 @@
 
 static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) {
   assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
-         " mismatch in calculation");
+         "mismatch in calculation");
   sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
   int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
   OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
@@ -176,9 +176,8 @@
 
 static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) {
   assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
-         " mismatch in calculation");
+         "mismatch in calculation");
   __ save_frame_c1(frame_size_in_bytes);
-  sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
 
   // Record volatile registers as callee-save values in an OopMap so their save locations will be
   // propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for
@@ -367,23 +366,7 @@
   switch (id) {
     case forward_exception_id:
       {
-        // we're handling an exception in the context of a compiled
-        // frame.  The registers have been saved in the standard
-        // places.  Perform an exception lookup in the caller and
-        // dispatch to the handler if found.  Otherwise unwind and
-        // dispatch to the callers exception handler.
-
-        oop_maps = new OopMapSet();
-        OopMap* oop_map = generate_oop_map(sasm, true);
-
-        // transfer the pending exception to the exception_oop
-        __ ld_ptr(G2_thread, in_bytes(JavaThread::pending_exception_offset()), Oexception);
-        __ ld_ptr(Oexception, 0, G0);
-        __ st_ptr(G0, G2_thread, in_bytes(JavaThread::pending_exception_offset()));
-        __ add(I7, frame::pc_return_offset, Oissuing_pc);
-
-        generate_handle_exception(sasm, oop_maps, oop_map);
-        __ should_not_reach_here();
+        oop_maps = generate_handle_exception(id, sasm);
       }
       break;
 
@@ -671,15 +654,14 @@
       break;
 
     case handle_exception_id:
-      {
-        __ set_info("handle_exception", dont_gc_arguments);
-        // make a frame and preserve the caller's caller-save registers
+      { __ set_info("handle_exception", dont_gc_arguments);
+        oop_maps = generate_handle_exception(id, sasm);
+      }
+      break;
 
-        oop_maps = new OopMapSet();
-        OopMap* oop_map = save_live_registers(sasm);
-        __ mov(Oexception->after_save(),  Oexception);
-        __ mov(Oissuing_pc->after_save(), Oissuing_pc);
-        generate_handle_exception(sasm, oop_maps, oop_map);
+    case handle_exception_from_callee_id:
+      { __ set_info("handle_exception_from_callee", dont_gc_arguments);
+        oop_maps = generate_handle_exception(id, sasm);
       }
       break;
 
@@ -696,7 +678,7 @@
                         G2_thread, Oissuing_pc->after_save());
         __ verify_not_null_oop(Oexception->after_save());
 
-        // Restore SP from L7 if the exception PC is a MethodHandle call site.
+        // Restore SP from L7 if the exception PC is a method handle call site.
         __ mov(O0, G5);  // Save the target address.
         __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
         __ tst(L0);  // Condition codes are preserved over the restore.
@@ -1006,48 +988,89 @@
 }
 
 
-void Runtime1::generate_handle_exception(StubAssembler* sasm, OopMapSet* oop_maps, OopMap* oop_map, bool) {
-  Label no_deopt;
+OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
+  __ block_comment("generate_handle_exception");
+
+  // Save registers, if required.
+  OopMapSet* oop_maps = new OopMapSet();
+  OopMap* oop_map = NULL;
+  switch (id) {
+  case forward_exception_id:
+    // We're handling an exception in the context of a compiled frame.
+    // The registers have been saved in the standard places.  Perform
+    // an exception lookup in the caller and dispatch to the handler
+    // if found.  Otherwise unwind and dispatch to the callers
+    // exception handler.
+     oop_map = generate_oop_map(sasm, true);
+
+     // transfer the pending exception to the exception_oop
+     __ ld_ptr(G2_thread, in_bytes(JavaThread::pending_exception_offset()), Oexception);
+     __ ld_ptr(Oexception, 0, G0);
+     __ st_ptr(G0, G2_thread, in_bytes(JavaThread::pending_exception_offset()));
+     __ add(I7, frame::pc_return_offset, Oissuing_pc);
+    break;
+  case handle_exception_id:
+    // At this point all registers MAY be live.
+    oop_map = save_live_registers(sasm);
+    __ mov(Oexception->after_save(),  Oexception);
+    __ mov(Oissuing_pc->after_save(), Oissuing_pc);
+    break;
+  case handle_exception_from_callee_id:
+    // At this point all registers except exception oop (Oexception)
+    // and exception pc (Oissuing_pc) are dead.
+    oop_map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
+    sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
+    __ save_frame_c1(frame_size_in_bytes);
+    __ mov(Oexception->after_save(),  Oexception);
+    __ mov(Oissuing_pc->after_save(), Oissuing_pc);
+    break;
+  default:  ShouldNotReachHere();
+  }
 
   __ verify_not_null_oop(Oexception);
 
   // save the exception and issuing pc in the thread
-  __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
+  __ st_ptr(Oexception,  G2_thread, in_bytes(JavaThread::exception_oop_offset()));
   __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
 
-  // save the real return address and use the throwing pc as the return address to lookup (has bci & oop map)
-  __ mov(I7, L0);
+  // use the throwing pc as the return address to lookup (has bci & oop map)
   __ mov(Oissuing_pc, I7);
   __ sub(I7, frame::pc_return_offset, I7);
   int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
+  oop_maps->add_gc_map(call_offset, oop_map);
 
   // Note: if nmethod has been deoptimized then regardless of
   // whether it had a handler or not we will deoptimize
   // by entering the deopt blob with a pending exception.
 
-#ifdef ASSERT
-  Label done;
-  __ tst(O0);
-  __ br(Assembler::notZero, false, Assembler::pn, done);
-  __ delayed()->nop();
-  __ stop("should have found address");
-  __ bind(done);
-#endif
+  // Restore the registers that were saved at the beginning, remove
+  // the frame and jump to the exception handler.
+  switch (id) {
+  case forward_exception_id:
+  case handle_exception_id:
+    restore_live_registers(sasm);
+    __ jmp(O0, 0);
+    __ delayed()->restore();
+    break;
+  case handle_exception_from_callee_id:
+    // Restore SP from L7 if the exception PC is a method handle call site.
+    __ mov(O0, G5);  // Save the target address.
+    __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
+    __ tst(L0);  // Condition codes are preserved over the restore.
+    __ restore();
 
-  // restore the registers that were saved at the beginning and jump to the exception handler.
-  restore_live_registers(sasm);
+    __ jmp(G5, 0);  // jump to the exception handler
+    __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP);  // Restore SP if required.
+    break;
+  default:  ShouldNotReachHere();
+  }
 
-  __ jmp(O0, 0);
-  __ delayed()->restore();
-
-  oop_maps->add_gc_map(call_offset, oop_map);
+  return oop_maps;
 }
 
 
 #undef __
 
-#define __ masm->
-
 const char *Runtime1::pd_name_for_address(address entry) {
   return "<unknown function>";
 }
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -417,6 +417,7 @@
 
   // Some handy addresses:
   Address G5_method_fie(    G5_method,        in_bytes(methodOopDesc::from_interpreted_offset()));
+  Address G5_method_fce(    G5_method,        in_bytes(methodOopDesc::from_compiled_offset()));
 
   Address G3_mh_vmtarget(   G3_method_handle, java_dyn_MethodHandle::vmtarget_offset_in_bytes());
 
@@ -444,12 +445,10 @@
   case _raise_exception:
     {
       // Not a real MH entry, but rather shared code for raising an
-      // exception.  Since we use a C2I adapter to set up the
-      // interpreter state, arguments are expected in compiler
-      // argument registers.
+      // exception.  Since we use the compiled entry, arguments are
+      // expected in compiler argument registers.
       assert(raise_exception_method(), "must be set");
-      address c2i_entry = raise_exception_method()->get_c2i_entry();
-      assert(c2i_entry, "method must be linked");
+      assert(raise_exception_method()->from_compiled_entry(), "method must be linked");
 
       __ mov(O5_savedSP, SP);  // Cut the stack back to where the caller started.
 
@@ -468,10 +467,9 @@
       __ delayed()->nop();
 
       __ verify_oop(G5_method);
-      __ jump_to(AddressLiteral(c2i_entry), O3_scratch);
+      __ jump_indirect_to(G5_method_fce, O3_scratch);  // jump to compiled entry
       __ delayed()->nop();
 
-      // If we get here, the Java runtime did not do its job of creating the exception.
       // Do something that is at least causes a valid throw from the interpreter.
       __ bind(L_no_method);
       __ unimplemented("call throw_WrongMethodType_entry");
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -968,19 +968,6 @@
     return start;
   }
 
-  static address disjoint_byte_copy_entry;
-  static address disjoint_short_copy_entry;
-  static address disjoint_int_copy_entry;
-  static address disjoint_long_copy_entry;
-  static address disjoint_oop_copy_entry;
-
-  static address byte_copy_entry;
-  static address short_copy_entry;
-  static address int_copy_entry;
-  static address long_copy_entry;
-  static address oop_copy_entry;
-
-  static address checkcast_copy_entry;
 
   //
   // Verify that a register contains clean 32-bits positive value
@@ -1046,31 +1033,40 @@
   //
   //  The input registers are overwritten.
   //
-  void gen_write_ref_array_pre_barrier(Register addr, Register count) {
+  void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
-    if (bs->has_write_ref_pre_barrier()) {
-      assert(bs->has_write_ref_array_pre_opt(),
-             "Else unsupported barrier set.");
-
-      __ save_frame(0);
-      // Save the necessary global regs... will be used after.
-      if (addr->is_global()) {
-        __ mov(addr, L0);
-      }
-      if (count->is_global()) {
-        __ mov(count, L1);
-      }
-      __ mov(addr->after_save(), O0);
-      // Get the count into O1
-      __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre));
-      __ delayed()->mov(count->after_save(), O1);
-      if (addr->is_global()) {
-        __ mov(L0, addr);
-      }
-      if (count->is_global()) {
-        __ mov(L1, count);
-      }
-      __ restore();
+    switch (bs->kind()) {
+      case BarrierSet::G1SATBCT:
+      case BarrierSet::G1SATBCTLogging:
+        // With G1, don't generate the call if we statically know that the target in uninitialized
+        if (!dest_uninitialized) {
+          __ save_frame(0);
+          // Save the necessary global regs... will be used after.
+          if (addr->is_global()) {
+            __ mov(addr, L0);
+          }
+          if (count->is_global()) {
+            __ mov(count, L1);
+          }
+          __ mov(addr->after_save(), O0);
+          // Get the count into O1
+          __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre));
+          __ delayed()->mov(count->after_save(), O1);
+          if (addr->is_global()) {
+            __ mov(L0, addr);
+          }
+          if (count->is_global()) {
+            __ mov(L1, count);
+          }
+          __ restore();
+        }
+        break;
+      case BarrierSet::CardTableModRef:
+      case BarrierSet::CardTableExtension:
+      case BarrierSet::ModRef:
+        break;
+      default:
+        ShouldNotReachHere();
     }
   }
   //
@@ -1084,7 +1080,7 @@
   //  The input registers are overwritten.
   //
   void gen_write_ref_array_post_barrier(Register addr, Register count,
-                                   Register tmp) {
+                                        Register tmp) {
     BarrierSet* bs = Universe::heap()->barrier_set();
 
     switch (bs->kind()) {
@@ -1283,7 +1279,7 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_disjoint_byte_copy(bool aligned, const char * name) {
+  address generate_disjoint_byte_copy(bool aligned, address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1299,9 +1295,11 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  disjoint_byte_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     // for short arrays, just do single element copy
     __ cmp(count, 23); // 16 + 7
@@ -1391,15 +1389,13 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_conjoint_byte_copy(bool aligned, const char * name) {
+  address generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
+                                      address *entry, const char *name) {
     // Do reverse copy.
 
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
-    address nooverlap_target = aligned ?
-        StubRoutines::arrayof_jbyte_disjoint_arraycopy() :
-        disjoint_byte_copy_entry;
 
     Label L_skip_alignment, L_align, L_aligned_copy;
     Label L_copy_byte, L_copy_byte_loop, L_exit;
@@ -1412,9 +1408,11 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  byte_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     array_overlap_test(nooverlap_target, 0);
 
@@ -1504,7 +1502,7 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_disjoint_short_copy(bool aligned, const char * name) {
+  address generate_disjoint_short_copy(bool aligned, address *entry, const char * name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1520,9 +1518,11 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  disjoint_short_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     // for short arrays, just do single element copy
     __ cmp(count, 11); // 8 + 3  (22 bytes)
@@ -1842,15 +1842,13 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_conjoint_short_copy(bool aligned, const char * name) {
+  address generate_conjoint_short_copy(bool aligned, address nooverlap_target,
+                                       address *entry, const char *name) {
     // Do reverse copy.
 
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
-    address nooverlap_target = aligned ?
-        StubRoutines::arrayof_jshort_disjoint_arraycopy() :
-        disjoint_short_copy_entry;
 
     Label L_skip_alignment, L_skip_alignment2, L_aligned_copy;
     Label L_copy_2_bytes, L_copy_2_bytes_loop, L_exit;
@@ -1865,9 +1863,11 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  short_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     array_overlap_test(nooverlap_target, 1);
 
@@ -2072,7 +2072,7 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_disjoint_int_copy(bool aligned, const char * name) {
+  address generate_disjoint_int_copy(bool aligned, address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -2080,9 +2080,11 @@
     const Register count = O2;
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  disjoint_int_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     generate_disjoint_int_copy_core(aligned);
 
@@ -2204,20 +2206,19 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_conjoint_int_copy(bool aligned, const char * name) {
+  address generate_conjoint_int_copy(bool aligned, address nooverlap_target,
+                                     address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    address nooverlap_target = aligned ?
-        StubRoutines::arrayof_jint_disjoint_arraycopy() :
-        disjoint_int_copy_entry;
-
     assert_clean_int(O2, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  int_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     array_overlap_test(nooverlap_target, 2);
 
@@ -2336,16 +2337,18 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_disjoint_long_copy(bool aligned, const char * name) {
+  address generate_disjoint_long_copy(bool aligned, address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
     assert_clean_int(O2, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  disjoint_long_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     generate_disjoint_long_copy_core(aligned);
 
@@ -2406,19 +2409,21 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_conjoint_long_copy(bool aligned, const char * name) {
+  address generate_conjoint_long_copy(bool aligned, address nooverlap_target,
+                                      address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    assert(!aligned, "usage");
-    address nooverlap_target = disjoint_long_copy_entry;
+    assert(aligned, "Should always be aligned");
 
     assert_clean_int(O2, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  long_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     array_overlap_test(nooverlap_target, 3);
 
@@ -2439,7 +2444,8 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_disjoint_oop_copy(bool aligned, const char * name) {
+  address generate_disjoint_oop_copy(bool aligned, address *entry, const char *name,
+                                     bool dest_uninitialized = false) {
 
     const Register from  = O0;  // source array address
     const Register to    = O1;  // destination array address
@@ -2451,14 +2457,16 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  disjoint_oop_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here
+      BLOCK_COMMENT("Entry:");
+    }
 
     // save arguments for barrier generation
     __ mov(to, G1);
     __ mov(count, G5);
-    gen_write_ref_array_pre_barrier(G1, G5);
+    gen_write_ref_array_pre_barrier(G1, G5, dest_uninitialized);
   #ifdef _LP64
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
     if (UseCompressedOops) {
@@ -2487,7 +2495,9 @@
   //      to:    O1
   //      count: O2 treated as signed
   //
-  address generate_conjoint_oop_copy(bool aligned, const char * name) {
+  address generate_conjoint_oop_copy(bool aligned, address nooverlap_target,
+                                     address *entry, const char *name,
+                                     bool dest_uninitialized = false) {
 
     const Register from  = O0;  // source array address
     const Register to    = O1;  // destination array address
@@ -2499,21 +2509,18 @@
 
     assert_clean_int(count, O3);     // Make sure 'count' is clean int.
 
-    if (!aligned)  oop_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here
-    if (!aligned)  BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here
+      BLOCK_COMMENT("Entry:");
+    }
+
+    array_overlap_test(nooverlap_target, LogBytesPerHeapOop);
 
     // save arguments for barrier generation
     __ mov(to, G1);
     __ mov(count, G5);
-
-    gen_write_ref_array_pre_barrier(G1, G5);
-
-    address nooverlap_target = aligned ?
-        StubRoutines::arrayof_oop_disjoint_arraycopy() :
-        disjoint_oop_copy_entry;
-
-    array_overlap_test(nooverlap_target, LogBytesPerHeapOop);
+    gen_write_ref_array_pre_barrier(G1, G5, dest_uninitialized);
 
   #ifdef _LP64
     if (UseCompressedOops) {
@@ -2582,7 +2589,7 @@
   //      ckval: O4 (super_klass)
   //      ret:   O0 zero for success; (-1^K) where K is partial transfer count
   //
-  address generate_checkcast_copy(const char* name) {
+  address generate_checkcast_copy(const char *name, address *entry, bool dest_uninitialized = false) {
 
     const Register O0_from   = O0;      // source array address
     const Register O1_to     = O1;      // destination array address
@@ -2600,8 +2607,6 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    gen_write_ref_array_pre_barrier(O1, O2);
-
 #ifdef ASSERT
     // We sometimes save a frame (see generate_type_check below).
     // If this will cause trouble, let's fail now instead of later.
@@ -2625,9 +2630,12 @@
     }
 #endif //ASSERT
 
-    checkcast_copy_entry = __ pc();
-    // caller can pass a 64-bit byte count here (from generic stub)
-    BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from generic stub)
+      BLOCK_COMMENT("Entry:");
+    }
+    gen_write_ref_array_pre_barrier(O1_to, O2_count, dest_uninitialized);
 
     Label load_element, store_element, do_card_marks, fail, done;
     __ addcc(O2_count, 0, G1_remain);   // initialize loop index, and test it
@@ -2700,7 +2708,11 @@
   // Examines the alignment of the operands and dispatches
   // to a long, int, short, or byte copy loop.
   //
-  address generate_unsafe_copy(const char* name) {
+  address generate_unsafe_copy(const char* name,
+                               address byte_copy_entry,
+                               address short_copy_entry,
+                               address int_copy_entry,
+                               address long_copy_entry) {
 
     const Register O0_from   = O0;      // source array address
     const Register O1_to     = O1;      // destination array address
@@ -2796,8 +2808,13 @@
   //    O0 ==  0  -  success
   //    O0 == -1  -  need to call System.arraycopy
   //
-  address generate_generic_copy(const char *name) {
-
+  address generate_generic_copy(const char *name,
+                                address entry_jbyte_arraycopy,
+                                address entry_jshort_arraycopy,
+                                address entry_jint_arraycopy,
+                                address entry_oop_arraycopy,
+                                address entry_jlong_arraycopy,
+                                address entry_checkcast_arraycopy) {
     Label L_failed, L_objArray;
 
     // Input registers
@@ -2970,15 +2987,15 @@
 
     BLOCK_COMMENT("choose copy loop based on element size");
     __ cmp(G3_elsize, 0);
-    __ br(Assembler::equal,true,Assembler::pt,StubRoutines::_jbyte_arraycopy);
+    __ br(Assembler::equal, true, Assembler::pt, entry_jbyte_arraycopy);
     __ delayed()->signx(length, count); // length
 
     __ cmp(G3_elsize, LogBytesPerShort);
-    __ br(Assembler::equal,true,Assembler::pt,StubRoutines::_jshort_arraycopy);
+    __ br(Assembler::equal, true, Assembler::pt, entry_jshort_arraycopy);
     __ delayed()->signx(length, count); // length
 
     __ cmp(G3_elsize, LogBytesPerInt);
-    __ br(Assembler::equal,true,Assembler::pt,StubRoutines::_jint_arraycopy);
+    __ br(Assembler::equal, true, Assembler::pt, entry_jint_arraycopy);
     __ delayed()->signx(length, count); // length
 #ifdef ASSERT
     { Label L;
@@ -2989,7 +3006,7 @@
       __ bind(L);
     }
 #endif
-    __ br(Assembler::always,false,Assembler::pt,StubRoutines::_jlong_arraycopy);
+    __ br(Assembler::always, false, Assembler::pt, entry_jlong_arraycopy);
     __ delayed()->signx(length, count); // length
 
     // objArrayKlass
@@ -3013,7 +3030,7 @@
     __ add(src, src_pos, from);       // src_addr
     __ add(dst, dst_pos, to);         // dst_addr
   __ BIND(L_plain_copy);
-    __ br(Assembler::always, false, Assembler::pt,StubRoutines::_oop_arraycopy);
+    __ br(Assembler::always, false, Assembler::pt, entry_oop_arraycopy);
     __ delayed()->signx(length, count); // length
 
   __ BIND(L_checkcast_copy);
@@ -3057,7 +3074,7 @@
       __ ld_ptr(G4_dst_klass, ek_offset, O4);   // dest elem klass
       // lduw(O4, sco_offset, O3);              // sco of elem klass
 
-      __ br(Assembler::always, false, Assembler::pt, checkcast_copy_entry);
+      __ br(Assembler::always, false, Assembler::pt, entry_checkcast_arraycopy);
       __ delayed()->lduw(O4, sco_offset, O3);
     }
 
@@ -3068,39 +3085,124 @@
   }
 
   void generate_arraycopy_stubs() {
-
-    // Note:  the disjoint stubs must be generated first, some of
-    //        the conjoint stubs use them.
-    StubRoutines::_jbyte_disjoint_arraycopy  = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
-    StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
-    StubRoutines::_jint_disjoint_arraycopy   = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy");
-    StubRoutines::_jlong_disjoint_arraycopy  = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy");
-    StubRoutines::_oop_disjoint_arraycopy    = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy");
-    StubRoutines::_arrayof_jbyte_disjoint_arraycopy  = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy");
-    StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
-    StubRoutines::_arrayof_jint_disjoint_arraycopy   = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy");
-    StubRoutines::_arrayof_jlong_disjoint_arraycopy  = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy");
-    StubRoutines::_arrayof_oop_disjoint_arraycopy    =  generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy");
-
-    StubRoutines::_jbyte_arraycopy  = generate_conjoint_byte_copy(false, "jbyte_arraycopy");
-    StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy");
-    StubRoutines::_jint_arraycopy   = generate_conjoint_int_copy(false, "jint_arraycopy");
-    StubRoutines::_jlong_arraycopy  = generate_conjoint_long_copy(false, "jlong_arraycopy");
-    StubRoutines::_oop_arraycopy    = generate_conjoint_oop_copy(false, "oop_arraycopy");
-    StubRoutines::_arrayof_jbyte_arraycopy    = generate_conjoint_byte_copy(true, "arrayof_jbyte_arraycopy");
-    StubRoutines::_arrayof_jshort_arraycopy   = generate_conjoint_short_copy(true, "arrayof_jshort_arraycopy");
+    address entry;
+    address entry_jbyte_arraycopy;
+    address entry_jshort_arraycopy;
+    address entry_jint_arraycopy;
+    address entry_oop_arraycopy;
+    address entry_jlong_arraycopy;
+    address entry_checkcast_arraycopy;
+
+    //*** jbyte
+    // Always need aligned and unaligned versions
+    StubRoutines::_jbyte_disjoint_arraycopy         = generate_disjoint_byte_copy(false, &entry,
+                                                                                  "jbyte_disjoint_arraycopy");
+    StubRoutines::_jbyte_arraycopy                  = generate_conjoint_byte_copy(false, entry,
+                                                                                  &entry_jbyte_arraycopy,
+                                                                                  "jbyte_arraycopy");
+    StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, &entry,
+                                                                                  "arrayof_jbyte_disjoint_arraycopy");
+    StubRoutines::_arrayof_jbyte_arraycopy          = generate_conjoint_byte_copy(true, entry, NULL,
+                                                                                  "arrayof_jbyte_arraycopy");
+
+    //*** jshort
+    // Always need aligned and unaligned versions
+    StubRoutines::_jshort_disjoint_arraycopy         = generate_disjoint_short_copy(false, &entry,
+                                                                                    "jshort_disjoint_arraycopy");
+    StubRoutines::_jshort_arraycopy                  = generate_conjoint_short_copy(false, entry,
+                                                                                    &entry_jshort_arraycopy,
+                                                                                    "jshort_arraycopy");
+    StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, &entry,
+                                                                                    "arrayof_jshort_disjoint_arraycopy");
+    StubRoutines::_arrayof_jshort_arraycopy          = generate_conjoint_short_copy(true, entry, NULL,
+                                                                                    "arrayof_jshort_arraycopy");
+
+    //*** jint
+    // Aligned versions
+    StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, &entry,
+                                                                                "arrayof_jint_disjoint_arraycopy");
+    StubRoutines::_arrayof_jint_arraycopy          = generate_conjoint_int_copy(true, entry, &entry_jint_arraycopy,
+                                                                                "arrayof_jint_arraycopy");
 #ifdef _LP64
-    // since sizeof(jint) < sizeof(HeapWord), there's a different flavor:
-    StubRoutines::_arrayof_jint_arraycopy     = generate_conjoint_int_copy(true, "arrayof_jint_arraycopy");
-  #else
-    StubRoutines::_arrayof_jint_arraycopy     = StubRoutines::_jint_arraycopy;
+    // In 64 bit we need both aligned and unaligned versions of jint arraycopy.
+    // entry_jint_arraycopy always points to the unaligned version (notice that we overwrite it).
+    StubRoutines::_jint_disjoint_arraycopy         = generate_disjoint_int_copy(false, &entry,
+                                                                                "jint_disjoint_arraycopy");
+    StubRoutines::_jint_arraycopy                  = generate_conjoint_int_copy(false, entry,
+                                                                                &entry_jint_arraycopy,
+                                                                                "jint_arraycopy");
+#else
+    // In 32 bit jints are always HeapWordSize aligned, so always use the aligned version
+    // (in fact in 32bit we always have a pre-loop part even in the aligned version,
+    //  because it uses 64-bit loads/stores, so the aligned flag is actually ignored).
+    StubRoutines::_jint_disjoint_arraycopy = StubRoutines::_arrayof_jint_disjoint_arraycopy;
+    StubRoutines::_jint_arraycopy          = StubRoutines::_arrayof_jint_arraycopy;
 #endif
-    StubRoutines::_arrayof_jlong_arraycopy    = StubRoutines::_jlong_arraycopy;
-    StubRoutines::_arrayof_oop_arraycopy      = StubRoutines::_oop_arraycopy;
-
-    StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy");
-    StubRoutines::_unsafe_arraycopy    = generate_unsafe_copy("unsafe_arraycopy");
-    StubRoutines::_generic_arraycopy   = generate_generic_copy("generic_arraycopy");
+
+
+    //*** jlong
+    // It is always aligned
+    StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, &entry,
+                                                                                  "arrayof_jlong_disjoint_arraycopy");
+    StubRoutines::_arrayof_jlong_arraycopy          = generate_conjoint_long_copy(true, entry, &entry_jlong_arraycopy,
+                                                                                  "arrayof_jlong_arraycopy");
+    StubRoutines::_jlong_disjoint_arraycopy         = StubRoutines::_arrayof_jlong_disjoint_arraycopy;
+    StubRoutines::_jlong_arraycopy                  = StubRoutines::_arrayof_jlong_arraycopy;
+
+
+    //*** oops
+    // Aligned versions
+    StubRoutines::_arrayof_oop_disjoint_arraycopy        = generate_disjoint_oop_copy(true, &entry,
+                                                                                      "arrayof_oop_disjoint_arraycopy");
+    StubRoutines::_arrayof_oop_arraycopy                 = generate_conjoint_oop_copy(true, entry, &entry_oop_arraycopy,
+                                                                                      "arrayof_oop_arraycopy");
+    // Aligned versions without pre-barriers
+    StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, &entry,
+                                                                                      "arrayof_oop_disjoint_arraycopy_uninit",
+                                                                                      /*dest_uninitialized*/true);
+    StubRoutines::_arrayof_oop_arraycopy_uninit          = generate_conjoint_oop_copy(true, entry, NULL,
+                                                                                      "arrayof_oop_arraycopy_uninit",
+                                                                                      /*dest_uninitialized*/true);
+#ifdef _LP64
+    if (UseCompressedOops) {
+      // With compressed oops we need unaligned versions, notice that we overwrite entry_oop_arraycopy.
+      StubRoutines::_oop_disjoint_arraycopy            = generate_disjoint_oop_copy(false, &entry,
+                                                                                    "oop_disjoint_arraycopy");
+      StubRoutines::_oop_arraycopy                     = generate_conjoint_oop_copy(false, entry, &entry_oop_arraycopy,
+                                                                                    "oop_arraycopy");
+      // Unaligned versions without pre-barriers
+      StubRoutines::_oop_disjoint_arraycopy_uninit     = generate_disjoint_oop_copy(false, &entry,
+                                                                                    "oop_disjoint_arraycopy_uninit",
+                                                                                    /*dest_uninitialized*/true);
+      StubRoutines::_oop_arraycopy_uninit              = generate_conjoint_oop_copy(false, entry, NULL,
+                                                                                    "oop_arraycopy_uninit",
+                                                                                    /*dest_uninitialized*/true);
+    } else
+#endif
+    {
+      // oop arraycopy is always aligned on 32bit and 64bit without compressed oops
+      StubRoutines::_oop_disjoint_arraycopy            = StubRoutines::_arrayof_oop_disjoint_arraycopy;
+      StubRoutines::_oop_arraycopy                     = StubRoutines::_arrayof_oop_arraycopy;
+      StubRoutines::_oop_disjoint_arraycopy_uninit     = StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit;
+      StubRoutines::_oop_arraycopy_uninit              = StubRoutines::_arrayof_oop_arraycopy_uninit;
+    }
+
+    StubRoutines::_checkcast_arraycopy        = generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
+    StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", NULL,
+                                                                        /*dest_uninitialized*/true);
+
+    StubRoutines::_unsafe_arraycopy    = generate_unsafe_copy("unsafe_arraycopy",
+                                                              entry_jbyte_arraycopy,
+                                                              entry_jshort_arraycopy,
+                                                              entry_jint_arraycopy,
+                                                              entry_jlong_arraycopy);
+    StubRoutines::_generic_arraycopy   = generate_generic_copy("generic_arraycopy",
+                                                               entry_jbyte_arraycopy,
+                                                               entry_jshort_arraycopy,
+                                                               entry_jint_arraycopy,
+                                                               entry_oop_arraycopy,
+                                                               entry_jlong_arraycopy,
+                                                               entry_checkcast_arraycopy);
 
     StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
     StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
@@ -3224,21 +3326,6 @@
 
 }; // end class declaration
 
-
-address StubGenerator::disjoint_byte_copy_entry  = NULL;
-address StubGenerator::disjoint_short_copy_entry = NULL;
-address StubGenerator::disjoint_int_copy_entry   = NULL;
-address StubGenerator::disjoint_long_copy_entry  = NULL;
-address StubGenerator::disjoint_oop_copy_entry   = NULL;
-
-address StubGenerator::byte_copy_entry  = NULL;
-address StubGenerator::short_copy_entry = NULL;
-address StubGenerator::int_copy_entry   = NULL;
-address StubGenerator::long_copy_entry  = NULL;
-address StubGenerator::oop_copy_entry   = NULL;
-
-address StubGenerator::checkcast_copy_entry = NULL;
-
 void StubGenerator_generate(CodeBuffer* code, bool all) {
   StubGenerator g(code, all);
 }
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1601,6 +1601,17 @@
   emit_byte(0xC0 | encode);
 }
 
+void Assembler::movdl(XMMRegister dst, Address src) {
+  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
+  InstructionMark im(this);
+  emit_byte(0x66);
+  prefix(src, dst);
+  emit_byte(0x0F);
+  emit_byte(0x6E);
+  emit_operand(dst, src);
+}
+
+
 void Assembler::movdqa(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
@@ -2412,7 +2423,10 @@
 }
 
 void Assembler::psrlq(XMMRegister dst, int shift) {
-  // HMM Table D-1 says sse2 or mmx
+  // Shift 64 bit value logically right by specified number of bits.
+  // HMM Table D-1 says sse2 or mmx.
+  // Do not confuse it with psrldq SSE2 instruction which
+  // shifts 128 bit value in xmm register by number of bytes.
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
 
   int encode = prefixq_and_encode(xmm2->encoding(), dst->encoding());
@@ -2423,6 +2437,18 @@
   emit_byte(shift);
 }
 
+void Assembler::psrldq(XMMRegister dst, int shift) {
+  // Shift 128 bit value in xmm register by number of bytes.
+  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
+
+  int encode = prefixq_and_encode(xmm3->encoding(), dst->encoding());
+  emit_byte(0x66);
+  emit_byte(0x0F);
+  emit_byte(0x73);
+  emit_byte(0xC0 | encode);
+  emit_byte(shift);
+}
+
 void Assembler::ptest(XMMRegister dst, Address src) {
   assert(VM_Version::supports_sse4_1(), "");
 
@@ -8567,101 +8593,418 @@
 }
 #endif // _LP64
 
-// IndexOf substring.
-void MacroAssembler::string_indexof(Register str1, Register str2,
-                                    Register cnt1, Register cnt2, Register result,
-                                    XMMRegister vec, Register tmp) {
+// IndexOf for constant substrings with size >= 8 chars
+// which don't need to be loaded through stack.
+void MacroAssembler::string_indexofC8(Register str1, Register str2,
+                                      Register cnt1, Register cnt2,
+                                      int int_cnt2,  Register result,
+                                      XMMRegister vec, Register tmp) {
   assert(UseSSE42Intrinsics, "SSE4.2 is required");
 
-  Label RELOAD_SUBSTR, PREP_FOR_SCAN, SCAN_TO_SUBSTR,
-        SCAN_SUBSTR, RET_NOT_FOUND, CLEANUP;
-
-  push(str1); // string addr
-  push(str2); // substr addr
-  push(cnt2); // substr count
-  jmpb(PREP_FOR_SCAN);
-
-  // Substr count saved at sp
-  // Substr saved at sp+1*wordSize
-  // String saved at sp+2*wordSize
-
-  // Reload substr for rescan
-  bind(RELOAD_SUBSTR);
-  movl(cnt2, Address(rsp, 0));
-  movptr(str2, Address(rsp, wordSize));
-  // We came here after the beginninig of the substring was
-  // matched but the rest of it was not so we need to search
-  // again. Start from the next element after the previous match.
-  subptr(str1, result); // Restore counter
-  shrl(str1, 1);
-  addl(cnt1, str1);
-  decrementl(cnt1);
-  lea(str1, Address(result, 2)); // Reload string
-
-  // Load substr
-  bind(PREP_FOR_SCAN);
-  movdqu(vec, Address(str2, 0));
-  addl(cnt1, 8);  // prime the loop
-  subptr(str1, 16);
-
-  // Scan string for substr in 16-byte vectors
-  bind(SCAN_TO_SUBSTR);
-  subl(cnt1, 8);
-  addptr(str1, 16);
-
-  // pcmpestri
+  // This method uses pcmpestri inxtruction with bound registers
   //   inputs:
   //     xmm - substring
   //     rax - substring length (elements count)
-  //     mem - scaned string
+  //     mem - scanned string
+  //     rdx - string length (elements count)
+  //     0xd - mode: 1100 (substring search) + 01 (unsigned shorts)
+  //   outputs:
+  //     rcx - matched index in string
+  assert(cnt1 == rdx && cnt2 == rax && tmp == rcx, "pcmpestri");
+
+  Label RELOAD_SUBSTR, SCAN_TO_SUBSTR, SCAN_SUBSTR,
+        RET_FOUND, RET_NOT_FOUND, EXIT, FOUND_SUBSTR,
+        MATCH_SUBSTR_HEAD, RELOAD_STR, FOUND_CANDIDATE;
+
+  // Note, inline_string_indexOf() generates checks:
+  // if (substr.count > string.count) return -1;
+  // if (substr.count == 0) return 0;
+  assert(int_cnt2 >= 8, "this code isused only for cnt2 >= 8 chars");
+
+  // Load substring.
+  movdqu(vec, Address(str2, 0));
+  movl(cnt2, int_cnt2);
+  movptr(result, str1); // string addr
+
+  if (int_cnt2 > 8) {
+    jmpb(SCAN_TO_SUBSTR);
+
+    // Reload substr for rescan, this code
+    // is executed only for large substrings (> 8 chars)
+    bind(RELOAD_SUBSTR);
+    movdqu(vec, Address(str2, 0));
+    negptr(cnt2); // Jumped here with negative cnt2, convert to positive
+
+    bind(RELOAD_STR);
+    // We came here after the beginning of the substring was
+    // matched but the rest of it was not so we need to search
+    // again. Start from the next element after the previous match.
+
+    // cnt2 is number of substring reminding elements and
+    // cnt1 is number of string reminding elements when cmp failed.
+    // Restored cnt1 = cnt1 - cnt2 + int_cnt2
+    subl(cnt1, cnt2);
+    addl(cnt1, int_cnt2);
+    movl(cnt2, int_cnt2); // Now restore cnt2
+
+    decrementl(cnt1);     // Shift to next element
+    cmpl(cnt1, cnt2);
+    jccb(Assembler::negative, RET_NOT_FOUND);  // Left less then substring
+
+    addptr(result, 2);
+
+  } // (int_cnt2 > 8)
+
+  // Scan string for start of substr in 16-byte vectors
+  bind(SCAN_TO_SUBSTR);
+  pcmpestri(vec, Address(result, 0), 0x0d);
+  jccb(Assembler::below, FOUND_CANDIDATE);   // CF == 1
+  subl(cnt1, 8);
+  jccb(Assembler::lessEqual, RET_NOT_FOUND); // Scanned full string
+  cmpl(cnt1, cnt2);
+  jccb(Assembler::negative, RET_NOT_FOUND);  // Left less then substring
+  addptr(result, 16);
+  jmpb(SCAN_TO_SUBSTR);
+
+  // Found a potential substr
+  bind(FOUND_CANDIDATE);
+  // Matched whole vector if first element matched (tmp(rcx) == 0).
+  if (int_cnt2 == 8) {
+    jccb(Assembler::overflow, RET_FOUND);    // OF == 1
+  } else { // int_cnt2 > 8
+    jccb(Assembler::overflow, FOUND_SUBSTR);
+  }
+  // After pcmpestri tmp(rcx) contains matched element index
+  // Compute start addr of substr
+  lea(result, Address(result, tmp, Address::times_2));
+
+  // Make sure string is still long enough
+  subl(cnt1, tmp);
+  cmpl(cnt1, cnt2);
+  if (int_cnt2 == 8) {
+    jccb(Assembler::greaterEqual, SCAN_TO_SUBSTR);
+  } else { // int_cnt2 > 8
+    jccb(Assembler::greaterEqual, MATCH_SUBSTR_HEAD);
+  }
+  // Left less then substring.
+
+  bind(RET_NOT_FOUND);
+  movl(result, -1);
+  jmpb(EXIT);
+
+  if (int_cnt2 > 8) {
+    // This code is optimized for the case when whole substring
+    // is matched if its head is matched.
+    bind(MATCH_SUBSTR_HEAD);
+    pcmpestri(vec, Address(result, 0), 0x0d);
+    // Reload only string if does not match
+    jccb(Assembler::noOverflow, RELOAD_STR); // OF == 0
+
+    Label CONT_SCAN_SUBSTR;
+    // Compare the rest of substring (> 8 chars).
+    bind(FOUND_SUBSTR);
+    // First 8 chars are already matched.
+    negptr(cnt2);
+    addptr(cnt2, 8);
+
+    bind(SCAN_SUBSTR);
+    subl(cnt1, 8);
+    cmpl(cnt2, -8); // Do not read beyond substring
+    jccb(Assembler::lessEqual, CONT_SCAN_SUBSTR);
+    // Back-up strings to avoid reading beyond substring:
+    // cnt1 = cnt1 - cnt2 + 8
+    addl(cnt1, cnt2); // cnt2 is negative
+    addl(cnt1, 8);
+    movl(cnt2, 8); negptr(cnt2);
+    bind(CONT_SCAN_SUBSTR);
+    if (int_cnt2 < (int)G) {
+      movdqu(vec, Address(str2, cnt2, Address::times_2, int_cnt2*2));
+      pcmpestri(vec, Address(result, cnt2, Address::times_2, int_cnt2*2), 0x0d);
+    } else {
+      // calculate index in register to avoid integer overflow (int_cnt2*2)
+      movl(tmp, int_cnt2);
+      addptr(tmp, cnt2);
+      movdqu(vec, Address(str2, tmp, Address::times_2, 0));
+      pcmpestri(vec, Address(result, tmp, Address::times_2, 0), 0x0d);
+    }
+    // Need to reload strings pointers if not matched whole vector
+    jccb(Assembler::noOverflow, RELOAD_SUBSTR); // OF == 0
+    addptr(cnt2, 8);
+    jccb(Assembler::negative, SCAN_SUBSTR);
+    // Fall through if found full substring
+
+  } // (int_cnt2 > 8)
+
+  bind(RET_FOUND);
+  // Found result if we matched full small substring.
+  // Compute substr offset
+  subptr(result, str1);
+  shrl(result, 1); // index
+  bind(EXIT);
+
+} // string_indexofC8
+
+// Small strings are loaded through stack if they cross page boundary.
+void MacroAssembler::string_indexof(Register str1, Register str2,
+                                    Register cnt1, Register cnt2,
+                                    int int_cnt2,  Register result,
+                                    XMMRegister vec, Register tmp) {
+  assert(UseSSE42Intrinsics, "SSE4.2 is required");
+  //
+  // int_cnt2 is length of small (< 8 chars) constant substring
+  // or (-1) for non constant substring in which case its length
+  // is in cnt2 register.
+  //
+  // Note, inline_string_indexOf() generates checks:
+  // if (substr.count > string.count) return -1;
+  // if (substr.count == 0) return 0;
+  //
+  assert(int_cnt2 == -1 || (0 < int_cnt2 && int_cnt2 < 8), "should be != 0");
+
+  // This method uses pcmpestri inxtruction with bound registers
+  //   inputs:
+  //     xmm - substring
+  //     rax - substring length (elements count)
+  //     mem - scanned string
   //     rdx - string length (elements count)
   //     0xd - mode: 1100 (substring search) + 01 (unsigned shorts)
   //   outputs:
   //     rcx - matched index in string
   assert(cnt1 == rdx && cnt2 == rax && tmp == rcx, "pcmpestri");
 
-  pcmpestri(vec, Address(str1, 0), 0x0d);
-  jcc(Assembler::above, SCAN_TO_SUBSTR);      // CF == 0 && ZF == 0
-  jccb(Assembler::aboveEqual, RET_NOT_FOUND); // CF == 0
-
-  // Fallthrough: found a potential substr
+  Label RELOAD_SUBSTR, SCAN_TO_SUBSTR, SCAN_SUBSTR, ADJUST_STR,
+        RET_FOUND, RET_NOT_FOUND, CLEANUP, FOUND_SUBSTR,
+        FOUND_CANDIDATE;
+
+  { //========================================================
+    // We don't know where these strings are located
+    // and we can't read beyond them. Load them through stack.
+    Label BIG_STRINGS, CHECK_STR, COPY_SUBSTR, COPY_STR;
+
+    movptr(tmp, rsp); // save old SP
+
+    if (int_cnt2 > 0) {     // small (< 8 chars) constant substring
+      if (int_cnt2 == 1) {  // One char
+        load_unsigned_short(result, Address(str2, 0));
+        movdl(vec, result); // move 32 bits
+      } else if (int_cnt2 == 2) { // Two chars
+        movdl(vec, Address(str2, 0)); // move 32 bits
+      } else if (int_cnt2 == 4) { // Four chars
+        movq(vec, Address(str2, 0));  // move 64 bits
+      } else { // cnt2 = { 3, 5, 6, 7 }
+        // Array header size is 12 bytes in 32-bit VM
+        // + 6 bytes for 3 chars == 18 bytes,
+        // enough space to load vec and shift.
+        assert(HeapWordSize*typeArrayKlass::header_size() >= 12,"sanity");
+        movdqu(vec, Address(str2, (int_cnt2*2)-16));
+        psrldq(vec, 16-(int_cnt2*2));
+      }
+    } else { // not constant substring
+      cmpl(cnt2, 8);
+      jccb(Assembler::aboveEqual, BIG_STRINGS); // Both strings are big enough
+
+      // We can read beyond string if srt+16 does not cross page boundary
+      // since heaps are aligned and mapped by pages.
+      assert(os::vm_page_size() < (int)G, "default page should be small");
+      movl(result, str2); // We need only low 32 bits
+      andl(result, (os::vm_page_size()-1));
+      cmpl(result, (os::vm_page_size()-16));
+      jccb(Assembler::belowEqual, CHECK_STR);
+
+      // Move small strings to stack to allow load 16 bytes into vec.
+      subptr(rsp, 16);
+      int stk_offset = wordSize-2;
+      push(cnt2);
+
+      bind(COPY_SUBSTR);
+      load_unsigned_short(result, Address(str2, cnt2, Address::times_2, -2));
+      movw(Address(rsp, cnt2, Address::times_2, stk_offset), result);
+      decrement(cnt2);
+      jccb(Assembler::notZero, COPY_SUBSTR);
+
+      pop(cnt2);
+      movptr(str2, rsp);  // New substring address
+    } // non constant
+
+    bind(CHECK_STR);
+    cmpl(cnt1, 8);
+    jccb(Assembler::aboveEqual, BIG_STRINGS);
+
+    // Check cross page boundary.
+    movl(result, str1); // We need only low 32 bits
+    andl(result, (os::vm_page_size()-1));
+    cmpl(result, (os::vm_page_size()-16));
+    jccb(Assembler::belowEqual, BIG_STRINGS);
+
+    subptr(rsp, 16);
+    int stk_offset = -2;
+    if (int_cnt2 < 0) { // not constant
+      push(cnt2);
+      stk_offset += wordSize;
+    }
+    movl(cnt2, cnt1);
+
+    bind(COPY_STR);
+    load_unsigned_short(result, Address(str1, cnt2, Address::times_2, -2));
+    movw(Address(rsp, cnt2, Address::times_2, stk_offset), result);
+    decrement(cnt2);
+    jccb(Assembler::notZero, COPY_STR);
+
+    if (int_cnt2 < 0) { // not constant
+      pop(cnt2);
+    }
+    movptr(str1, rsp);  // New string address
+
+    bind(BIG_STRINGS);
+    // Load substring.
+    if (int_cnt2 < 0) { // -1
+      movdqu(vec, Address(str2, 0));
+      push(cnt2);       // substr count
+      push(str2);       // substr addr
+      push(str1);       // string addr
+    } else {
+      // Small (< 8 chars) constant substrings are loaded already.
+      movl(cnt2, int_cnt2);
+    }
+    push(tmp);  // original SP
+
+  } // Finished loading
+
+  //========================================================
+  // Start search
+  //
+
+  movptr(result, str1); // string addr
+
+  if (int_cnt2  < 0) {  // Only for non constant substring
+    jmpb(SCAN_TO_SUBSTR);
+
+    // SP saved at sp+0
+    // String saved at sp+1*wordSize
+    // Substr saved at sp+2*wordSize
+    // Substr count saved at sp+3*wordSize
+
+    // Reload substr for rescan, this code
+    // is executed only for large substrings (> 8 chars)
+    bind(RELOAD_SUBSTR);
+    movptr(str2, Address(rsp, 2*wordSize));
+    movl(cnt2, Address(rsp, 3*wordSize));
+    movdqu(vec, Address(str2, 0));
+    // We came here after the beginning of the substring was
+    // matched but the rest of it was not so we need to search
+    // again. Start from the next element after the previous match.
+    subptr(str1, result); // Restore counter
+    shrl(str1, 1);
+    addl(cnt1, str1);
+    decrementl(cnt1);   // Shift to next element
+    cmpl(cnt1, cnt2);
+    jccb(Assembler::negative, RET_NOT_FOUND);  // Left less then substring
+
+    addptr(result, 2);
+  } // non constant
+
+  // Scan string for start of substr in 16-byte vectors
+  bind(SCAN_TO_SUBSTR);
+  assert(cnt1 == rdx && cnt2 == rax && tmp == rcx, "pcmpestri");
+  pcmpestri(vec, Address(result, 0), 0x0d);
+  jccb(Assembler::below, FOUND_CANDIDATE);   // CF == 1
+  subl(cnt1, 8);
+  jccb(Assembler::lessEqual, RET_NOT_FOUND); // Scanned full string
+  cmpl(cnt1, cnt2);
+  jccb(Assembler::negative, RET_NOT_FOUND);  // Left less then substring
+  addptr(result, 16);
+
+  bind(ADJUST_STR);
+  cmpl(cnt1, 8); // Do not read beyond string
+  jccb(Assembler::greaterEqual, SCAN_TO_SUBSTR);
+  // Back-up string to avoid reading beyond string.
+  lea(result, Address(result, cnt1, Address::times_2, -16));
+  movl(cnt1, 8);
+  jmpb(SCAN_TO_SUBSTR);
+
+  // Found a potential substr
+  bind(FOUND_CANDIDATE);
+  // After pcmpestri tmp(rcx) contains matched element index
 
   // Make sure string is still long enough
   subl(cnt1, tmp);
   cmpl(cnt1, cnt2);
-  jccb(Assembler::negative, RET_NOT_FOUND);
-  // Compute start addr of substr
-  lea(str1, Address(str1, tmp, Address::times_2));
-  movptr(result, str1); // save
-
-  // Compare potential substr
-  addl(cnt1, 8);     // prime the loop
-  addl(cnt2, 8);
-  subptr(str1, 16);
-  subptr(str2, 16);
-
-  // Scan 16-byte vectors of string and substr
-  bind(SCAN_SUBSTR);
-  subl(cnt1, 8);
-  subl(cnt2, 8);
-  addptr(str1, 16);
-  addptr(str2, 16);
-  movdqu(vec, Address(str2, 0));
-  pcmpestri(vec, Address(str1, 0), 0x0d);
-  jcc(Assembler::noOverflow, RELOAD_SUBSTR); // OF == 0
-  jcc(Assembler::positive, SCAN_SUBSTR);     // SF == 0
-
-  // Compute substr offset
-  subptr(result, Address(rsp, 2*wordSize));
-  shrl(result, 1); // index
-  jmpb(CLEANUP);
+  jccb(Assembler::greaterEqual, FOUND_SUBSTR);
+  // Left less then substring.
 
   bind(RET_NOT_FOUND);
   movl(result, -1);
+  jmpb(CLEANUP);
+
+  bind(FOUND_SUBSTR);
+  // Compute start addr of substr
+  lea(result, Address(result, tmp, Address::times_2));
+
+  if (int_cnt2 > 0) { // Constant substring
+    // Repeat search for small substring (< 8 chars)
+    // from new point without reloading substring.
+    // Have to check that we don't read beyond string.
+    cmpl(tmp, 8-int_cnt2);
+    jccb(Assembler::greater, ADJUST_STR);
+    // Fall through if matched whole substring.
+  } else { // non constant
+    assert(int_cnt2 == -1, "should be != 0");
+
+    addl(tmp, cnt2);
+    // Found result if we matched whole substring.
+    cmpl(tmp, 8);
+    jccb(Assembler::lessEqual, RET_FOUND);
+
+    // Repeat search for small substring (<= 8 chars)
+    // from new point 'str1' without reloading substring.
+    cmpl(cnt2, 8);
+    // Have to check that we don't read beyond string.
+    jccb(Assembler::lessEqual, ADJUST_STR);
+
+    Label CHECK_NEXT, CONT_SCAN_SUBSTR, RET_FOUND_LONG;
+    // Compare the rest of substring (> 8 chars).
+    movptr(str1, result);
+
+    cmpl(tmp, cnt2);
+    // First 8 chars are already matched.
+    jccb(Assembler::equal, CHECK_NEXT);
+
+    bind(SCAN_SUBSTR);
+    pcmpestri(vec, Address(str1, 0), 0x0d);
+    // Need to reload strings pointers if not matched whole vector
+    jcc(Assembler::noOverflow, RELOAD_SUBSTR); // OF == 0
+
+    bind(CHECK_NEXT);
+    subl(cnt2, 8);
+    jccb(Assembler::lessEqual, RET_FOUND_LONG); // Found full substring
+    addptr(str1, 16);
+    addptr(str2, 16);
+    subl(cnt1, 8);
+    cmpl(cnt2, 8); // Do not read beyond substring
+    jccb(Assembler::greaterEqual, CONT_SCAN_SUBSTR);
+    // Back-up strings to avoid reading beyond substring.
+    lea(str2, Address(str2, cnt2, Address::times_2, -16));
+    lea(str1, Address(str1, cnt2, Address::times_2, -16));
+    subl(cnt1, cnt2);
+    movl(cnt2, 8);
+    addl(cnt1, 8);
+    bind(CONT_SCAN_SUBSTR);
+    movdqu(vec, Address(str2, 0));
+    jmpb(SCAN_SUBSTR);
+
+    bind(RET_FOUND_LONG);
+    movptr(str1, Address(rsp, wordSize));
+  } // non constant
+
+  bind(RET_FOUND);
+  // Compute substr offset
+  subptr(result, str1);
+  shrl(result, 1); // index
 
   bind(CLEANUP);
-  addptr(rsp, 3*wordSize);
-}
+  pop(rsp); // restore SP
+
+} // string_indexof
 
 // Compare strings.
 void MacroAssembler::string_compare(Register str1, Register str2,
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1121,6 +1121,7 @@
 
   void movdl(XMMRegister dst, Register src);
   void movdl(Register dst, XMMRegister src);
+  void movdl(XMMRegister dst, Address src);
 
   // Move Double Quadword
   void movdq(XMMRegister dst, Register src);
@@ -1288,9 +1289,12 @@
   void pshuflw(XMMRegister dst, XMMRegister src, int mode);
   void pshuflw(XMMRegister dst, Address src,     int mode);
 
-  // Shift Right Logical Quadword Immediate
+  // Shift Right by bits Logical Quadword Immediate
   void psrlq(XMMRegister dst, int shift);
 
+  // Shift Right by bytes Logical DoubleQuadword Immediate
+  void psrldq(XMMRegister dst, int shift);
+
   // Logical Compare Double Quadword
   void ptest(XMMRegister dst, XMMRegister src);
   void ptest(XMMRegister dst, Address src);
@@ -2290,10 +2294,22 @@
   void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
 
   // IndexOf strings.
+  // Small strings are loaded through stack if they cross page boundary.
   void string_indexof(Register str1, Register str2,
-                      Register cnt1, Register cnt2, Register result,
+                      Register cnt1, Register cnt2,
+                      int int_cnt2,  Register result,
                       XMMRegister vec, Register tmp);
 
+  // IndexOf for constant substrings with size >= 8 elements
+  // which don't need to be loaded through stack.
+  void string_indexofC8(Register str1, Register str2,
+                      Register cnt1, Register cnt2,
+                      int int_cnt2,  Register result,
+                      XMMRegister vec, Register tmp);
+
+    // Smallest code: we don't need to load through stack,
+    // check string tail.
+
   // Compare strings.
   void string_compare(Register str1, Register str2,
                       Register cnt1, Register cnt2, Register result,
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -456,10 +456,8 @@
   __ verify_not_null_oop(rax);
 
   // search an exception handler (rax: exception oop, rdx: throwing pc)
-  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
-
-  __ stop("should not reach here");
-
+  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id)));
+  __ should_not_reach_here();
   assert(code_offset() - offset <= exception_handler_size, "overflow");
   __ end_a_stub();
 
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -248,11 +248,14 @@
 #ifdef _LP64
   align_dummy_0, align_dummy_1,
 #endif // _LP64
-  dummy1, SLOT2(dummy1H)                                                                    // 0, 4
-  dummy2, SLOT2(dummy2H)                                                                    // 8, 12
-  // Two temps to be used as needed by users of save/restore callee registers
-  temp_2_off, SLOT2(temp_2H_off)                                                            // 16, 20
-  temp_1_off, SLOT2(temp_1H_off)                                                            // 24, 28
+#ifdef _WIN64
+  // Windows always allocates space for it's argument registers (see
+  // frame::arg_reg_save_area_bytes).
+  arg_reg_save_1, arg_reg_save_1H,                                                          // 0, 4
+  arg_reg_save_2, arg_reg_save_2H,                                                          // 8, 12
+  arg_reg_save_3, arg_reg_save_3H,                                                          // 16, 20
+  arg_reg_save_4, arg_reg_save_4H,                                                          // 24, 28
+#endif // _WIN64
   xmm_regs_as_doubles_off,                                                                  // 32
   float_regs_as_doubles_off = xmm_regs_as_doubles_off + xmm_regs_as_doubles_size_in_slots,  // 160
   fpu_state_off = float_regs_as_doubles_off + float_regs_as_doubles_size_in_slots,          // 224
@@ -282,24 +285,7 @@
   rax_off, SLOT2(raxH_off)                                                                  // 480, 484
   saved_rbp_off, SLOT2(saved_rbpH_off)                                                      // 488, 492
   return_off, SLOT2(returnH_off)                                                            // 496, 500
-  reg_save_frame_size,  // As noted: neglects any parameters to runtime                     // 504
-
-#ifdef _WIN64
-  c_rarg0_off = rcx_off,
-#else
-  c_rarg0_off = rdi_off,
-#endif // WIN64
-
-  // equates
-
-  // illegal instruction handler
-  continue_dest_off = temp_1_off,
-
-  // deoptimization equates
-  fp0_off = float_regs_as_doubles_off, // slot for java float/double return value
-  xmm0_off = xmm_regs_as_doubles_off,  // slot for java float/double return value
-  deopt_type = temp_2_off,             // slot for type of deopt in progress
-  ret_type = temp_1_off                // slot for return type
+  reg_save_frame_size   // As noted: neglects any parameters to runtime                     // 504
 };
 
 
@@ -405,11 +391,6 @@
                                    bool save_fpu_registers = true) {
   __ block_comment("save_live_registers");
 
-  // 64bit passes the args in regs to the c++ runtime
-  int frame_size_in_slots = reg_save_frame_size NOT_LP64(+ num_rt_args); // args + thread
-  // frame_size = round_to(frame_size, 4);
-  sasm->set_frame_size(frame_size_in_slots / VMRegImpl::slots_per_word );
-
   __ pusha();         // integer registers
 
   // assert(float_regs_as_doubles_off % 2 == 0, "misaligned offset");
@@ -642,19 +623,58 @@
 }
 
 
-void Runtime1::generate_handle_exception(StubAssembler *sasm, OopMapSet* oop_maps, OopMap* oop_map, bool save_fpu_registers) {
+OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler *sasm) {
+  __ block_comment("generate_handle_exception");
+
   // incoming parameters
   const Register exception_oop = rax;
-  const Register exception_pc = rdx;
+  const Register exception_pc  = rdx;
   // other registers used in this stub
-  const Register real_return_addr = rbx;
   const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread);
 
-  __ block_comment("generate_handle_exception");
+  // Save registers, if required.
+  OopMapSet* oop_maps = new OopMapSet();
+  OopMap* oop_map = NULL;
+  switch (id) {
+  case forward_exception_id:
+    // We're handling an exception in the context of a compiled frame.
+    // The registers have been saved in the standard places.  Perform
+    // an exception lookup in the caller and dispatch to the handler
+    // if found.  Otherwise unwind and dispatch to the callers
+    // exception handler.
+    oop_map = generate_oop_map(sasm, 1 /*thread*/);
+
+    // load and clear pending exception oop into RAX
+    __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset()));
+    __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD);
+
+    // load issuing PC (the return address for this stub) into rdx
+    __ movptr(exception_pc, Address(rbp, 1*BytesPerWord));
+
+    // make sure that the vm_results are cleared (may be unnecessary)
+    __ movptr(Address(thread, JavaThread::vm_result_offset()),   NULL_WORD);
+    __ movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD);
+    break;
+  case handle_exception_nofpu_id:
+  case handle_exception_id:
+    // At this point all registers MAY be live.
+    oop_map = save_live_registers(sasm, 1 /*thread*/, id == handle_exception_nofpu_id);
+    break;
+  case handle_exception_from_callee_id: {
+    // At this point all registers except exception oop (RAX) and
+    // exception pc (RDX) are dead.
+    const int frame_size = 2 /*BP, return address*/ NOT_LP64(+ 1 /*thread*/) WIN64_ONLY(+ frame::arg_reg_save_area_bytes / BytesPerWord);
+    oop_map = new OopMap(frame_size * VMRegImpl::slots_per_word, 0);
+    sasm->set_frame_size(frame_size);
+    WIN64_ONLY(__ subq(rsp, frame::arg_reg_save_area_bytes));
+    break;
+  }
+  default:  ShouldNotReachHere();
+  }
 
 #ifdef TIERED
   // C2 can leave the fpu stack dirty
-  if (UseSSE < 2 ) {
+  if (UseSSE < 2) {
     __ empty_FPU_stack();
   }
 #endif // TIERED
@@ -686,11 +706,7 @@
   // save exception oop and issuing pc into JavaThread
   // (exception handler will load it from here)
   __ movptr(Address(thread, JavaThread::exception_oop_offset()), exception_oop);
-  __ movptr(Address(thread, JavaThread::exception_pc_offset()), exception_pc);
-
-  // save real return address (pc that called this stub)
-  __ movptr(real_return_addr, Address(rbp, 1*BytesPerWord));
-  __ movptr(Address(rsp, temp_1_off * VMRegImpl::stack_slot_size), real_return_addr);
+  __ movptr(Address(thread, JavaThread::exception_pc_offset()),  exception_pc);
 
   // patch throwing pc into return address (has bci & oop map)
   __ movptr(Address(rbp, 1*BytesPerWord), exception_pc);
@@ -700,33 +716,41 @@
   int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
   oop_maps->add_gc_map(call_offset, oop_map);
 
-  // rax,: handler address
+  // rax: handler address
   //      will be the deopt blob if nmethod was deoptimized while we looked up
   //      handler regardless of whether handler existed in the nmethod.
 
   // only rax, is valid at this time, all other registers have been destroyed by the runtime call
   __ invalidate_registers(false, true, true, true, true, true);
 
-#ifdef ASSERT
-  // Do we have an exception handler in the nmethod?
-  Label done;
-  __ testptr(rax, rax);
-  __ jcc(Assembler::notZero, done);
-  __ stop("no handler found");
-  __ bind(done);
-#endif
-
-  // exception handler found
-  // patch the return address -> the stub will directly return to the exception handler
+  // patch the return address, this stub will directly return to the exception handler
   __ movptr(Address(rbp, 1*BytesPerWord), rax);
 
-  // restore registers
-  restore_live_registers(sasm, save_fpu_registers);
+  switch (id) {
+  case forward_exception_id:
+  case handle_exception_nofpu_id:
+  case handle_exception_id:
+    // Restore the registers that were saved at the beginning.
+    restore_live_registers(sasm, id == handle_exception_nofpu_id);
+    break;
+  case handle_exception_from_callee_id:
+    // WIN64_ONLY: No need to add frame::arg_reg_save_area_bytes to SP
+    // since we do a leave anyway.
 
-  // return to exception handler
-  __ leave();
-  __ ret(0);
+    // Pop the return address since we are possibly changing SP (restoring from BP).
+    __ leave();
+    __ pop(rcx);
 
+    // Restore SP from BP if the exception PC is a method handle call site.
+    NOT_LP64(__ get_thread(thread);)
+    __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
+    __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save);
+    __ jmp(rcx);  // jump to exception handler
+    break;
+  default:  ShouldNotReachHere();
+  }
+
+  return oop_maps;
 }
 
 
@@ -791,7 +815,7 @@
   // the pop is also necessary to simulate the effect of a ret(0)
   __ pop(exception_pc);
 
-  // Restore SP from BP if the exception PC is a MethodHandle call site.
+  // Restore SP from BP if the exception PC is a method handle call site.
   NOT_LP64(__ get_thread(thread);)
   __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
   __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save);
@@ -934,7 +958,6 @@
   __ ret(0);
 
   return oop_maps;
-
 }
 
 
@@ -952,35 +975,9 @@
   switch (id) {
     case forward_exception_id:
       {
-        // we're handling an exception in the context of a compiled
-        // frame.  The registers have been saved in the standard
-        // places.  Perform an exception lookup in the caller and
-        // dispatch to the handler if found.  Otherwise unwind and
-        // dispatch to the callers exception handler.
-
-        const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread);
-        const Register exception_oop = rax;
-        const Register exception_pc = rdx;
-
-        // load pending exception oop into rax,
-        __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset()));
-        // clear pending exception
-        __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD);
-
-        // load issuing PC (the return address for this stub) into rdx
-        __ movptr(exception_pc, Address(rbp, 1*BytesPerWord));
-
-        // make sure that the vm_results are cleared (may be unnecessary)
-        __ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD);
-        __ movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD);
-
-        // verify that that there is really a valid exception in rax,
-        __ verify_not_null_oop(exception_oop);
-
-        oop_maps = new OopMapSet();
-        OopMap* oop_map = generate_oop_map(sasm, 1);
-        generate_handle_exception(sasm, oop_maps, oop_map);
-        __ stop("should not reach here");
+        oop_maps = generate_handle_exception(id, sasm);
+        __ leave();
+        __ ret(0);
       }
       break;
 
@@ -1315,13 +1312,15 @@
       break;
 
     case handle_exception_nofpu_id:
-      save_fpu_registers = false;
-      // fall through
     case handle_exception_id:
       { StubFrame f(sasm, "handle_exception", dont_gc_arguments);
-        oop_maps = new OopMapSet();
-        OopMap* oop_map = save_live_registers(sasm, 1, save_fpu_registers);
-        generate_handle_exception(sasm, oop_maps, oop_map, save_fpu_registers);
+        oop_maps = generate_handle_exception(id, sasm);
+      }
+      break;
+
+    case handle_exception_from_callee_id:
+      { StubFrame f(sasm, "handle_exception_from_callee", dont_gc_arguments);
+        oop_maps = generate_handle_exception(id, sasm);
       }
       break;
 
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -419,6 +419,7 @@
 
   // some handy addresses
   Address rbx_method_fie(     rbx,      methodOopDesc::from_interpreted_offset() );
+  Address rbx_method_fce(     rbx,      methodOopDesc::from_compiled_offset() );
 
   Address rcx_mh_vmtarget(    rcx_recv, java_dyn_MethodHandle::vmtarget_offset_in_bytes() );
   Address rcx_dmh_vmindex(    rcx_recv, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes() );
@@ -448,12 +449,10 @@
   case _raise_exception:
     {
       // Not a real MH entry, but rather shared code for raising an
-      // exception.  Since we use a C2I adapter to set up the
-      // interpreter state, arguments are expected in compiler
-      // argument registers.
+      // exception.  Since we use the compiled entry, arguments are
+      // expected in compiler argument registers.
       assert(raise_exception_method(), "must be set");
-      address c2i_entry = raise_exception_method()->get_c2i_entry();
-      assert(c2i_entry, "method must be linked");
+      assert(raise_exception_method()->from_compiled_entry(), "method must be linked");
 
       const Register rdi_pc = rax;
       __ pop(rdi_pc);  // caller PC
@@ -472,13 +471,10 @@
       __ jccb(Assembler::zero, L_no_method);
       __ verify_oop(rbx_method);
 
-      // 32-bit: push remaining arguments as if coming from the compiler.
       NOT_LP64(__ push(rarg2_required));
+      __ push(rdi_pc);         // restore caller PC
+      __ jmp(rbx_method_fce);  // jump to compiled entry
 
-      __ push(rdi_pc);  // restore caller PC
-      __ jump(ExternalAddress(c2i_entry));  // do C2I transition
-
-      // If we get here, the Java runtime did not do its job of creating the exception.
       // Do something that is at least causes a valid throw from the interpreter.
       __ bind(L_no_method);
       __ push(rarg2_required);
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -439,10 +439,6 @@
     // Verify that there is really a valid exception in RAX.
     __ verify_oop(exception_oop);
 
-    // Restore SP from BP if the exception PC is a MethodHandle call site.
-    __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
-    __ cmovptr(Assembler::notEqual, rsp, rbp);
-
     // continue at exception handler (return address removed)
     // rax: exception
     // rbx: exception handler
@@ -733,18 +729,19 @@
   //  Input:
   //     start   -  starting address
   //     count   -  element count
-  void  gen_write_ref_array_pre_barrier(Register start, Register count) {
+  void  gen_write_ref_array_pre_barrier(Register start, Register count, bool uninitialized_target) {
     assert_different_registers(start, count);
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
       case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
-        {
-          __ pusha();                      // push registers
-          __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),
-                          start, count);
-          __ popa();
-        }
+        // With G1, don't generate the call if we statically know that the target in uninitialized
+        if (!uninitialized_target) {
+           __ pusha();                      // push registers
+           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),
+                           start, count);
+           __ popa();
+         }
         break;
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
@@ -923,7 +920,8 @@
 
   address generate_disjoint_copy(BasicType t, bool aligned,
                                  Address::ScaleFactor sf,
-                                 address* entry, const char *name) {
+                                 address* entry, const char *name,
+                                 bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -945,16 +943,19 @@
     __ movptr(from , Address(rsp, 12+ 4));
     __ movptr(to   , Address(rsp, 12+ 8));
     __ movl(count, Address(rsp, 12+ 12));
+
+    if (entry != NULL) {
+      *entry = __ pc(); // Entry point from conjoint arraycopy stub.
+      BLOCK_COMMENT("Entry:");
+    }
+
     if (t == T_OBJECT) {
       __ testl(count, count);
       __ jcc(Assembler::zero, L_0_count);
-      gen_write_ref_array_pre_barrier(to, count);
+      gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
       __ mov(saved_to, to);          // save 'to'
     }
 
-    *entry = __ pc(); // Entry point from conjoint arraycopy stub.
-    BLOCK_COMMENT("Entry:");
-
     __ subptr(to, from); // to --> to_from
     __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
     __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
@@ -1085,7 +1086,8 @@
   address generate_conjoint_copy(BasicType t, bool aligned,
                                  Address::ScaleFactor sf,
                                  address nooverlap_target,
-                                 address* entry, const char *name) {
+                                 address* entry, const char *name,
+                                 bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1108,23 +1110,17 @@
     __ movptr(src  , Address(rsp, 12+ 4));   // from
     __ movptr(dst  , Address(rsp, 12+ 8));   // to
     __ movl2ptr(count, Address(rsp, 12+12)); // count
-    if (t == T_OBJECT) {
-       gen_write_ref_array_pre_barrier(dst, count);
-    }
 
     if (entry != NULL) {
       *entry = __ pc(); // Entry point from generic arraycopy stub.
       BLOCK_COMMENT("Entry:");
     }
 
-    if (t == T_OBJECT) {
-      __ testl(count, count);
-      __ jcc(Assembler::zero, L_0_count);
-    }
+    // nooverlap_target expects arguments in rsi and rdi.
     __ mov(from, src);
     __ mov(to  , dst);
 
-    // arrays overlap test
+    // arrays overlap test: dispatch to disjoint stub if necessary.
     RuntimeAddress nooverlap(nooverlap_target);
     __ cmpptr(dst, src);
     __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
@@ -1132,6 +1128,12 @@
     __ cmpptr(dst, end);
     __ jump_cc(Assembler::aboveEqual, nooverlap);
 
+    if (t == T_OBJECT) {
+      __ testl(count, count);
+      __ jcc(Assembler::zero, L_0_count);
+      gen_write_ref_array_pre_barrier(dst, count, dest_uninitialized);
+    }
+
     // copy from high to low
     __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
     __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
@@ -1416,7 +1418,7 @@
   //    rax, ==  0  -  success
   //    rax, == -1^K - failure, where K is partial transfer count
   //
-  address generate_checkcast_copy(const char *name, address* entry) {
+  address generate_checkcast_copy(const char *name, address* entry, bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1451,8 +1453,10 @@
     __ movptr(to,         to_arg);
     __ movl2ptr(length, length_arg);
 
-    *entry = __ pc(); // Entry point from generic arraycopy stub.
-    BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc(); // Entry point from generic arraycopy stub.
+      BLOCK_COMMENT("Entry:");
+    }
 
     //---------------------------------------------------------------
     // Assembler stub will be used for this call to arraycopy
@@ -1475,7 +1479,7 @@
     Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
 
     // Copy from low to high addresses, indexed from the end of each array.
-    gen_write_ref_array_pre_barrier(to, count);
+    gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
     __ lea(end_from, end_from_addr);
     __ lea(end_to,   end_to_addr);
     assert(length == count, "");        // else fix next line:
@@ -2038,6 +2042,15 @@
         generate_conjoint_copy(T_OBJECT, true, Address::times_ptr,  entry,
                                &entry_oop_arraycopy, "oop_arraycopy");
 
+    StubRoutines::_oop_disjoint_arraycopy_uninit =
+        generate_disjoint_copy(T_OBJECT, true, Address::times_ptr, &entry,
+                               "oop_disjoint_arraycopy_uninit",
+                               /*dest_uninitialized*/true);
+    StubRoutines::_oop_arraycopy_uninit =
+        generate_conjoint_copy(T_OBJECT, true, Address::times_ptr,  entry,
+                               NULL, "oop_arraycopy_uninit",
+                               /*dest_uninitialized*/true);
+
     StubRoutines::_jlong_disjoint_arraycopy =
         generate_disjoint_long_copy(&entry, "jlong_disjoint_arraycopy");
     StubRoutines::_jlong_arraycopy =
@@ -2051,20 +2064,20 @@
     StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
     StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
 
-    StubRoutines::_arrayof_jint_disjoint_arraycopy  =
-        StubRoutines::_jint_disjoint_arraycopy;
-    StubRoutines::_arrayof_oop_disjoint_arraycopy   =
-        StubRoutines::_oop_disjoint_arraycopy;
-    StubRoutines::_arrayof_jlong_disjoint_arraycopy =
-        StubRoutines::_jlong_disjoint_arraycopy;
+    StubRoutines::_arrayof_jint_disjoint_arraycopy       = StubRoutines::_jint_disjoint_arraycopy;
+    StubRoutines::_arrayof_oop_disjoint_arraycopy        = StubRoutines::_oop_disjoint_arraycopy;
+    StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = StubRoutines::_oop_disjoint_arraycopy_uninit;
+    StubRoutines::_arrayof_jlong_disjoint_arraycopy      = StubRoutines::_jlong_disjoint_arraycopy;
 
-    StubRoutines::_arrayof_jint_arraycopy  = StubRoutines::_jint_arraycopy;
-    StubRoutines::_arrayof_oop_arraycopy   = StubRoutines::_oop_arraycopy;
-    StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy;
+    StubRoutines::_arrayof_jint_arraycopy       = StubRoutines::_jint_arraycopy;
+    StubRoutines::_arrayof_oop_arraycopy        = StubRoutines::_oop_arraycopy;
+    StubRoutines::_arrayof_oop_arraycopy_uninit = StubRoutines::_oop_arraycopy_uninit;
+    StubRoutines::_arrayof_jlong_arraycopy      = StubRoutines::_jlong_arraycopy;
 
     StubRoutines::_checkcast_arraycopy =
-        generate_checkcast_copy("checkcast_arraycopy",
-                                  &entry_checkcast_arraycopy);
+        generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
+    StubRoutines::_checkcast_arraycopy_uninit =
+        generate_checkcast_copy("checkcast_arraycopy_uninit", NULL, /*dest_uninitialized*/true);
 
     StubRoutines::_unsafe_arraycopy =
         generate_unsafe_copy("unsafe_arraycopy",
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1057,20 +1057,6 @@
     return start;
   }
 
-  static address disjoint_byte_copy_entry;
-  static address disjoint_short_copy_entry;
-  static address disjoint_int_copy_entry;
-  static address disjoint_long_copy_entry;
-  static address disjoint_oop_copy_entry;
-
-  static address byte_copy_entry;
-  static address short_copy_entry;
-  static address int_copy_entry;
-  static address long_copy_entry;
-  static address oop_copy_entry;
-
-  static address checkcast_copy_entry;
-
   //
   // Verify that a register contains clean 32-bits positive value
   // (high 32-bits are 0) so it could be used in 64-bits shifts.
@@ -1173,34 +1159,35 @@
   // Generate code for an array write pre barrier
   //
   //     addr    -  starting address
-  //     count    -  element count
+  //     count   -  element count
+  //     tmp     - scratch register
   //
   //     Destroy no registers!
   //
-  void  gen_write_ref_array_pre_barrier(Register addr, Register count) {
+  void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
       case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
-        {
-          __ pusha();                      // push registers
-          if (count == c_rarg0) {
-            if (addr == c_rarg1) {
-              // exactly backwards!!
-              __ xchgptr(c_rarg1, c_rarg0);
-            } else {
-              __ movptr(c_rarg1, count);
-              __ movptr(c_rarg0, addr);
-            }
-
-          } else {
-            __ movptr(c_rarg0, addr);
-            __ movptr(c_rarg1, count);
-          }
-          __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
-          __ popa();
+        // With G1, don't generate the call if we statically know that the target in uninitialized
+        if (!dest_uninitialized) {
+           __ pusha();                      // push registers
+           if (count == c_rarg0) {
+             if (addr == c_rarg1) {
+               // exactly backwards!!
+               __ xchgptr(c_rarg1, c_rarg0);
+             } else {
+               __ movptr(c_rarg1, count);
+               __ movptr(c_rarg0, addr);
+             }
+           } else {
+             __ movptr(c_rarg0, addr);
+             __ movptr(c_rarg1, count);
+           }
+           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
+           __ popa();
         }
-        break;
+         break;
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
       case BarrierSet::ModRef:
@@ -1379,7 +1366,7 @@
   //   disjoint_byte_copy_entry is set to the no-overlap entry point
   //   used by generate_conjoint_byte_copy().
   //
-  address generate_disjoint_byte_copy(bool aligned, const char *name) {
+  address generate_disjoint_byte_copy(bool aligned, address* entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1399,9 +1386,11 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    disjoint_byte_copy_entry = __ pc();
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+    if (entry != NULL) {
+      *entry = __ pc();
+       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
@@ -1479,7 +1468,8 @@
   // dwords or qwords that span cache line boundaries will still be loaded
   // and stored atomically.
   //
-  address generate_conjoint_byte_copy(bool aligned, const char *name) {
+  address generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
+                                      address* entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1494,11 +1484,13 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    byte_copy_entry = __ pc();
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-
-    array_overlap_test(disjoint_byte_copy_entry, Address::times_1);
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
+
+    array_overlap_test(nooverlap_target, Address::times_1);
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
 
@@ -1574,7 +1566,7 @@
   //   disjoint_short_copy_entry is set to the no-overlap entry point
   //   used by generate_conjoint_short_copy().
   //
-  address generate_disjoint_short_copy(bool aligned, const char *name) {
+  address generate_disjoint_short_copy(bool aligned, address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1593,9 +1585,11 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    disjoint_short_copy_entry = __ pc();
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
 
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
@@ -1686,7 +1680,8 @@
   // or qwords that span cache line boundaries will still be loaded
   // and stored atomically.
   //
-  address generate_conjoint_short_copy(bool aligned, const char *name) {
+  address generate_conjoint_short_copy(bool aligned, address nooverlap_target,
+                                       address *entry, const char *name) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1701,11 +1696,13 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    short_copy_entry = __ pc();
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-
-    array_overlap_test(disjoint_short_copy_entry, Address::times_2);
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
+
+    array_overlap_test(nooverlap_target, Address::times_2);
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
 
@@ -1773,7 +1770,8 @@
   //   disjoint_int_copy_entry is set to the no-overlap entry point
   //   used by generate_conjoint_int_oop_copy().
   //
-  address generate_disjoint_int_oop_copy(bool aligned, bool is_oop, const char *name) {
+  address generate_disjoint_int_oop_copy(bool aligned, bool is_oop, address* entry,
+                                         const char *name, bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1793,21 +1791,17 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    (is_oop ? disjoint_oop_copy_entry : disjoint_int_copy_entry) = __ pc();
-
-    if (is_oop) {
-      // no registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2);
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
     }
 
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
-
     if (is_oop) {
       __ movq(saved_to, to);
+      gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
     }
 
     // 'from', 'to' and 'count' are now valid
@@ -1867,7 +1861,9 @@
   // the hardware handle it.  The two dwords within qwords that span
   // cache line boundaries will still be loaded and stored atomicly.
   //
-  address generate_conjoint_int_oop_copy(bool aligned, bool is_oop, const char *name) {
+  address generate_conjoint_int_oop_copy(bool aligned, bool is_oop, address nooverlap_target,
+                                         address *entry, const char *name,
+                                         bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1882,20 +1878,21 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
+    if (entry != NULL) {
+      *entry = __ pc();
+       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
+    }
+
+    array_overlap_test(nooverlap_target, Address::times_4);
+    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
+                      // r9 and r10 may be used to save non-volatile registers
+
     if (is_oop) {
       // no registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2);
+      gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
     }
 
-    (is_oop ? oop_copy_entry : int_copy_entry) = __ pc();
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-
-    array_overlap_test(is_oop ? disjoint_oop_copy_entry : disjoint_int_copy_entry,
-                       Address::times_4);
-    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
-                      // r9 and r10 may be used to save non-volatile registers
-
     assert_clean_int(count, rax); // Make sure 'count' is clean int.
     // 'from', 'to' and 'count' are now valid
     __ movptr(dword_count, count);
@@ -1959,7 +1956,8 @@
   //   disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
   //   no-overlap entry point used by generate_conjoint_long_oop_copy().
   //
-  address generate_disjoint_long_oop_copy(bool aligned, bool is_oop, const char *name) {
+  address generate_disjoint_long_oop_copy(bool aligned, bool is_oop, address *entry,
+                                          const char *name, bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -1978,20 +1976,19 @@
     // Save no-overlap entry point for generate_conjoint_long_oop_copy()
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    if (is_oop) {
-      disjoint_oop_copy_entry  = __ pc();
-      // no registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2);
-    } else {
-      disjoint_long_copy_entry = __ pc();
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
     }
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
 
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
-
     // 'from', 'to' and 'qword_count' are now valid
+    if (is_oop) {
+      // no registers are destroyed by this call
+      gen_write_ref_array_pre_barrier(to, qword_count, dest_uninitialized);
+    }
 
     // Copy from low to high addresses.  Use 'to' as scratch.
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
@@ -2045,7 +2042,9 @@
   //   c_rarg1   - destination array address
   //   c_rarg2   - element count, treated as ssize_t, can be zero
   //
-  address generate_conjoint_long_oop_copy(bool aligned, bool is_oop, const char *name) {
+  address generate_conjoint_long_oop_copy(bool aligned, bool is_oop,
+                                          address nooverlap_target, address *entry,
+                                          const char *name, bool dest_uninitialized = false) {
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
@@ -2059,31 +2058,21 @@
     __ enter(); // required for proper stackwalking of RuntimeStub frame
     assert_clean_int(c_rarg2, rax);    // Make sure 'count' is clean int.
 
-    address disjoint_copy_entry = NULL;
-    if (is_oop) {
-      assert(!UseCompressedOops, "shouldn't be called for compressed oops");
-      disjoint_copy_entry = disjoint_oop_copy_entry;
-      oop_copy_entry  = __ pc();
-      array_overlap_test(disjoint_oop_copy_entry, Address::times_8);
-    } else {
-      disjoint_copy_entry = disjoint_long_copy_entry;
-      long_copy_entry = __ pc();
-      array_overlap_test(disjoint_long_copy_entry, Address::times_8);
+    if (entry != NULL) {
+      *entry = __ pc();
+      // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
+      BLOCK_COMMENT("Entry:");
     }
-    BLOCK_COMMENT("Entry:");
-    // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
-
-    array_overlap_test(disjoint_copy_entry, Address::times_8);
+
+    array_overlap_test(nooverlap_target, Address::times_8);
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
-
     // 'from', 'to' and 'qword_count' are now valid
-
     if (is_oop) {
       // Save to and count for store barrier
       __ movptr(saved_count, qword_count);
       // No registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(to, saved_count);
+      gen_write_ref_array_pre_barrier(to, saved_count, dest_uninitialized);
     }
 
     __ jmp(L_copy_32_bytes);
@@ -2162,7 +2151,8 @@
   //    rax ==  0  -  success
   //    rax == -1^K - failure, where K is partial transfer count
   //
-  address generate_checkcast_copy(const char *name) {
+  address generate_checkcast_copy(const char *name, address *entry,
+                                  bool dest_uninitialized = false) {
 
     Label L_load_element, L_store_element, L_do_card_marks, L_done;
 
@@ -2216,8 +2206,10 @@
 #endif
 
     // Caller of this entry point must set up the argument registers.
-    checkcast_copy_entry  = __ pc();
-    BLOCK_COMMENT("Entry:");
+    if (entry != NULL) {
+      *entry = __ pc();
+      BLOCK_COMMENT("Entry:");
+    }
 
     // allocate spill slots for r13, r14
     enum {
@@ -2254,7 +2246,7 @@
     Address from_element_addr(end_from, count, TIMES_OOP, 0);
     Address   to_element_addr(end_to,   count, TIMES_OOP, 0);
 
-    gen_write_ref_array_pre_barrier(to, count);
+    gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
 
     // Copy from low to high addresses, indexed from the end of each array.
     __ lea(end_from, end_from_addr);
@@ -2334,7 +2326,9 @@
   // Examines the alignment of the operands and dispatches
   // to a long, int, short, or byte copy loop.
   //
-  address generate_unsafe_copy(const char *name) {
+  address generate_unsafe_copy(const char *name,
+                               address byte_copy_entry, address short_copy_entry,
+                               address int_copy_entry, address long_copy_entry) {
 
     Label L_long_aligned, L_int_aligned, L_short_aligned;
 
@@ -2432,7 +2426,10 @@
   //    rax ==  0  -  success
   //    rax == -1^K - failure, where K is partial transfer count
   //
-  address generate_generic_copy(const char *name) {
+  address generate_generic_copy(const char *name,
+                                address byte_copy_entry, address short_copy_entry,
+                                address int_copy_entry, address long_copy_entry,
+                                address oop_copy_entry, address checkcast_copy_entry) {
 
     Label L_failed, L_failed_0, L_objArray;
     Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs;
@@ -2725,33 +2722,75 @@
   }
 
   void generate_arraycopy_stubs() {
-    // Call the conjoint generation methods immediately after
-    // the disjoint ones so that short branches from the former
-    // to the latter can be generated.
-    StubRoutines::_jbyte_disjoint_arraycopy  = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
-    StubRoutines::_jbyte_arraycopy           = generate_conjoint_byte_copy(false, "jbyte_arraycopy");
-
-    StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
-    StubRoutines::_jshort_arraycopy          = generate_conjoint_short_copy(false, "jshort_arraycopy");
-
-    StubRoutines::_jint_disjoint_arraycopy   = generate_disjoint_int_oop_copy(false, false, "jint_disjoint_arraycopy");
-    StubRoutines::_jint_arraycopy            = generate_conjoint_int_oop_copy(false, false, "jint_arraycopy");
-
-    StubRoutines::_jlong_disjoint_arraycopy  = generate_disjoint_long_oop_copy(false, false, "jlong_disjoint_arraycopy");
-    StubRoutines::_jlong_arraycopy           = generate_conjoint_long_oop_copy(false, false, "jlong_arraycopy");
+    address entry;
+    address entry_jbyte_arraycopy;
+    address entry_jshort_arraycopy;
+    address entry_jint_arraycopy;
+    address entry_oop_arraycopy;
+    address entry_jlong_arraycopy;
+    address entry_checkcast_arraycopy;
+
+    StubRoutines::_jbyte_disjoint_arraycopy  = generate_disjoint_byte_copy(false, &entry,
+                                                                           "jbyte_disjoint_arraycopy");
+    StubRoutines::_jbyte_arraycopy           = generate_conjoint_byte_copy(false, entry, &entry_jbyte_arraycopy,
+                                                                           "jbyte_arraycopy");
+
+    StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, &entry,
+                                                                            "jshort_disjoint_arraycopy");
+    StubRoutines::_jshort_arraycopy          = generate_conjoint_short_copy(false, entry, &entry_jshort_arraycopy,
+                                                                            "jshort_arraycopy");
+
+    StubRoutines::_jint_disjoint_arraycopy   = generate_disjoint_int_oop_copy(false, false, &entry,
+                                                                              "jint_disjoint_arraycopy");
+    StubRoutines::_jint_arraycopy            = generate_conjoint_int_oop_copy(false, false, entry,
+                                                                              &entry_jint_arraycopy, "jint_arraycopy");
+
+    StubRoutines::_jlong_disjoint_arraycopy  = generate_disjoint_long_oop_copy(false, false, &entry,
+                                                                               "jlong_disjoint_arraycopy");
+    StubRoutines::_jlong_arraycopy           = generate_conjoint_long_oop_copy(false, false, entry,
+                                                                               &entry_jlong_arraycopy, "jlong_arraycopy");
 
 
     if (UseCompressedOops) {
-      StubRoutines::_oop_disjoint_arraycopy  = generate_disjoint_int_oop_copy(false, true, "oop_disjoint_arraycopy");
-      StubRoutines::_oop_arraycopy           = generate_conjoint_int_oop_copy(false, true, "oop_arraycopy");
+      StubRoutines::_oop_disjoint_arraycopy  = generate_disjoint_int_oop_copy(false, true, &entry,
+                                                                              "oop_disjoint_arraycopy");
+      StubRoutines::_oop_arraycopy           = generate_conjoint_int_oop_copy(false, true, entry,
+                                                                              &entry_oop_arraycopy, "oop_arraycopy");
+      StubRoutines::_oop_disjoint_arraycopy_uninit  = generate_disjoint_int_oop_copy(false, true, &entry,
+                                                                                     "oop_disjoint_arraycopy_uninit",
+                                                                                     /*dest_uninitialized*/true);
+      StubRoutines::_oop_arraycopy_uninit           = generate_conjoint_int_oop_copy(false, true, entry,
+                                                                                     NULL, "oop_arraycopy_uninit",
+                                                                                     /*dest_uninitialized*/true);
     } else {
-      StubRoutines::_oop_disjoint_arraycopy  = generate_disjoint_long_oop_copy(false, true, "oop_disjoint_arraycopy");
-      StubRoutines::_oop_arraycopy           = generate_conjoint_long_oop_copy(false, true, "oop_arraycopy");
+      StubRoutines::_oop_disjoint_arraycopy  = generate_disjoint_long_oop_copy(false, true, &entry,
+                                                                               "oop_disjoint_arraycopy");
+      StubRoutines::_oop_arraycopy           = generate_conjoint_long_oop_copy(false, true, entry,
+                                                                               &entry_oop_arraycopy, "oop_arraycopy");
+      StubRoutines::_oop_disjoint_arraycopy_uninit  = generate_disjoint_long_oop_copy(false, true, &entry,
+                                                                                      "oop_disjoint_arraycopy_uninit",
+                                                                                      /*dest_uninitialized*/true);
+      StubRoutines::_oop_arraycopy_uninit           = generate_conjoint_long_oop_copy(false, true, entry,
+                                                                                      NULL, "oop_arraycopy_uninit",
+                                                                                      /*dest_uninitialized*/true);
     }
 
-    StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy");
-    StubRoutines::_unsafe_arraycopy    = generate_unsafe_copy("unsafe_arraycopy");
-    StubRoutines::_generic_arraycopy   = generate_generic_copy("generic_arraycopy");
+    StubRoutines::_checkcast_arraycopy        = generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
+    StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", NULL,
+                                                                        /*dest_uninitialized*/true);
+
+    StubRoutines::_unsafe_arraycopy    = generate_unsafe_copy("unsafe_arraycopy",
+                                                              entry_jbyte_arraycopy,
+                                                              entry_jshort_arraycopy,
+                                                              entry_jint_arraycopy,
+                                                              entry_jlong_arraycopy);
+    StubRoutines::_generic_arraycopy   = generate_generic_copy("generic_arraycopy",
+                                                               entry_jbyte_arraycopy,
+                                                               entry_jshort_arraycopy,
+                                                               entry_jint_arraycopy,
+                                                               entry_oop_arraycopy,
+                                                               entry_jlong_arraycopy,
+                                                               entry_checkcast_arraycopy);
 
     StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
     StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
@@ -2776,6 +2815,9 @@
 
     StubRoutines::_arrayof_oop_disjoint_arraycopy    = StubRoutines::_oop_disjoint_arraycopy;
     StubRoutines::_arrayof_oop_arraycopy             = StubRoutines::_oop_arraycopy;
+
+    StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit    = StubRoutines::_oop_disjoint_arraycopy_uninit;
+    StubRoutines::_arrayof_oop_arraycopy_uninit             = StubRoutines::_oop_arraycopy_uninit;
   }
 
   void generate_math_stubs() {
@@ -3069,20 +3111,6 @@
   }
 }; // end class declaration
 
-address StubGenerator::disjoint_byte_copy_entry  = NULL;
-address StubGenerator::disjoint_short_copy_entry = NULL;
-address StubGenerator::disjoint_int_copy_entry   = NULL;
-address StubGenerator::disjoint_long_copy_entry  = NULL;
-address StubGenerator::disjoint_oop_copy_entry   = NULL;
-
-address StubGenerator::byte_copy_entry  = NULL;
-address StubGenerator::short_copy_entry = NULL;
-address StubGenerator::int_copy_entry   = NULL;
-address StubGenerator::long_copy_entry  = NULL;
-address StubGenerator::oop_copy_entry   = NULL;
-
-address StubGenerator::checkcast_copy_entry = NULL;
-
 void StubGenerator_generate(CodeBuffer* code, bool all) {
   StubGenerator g(code, all);
 }
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1997, 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
@@ -12658,17 +12658,46 @@
   ins_pipe( pipe_slow );
 %}
 
+// fast search of substring with known size.
+instruct string_indexof_con(eDIRegP str1, eDXRegI cnt1, eSIRegP str2, immI int_cnt2,
+                            eBXRegI result, regXD vec, eAXRegI cnt2, eCXRegI tmp, eFlagsReg cr) %{
+  predicate(UseSSE42Intrinsics);
+  match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2)));
+  effect(TEMP vec, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, KILL cnt2, KILL tmp, KILL cr);
+
+  format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result   // KILL $vec, $cnt1, $cnt2, $tmp" %}
+  ins_encode %{
+    int icnt2 = (int)$int_cnt2$$constant;
+    if (icnt2 >= 8) {
+      // IndexOf for constant substrings with size >= 8 elements
+      // which don't need to be loaded through stack.
+      __ string_indexofC8($str1$$Register, $str2$$Register,
+                          $cnt1$$Register, $cnt2$$Register,
+                          icnt2, $result$$Register,
+                          $vec$$XMMRegister, $tmp$$Register);
+    } else {
+      // Small strings are loaded through stack if they cross page boundary.
+      __ string_indexof($str1$$Register, $str2$$Register,
+                        $cnt1$$Register, $cnt2$$Register,
+                        icnt2, $result$$Register,
+                        $vec$$XMMRegister, $tmp$$Register);
+    }
+  %}
+  ins_pipe( pipe_slow );
+%}
+
 instruct string_indexof(eDIRegP str1, eDXRegI cnt1, eSIRegP str2, eAXRegI cnt2,
-                        eBXRegI result, regXD tmp1, eCXRegI tmp2, eFlagsReg cr) %{
+                        eBXRegI result, regXD vec, eCXRegI tmp, eFlagsReg cr) %{
   predicate(UseSSE42Intrinsics);
   match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
-  effect(TEMP tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL tmp2, KILL cr);
-
-  format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp2, $tmp1" %}
+  effect(TEMP vec, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL tmp, KILL cr);
+
+  format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result   // KILL all" %}
   ins_encode %{
     __ string_indexof($str1$$Register, $str2$$Register,
-                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
-                      $tmp1$$XMMRegister, $tmp2$$Register);
+                      $cnt1$$Register, $cnt2$$Register,
+                      (-1), $result$$Register,
+                      $vec$$XMMRegister, $tmp$$Register);
   %}
   ins_pipe( pipe_slow );
 %}
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -11598,18 +11598,48 @@
   ins_pipe( pipe_slow );
 %}
 
+// fast search of substring with known size.
+instruct string_indexof_con(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, immI int_cnt2,
+                            rbx_RegI result, regD vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr)
+%{
+  predicate(UseSSE42Intrinsics);
+  match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2)));
+  effect(TEMP vec, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, KILL cnt2, KILL tmp, KILL cr);
+
+  format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result   // KILL $vec, $cnt1, $cnt2, $tmp" %}
+  ins_encode %{
+    int icnt2 = (int)$int_cnt2$$constant;
+    if (icnt2 >= 8) {
+      // IndexOf for constant substrings with size >= 8 elements
+      // which don't need to be loaded through stack.
+      __ string_indexofC8($str1$$Register, $str2$$Register,
+                          $cnt1$$Register, $cnt2$$Register,
+                          icnt2, $result$$Register,
+                          $vec$$XMMRegister, $tmp$$Register);
+    } else {
+      // Small strings are loaded through stack if they cross page boundary.
+      __ string_indexof($str1$$Register, $str2$$Register,
+                        $cnt1$$Register, $cnt2$$Register,
+                        icnt2, $result$$Register,
+                        $vec$$XMMRegister, $tmp$$Register);
+    }
+  %}
+  ins_pipe( pipe_slow );
+%}
+
 instruct string_indexof(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, rax_RegI cnt2,
-                        rbx_RegI result, regD tmp1, rcx_RegI tmp2, rFlagsReg cr)
+                        rbx_RegI result, regD vec, rcx_RegI tmp, rFlagsReg cr)
 %{
   predicate(UseSSE42Intrinsics);
   match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
-  effect(TEMP tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL tmp2, KILL cr);
-
-  format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp1, $tmp2" %}
+  effect(TEMP vec, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL tmp, KILL cr);
+
+  format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result   // KILL all" %}
   ins_encode %{
     __ string_indexof($str1$$Register, $str2$$Register,
-                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
-                      $tmp1$$XMMRegister, $tmp2$$Register);
+                      $cnt1$$Register, $cnt2$$Register,
+                      (-1), $result$$Register,
+                      $vec$$XMMRegister, $tmp$$Register);
   %}
   ins_pipe( pipe_slow );
 %}
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -2213,7 +2213,7 @@
   if (rp == NULL)
     return;
 
-  if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
+  if (Arguments::created_by_gamma_launcher()) {
     // Support for the gamma launcher.  Typical value for buf is
     // "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".  If "/jre/lib/" appears at
     // the right place in the string, then assume we are installed in a JDK and
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -59,3 +59,12 @@
   VMError::report_coredump_status(buffer, success);
 }
 
+bool os::is_debugger_attached() {
+  // not implemented
+  return false;
+}
+
+void os::wait_for_keypress_at_exit(void) {
+  // don't do anything on posix platforms
+  return;
+}
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -2511,7 +2511,7 @@
   assert(ret != 0, "cannot locate libjvm");
   realpath((char *)dlinfo.dli_fname, buf);
 
-  if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
+  if (Arguments::created_by_gamma_launcher()) {
     // Support for the gamma launcher.  Typical value for buf is
     // "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".  If "/jre/lib/" appears at
     // the right place in the string, then assume we are installed in a JDK and
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -22,10 +22,8 @@
  *
  */
 
-#ifdef _WIN64
-// Must be at least Windows 2000 or XP to use VectoredExceptions
+// Must be at least Windows 2000 or XP to use VectoredExceptions and IsDebuggerPresent
 #define _WIN32_WINNT 0x500
-#endif
 
 // no precompiled headers
 #include "classfile/classLoader.hpp"
@@ -1788,7 +1786,7 @@
   }
 
   buf[0] = '\0';
-  if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
+  if (Arguments::created_by_gamma_launcher()) {
      // Support for the gamma launcher. Check for an
      // JAVA_HOME environment variable
      // and fix up the path so it looks like
@@ -3418,6 +3416,19 @@
 }
 
 
+bool os::is_debugger_attached() {
+  return IsDebuggerPresent() ? true : false;
+}
+
+
+void os::wait_for_keypress_at_exit(void) {
+  if (PauseAtExit) {
+    fprintf(stderr, "Press any key to continue...\n");
+    fgetc(stdin);
+  }
+}
+
+
 int os::message_box(const char* title, const char* message) {
   int result = MessageBox(NULL, message, title,
                           MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY);
--- a/hotspot/src/share/tools/hsdis/hsdis-demo.c	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/tools/hsdis/hsdis-demo.c	Fri Mar 18 15:44:48 2011 -0700
@@ -22,8 +22,6 @@
  *
  */
 
-#include "precompiled.hpp"
-
 /* hsdis-demo.c -- dump a range of addresses as native instructions
    This demonstrates the protocol required by the HotSpot PrintAssembly option.
 */
--- a/hotspot/src/share/tools/hsdis/hsdis.c	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/tools/hsdis/hsdis.c	Fri Mar 18 15:44:48 2011 -0700
@@ -22,8 +22,6 @@
  *
  */
 
-#include "precompiled.hpp"
-
 /* hsdis.c -- dump a range of addresses as native instructions
    This implements the plugin protocol required by the
    HotSpot PrintAssembly option.
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -3308,22 +3308,23 @@
   Value exception = append_with_bci(new ExceptionObject(), SynchronizationEntryBCI);
   assert(exception->is_pinned(), "must be");
 
+  int bci = SynchronizationEntryBCI;
   if (compilation()->env()->dtrace_method_probes()) {
-    // Report exit from inline methods
+    // Report exit from inline methods.  We don't have a stream here
+    // so pass an explicit bci of SynchronizationEntryBCI.
     Values* args = new Values(1);
-    args->push(append(new Constant(new ObjectConstant(method()))));
-    append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
+    args->push(append_with_bci(new Constant(new ObjectConstant(method())), bci));
+    append_with_bci(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args), bci);
   }
 
-  int bci = SynchronizationEntryBCI;
   if (lock) {
     assert(state()->locks_size() > 0 && state()->lock_at(state()->locks_size() - 1) == lock, "lock is missing");
     if (!lock->is_linked()) {
-      lock = append_with_bci(lock, -1);
+      lock = append_with_bci(lock, bci);
     }
 
     // exit the monitor in the context of the synchronized method
-    monitorexit(lock, SynchronizationEntryBCI);
+    monitorexit(lock, bci);
 
     // exit the context of the synchronized method
     if (!default_handler) {
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -426,10 +426,9 @@
 // been deoptimized. If that is the case we return the deopt blob
 // unpack_with_exception entry instead. This makes life for the exception blob easier
 // because making that same check and diverting is painful from assembly language.
-//
-
-
 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm))
+  // Reset method handle flag.
+  thread->set_is_method_handle_return(false);
 
   Handle exception(thread, ex);
   nm = CodeCache::find_nmethod(pc);
@@ -480,11 +479,12 @@
     return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
   }
 
-  // ExceptionCache is used only for exceptions at call and not for implicit exceptions
+  // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions
   if (guard_pages_enabled) {
     address fast_continuation = nm->handler_for_exception_and_pc(exception, pc);
     if (fast_continuation != NULL) {
-      if (fast_continuation == ExceptionCache::unwind_handler()) fast_continuation = NULL;
+      // Set flag if return address is a method handle call site.
+      thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
       return fast_continuation;
     }
   }
@@ -522,14 +522,14 @@
     thread->set_exception_pc(pc);
 
     // the exception cache is used only by non-implicit exceptions
-    if (continuation == NULL) {
-      nm->add_handler_for_exception_and_pc(exception, pc, ExceptionCache::unwind_handler());
-    } else {
+    if (continuation != NULL) {
       nm->add_handler_for_exception_and_pc(exception, pc, continuation);
     }
   }
 
   thread->set_vm_result(exception());
+  // Set flag if return address is a method handle call site.
+  thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
 
   if (TraceExceptions) {
     ttyLocker ttyl;
@@ -542,20 +542,19 @@
 JRT_END
 
 // Enter this method from compiled code only if there is a Java exception handler
-// in the method handling the exception
+// in the method handling the exception.
 // We are entering here from exception stub. We don't do a normal VM transition here.
 // We do it in a helper. This is so we can check to see if the nmethod we have just
 // searched for an exception handler has been deoptimized in the meantime.
-address  Runtime1::exception_handler_for_pc(JavaThread* thread) {
+address Runtime1::exception_handler_for_pc(JavaThread* thread) {
   oop exception = thread->exception_oop();
   address pc = thread->exception_pc();
   // Still in Java mode
-  debug_only(ResetNoHandleMark rnhm);
+  DEBUG_ONLY(ResetNoHandleMark rnhm);
   nmethod* nm = NULL;
   address continuation = NULL;
   {
     // Enter VM mode by calling the helper
-
     ResetNoHandleMark rnhm;
     continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
   }
@@ -563,11 +562,11 @@
 
   // Now check to see if the nmethod we were called from is now deoptimized.
   // If so we must return to the deopt blob and deoptimize the nmethod
-
   if (nm != NULL && caller_is_deopted()) {
     continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
   }
 
+  assert(continuation != NULL, "no handler found");
   return continuation;
 }
 
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -54,6 +54,7 @@
   stub(new_multi_array)              \
   stub(handle_exception_nofpu)         /* optimized version that does not preserve fpu registers */ \
   stub(handle_exception)             \
+  stub(handle_exception_from_callee) \
   stub(throw_array_store_exception)  \
   stub(throw_class_cast_exception)   \
   stub(throw_incompatible_class_change_error)   \
@@ -116,11 +117,11 @@
   static const char* _blob_names[];
 
   // stub generation
-  static void generate_blob_for(BufferBlob* blob, StubID id);
-  static OopMapSet* generate_code_for(StubID id, StubAssembler* masm);
+  static void       generate_blob_for(BufferBlob* blob, StubID id);
+  static OopMapSet* generate_code_for(StubID id, StubAssembler* sasm);
   static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
-  static void generate_handle_exception(StubAssembler *sasm, OopMapSet* oop_maps, OopMap* oop_map, bool ignore_fpu_registers = false);
-  static void generate_unwind_exception(StubAssembler *sasm);
+  static OopMapSet* generate_handle_exception(StubID id, StubAssembler* sasm);
+  static void       generate_unwind_exception(StubAssembler *sasm);
   static OopMapSet* generate_patching(StubAssembler* sasm, address target);
 
   static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1332,7 +1332,7 @@
       }
 
       if (_compile_the_world_counter >= CompileTheWorldStartAt) {
-        if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) {
+        if (k.is_null() || exception_occurred) {
           // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
           tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
         } else {
--- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -170,6 +170,44 @@
   return true;
 }
 
+bool StackMapFrame::has_flag_match_exception(
+    const StackMapFrame* target) const {
+  // We allow flags of {UninitThis} to assign to {} if-and-only-if the
+  // target frame does not depend upon the current type.
+  // This is slightly too strict, as we need only enforce that the
+  // slots that were initialized by the <init> (the things that were
+  // UninitializedThis before initialize_object() converted them) are unused.
+  // However we didn't save that information so we'll enforce this upon
+  // anything that might have been initialized.  This is a rare situation
+  // and javac never generates code that would end up here, but some profilers
+  // (such as NetBeans) might, when adding exception handlers in <init>
+  // methods to cover the invokespecial instruction.  See 7020118.
+
+  assert(max_locals() == target->max_locals() &&
+         stack_size() == target->stack_size(), "StackMap sizes must match");
+
+  VerificationType top = VerificationType::top_type();
+  VerificationType this_type = verifier()->current_type();
+
+  if (!flag_this_uninit() || target->flags() != 0) {
+    return false;
+  }
+
+  for (int i = 0; i < target->locals_size(); ++i) {
+    if (locals()[i] == this_type && target->locals()[i] != top) {
+      return false;
+    }
+  }
+
+  for (int i = 0; i < target->stack_size(); ++i) {
+    if (stack()[i] == this_type && target->stack()[i] != top) {
+      return false;
+    }
+  }
+
+  return true;
+}
+
 bool StackMapFrame::is_assignable_to(const StackMapFrame* target, TRAPS) const {
   if (_max_locals != target->max_locals() || _stack_size != target->stack_size()) {
     return false;
@@ -182,7 +220,9 @@
   bool match_stack = is_assignable_to(
     _stack, target->stack(), _stack_size, CHECK_false);
   bool match_flags = (_flags | target->flags()) == target->flags();
-  return (match_locals && match_stack && match_flags);
+
+  return match_locals && match_stack &&
+    (match_flags || has_flag_match_exception(target));
 }
 
 VerificationType StackMapFrame::pop_stack_ex(VerificationType type, TRAPS) {
--- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -228,6 +228,8 @@
   bool is_assignable_to(
     VerificationType* src, VerificationType* target, int32_t len, TRAPS) const;
 
+  bool has_flag_match_exception(const StackMapFrame* target) const;
+
   // Debugging
   void print() const PRODUCT_RETURN;
 };
--- a/hotspot/src/share/vm/classfile/verificationType.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/classfile/verificationType.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -128,6 +128,7 @@
 
   // Create verification types
   static VerificationType bogus_type() { return VerificationType(Bogus); }
+  static VerificationType top_type() { return bogus_type(); } // alias
   static VerificationType null_type() { return VerificationType(Null); }
   static VerificationType integer_type() { return VerificationType(Integer); }
   static VerificationType float_type() { return VerificationType(Float); }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -190,15 +190,10 @@
 } nmethod_stats;
 #endif //PRODUCT
 
+
 //---------------------------------------------------------------------------------
 
 
-// The _unwind_handler is a special marker address, which says that
-// for given exception oop and address, the frame should be removed
-// as the tuple cannot be caught in the nmethod
-address ExceptionCache::_unwind_handler = (address) -1;
-
-
 ExceptionCache::ExceptionCache(Handle exception, address pc, address handler) {
   assert(pc != NULL, "Must be non null");
   assert(exception.not_null(), "Must be non null");
--- a/hotspot/src/share/vm/code/nmethod.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -34,7 +34,6 @@
 class ExceptionCache : public CHeapObj {
   friend class VMStructs;
  private:
-  static address _unwind_handler;
   enum { cache_size = 16 };
   klassOop _exception_type;
   address  _pc[cache_size];
@@ -62,8 +61,6 @@
   bool    match_exception_with_space(Handle exception) ;
   address test_address(address addr);
   bool    add_address_and_handler(address addr, address handler) ;
-
-  static address unwind_handler() { return _unwind_handler; }
 };
 
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -5474,8 +5474,6 @@
   _refine_cte_cl->set_concurrent(concurrent);
 }
 
-#ifdef ASSERT
-
 bool G1CollectedHeap::is_in_closed_subset(const void* p) const {
   HeapRegion* hr = heap_region_containing(p);
   if (hr == NULL) {
@@ -5484,7 +5482,6 @@
     return hr->is_in(p);
   }
 }
-#endif // ASSERT
 
 class VerifyRegionListsClosure : public HeapRegionClosure {
 private:
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1134,7 +1134,7 @@
     return _g1_committed;
   }
 
-  NOT_PRODUCT(bool is_in_closed_subset(const void* p) const;)
+  virtual bool is_in_closed_subset(const void* p) const;
 
   // Dirty card table entries covering a list of young regions.
   void dirtyCardsForYoungRegions(CardTableModRefBS* ct_bs, HeapRegion* list);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -83,11 +83,15 @@
   }
 
   template <class T> void write_ref_array_pre_work(T* dst, int count);
-  virtual void write_ref_array_pre(oop* dst, int count) {
-    write_ref_array_pre_work(dst, count);
+  virtual void write_ref_array_pre(oop* dst, int count, bool dest_uninitialized) {
+    if (!dest_uninitialized) {
+      write_ref_array_pre_work(dst, count);
+    }
   }
-  virtual void write_ref_array_pre(narrowOop* dst, int count) {
-    write_ref_array_pre_work(dst, count);
+  virtual void write_ref_array_pre(narrowOop* dst, int count, bool dest_uninitialized) {
+    if (!dest_uninitialized) {
+      write_ref_array_pre_work(dst, count);
+    }
   }
 };
 
--- a/hotspot/src/share/vm/memory/allocation.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -422,6 +422,9 @@
   return sum;                   // Return total consumed space.
 }
 
+void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
+  vm_exit_out_of_memory(sz, whence);
+}
 
 // Grow a new Chunk
 void* Arena::grow( size_t x ) {
@@ -431,8 +434,9 @@
   Chunk *k = _chunk;            // Get filled-up chunk address
   _chunk = new (len) Chunk(len);
 
-  if (_chunk == NULL)
-      vm_exit_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
+  if (_chunk == NULL) {
+    signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
+  }
 
   if (k) k->set_next(_chunk);   // Append new chunk to end of linked list
   else _first = _chunk;
@@ -529,6 +533,7 @@
 // for debugging with UseMallocOnly
 void* Arena::internal_malloc_4(size_t x) {
   assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
+  check_for_overflow(x, "Arena::internal_malloc_4");
   if (_hwm + x > _max) {
     return grow(x);
   } else {
--- a/hotspot/src/share/vm/memory/allocation.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -207,6 +207,15 @@
   debug_only(void* malloc(size_t size);)
   debug_only(void* internal_malloc_4(size_t x);)
   NOT_PRODUCT(void inc_bytes_allocated(size_t x);)
+
+  void signal_out_of_memory(size_t request, const char* whence) const;
+
+  void check_for_overflow(size_t request, const char* whence) const {
+    if (UINTPTR_MAX - request < (uintptr_t)_hwm) {
+      signal_out_of_memory(request, whence);
+    }
+ }
+
  public:
   Arena();
   Arena(size_t init_size);
@@ -220,6 +229,7 @@
     assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT) , "should be a power of 2");
     x = ARENA_ALIGN(x);
     debug_only(if (UseMallocOnly) return malloc(x);)
+    check_for_overflow(x, "Arena::Amalloc");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
       return grow(x);
@@ -233,6 +243,7 @@
   void *Amalloc_4(size_t x) {
     assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
     debug_only(if (UseMallocOnly) return malloc(x);)
+    check_for_overflow(x, "Arena::Amalloc_4");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
       return grow(x);
@@ -253,6 +264,7 @@
     size_t delta = (((size_t)_hwm + DALIGN_M1) & ~DALIGN_M1) - (size_t)_hwm;
     x += delta;
 #endif
+    check_for_overflow(x, "Arena::Amalloc_D");
     NOT_PRODUCT(inc_bytes_allocated(x);)
     if (_hwm + x > _max) {
       return grow(x); // grow() returns a result aligned >= 8 bytes.
--- a/hotspot/src/share/vm/memory/barrierSet.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/memory/barrierSet.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -35,9 +35,9 @@
                    start,            count);
 #endif
   if (UseCompressedOops) {
-    Universe::heap()->barrier_set()->write_ref_array_pre((narrowOop*)start, (int)count);
+    Universe::heap()->barrier_set()->write_ref_array_pre((narrowOop*)start, (int)count, false);
   } else {
-    Universe::heap()->barrier_set()->write_ref_array_pre(      (oop*)start, (int)count);
+    Universe::heap()->barrier_set()->write_ref_array_pre(      (oop*)start, (int)count, false);
   }
 }
 
--- a/hotspot/src/share/vm/memory/barrierSet.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,10 @@
     Uninit
   };
 
+  enum Flags {
+    None                = 0,
+    TargetUninitialized = 1
+  };
 protected:
   int _max_covered_regions;
   Name _kind;
@@ -128,8 +132,10 @@
   virtual void read_prim_array(MemRegion mr) = 0;
 
   // Below length is the # array elements being written
-  virtual void write_ref_array_pre(      oop* dst, int length) {}
-  virtual void write_ref_array_pre(narrowOop* dst, int length) {}
+  virtual void write_ref_array_pre(oop* dst, int length,
+                                   bool dest_uninitialized = false) {}
+  virtual void write_ref_array_pre(narrowOop* dst, int length,
+                                   bool dest_uninitialized = false) {}
   // Below count is the # array elements being written, starting
   // at the address "start", which may not necessarily be HeapWord-aligned
   inline void write_ref_array(HeapWord* start, size_t count);
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,7 +97,7 @@
                              RegionNode* region);
   Node* generate_current_thread(Node* &tls_output);
   address basictype2arraycopy(BasicType t, Node *src_offset, Node *dest_offset,
-                              bool disjoint_bases, const char* &name);
+                              bool disjoint_bases, const char* &name, bool dest_uninitialized);
   Node* load_mirror_from_klass(Node* klass);
   Node* load_klass_from_mirror_common(Node* mirror, bool never_see_null,
                                       int nargs,
@@ -212,26 +212,26 @@
                                 AllocateNode* alloc,
                                 Node* src,  Node* src_offset,
                                 Node* dest, Node* dest_offset,
-                                Node* dest_size);
+                                Node* dest_size, bool dest_uninitialized);
   void generate_slow_arraycopy(const TypePtr* adr_type,
                                Node* src,  Node* src_offset,
                                Node* dest, Node* dest_offset,
-                               Node* copy_length);
+                               Node* copy_length, bool dest_uninitialized);
   Node* generate_checkcast_arraycopy(const TypePtr* adr_type,
                                      Node* dest_elem_klass,
                                      Node* src,  Node* src_offset,
                                      Node* dest, Node* dest_offset,
-                                     Node* copy_length);
+                                     Node* copy_length, bool dest_uninitialized);
   Node* generate_generic_arraycopy(const TypePtr* adr_type,
                                    Node* src,  Node* src_offset,
                                    Node* dest, Node* dest_offset,
-                                   Node* copy_length);
+                                   Node* copy_length, bool dest_uninitialized);
   void generate_unchecked_arraycopy(const TypePtr* adr_type,
                                     BasicType basic_elem_type,
                                     bool disjoint_bases,
                                     Node* src,  Node* src_offset,
                                     Node* dest, Node* dest_offset,
-                                    Node* copy_length);
+                                    Node* copy_length, bool dest_uninitialized);
   bool inline_unsafe_CAS(BasicType type);
   bool inline_unsafe_ordered_store(BasicType type);
   bool inline_fp_conversions(vmIntrinsics::ID id);
@@ -1193,7 +1193,7 @@
   Node* result;
   // Disable the use of pcmpestri until it can be guaranteed that
   // the load doesn't cross into the uncommited space.
-  if (false && Matcher::has_match_rule(Op_StrIndexOf) &&
+  if (Matcher::has_match_rule(Op_StrIndexOf) &&
       UseSSE42Intrinsics) {
     // Generate SSE4.2 version of indexOf
     // We currently only have match rules that use SSE4.2
@@ -1211,14 +1211,14 @@
       return true;
     }
 
+    ciInstanceKlass* str_klass = env()->String_klass();
+    const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(str_klass);
+
     // Make the merge point
-    RegionNode* result_rgn = new (C, 3) RegionNode(3);
-    Node*       result_phi = new (C, 3) PhiNode(result_rgn, TypeInt::INT);
+    RegionNode* result_rgn = new (C, 4) RegionNode(4);
+    Node*       result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT);
     Node* no_ctrl  = NULL;
 
-    ciInstanceKlass* klass = env()->String_klass();
-    const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
-
     // Get counts for string and substr
     Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset);
     Node* source_cnt  = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
@@ -1236,6 +1236,17 @@
     }
 
     if (!stopped()) {
+      // Check for substr count == 0
+      cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, intcon(0)) );
+      bol = _gvn.transform( new(C, 2) BoolNode(cmp, BoolTest::eq) );
+      Node* if_zero = generate_slow_guard(bol, NULL);
+      if (if_zero != NULL) {
+        result_phi->init_req(3, intcon(0));
+        result_rgn->init_req(3, if_zero);
+      }
+    }
+
+    if (!stopped()) {
       result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt);
       result_phi->init_req(1, result);
       result_rgn->init_req(1, control());
@@ -1244,8 +1255,8 @@
     record_for_igvn(result_rgn);
     result = _gvn.transform(result_phi);
 
-  } else { //Use LibraryCallKit::string_indexOf
-    // don't intrinsify is argument isn't a constant string.
+  } else { // Use LibraryCallKit::string_indexOf
+    // don't intrinsify if argument isn't a constant string.
     if (!argument->is_Con()) {
      return false;
     }
@@ -1281,7 +1292,7 @@
     // No null check on the argument is needed since it's a constant String oop.
     _sp -= 2;
     if (stopped()) {
-     return true;
+      return true;
     }
 
     // The null string as a pattern always returns 0 (match at beginning of string)
@@ -4081,7 +4092,8 @@
   const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
   bool disjoint_bases = true;
   generate_unchecked_arraycopy(raw_adr_type, T_LONG, disjoint_bases,
-                               src, NULL, dest, NULL, countx);
+                               src, NULL, dest, NULL, countx,
+                               /*dest_uninitialized*/true);
 
   // If necessary, emit some card marks afterwards.  (Non-arrays only.)
   if (card_mark) {
@@ -4295,7 +4307,7 @@
 // Note:  The condition "disjoint" applies also for overlapping copies
 // where an descending copy is permitted (i.e., dest_offset <= src_offset).
 static address
-select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name) {
+select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
   int selector =
     (aligned  ? COPYFUNC_ALIGNED  : COPYFUNC_UNALIGNED) +
     (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
@@ -4304,6 +4316,10 @@
   name = #xxx_arraycopy; \
   return StubRoutines::xxx_arraycopy(); }
 
+#define RETURN_STUB_PARM(xxx_arraycopy, parm) {           \
+  name = #xxx_arraycopy; \
+  return StubRoutines::xxx_arraycopy(parm); }
+
   switch (t) {
   case T_BYTE:
   case T_BOOLEAN:
@@ -4340,10 +4356,10 @@
   case T_ARRAY:
   case T_OBJECT:
     switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(oop_arraycopy);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_oop_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(oop_disjoint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_oop_disjoint_arraycopy);
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
     }
   default:
     ShouldNotReachHere();
@@ -4351,6 +4367,7 @@
   }
 
 #undef RETURN_STUB
+#undef RETURN_STUB_PARM
 }
 
 //------------------------------basictype2arraycopy----------------------------
@@ -4358,7 +4375,8 @@
                                             Node* src_offset,
                                             Node* dest_offset,
                                             bool disjoint_bases,
-                                            const char* &name) {
+                                            const char* &name,
+                                            bool dest_uninitialized) {
   const TypeInt* src_offset_inttype  = gvn().find_int_type(src_offset);;
   const TypeInt* dest_offset_inttype = gvn().find_int_type(dest_offset);;
 
@@ -4384,7 +4402,7 @@
     disjoint = true;
   }
 
-  return select_arraycopy_function(t, aligned, disjoint, name);
+  return select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
 }
 
 
@@ -4440,7 +4458,8 @@
     // The component types are not the same or are not recognized.  Punt.
     // (But, avoid the native method wrapper to JVM_ArrayCopy.)
     generate_slow_arraycopy(TypePtr::BOTTOM,
-                            src, src_offset, dest, dest_offset, length);
+                            src, src_offset, dest, dest_offset, length,
+                            /*dest_uninitialized*/false);
     return true;
   }
 
@@ -4553,7 +4572,7 @@
 
   Node* original_dest      = dest;
   AllocateArrayNode* alloc = NULL;  // used for zeroing, if needed
-  bool  must_clear_dest    = false;
+  bool  dest_uninitialized = false;
 
   // See if this is the initialization of a newly-allocated array.
   // If so, we will take responsibility here for initializing it to zero.
@@ -4576,12 +4595,14 @@
     adr_type = TypeRawPtr::BOTTOM;  // all initializations are into raw memory
     // From this point on, every exit path is responsible for
     // initializing any non-copied parts of the object to zero.
-    must_clear_dest = true;
+    // Also, if this flag is set we make sure that arraycopy interacts properly
+    // with G1, eliding pre-barriers. See CR 6627983.
+    dest_uninitialized = true;
   } else {
     // No zeroing elimination here.
     alloc             = NULL;
     //original_dest   = dest;
-    //must_clear_dest = false;
+    //dest_uninitialized = false;
   }
 
   // Results are placed here:
@@ -4613,10 +4634,10 @@
   Node* checked_value   = NULL;
 
   if (basic_elem_type == T_CONFLICT) {
-    assert(!must_clear_dest, "");
+    assert(!dest_uninitialized, "");
     Node* cv = generate_generic_arraycopy(adr_type,
                                           src, src_offset, dest, dest_offset,
-                                          copy_length);
+                                          copy_length, dest_uninitialized);
     if (cv == NULL)  cv = intcon(-1);  // failure (no stub available)
     checked_control = control();
     checked_i_o     = i_o();
@@ -4636,7 +4657,7 @@
     }
 
     // copy_length is 0.
-    if (!stopped() && must_clear_dest) {
+    if (!stopped() && dest_uninitialized) {
       Node* dest_length = alloc->in(AllocateNode::ALength);
       if (_gvn.eqv_uncast(copy_length, dest_length)
           || _gvn.find_int_con(dest_length, 1) <= 0) {
@@ -4662,7 +4683,7 @@
     result_memory->init_req(zero_path, memory(adr_type));
   }
 
-  if (!stopped() && must_clear_dest) {
+  if (!stopped() && dest_uninitialized) {
     // We have to initialize the *uncopied* part of the array to zero.
     // The copy destination is the slice dest[off..off+len].  The other slices
     // are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length].
@@ -4698,7 +4719,7 @@
       { PreserveJVMState pjvms(this);
         didit = generate_block_arraycopy(adr_type, basic_elem_type, alloc,
                                          src, src_offset, dest, dest_offset,
-                                         dest_size);
+                                         dest_size, dest_uninitialized);
         if (didit) {
           // Present the results of the block-copying fast call.
           result_region->init_req(bcopy_path, control());
@@ -4774,7 +4795,7 @@
       Node* cv = generate_checkcast_arraycopy(adr_type,
                                               dest_elem_klass,
                                               src, src_offset, dest, dest_offset,
-                                              ConvI2X(copy_length));
+                                              ConvI2X(copy_length), dest_uninitialized);
       if (cv == NULL)  cv = intcon(-1);  // failure (no stub available)
       checked_control = control();
       checked_i_o     = i_o();
@@ -4797,7 +4818,7 @@
     PreserveJVMState pjvms(this);
     generate_unchecked_arraycopy(adr_type, copy_type, disjoint_bases,
                                  src, src_offset, dest, dest_offset,
-                                 ConvI2X(copy_length));
+                                 ConvI2X(copy_length), dest_uninitialized);
 
     // Present the results of the fast call.
     result_region->init_req(fast_path, control());
@@ -4876,7 +4897,7 @@
     set_memory(slow_mem, adr_type);
     set_i_o(slow_i_o);
 
-    if (must_clear_dest) {
+    if (dest_uninitialized) {
       generate_clear_array(adr_type, dest, basic_elem_type,
                            intcon(0), NULL,
                            alloc->in(AllocateNode::AllocSize));
@@ -4884,7 +4905,7 @@
 
     generate_slow_arraycopy(adr_type,
                             src, src_offset, dest, dest_offset,
-                            copy_length);
+                            copy_length, /*dest_uninitialized*/false);
 
     result_region->init_req(slow_call_path, control());
     result_i_o   ->init_req(slow_call_path, i_o());
@@ -5128,7 +5149,7 @@
                                          AllocateNode* alloc,
                                          Node* src,  Node* src_offset,
                                          Node* dest, Node* dest_offset,
-                                         Node* dest_size) {
+                                         Node* dest_size, bool dest_uninitialized) {
   // See if there is an advantage from block transfer.
   int scale = exact_log2(type2aelembytes(basic_elem_type));
   if (scale >= LogBytesPerLong)
@@ -5173,7 +5194,7 @@
 
   bool disjoint_bases = true;   // since alloc != NULL
   generate_unchecked_arraycopy(adr_type, T_LONG, disjoint_bases,
-                               sptr, NULL, dptr, NULL, countx);
+                               sptr, NULL, dptr, NULL, countx, dest_uninitialized);
 
   return true;
 }
@@ -5186,7 +5207,8 @@
 LibraryCallKit::generate_slow_arraycopy(const TypePtr* adr_type,
                                         Node* src,  Node* src_offset,
                                         Node* dest, Node* dest_offset,
-                                        Node* copy_length) {
+                                        Node* copy_length, bool dest_uninitialized) {
+  assert(!dest_uninitialized, "Invariant");
   Node* call = make_runtime_call(RC_NO_LEAF | RC_UNCOMMON,
                                  OptoRuntime::slow_arraycopy_Type(),
                                  OptoRuntime::slow_arraycopy_Java(),
@@ -5204,10 +5226,10 @@
                                              Node* dest_elem_klass,
                                              Node* src,  Node* src_offset,
                                              Node* dest, Node* dest_offset,
-                                             Node* copy_length) {
+                                             Node* copy_length, bool dest_uninitialized) {
   if (stopped())  return NULL;
 
-  address copyfunc_addr = StubRoutines::checkcast_arraycopy();
+  address copyfunc_addr = StubRoutines::checkcast_arraycopy(dest_uninitialized);
   if (copyfunc_addr == NULL) { // Stub was not generated, go slow path.
     return NULL;
   }
@@ -5245,9 +5267,9 @@
 LibraryCallKit::generate_generic_arraycopy(const TypePtr* adr_type,
                                            Node* src,  Node* src_offset,
                                            Node* dest, Node* dest_offset,
-                                           Node* copy_length) {
+                                           Node* copy_length, bool dest_uninitialized) {
+  assert(!dest_uninitialized, "Invariant");
   if (stopped())  return NULL;
-
   address copyfunc_addr = StubRoutines::generic_arraycopy();
   if (copyfunc_addr == NULL) { // Stub was not generated, go slow path.
     return NULL;
@@ -5268,7 +5290,7 @@
                                              bool disjoint_bases,
                                              Node* src,  Node* src_offset,
                                              Node* dest, Node* dest_offset,
-                                             Node* copy_length) {
+                                             Node* copy_length, bool dest_uninitialized) {
   if (stopped())  return;               // nothing to do
 
   Node* src_start  = src;
@@ -5283,7 +5305,7 @@
   const char* copyfunc_name = "arraycopy";
   address     copyfunc_addr =
       basictype2arraycopy(basic_elem_type, src_offset, dest_offset,
-                          disjoint_bases, copyfunc_name);
+                          disjoint_bases, copyfunc_name, dest_uninitialized);
 
   // Call it.  Note that the count_ix value is not scaled to a byte-size.
   make_runtime_call(RC_LEAF|RC_NO_FP,
--- a/hotspot/src/share/vm/opto/memnode.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1559,21 +1559,24 @@
             phase->C->has_unsafe_access(),
             "Field accesses must be precise" );
     // For oop loads, we expect the _type to be precise
-    if (OptimizeStringConcat && klass == phase->C->env()->String_klass() &&
+    if (klass == phase->C->env()->String_klass() &&
         adr->is_AddP() && off != Type::OffsetBot) {
-      // For constant Strings treat the fields as compile time constants.
+      // For constant Strings treat the final fields as compile time constants.
       Node* base = adr->in(AddPNode::Base);
       const TypeOopPtr* t = phase->type(base)->isa_oopptr();
       if (t != NULL && t->singleton()) {
-        ciObject* string = t->const_oop();
-        ciConstant constant = string->as_instance()->field_value_by_offset(off);
-        if (constant.basic_type() == T_INT) {
-          return TypeInt::make(constant.as_int());
-        } else if (constant.basic_type() == T_ARRAY) {
-          if (adr->bottom_type()->is_ptr_to_narrowoop()) {
-            return TypeNarrowOop::make_from_constant(constant.as_object());
-          } else {
-            return TypeOopPtr::make_from_constant(constant.as_object());
+        ciField* field = phase->C->env()->String_klass()->get_field_by_offset(off, false);
+        if (field != NULL && field->is_final()) {
+          ciObject* string = t->const_oop();
+          ciConstant constant = string->as_instance()->field_value(field);
+          if (constant.basic_type() == T_INT) {
+            return TypeInt::make(constant.as_int());
+          } else if (constant.basic_type() == T_ARRAY) {
+            if (adr->bottom_type()->is_ptr_to_narrowoop()) {
+              return TypeNarrowOop::make_from_constant(constant.as_object());
+            } else {
+              return TypeOopPtr::make_from_constant(constant.as_object());
+            }
           }
         }
       }
@@ -4077,6 +4080,7 @@
     n = base_memory();
     assert(Node::in_dump()
            || n == NULL || n->bottom_type() == Type::TOP
+           || n->adr_type() == NULL // address is TOP
            || n->adr_type() == TypePtr::BOTTOM
            || n->adr_type() == TypeRawPtr::BOTTOM
            || Compile::current()->AliasLevel() == 0,
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1805,6 +1805,10 @@
 
 void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) {
   JavaThread* thread = JavaThread::current();
+  // In theory everyone coming thru here is in_vm but we need to be certain
+  // because a callee will do a vm->native transition
+  ThreadInVMfromUnknown __tiv;
+
   EVT_TRIG_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED,
                  ("JVMTI [%s] method dynamic code generated event triggered",
                  JvmtiTrace::safe_get_thread_name(thread)));
@@ -1826,19 +1830,18 @@
 }
 
 void JvmtiExport::post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) {
-  // In theory everyone coming thru here is in_vm but we need to be certain
-  // because a callee will do a vm->native transition
-  ThreadInVMfromUnknown __tiv;
   jvmtiPhase phase = JvmtiEnv::get_phase();
   if (phase == JVMTI_PHASE_PRIMORDIAL || phase == JVMTI_PHASE_START) {
     post_dynamic_code_generated_internal(name, code_begin, code_end);
-    return;
+  } else {
+    // It may not be safe to post the event from this thread.  Defer all
+    // postings to the service thread so that it can perform them in a safe
+    // context and in-order.
+    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    JvmtiDeferredEvent event = JvmtiDeferredEvent::dynamic_code_generated_event(
+        name, code_begin, code_end);
+    JvmtiDeferredEventQueue::enqueue(event);
   }
-
-  // Blocks until everything now in the queue has been posted
-  JvmtiDeferredEventQueue::flush_queue(Thread::current());
-
-  post_dynamic_code_generated_internal(name, code_begin, code_end);
 }
 
 
--- a/hotspot/src/share/vm/prims/jvmtiExport.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -140,12 +140,12 @@
                                       char sig_type, jvalue *value);
 
 
- private:
   // posts a DynamicCodeGenerated event (internal/private implementation).
   // The public post_dynamic_code_generated* functions make use of the
-  // internal implementation.
+  // internal implementation.  Also called from JvmtiDeferredEvent::post()
   static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) KERNEL_RETURN;
 
+ private:
 
   // GenerateEvents support to allow posting of CompiledMethodLoad and
   // DynamicCodeGenerated events for a given environment.
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -918,7 +918,7 @@
 JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
     nmethod* nm) {
   JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_LOAD);
-  event.set_compiled_method_load(nm);
+  event._event_data.compiled_method_load = nm;
   nmethodLocker::lock_nmethod(nm); // will be unlocked when posted
   return event;
 }
@@ -926,23 +926,39 @@
 JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_unload_event(
     jmethodID id, const void* code) {
   JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_UNLOAD);
-  event.set_compiled_method_unload(id, code);
+  event._event_data.compiled_method_unload.method_id = id;
+  event._event_data.compiled_method_unload.code_begin = code;
+  return event;
+}
+JvmtiDeferredEvent JvmtiDeferredEvent::dynamic_code_generated_event(
+      const char* name, const void* code_begin, const void* code_end) {
+  JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_DYNAMIC_CODE_GENERATED);
+  event._event_data.dynamic_code_generated.name = name;
+  event._event_data.dynamic_code_generated.code_begin = code_begin;
+  event._event_data.dynamic_code_generated.code_end = code_end;
   return event;
 }
 
 void JvmtiDeferredEvent::post() {
+  assert(ServiceThread::is_service_thread(Thread::current()),
+         "Service thread must post enqueued events");
   switch(_type) {
-    case TYPE_COMPILED_METHOD_LOAD:
-      JvmtiExport::post_compiled_method_load(compiled_method_load());
-      nmethodLocker::unlock_nmethod(compiled_method_load());
+    case TYPE_COMPILED_METHOD_LOAD: {
+      nmethod* nm = _event_data.compiled_method_load;
+      JvmtiExport::post_compiled_method_load(nm);
+      nmethodLocker::unlock_nmethod(nm);
       break;
+    }
     case TYPE_COMPILED_METHOD_UNLOAD:
       JvmtiExport::post_compiled_method_unload(
-        compiled_method_unload_method_id(),
-        compiled_method_unload_code_begin());
+        _event_data.compiled_method_unload.method_id,
+        _event_data.compiled_method_unload.code_begin);
       break;
-    case TYPE_FLUSH:
-      JvmtiDeferredEventQueue::flush_complete(flush_state_addr());
+    case TYPE_DYNAMIC_CODE_GENERATED:
+      JvmtiExport::post_dynamic_code_generated_internal(
+        _event_data.dynamic_code_generated.name,
+        _event_data.dynamic_code_generated.code_begin,
+        _event_data.dynamic_code_generated.code_end);
       break;
     default:
       ShouldNotReachHere();
@@ -1065,54 +1081,4 @@
   }
 }
 
-enum {
-  // Random - used for debugging
-  FLUSHING  = 0x50403020,
-  FLUSHED   = 0x09080706
-};
-
-void JvmtiDeferredEventQueue::flush_queue(Thread* thread) {
-
-  volatile int flush_state = FLUSHING;
-
-  JvmtiDeferredEvent flush(JvmtiDeferredEvent::TYPE_FLUSH);
-  flush.set_flush_state_addr((int*)&flush_state);
-
-  if (ServiceThread::is_service_thread(thread)) {
-    // If we are the service thread we have to post all preceding events
-    // Use the flush event as a token to indicate when we can stop
-    JvmtiDeferredEvent event;
-    {
-      MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
-      enqueue(flush);
-      event = dequeue();
-    }
-    while (!event.is_flush_event() ||
-           event.flush_state_addr() != &flush_state) {
-      event.post();
-      {
-        MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
-        event = dequeue();
-      }
-    }
-  } else {
-    // Wake up the service thread so it will process events.  When it gets
-    // to the flush event it will set 'flush_complete' and notify us.
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
-    enqueue(flush);
-    while (flush_state != FLUSHED) {
-      assert(flush_state == FLUSHING || flush_state == FLUSHED,
-             "only valid values for this");
-      Service_lock->wait(Mutex::_no_safepoint_check_flag);
-    }
-  }
-}
-
-void JvmtiDeferredEventQueue::flush_complete(int* state_addr) {
-  assert(state_addr != NULL && *state_addr == FLUSHING, "must be");
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
-  *state_addr = FLUSHED;
-  Service_lock->notify_all();
-}
-
 #endif // ndef KERNEL
--- a/hotspot/src/share/vm/prims/jvmtiImpl.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -451,7 +451,7 @@
     TYPE_NONE,
     TYPE_COMPILED_METHOD_LOAD,
     TYPE_COMPILED_METHOD_UNLOAD,
-    TYPE_FLUSH // pseudo-event used to implement flush_queue()
+    TYPE_DYNAMIC_CODE_GENERATED
   } Type;
 
   Type _type;
@@ -461,49 +461,15 @@
       jmethodID method_id;
       const void* code_begin;
     } compiled_method_unload;
-    int* flush_state_addr;
+    struct {
+      const char* name;
+      const void* code_begin;
+      const void* code_end;
+    } dynamic_code_generated;
   } _event_data;
 
   JvmtiDeferredEvent(Type t) : _type(t) {}
 
-  void set_compiled_method_load(nmethod* nm) {
-    assert(_type == TYPE_COMPILED_METHOD_LOAD, "must be");
-    _event_data.compiled_method_load = nm;
-  }
-
-  nmethod* compiled_method_load() const {
-    assert(_type == TYPE_COMPILED_METHOD_LOAD, "must be");
-    return _event_data.compiled_method_load;
-  }
-
-  void set_compiled_method_unload(jmethodID id, const void* code) {
-    assert(_type == TYPE_COMPILED_METHOD_UNLOAD, "must be");
-    _event_data.compiled_method_unload.method_id = id;
-    _event_data.compiled_method_unload.code_begin = code;
-  }
-
-  jmethodID compiled_method_unload_method_id() const {
-    assert(_type == TYPE_COMPILED_METHOD_UNLOAD, "must be");
-    return _event_data.compiled_method_unload.method_id;
-  }
-
-  const void* compiled_method_unload_code_begin() const {
-    assert(_type == TYPE_COMPILED_METHOD_UNLOAD, "must be");
-    return _event_data.compiled_method_unload.code_begin;
-  }
-
-  bool is_flush_event() const { return _type == TYPE_FLUSH; }
-
-  int* flush_state_addr() const {
-    assert(is_flush_event(), "must be");
-    return _event_data.flush_state_addr;
-  }
-
-  void set_flush_state_addr(int* flag) {
-    assert(is_flush_event(), "must be");
-    _event_data.flush_state_addr = flag;
-  }
-
  public:
 
   JvmtiDeferredEvent() : _type(TYPE_NONE) {}
@@ -513,6 +479,9 @@
     KERNEL_RETURN_(JvmtiDeferredEvent());
   static JvmtiDeferredEvent compiled_method_unload_event(
       jmethodID id, const void* code) KERNEL_RETURN_(JvmtiDeferredEvent());
+  static JvmtiDeferredEvent dynamic_code_generated_event(
+      const char* name, const void* begin, const void* end)
+          KERNEL_RETURN_(JvmtiDeferredEvent());
 
   // Actually posts the event.
   void post() KERNEL_RETURN;
@@ -548,25 +517,12 @@
   // Transfers events from the _pending_list to the _queue.
   static void process_pending_events() KERNEL_RETURN;
 
-  static void flush_complete(int* flush_state) KERNEL_RETURN;
-
  public:
   // Must be holding Service_lock when calling these
   static bool has_events() KERNEL_RETURN_(false);
   static void enqueue(const JvmtiDeferredEvent& event) KERNEL_RETURN;
   static JvmtiDeferredEvent dequeue() KERNEL_RETURN_(JvmtiDeferredEvent());
 
-  // This call blocks until all events enqueued prior to this call
-  // have been posted.  The Service_lock is acquired and waited upon.
-  //
-  // Implemented by creating a "flush" event and placing it in the queue.
-  // When the flush event is "posted" it will call flush_complete(), which
-  // will release the caller.
-  //
-  // Can be called by any thread (maybe even the service thread itself).
-  // Not necessary for the caller to be a JavaThread.
-  static void flush_queue(Thread* current) KERNEL_RETURN;
-
   // Used to enqueue events without using a lock, for times (such as during
   // safepoint) when we can't or don't want to lock the Service_lock.
   //
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -110,6 +110,8 @@
 
 inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) {
   jlong byte_offset = field_offset_to_byte_offset(field_offset);
+  // Don't allow unsafe to be used to read or write the header word of oops
+  assert(p == NULL || field_offset >= oopDesc::header_size(), "offset must be outside of header");
 #ifdef ASSERT
   if (p != NULL) {
     assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -78,6 +78,7 @@
 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
 int    Arguments::_sun_java_launcher_pid        = -1;
+bool   Arguments::_created_by_gamma_launcher    = false;
 
 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
 bool   Arguments::_AlwaysCompileLoopMethods     = AlwaysCompileLoopMethods;
@@ -1656,6 +1657,9 @@
 
 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
   _sun_java_launcher = strdup(launcher);
+  if (strcmp("gamma", _sun_java_launcher) == 0) {
+    _created_by_gamma_launcher = true;
+  }
 }
 
 bool Arguments::created_by_java_launcher() {
@@ -1663,6 +1667,10 @@
   return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
 }
 
+bool Arguments::created_by_gamma_launcher() {
+  return _created_by_gamma_launcher;
+}
+
 //===========================================================================================================
 // Parsing of main arguments
 
@@ -2790,10 +2798,6 @@
   if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
     FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);
   }
-  // Temporary disable bulk zeroing reduction with G1. See CR 6627983.
-  if (UseG1GC) {
-    FLAG_SET_DEFAULT(ReduceBulkZeroing, false);
-  }
 #endif
 
   // If we are running in a headless jre, force java.awt.headless property
@@ -3155,6 +3159,16 @@
     }
   }
 
+  // set PauseAtExit if the gamma launcher was used and a debugger is attached
+  // but only if not already set on the commandline
+  if (Arguments::created_by_gamma_launcher() && os::is_debugger_attached()) {
+    bool set = false;
+    CommandLineFlags::wasSetOnCmdline("PauseAtExit", &set);
+    if (!set) {
+      FLAG_SET_DEFAULT(PauseAtExit, true);
+    }
+  }
+
   return JNI_OK;
 }
 
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -257,6 +257,9 @@
   // sun.java.launcher.pid, private property
   static int    _sun_java_launcher_pid;
 
+  // was this VM created by the gamma launcher
+  static bool   _created_by_gamma_launcher;
+
   // Option flags
   static bool   _has_profile;
   static bool   _has_alloc_profile;
@@ -444,6 +447,8 @@
   static const char* sun_java_launcher()    { return _sun_java_launcher; }
   // Was VM created by a Java launcher?
   static bool created_by_java_launcher();
+  // Was VM created by the gamma Java launcher?
+  static bool created_by_gamma_launcher();
   // -Dsun.java.launcher.pid
   static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -2610,9 +2610,6 @@
   develop(bool, CompileTheWorldPreloadClasses, true,                        \
           "Preload all classes used by a class before start loading")       \
                                                                             \
-  notproduct(bool, CompileTheWorldIgnoreInitErrors, false,                  \
-          "Compile all methods although class initializer failed")          \
-                                                                            \
   notproduct(intx, CompileTheWorldSafepointInterval, 100,                   \
           "Force a safepoint every n compiles so sweeper can keep up")      \
                                                                             \
@@ -3733,6 +3730,9 @@
           "The file to create and for whose removal to await when pausing " \
           "at startup. (default: ./vm.paused.<pid>)")                       \
                                                                             \
+  diagnostic(bool, PauseAtExit, false,                                      \
+          "Pause and wait for keypress on exit if a debugger is attached")  \
+                                                                            \
   product(bool, ExtendedDTraceProbes,    false,                             \
           "Enable performance-impacting dtrace probes")                     \
                                                                             \
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -551,6 +551,7 @@
 
 void vm_direct_exit(int code) {
   notify_vm_shutdown();
+  os::wait_for_keypress_at_exit();
   ::exit(code);
 }
 
@@ -577,11 +578,13 @@
 void vm_shutdown()
 {
   vm_perform_shutdown_actions();
+  os::wait_for_keypress_at_exit();
   os::shutdown();
 }
 
 void vm_abort(bool dump_core) {
   vm_perform_shutdown_actions();
+  os::wait_for_keypress_at_exit();
   os::abort(dump_core);
   ShouldNotReachHere();
 }
--- a/hotspot/src/share/vm/runtime/os.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -492,6 +492,12 @@
   static void print_location(outputStream* st, intptr_t x, bool verbose = false);
   static size_t lasterror(char *buf, size_t len);
 
+  // Determines whether the calling process is being debugged by a user-mode debugger.
+  static bool is_debugger_attached();
+
+  // wait for a key press if PauseAtExit is set
+  static void wait_for_keypress_at_exit(void);
+
   // The following two functions are used by fatal error handler to trace
   // native (C) frames. They are not part of frame.hpp/frame.cpp because
   // frame.hpp/cpp assume thread is JavaThread, and also because different
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -431,25 +431,24 @@
 // previous frame depending on the return address.
 
 address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) {
-  assert(frame::verify_return_pc(return_address), "must be a return pc");
-
-  // Reset MethodHandle flag.
+  assert(frame::verify_return_pc(return_address), err_msg("must be a return address: " INTPTR_FORMAT, return_address));
+
+  // Reset method handle flag.
   thread->set_is_method_handle_return(false);
 
-  // the fastest case first
+  // The fastest case first
   CodeBlob* blob = CodeCache::find_blob(return_address);
-  if (blob != NULL && blob->is_nmethod()) {
-    nmethod* code = (nmethod*)blob;
-    assert(code != NULL, "nmethod must be present");
-    // Check if the return address is a MethodHandle call site.
-    thread->set_is_method_handle_return(code->is_method_handle_return(return_address));
+  nmethod* nm = (blob != NULL) ? blob->as_nmethod_or_null() : NULL;
+  if (nm != NULL) {
+    // Set flag if return address is a method handle call site.
+    thread->set_is_method_handle_return(nm->is_method_handle_return(return_address));
     // native nmethods don't have exception handlers
-    assert(!code->is_native_method(), "no exception handler");
-    assert(code->header_begin() != code->exception_begin(), "no exception handler");
-    if (code->is_deopt_pc(return_address)) {
+    assert(!nm->is_native_method(), "no exception handler");
+    assert(nm->header_begin() != nm->exception_begin(), "no exception handler");
+    if (nm->is_deopt_pc(return_address)) {
       return SharedRuntime::deopt_blob()->unpack_with_exception();
     } else {
-      return code->exception_begin();
+      return nm->exception_begin();
     }
   }
 
@@ -462,22 +461,9 @@
     return Interpreter::rethrow_exception_entry();
   }
 
-  // Compiled code
-  if (CodeCache::contains(return_address)) {
-    CodeBlob* blob = CodeCache::find_blob(return_address);
-    if (blob->is_nmethod()) {
-      nmethod* code = (nmethod*)blob;
-      assert(code != NULL, "nmethod must be present");
-      // Check if the return address is a MethodHandle call site.
-      thread->set_is_method_handle_return(code->is_method_handle_return(return_address));
-      assert(code->header_begin() != code->exception_begin(), "no exception handler");
-      return code->exception_begin();
-    }
-    if (blob->is_runtime_stub()) {
-      ShouldNotReachHere();   // callers are responsible for skipping runtime stub frames
-    }
-  }
+  guarantee(blob == NULL || !blob->is_runtime_stub(), "caller should have skipped stub");
   guarantee(!VtableStubs::contains(return_address), "NULL exceptions in vtables should have been handled already!");
+
 #ifndef PRODUCT
   { ResourceMark rm;
     tty->print_cr("No exception handler found for exception at " INTPTR_FORMAT " - potential problems:", return_address);
@@ -485,6 +471,7 @@
     tty->print_cr("b) other problem");
   }
 #endif // PRODUCT
+
   ShouldNotReachHere();
   return NULL;
 }
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,30 +80,36 @@
 jint    StubRoutines::_fpu_subnormal_bias2[3]                   = { 0, 0, 0 };
 
 // Compiled code entry points default values
-// The dafault functions don't have separate disjoint versions.
+// The default functions don't have separate disjoint versions.
 address StubRoutines::_jbyte_arraycopy          = CAST_FROM_FN_PTR(address, StubRoutines::jbyte_copy);
 address StubRoutines::_jshort_arraycopy         = CAST_FROM_FN_PTR(address, StubRoutines::jshort_copy);
 address StubRoutines::_jint_arraycopy           = CAST_FROM_FN_PTR(address, StubRoutines::jint_copy);
 address StubRoutines::_jlong_arraycopy          = CAST_FROM_FN_PTR(address, StubRoutines::jlong_copy);
 address StubRoutines::_oop_arraycopy            = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy);
+address StubRoutines::_oop_arraycopy_uninit     = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy_uninit);
 address StubRoutines::_jbyte_disjoint_arraycopy          = CAST_FROM_FN_PTR(address, StubRoutines::jbyte_copy);
 address StubRoutines::_jshort_disjoint_arraycopy         = CAST_FROM_FN_PTR(address, StubRoutines::jshort_copy);
 address StubRoutines::_jint_disjoint_arraycopy           = CAST_FROM_FN_PTR(address, StubRoutines::jint_copy);
 address StubRoutines::_jlong_disjoint_arraycopy          = CAST_FROM_FN_PTR(address, StubRoutines::jlong_copy);
 address StubRoutines::_oop_disjoint_arraycopy            = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy);
+address StubRoutines::_oop_disjoint_arraycopy_uninit     = CAST_FROM_FN_PTR(address, StubRoutines::oop_copy_uninit);
 
 address StubRoutines::_arrayof_jbyte_arraycopy  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jbyte_copy);
 address StubRoutines::_arrayof_jshort_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jshort_copy);
 address StubRoutines::_arrayof_jint_arraycopy   = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jint_copy);
 address StubRoutines::_arrayof_jlong_arraycopy  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jlong_copy);
 address StubRoutines::_arrayof_oop_arraycopy    = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy);
+address StubRoutines::_arrayof_oop_arraycopy_uninit      = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy_uninit);
 address StubRoutines::_arrayof_jbyte_disjoint_arraycopy  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jbyte_copy);
 address StubRoutines::_arrayof_jshort_disjoint_arraycopy = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jshort_copy);
 address StubRoutines::_arrayof_jint_disjoint_arraycopy   = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jint_copy);
 address StubRoutines::_arrayof_jlong_disjoint_arraycopy  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_jlong_copy);
-address StubRoutines::_arrayof_oop_disjoint_arraycopy  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy);
+address StubRoutines::_arrayof_oop_disjoint_arraycopy    = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy);
+address StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit  = CAST_FROM_FN_PTR(address, StubRoutines::arrayof_oop_copy_uninit);
+
 
 address StubRoutines::_checkcast_arraycopy               = NULL;
+address StubRoutines::_checkcast_arraycopy_uninit        = NULL;
 address StubRoutines::_unsafe_arraycopy                  = NULL;
 address StubRoutines::_generic_arraycopy                 = NULL;
 
@@ -282,12 +288,12 @@
 // Default versions of arraycopy functions
 //
 
-static void gen_arraycopy_barrier_pre(oop* dest, size_t count) {
+static void gen_arraycopy_barrier_pre(oop* dest, size_t count, bool dest_uninitialized) {
     assert(count != 0, "count should be non-zero");
     assert(count <= (size_t)max_intx, "count too large");
     BarrierSet* bs = Universe::heap()->barrier_set();
     assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt");
-    bs->write_ref_array_pre(dest, (int)count);
+    bs->write_ref_array_pre(dest, (int)count, dest_uninitialized);
 }
 
 static void gen_arraycopy_barrier(oop* dest, size_t count) {
@@ -330,7 +336,17 @@
   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 #endif // !PRODUCT
   assert(count != 0, "count should be non-zero");
-  gen_arraycopy_barrier_pre(dest, count);
+  gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/false);
+  Copy::conjoint_oops_atomic(src, dest, count);
+  gen_arraycopy_barrier(dest, count);
+JRT_END
+
+JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count))
+#ifndef PRODUCT
+  SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
+#endif // !PRODUCT
+  assert(count != 0, "count should be non-zero");
+  gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/true);
   Copy::conjoint_oops_atomic(src, dest, count);
   gen_arraycopy_barrier(dest, count);
 JRT_END
@@ -368,11 +384,20 @@
   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 #endif // !PRODUCT
   assert(count != 0, "count should be non-zero");
-  gen_arraycopy_barrier_pre((oop *) dest, count);
+  gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/false);
   Copy::arrayof_conjoint_oops(src, dest, count);
   gen_arraycopy_barrier((oop *) dest, count);
 JRT_END
 
+JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count))
+#ifndef PRODUCT
+  SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
+#endif // !PRODUCT
+  assert(count != 0, "count should be non-zero");
+  gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/true);
+  Copy::arrayof_conjoint_oops(src, dest, count);
+  gen_arraycopy_barrier((oop *) dest, count);
+JRT_END
 
 address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {
 #define RETURN_STUB(xxx_fill) { \
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -164,12 +164,12 @@
   static address _jshort_arraycopy;
   static address _jint_arraycopy;
   static address _jlong_arraycopy;
-  static address _oop_arraycopy;
+  static address _oop_arraycopy, _oop_arraycopy_uninit;
   static address _jbyte_disjoint_arraycopy;
   static address _jshort_disjoint_arraycopy;
   static address _jint_disjoint_arraycopy;
   static address _jlong_disjoint_arraycopy;
-  static address _oop_disjoint_arraycopy;
+  static address _oop_disjoint_arraycopy, _oop_disjoint_arraycopy_uninit;
 
   // arraycopy operands aligned on zero'th element boundary
   // These are identical to the ones aligned aligned on an
@@ -179,15 +179,15 @@
   static address _arrayof_jshort_arraycopy;
   static address _arrayof_jint_arraycopy;
   static address _arrayof_jlong_arraycopy;
-  static address _arrayof_oop_arraycopy;
+  static address _arrayof_oop_arraycopy, _arrayof_oop_arraycopy_uninit;
   static address _arrayof_jbyte_disjoint_arraycopy;
   static address _arrayof_jshort_disjoint_arraycopy;
   static address _arrayof_jint_disjoint_arraycopy;
   static address _arrayof_jlong_disjoint_arraycopy;
-  static address _arrayof_oop_disjoint_arraycopy;
+  static address _arrayof_oop_disjoint_arraycopy, _arrayof_oop_disjoint_arraycopy_uninit;
 
   // these are recommended but optional:
-  static address _checkcast_arraycopy;
+  static address _checkcast_arraycopy, _checkcast_arraycopy_uninit;
   static address _unsafe_arraycopy;
   static address _generic_arraycopy;
 
@@ -286,26 +286,36 @@
   static address jshort_arraycopy() { return _jshort_arraycopy; }
   static address jint_arraycopy()   { return _jint_arraycopy; }
   static address jlong_arraycopy()  { return _jlong_arraycopy; }
-  static address oop_arraycopy()    { return _oop_arraycopy; }
+  static address oop_arraycopy(bool dest_uninitialized = false) {
+    return dest_uninitialized ? _oop_arraycopy_uninit : _oop_arraycopy;
+  }
   static address jbyte_disjoint_arraycopy()  { return _jbyte_disjoint_arraycopy; }
   static address jshort_disjoint_arraycopy() { return _jshort_disjoint_arraycopy; }
   static address jint_disjoint_arraycopy()   { return _jint_disjoint_arraycopy; }
   static address jlong_disjoint_arraycopy()  { return _jlong_disjoint_arraycopy; }
-  static address oop_disjoint_arraycopy()    { return _oop_disjoint_arraycopy; }
+  static address oop_disjoint_arraycopy(bool dest_uninitialized = false) {
+    return dest_uninitialized ?  _oop_disjoint_arraycopy_uninit : _oop_disjoint_arraycopy;
+  }
 
   static address arrayof_jbyte_arraycopy()  { return _arrayof_jbyte_arraycopy; }
   static address arrayof_jshort_arraycopy() { return _arrayof_jshort_arraycopy; }
   static address arrayof_jint_arraycopy()   { return _arrayof_jint_arraycopy; }
   static address arrayof_jlong_arraycopy()  { return _arrayof_jlong_arraycopy; }
-  static address arrayof_oop_arraycopy()    { return _arrayof_oop_arraycopy; }
+  static address arrayof_oop_arraycopy(bool dest_uninitialized = false) {
+    return dest_uninitialized ? _arrayof_oop_arraycopy_uninit : _arrayof_oop_arraycopy;
+  }
 
   static address arrayof_jbyte_disjoint_arraycopy()  { return _arrayof_jbyte_disjoint_arraycopy; }
   static address arrayof_jshort_disjoint_arraycopy() { return _arrayof_jshort_disjoint_arraycopy; }
   static address arrayof_jint_disjoint_arraycopy()   { return _arrayof_jint_disjoint_arraycopy; }
   static address arrayof_jlong_disjoint_arraycopy()  { return _arrayof_jlong_disjoint_arraycopy; }
-  static address arrayof_oop_disjoint_arraycopy()    { return _arrayof_oop_disjoint_arraycopy; }
+  static address arrayof_oop_disjoint_arraycopy(bool dest_uninitialized = false) {
+    return dest_uninitialized ? _arrayof_oop_disjoint_arraycopy_uninit : _arrayof_oop_disjoint_arraycopy;
+  }
 
-  static address checkcast_arraycopy()     { return _checkcast_arraycopy; }
+  static address checkcast_arraycopy(bool dest_uninitialized = false) {
+    return dest_uninitialized ? _checkcast_arraycopy_uninit : _checkcast_arraycopy;
+  }
   static address unsafe_arraycopy()        { return _unsafe_arraycopy; }
   static address generic_arraycopy()       { return _generic_arraycopy; }
 
@@ -352,17 +362,19 @@
   // Default versions of the above arraycopy functions for platforms which do
   // not have specialized versions
   //
-  static void jbyte_copy (jbyte*  src, jbyte*  dest, size_t count);
-  static void jshort_copy(jshort* src, jshort* dest, size_t count);
-  static void jint_copy  (jint*   src, jint*   dest, size_t count);
-  static void jlong_copy (jlong*  src, jlong*  dest, size_t count);
-  static void oop_copy   (oop*    src, oop*    dest, size_t count);
+  static void jbyte_copy     (jbyte*  src, jbyte*  dest, size_t count);
+  static void jshort_copy    (jshort* src, jshort* dest, size_t count);
+  static void jint_copy      (jint*   src, jint*   dest, size_t count);
+  static void jlong_copy     (jlong*  src, jlong*  dest, size_t count);
+  static void oop_copy       (oop*    src, oop*    dest, size_t count);
+  static void oop_copy_uninit(oop*    src, oop*    dest, size_t count);
 
-  static void arrayof_jbyte_copy (HeapWord* src, HeapWord* dest, size_t count);
-  static void arrayof_jshort_copy(HeapWord* src, HeapWord* dest, size_t count);
-  static void arrayof_jint_copy  (HeapWord* src, HeapWord* dest, size_t count);
-  static void arrayof_jlong_copy (HeapWord* src, HeapWord* dest, size_t count);
-  static void arrayof_oop_copy   (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_jbyte_copy     (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_jshort_copy    (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_jint_copy      (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_jlong_copy     (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_oop_copy       (HeapWord* src, HeapWord* dest, size_t count);
+  static void arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count);
 };
 
 #endif // SHARE_VM_RUNTIME_STUBROUTINES_HPP
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -3644,6 +3644,7 @@
   if (ShowMessageBoxOnError && is_error_reported()) {
     os::infinite_sleep();
   }
+  os::wait_for_keypress_at_exit();
 
   if (JDK_Version::is_jdk12x_version()) {
     // We are the last thread running, so check if finalizers should be run.
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -77,6 +77,7 @@
 # endif
 
 #ifdef LINUX
+#define __STDC_LIMIT_MACROS
 #include <inttypes.h>
 #include <signal.h>
 #include <ucontext.h>
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -148,6 +148,17 @@
 #endif
 #endif
 
+// On solaris 8, UINTPTR_MAX is defined as empty.
+// Everywhere else it's an actual value.
+#if UINTPTR_MAX - 1 == -1
+#undef UINTPTR_MAX
+#ifdef _LP64
+#define UINTPTR_MAX UINT64_MAX
+#else
+#define UINTPTR_MAX UINT32_MAX
+#endif /* ifdef _LP64 */
+#endif
+
 // Additional Java basic types
 
 typedef unsigned char      jubyte;
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -41,6 +41,7 @@
 # include <stdio.h> // for va_list
 # include <time.h>
 # include <fcntl.h>
+# include <limits.h>
 // Need this on windows to get the math constants (e.g., M_PI).
 #define _USE_MATH_DEFINES
 # include <math.h>
@@ -99,6 +100,14 @@
 typedef signed   int ssize_t;
 #endif
 
+#ifndef UINTPTR_MAX
+#ifdef _WIN64
+#define UINTPTR_MAX _UI64_MAX
+#else
+#define UINTPTR_MAX _UI32_MAX
+#endif
+#endif
+
 //----------------------------------------------------------------------------------------------------
 // Additional Java basic types
 
--- a/hotspot/src/share/vm/utilities/macros.hpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Fri Mar 18 15:44:48 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -161,6 +161,14 @@
 #define NOT_WINDOWS(code) code
 #endif
 
+#ifdef _WIN64
+#define WIN64_ONLY(code) code
+#define NOT_WIN64(code)
+#else
+#define WIN64_ONLY(code)
+#define NOT_WIN64(code) code
+#endif
+
 #if defined(IA32) || defined(AMD64)
 #define X86
 #define X86_ONLY(code) code
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Fri Mar 18 08:42:05 2011 +0900
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Fri Mar 18 15:44:48 2011 -0700
@@ -802,7 +802,7 @@
     first_error_tid = mytid;
     set_error_reported();
 
-    if (ShowMessageBoxOnError) {
+    if (ShowMessageBoxOnError || PauseAtExit) {
       show_message_box(buffer, sizeof(buffer));
 
       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/6942326/Test.java	Fri Mar 18 15:44:48 2011 -0700
@@ -0,0 +1,409 @@
+/*
+ * 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 6942326
+ * @summary x86 code in string_indexof() could read beyond reserved heap space
+ *
+ * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=exclude,Test,main -XX:CompileCommand=exclude,Test,test_varsub_indexof -XX:CompileCommand=exclude,Test,test_varstr_indexof -XX:CompileCommand=exclude,Test,test_missub_indexof -XX:CompileCommand=exclude,Test,test_consub_indexof -XX:CompileCommand=exclude,Test,test_conmis_indexof -XX:CompileCommand=exclude,Test,test_subcon Test
+ *
+ */
+
+public class Test {
+
+    static String[] strings = new String[1024];
+    private static final int ITERATIONS = 100000;
+
+    public static void main(String[] args) {
+
+        long start_total = System.currentTimeMillis();
+
+        // search variable size substring in string (33 chars).
+        String a = " 1111111111111xx1111111111111xx11y"; // +1 to execute a.substring(1) first
+        String b =  "1111111111111xx1111111111111xx11y";
+        test_varsub_indexof(a, b);
+
+        // search variable size substring in string (32 chars).
+        a = " 1111111111111xx1111111111111xx1y";
+        b =  "1111111111111xx1111111111111xx1y";
+        test_varsub_indexof(a, b);
+
+        // search variable size substring in string (17 chars).
+        a = " 1111111111111xx1y";
+        b =  "1111111111111xx1y";
+        test_varsub_indexof(a, b);
+
+        // search variable size substring in string (16 chars).
+        a = " 111111111111xx1y";
+        b =  "111111111111xx1y";
+        test_varsub_indexof(a, b);
+
+        // search variable size substring in string (8 chars).
+        a = " 1111xx1y";
+        b =  "1111xx1y";
+        test_varsub_indexof(a, b);
+
+        // search variable size substring in string (7 chars).
+        a = " 111xx1y";
+        b =  "111xx1y";
+        test_varsub_indexof(a, b);
+
+
+
+        // search substring (17 chars) in variable size string.
+        a =                 "1111111111111xx1x";
+        b = " 1111111111111xx1111111111111xx1x"; // +1 to execute b.substring(1) first
+        test_varstr_indexof(a, b);
+
+        // search substring (16 chars) in variable size string.
+        a =                  "111111111111xx1x";
+        b = " 1111111111111xx1111111111111xx1x";
+        test_varstr_indexof(a, b);
+
+        // search substring (9 chars) in variable size string.
+        a =                         "11111xx1x";
+        b = " 1111111111111xx1111111111111xx1x";
+        test_varstr_indexof(a, b);
+
+        // search substring (8 chars) in variable size string.
+        a =                          "1111xx1x";
+        b = " 1111111111111xx1111111111111xx1x";
+        test_varstr_indexof(a, b);
+
+        // search substring (4 chars) in variable size string.
+        a =                              "xx1x";
+        b = " 1111111111111xx1111111111111xx1x";
+        test_varstr_indexof(a, b);
+
+        // search substring (3 chars) in variable size string.
+        a =                               "x1x";
+        b = " 1111111111111xx1111111111111xx1x";
+        test_varstr_indexof(a, b);
+
+        // search substring (2 chars) in variable size string.
+        a =                                "1y";
+        b = " 1111111111111xx1111111111111xx1y";
+        test_varstr_indexof(a, b);
+
+
+
+        // search non matching variable size substring in string (33 chars).
+        a = " 1111111111111xx1111111111111xx11z"; // +1 to execute a.substring(1) first
+        b =  "1111111111111xx1111111111111xx11y";
+        test_missub_indexof(a, b);
+
+        // search non matching variable size substring in string (32 chars).
+        a = " 1111111111111xx1111111111111xx1z";
+        b =  "1111111111111xx1111111111111xx1y";
+        test_missub_indexof(a, b);
+
+        // search non matching variable size substring in string (17 chars).
+        a = " 1111111111111xx1z";
+        b =  "1111111111111xx1y";
+        test_missub_indexof(a, b);
+
+        // search non matching variable size substring in string (16 chars).
+        a = " 111111111111xx1z";
+        b =  "111111111111xx1y";
+        test_missub_indexof(a, b);
+
+        // search non matching variable size substring in string (8 chars).
+        a = " 1111xx1z";
+        b =  "1111xx1y";
+        test_missub_indexof(a, b);
+
+        // search non matching variable size substring in string (7 chars).
+        a = " 111xx1z";
+        b =  "111xx1y";
+        test_missub_indexof(a, b);
+
+
+
+        // Testing constant substring search in variable size string.
+
+        // search constant substring (17 chars).
+        b = " 1111111111111xx1111111111111xx1x"; // +1 to execute b.substring(1) first
+        TestCon tc = new TestCon17();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (16 chars).
+        b = " 1111111111111xx1111111111111xx1x";
+        tc = new TestCon16();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (9 chars).
+        b = " 1111111111111xx1111111111111xx1x";
+        tc = new TestCon9();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (8 chars).
+        b = " 1111111111111xx1111111111111xx1x";
+        tc = new TestCon8();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (4 chars).
+        b = " 1111111111111xx1111111111111xx1x";
+        tc = new TestCon4();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (3 chars).
+        b = " 1111111111111xx1111111111111xx1x";
+        tc = new TestCon3();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (2 chars).
+        b = " 1111111111111xx1111111111111xx1y";
+        tc = new TestCon2();
+        test_consub_indexof(tc, b);
+
+        // search constant substring (1 chars).
+        b = " 1111111111111xx1111111111111xx1y";
+        tc = new TestCon1();
+        test_consub_indexof(tc, b);
+
+
+        // search non matching constant substring (17 chars).
+        b = " 1111111111111xx1111111111111xx1z"; // +1 to execute b.substring(1) first
+        tc = new TestCon17();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (16 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon16();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (9 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon9();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (8 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon8();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (4 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon4();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (3 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon3();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (2 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon2();
+        test_conmis_indexof(tc, b);
+
+        // search non matching constant substring (1 chars).
+        b = " 1111111111111xx1111111111111xx1z";
+        tc = new TestCon1();
+        test_conmis_indexof(tc, b);
+
+        long end_total = System.currentTimeMillis();
+        System.out.println("End run time: " + (end_total - start_total));
+
+    }
+
+    public static long test_init(String a, String b) {
+        for (int i = 0; i < 512; i++) {
+            strings[i * 2] = new String(b.toCharArray());
+            strings[i * 2 + 1] = new String(a.toCharArray());
+        }
+        System.out.print(a.length() + " " + b.length() + " ");
+        return System.currentTimeMillis();
+    }
+
+    public static void test_end(String a, String b, int v, int expected, long start) {
+        long end = System.currentTimeMillis();
+        int res = (v/ITERATIONS);
+        System.out.print(" " + res);
+        System.out.println(" time:" + (end - start));
+        if (res != expected) {
+            System.out.println("wrong indexOf result: " + res + ", expected " + expected);
+            System.out.println("\"" + b + "\".indexOf(\"" + a + "\")");
+            System.exit(97);
+        }
+    }
+
+    public static int test_subvar() {
+        int s = 0;
+        int v = 0;
+        for (int i = 0; i < ITERATIONS; i++) {
+            v += strings[s].indexOf(strings[s + 1]);
+            s += 2;
+            if (s >= strings.length) s = 0;
+        }
+        return v;
+    }
+
+    public static void test_varsub_indexof(String a, String b) {
+        System.out.println("Start search variable size substring in string (" + b.length() + " chars)");
+        long start_it = System.currentTimeMillis();
+        int limit = 1; // last a.length() == 1
+        while (a.length() > limit) {
+            a = a.substring(1);
+            long start = test_init(a, b);
+            int v = test_subvar();
+            test_end(a, b, v, (b.length() - a.length()), start);
+        }
+        long end_it = System.currentTimeMillis();
+        System.out.println("End search variable size substring in string (" + b.length() + " chars), time: " + (end_it - start_it));
+    }
+
+    public static void test_varstr_indexof(String a, String b) {
+        System.out.println("Start search substring (" + a.length() + " chars) in variable size string");
+        long start_it = System.currentTimeMillis();
+        int limit = a.length();
+        while (b.length() > limit) {
+            b = b.substring(1);
+            long start = test_init(a, b);
+            int v = test_subvar();
+            test_end(a, b, v, (b.length() - a.length()), start);
+        }
+        long end_it = System.currentTimeMillis();
+        System.out.println("End search substring (" + a.length() + " chars) in variable size string, time: " + (end_it - start_it));
+    }
+
+    public static void test_missub_indexof(String a, String b) {
+        System.out.println("Start search non matching variable size substring in string (" + b.length() + " chars)");
+        long start_it = System.currentTimeMillis();
+        int limit = 1; // last a.length() == 1
+        while (a.length() > limit) {
+            a = a.substring(1);
+            long start = test_init(a, b);
+            int v = test_subvar();
+            test_end(a, b, v, (-1), start);
+        }
+        long end_it = System.currentTimeMillis();
+        System.out.println("End search non matching variable size substring in string (" + b.length() + " chars), time: " + (end_it - start_it));
+    }
+
+
+
+    public static void test_consub_indexof(TestCon tc, String b) {
+        System.out.println("Start search constant substring (" + tc.constr().length() + " chars)");
+        long start_it = System.currentTimeMillis();
+        int limit = tc.constr().length();
+        while (b.length() > limit) {
+            b = b.substring(1);
+            long start = test_init(tc.constr(), b);
+            int v = test_subcon(tc);
+            test_end(tc.constr(), b, v, (b.length() - tc.constr().length()), start);
+        }
+        long end_it = System.currentTimeMillis();
+        System.out.println("End search constant substring (" + tc.constr().length() + " chars), time: " + (end_it - start_it));
+    }
+
+    public static void test_conmis_indexof(TestCon tc, String b) {
+        System.out.println("Start search non matching constant substring (" + tc.constr().length() + " chars)");
+        long start_it = System.currentTimeMillis();
+        int limit = tc.constr().length();
+        while (b.length() > limit) {
+            b = b.substring(1);
+            long start = test_init(tc.constr(), b);
+            int v = test_subcon(tc);
+            test_end(tc.constr(), b, v, (-1), start);
+        }
+        long end_it = System.currentTimeMillis();
+        System.out.println("End search non matching constant substring (" + tc.constr().length() + " chars), time: " + (end_it - start_it));
+    }
+
+    public static int test_subcon(TestCon tc) {
+        int s = 0;
+        int v = 0;
+        for (int i = 0; i < ITERATIONS; i++) {
+            v += tc.indexOf(strings[s]);
+            s += 2;
+            if (s >= strings.length) s = 0;
+        }
+        return v;
+    }
+
+    private interface TestCon {
+        public String constr();
+        public int indexOf(String str);
+    }
+
+    // search constant substring (17 chars).
+    private final static class TestCon17 implements TestCon {
+        private static final String constr = "1111111111111xx1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (16 chars).
+    private final static class TestCon16 implements TestCon {
+        private static final String constr = "111111111111xx1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (9 chars).
+    private final static class TestCon9 implements TestCon {
+        private static final String constr = "11111xx1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (8 chars).
+    private final static class TestCon8 implements TestCon {
+        private static final String constr = "1111xx1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (4 chars).
+    private final static class TestCon4 implements TestCon {
+        private static final String constr = "xx1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (3 chars).
+    private final static class TestCon3 implements TestCon {
+        private static final String constr = "x1x";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+    // search constant substring (2 chars).
+    private final static class TestCon2 implements TestCon {
+        private static final String constr = "1y";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+
+
+    // search constant substring (1 chars).
+    private final static class TestCon1 implements TestCon {
+        private static final String constr = "y";
+        public String constr() { return constr; }
+        public int indexOf(String str) { return str.indexOf(constr); }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/6878713/Test6878713.sh	Fri Mar 18 15:44:48 2011 -0700
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+##
+## @test
+## @bug 6878713
+## @summary Verifier heap corruption, relating to backward jsrs
+## @run shell/timeout=120 Test6878713.sh
+##
+
+if [ "${TESTSRC}" = "" ]
+then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+BIT_FLAG=""
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux )
+    NULL=/dev/null
+    PS=":"
+    FS="/"
+    ## for solaris, linux it's HOME
+    FILE_LOCATION=$HOME
+    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
+    then
+        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
+    fi
+    ;;
+  Windows_* )
+    NULL=NUL
+    PS=";"
+    FS="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+JEMMYPATH=${CPAPPEND}
+CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
+
+THIS_DIR=`pwd`
+
+${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
+
+${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
+
+${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass1960_2 > test.out 2>&1
+
+if [ -s core -o -s "hs_*.log" ]
+then
+    cat hs*.log
+    echo "Test Failed"
+    exit 1
+else
+    echo "Test Passed"
+    exit 0
+fi
Binary file hotspot/test/runtime/6878713/testcase.jar has changed
--- a/jaxp/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/jaxp/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -106,3 +106,5 @@
 f5b60c5a310f992c6ca627d17ca3e042f0e0b2c3 jdk7-b129
 ab107c1bc4b918404b191838c455e9b2892389f3 jdk7-b130
 eab6f27131e4e2f0af0016b35b18ae65cdd249d9 jdk7-b131
+abe04c59a556a3821c30bd8839e3c74f5d4281d1 jdk7-b132
+8e1148c7911b02e00a727461525f239da025cab7 jdk7-b133
--- a/jaxp/jaxp.properties	Fri Mar 18 08:42:05 2011 +0900
+++ b/jaxp/jaxp.properties	Fri Mar 18 15:44:48 2011 -0700
@@ -25,13 +25,13 @@
 
 drops.master.copy.base=${drops.dir}
 
-jaxp_src.bundle.name=jaxp-1_4_5-dev.zip
-jaxp_src.bundle.md5.checksum=84e2c26853262c9144133c6ff7ef5dc9
+jaxp_src.bundle.name=jaxp-1_4_5-dev1.zip
+jaxp_src.bundle.md5.checksum=53c95613c29852a12b93e7249f1aa227
 jaxp_src.master.bundle.dir=${drops.master.copy.base}
 jaxp_src.master.bundle.url.base=http://download.java.net/jaxp/1.4.5/dev
 
-jaxp_tests.bundle.name=jaxp-1_4_5-dev-unittests.zip
-jaxp_tests.bundle.md5.checksum=0377e715fa21814cb8006768c5967dc5
+jaxp_tests.bundle.name=jaxp-1_4_5-dev1-unittests.zip
+jaxp_tests.bundle.md5.checksum=754aaba2f4944f69bfea91dec11daf4c
 jaxp_tests.master.bundle.dir=${drops.master.copy.base}
 jaxp_tests.master.bundle.url.base=http://download.java.net/jaxp/1.4.5/dev
 
--- a/jaxp/make/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jaxp/make/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -136,7 +136,7 @@
 else
   ANT = ant
   ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
-    $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
+    $(error "'ant' not found; please set ANT_HOME or put 'ant' on your PATH")
   endif
 endif
 
--- a/jaxws/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/jaxws/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -106,3 +106,5 @@
 0f7b39ad902424e949e3d2dca8411b884888a76f jdk7-b129
 ba1fac1c2083196422a12130db174334179a4d44 jdk7-b130
 438abc0356cd97d91b25f67cd1abc9883e22f6ed jdk7-b131
+0e57c3272d377eee04cc32c898e9a558051516b0 jdk7-b132
+359d0c8c00a02d3a094c19f8a485b2217c99a4e0 jdk7-b133
--- a/jaxws/make/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jaxws/make/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -136,7 +136,7 @@
 else
   ANT = ant
   ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
-    $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
+    $(error "'ant' not found; please set ANT_HOME or put 'ant' on your PATH")
   endif
 endif
 
--- a/jdk/.hgtags	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/.hgtags	Fri Mar 18 15:44:48 2011 -0700
@@ -107,3 +107,5 @@
 bdc069d3f9101f89ec3f81c2950ee2d68fa846d3 jdk7-b130
 8ac52c85f9e91336dc00b52ef90b42eecf3230b3 jdk7-b131
 6bbc7a4734952ae7604578f270e1566639fa8752 jdk7-b132
+5e5f68a01d12a4432172f384d5201f3a05254493 jdk7-b133
+554adcfb615e63e62af530b1c10fcf7813a75b26 jdk7-b134
--- a/jdk/make/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -74,7 +74,6 @@
 import_product    -- copy in the product components \n\
 import_fastdebug  -- copy in the fastdebug components \n\
 import_debug      -- copy in the debug components \n\
-modules           -- build the jdk and jre module images (experimental) \n\
 create_links      -- create softlinks in Solaris 32bit build to 64bit dirs \n\
 "
 
@@ -261,7 +260,6 @@
 # Release engineering targets.
 #
 include $(BUILDDIR)/common/Release.gmk
-include $(BUILDDIR)/common/Modules.gmk
 
 #
 # Cscope targets.
--- a/jdk/make/com/sun/crypto/provider/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/crypto/provider/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -249,7 +249,7 @@
 else
 $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar
 endif
-	$(install-non-module-file)
+	$(install-file)
 
 ifndef OPENJDK
 install-prebuilt:
--- a/jdk/make/com/sun/java/pack/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/java/pack/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../..
-MODULE  = pack200
 PACKAGE = com.sun.java.util.jar.pack
 LIBRARY = unpack
 PRODUCT = sun
@@ -156,7 +155,6 @@
 endif
 	$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
 	@$(call binary_file_verification,$@)
-	$(install-module-file)
 
 ifeq ($(PLATFORM), windows) 
 $(RES):: $(VERSIONINFO_RESOURCE)
--- a/jdk/make/com/sun/java/pack/prop/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/java/pack/prop/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 # to a collision of rules with Classes.gmk and Library.gmk
 
 BUILDDIR = ../../../../..
-MODULE  = pack200
 PACKAGE = com.sun.java.util.jar.pack
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/jndi/cosnaming/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/jndi/cosnaming/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../..
-MODULE  = jndi-cosnaming
 PACKAGE = com.sun.jndi.cosnaming
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/jndi/dns/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/jndi/dns/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../..
-MODULE  = jndi-dns
 PACKAGE = com.sun.jndi.dns
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/jndi/ldap/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/jndi/ldap/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../..
-MODULE  = jndi-ldap
 PACKAGE = com.sun.jndi.ldap
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/jndi/rmi/registry/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/jndi/rmi/registry/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../../..
-MODULE  = jndi-rmiregistry
 PACKAGE = com.sun.jndi.rmi.registry
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/nio/sctp/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/nio/sctp/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../..
-MODULE  = sctp
 PACKAGE = com.sun.nio.sctp
 LIBRARY = sctp
 PRODUCT = sun
--- a/jdk/make/com/sun/org/apache/xml/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/org/apache/xml/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../../../..
-MODULE  = security-xmldsig
 PACKAGE = com.sun.org.apache.xml
 PRODUCT = xml
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/rowset/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/rowset/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = jdbc-enterprise
 PACKAGE = com.sun.rowset
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/script/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/script/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -25,7 +25,6 @@
 
 
 BUILDDIR = ../../..
-MODULE  = scripting-rhino
 PACKAGE = com.sun.script
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/security/auth/module/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/security/auth/module/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -26,7 +26,6 @@
 # Makefile for building auth modules.
 
 BUILDDIR = ../../../../..
-MODULE  = security-auth
 PACKAGE = com.sun.security.auth.module
 PRODUCT = sun
 
--- a/jdk/make/com/sun/servicetag/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/servicetag/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -22,7 +22,6 @@
 # questions.
 
 BUILDDIR = ../../..
-MODULE  = servicetag
 PACKAGE = com.sun.servicetag
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/com/sun/tools/attach/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/com/sun/tools/attach/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -25,7 +25,6 @@
 
 
 BUILDDIR = ../../../..
-MODULE  = attach
 PACKAGE = com.sun.tools.attach
 LIBRARY = attach
 PRODUCT = sun
@@ -66,8 +65,7 @@
 	@$(MKDIR) -p $(@D)
 	@$(RM) $@
 	@$(CAT) $< | $(SED) -e "s/^#\[$(PLATFORM)\]//" > $@
-	@$(install-module-file)
-                                                                                                
+
 .PHONY: copy-files
 
 
--- a/jdk/make/common/Defs.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Defs.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -224,9 +224,6 @@
 # for generated class files
 CLASSBINDIR         = $(OUTPUTDIR)/classes
 DEMOCLASSDIR        = $(OUTPUTDIR)/democlasses
-# for modules
-MODULES_DIR         = $(OUTPUTDIR)/modules
-ABS_MODULES_DIR     = $(ABS_OUTPUTDIR)/modules
 # for generated tool class files
 BUILDTOOLCLASSDIR   = $(OUTPUTDIR)/btclasses
 # for build tool jar files
@@ -297,22 +294,6 @@
   endif
 endif
 
-#
-# Build units may or may not define MODULE.  Default to "other".
-#
-# MODULE variable defines the lowest-level module name that
-# might or might not be the name of the modules created in
-# the modules build (see make/modules/modules.config and
-# modules.group).
-#
-MODULES_TEMPDIR     = $(OUTPUTDIR)/tmp/modules
-ABS_MODULES_TEMPDIR = $(ABS_OUTPUTDIR)/tmp/modules
-
-ifndef MODULE
-  MODULE = other
-endif
-override MODULE_DEST_DIR = $(MODULES_TEMPDIR)/$(MODULE)
-
 # the use of += above makes a space separated list which we need to 
 # remove for filespecs.
 #
@@ -422,52 +403,13 @@
 #
 include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk
 
-#
-# Macros to find the module that $@ belongs to
-#
-
 UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH))
-MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \
-		      -e 's%.*\/$(UNIQUE_PATH_PATTERN)\/%classes\/%' \
-		      -e 's%.*\/lib\/%lib\/%' \
-	              -e 's%.*\/bin\/%bin\/%' \
-	              -e 's%.*\/include\/%include\/%' \
-		      -e 's%.*\/demo\/%demo\/%' \
-		      -e 's%.*\/sample\/%sample\/%'
-
-# Install a file to its module
-define install-module-file
-dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \
-$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \
-$(CP) -f $@ $(MODULE_DEST_DIR)/$$dest
-endef
-
-# Install all files from the directory to its module
-define install-module-dir
-dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \
-$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \
-$(CP) -rf $(@D)/* $(MODULE_DEST_DIR)/$$dest
-endef
-
-# chmod the file in its module
-define chmod-module-file
-dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \
-$(CHMOD) $1 $(MODULE_DEST_DIR)/$$dest
-endef
-
-# install a sym link in its module
-define install-module-sym-link
-dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \
-$(LN) -sf $1 $(MODULE_DEST_DIR)/$$dest
-endef
-
 
 # Run MAKE $@ for a launcher:
 #   $(call make-launcher, name, mainclass, java-args, main-args)
 define make-launcher
 $(CD) $(BUILDDIR)/launchers && \
 $(MAKE) -f Makefile.launcher \
-        MODULE=$(MODULE) \
         PROGRAM=$(strip $1) \
         MAIN_CLASS=$(strip $2) \
         MAIN_JAVA_ARGS="$(strip $3)" \
@@ -488,28 +430,18 @@
 define install-file
 $(prep-target)
 $(CP) $< $@
-@$(install-module-file)
 endef
 
 define chmod-file
 $(CHMOD) $1 $@
-@$(call chmod-module-file, $1)
 endef
 
 define install-sym-link
 $(LN) -s $1 $@
-@$(call install-module-sym-link, $1)
-endef
-
-#
-# Marcos for files not belonging to any module 
-define install-non-module-file
-$(prep-target)
-$(CP) $< $@
 endef
 
 define install-manifest-file
-$(install-non-module-file)
+$(install-file)
 endef
 
 # Cleanup rule for after debug java run (hotspot.log file is left around)
@@ -577,7 +509,6 @@
 
 define install-import-file
 $(install-importonly-file)
-@$(install-module-file)
 endef
 
 .PHONY: all build clean clobber
--- a/jdk/make/common/Demo.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Demo.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -25,8 +25,6 @@
 
 # JDK Demo building jar file.
   
-MODULE = demos
-
 # Some names are defined with LIBRARY inside the Defs.gmk file
 LIBRARY=$(DEMONAME)
 OBJDIR=$(TEMPDIR)/$(DEMONAME)
@@ -120,8 +118,11 @@
 DEMO_ALL_NATIVE_SOURCES += $(filter %.hpp,$(DEMO_ALL_FILES))
 
 # If we have java sources, then define the jar file we will create
+ifndef DEMO_JAR_NAME
+  DEMO_JAR_NAME = $(DEMONAME).jar
+endif
 ifneq ($(strip $(DEMO_JAVA_SOURCES)),)
-  DEMO_JAR            = $(DEMO_DESTDIR)/$(DEMONAME).jar
+  DEMO_JAR            = $(DEMO_DESTDIR)/$(DEMO_JAR_NAME)
 endif
 
 # If we have native sources, define the native library we will create
@@ -254,6 +255,17 @@
 	$(MKDIR) -p $(DEMO_JAR_IMAGE)
 	$(JAVAC_CMD) -d $(DEMO_JAR_IMAGE) -sourcepath $(DEMO_BUILD_SRCDIR) \
 	    @$(DEMO_JAVAC_INPUT)
+  ifeq ($(DEMO_INCL_SRC),true)
+	$(CP) $(DEMO_JAVA_SOURCES:%=$(DEMO_BUILD_SRCDIR)/%) $(DEMO_JAR_IMAGE)
+  endif
+  ifeq ($(DEMO_ONLY_SRC),true)
+	$(RM) -r $(DEMO_JAR_IMAGE)
+	$(MKDIR) -p $(DEMO_JAR_IMAGE)
+	$(CP) -r $(DEMO_BUILD_SRCDIR)/* $(DEMO_JAR_IMAGE)
+    ifneq ($(DEMO_TOPFILES),)
+	$(CP) $(DEMO_ROOT)/$(DEMO_TOPFILES) $(DEMO_JAR_IMAGE)
+    endif
+  endif
 	$(BOOT_JAR_CMD) -cfm $@ $(DEMO_MANIFEST) \
 	     -C $(DEMO_JAR_IMAGE) . \
 	     $(BOOT_JAR_JFLAGS)
@@ -326,9 +338,9 @@
 ifdef DEMO_IS_APPLET
 	@$(ECHO) "Expanding jar file into demos area at $(DEMO_DESTDIR)"
 	( $(CD) $(DEMO_DESTDIR) && \
-	  $(BOOT_JAR_CMD) -xfv $(DEMONAME).jar \
+	  $(BOOT_JAR_CMD) -xfv $(DEMO_JAR_NAME) \
 	     $(BOOT_JAR_JFLAGS) && \
-	  $(RM) -r META-INF $(DEMONAME).jar  && \
+	  $(RM) -r META-INF $(DEMO_JAR_NAME) && \
 	  $(java-vm-cleanup) )
 	@( $(CD) $(DEMO_DESTDIR) && $(java-vm-cleanup) )
 	@$(ECHO) "Expanding source into demos area at $(DEMO_DESTDIR)"
--- a/jdk/make/common/Library.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Library.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -168,18 +168,9 @@
 	  $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
 	$(CP) $(OBJDIR)/$(@F) $@
 	@$(call binary_file_verification,$@)
-	$(install-module-file)
 	$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
 	$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
 
-$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb
-
-$(ACTUAL_LIBRARY_DIR)/%.map: FORCE
-	$(install-module-file)
-
-$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE
-	$(install-module-file)
-
 endif # LIBRARY
 
 $(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m)
@@ -235,7 +226,6 @@
 else # LIBRARY
 	$(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS)
 	@$(call binary_file_verification,$@)
-	$(install-module-file)
 ifeq ($(WRITE_LIBVERSION),true)
 	$(MCS) -d -a "$(FULL_VERSION)" $@
 endif # WRITE_LIBVERSION
--- a/jdk/make/common/Modules.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,454 +0,0 @@
-#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-JDK_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jdk-module-image
-JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image
-
-#
-# modules   Target to build jdk and jre module image
-#
-#           There is one jar file per module containing classes only.
-#           All module jars are currently placed under jre/lib directory.
-#
-# Open issues that need further investigation:
-# 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns
-#    module.  META-INF/services file is not installed.
-# 2. Signed jars
-#    For JDK build, signed jars are copied to the build.
-#    All jars in the module image are unsigned.
-
-MODULE_IMAGEBINDIR = bin
-
-#
-# Targets.
-#
-INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre
-INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk
-ifeq ($(PLATFORM), solaris)
-  ifeq ($(ARCH_DATA_MODEL), 64)
-    INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre-sol64
-    INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk-sol64
-  endif
-endif
-
-modules modules-clobber \
-initial-module-image-jre initial-module-image-jdk \
-initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
-trim-module-image-jre trim-module-image-jdk \
-process-module-image-jre process-module-image-jdk ::
-	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
-
-# Order is important here, trim jre after jdk image is created
-modules:: gen-modules \
-	 sanity-module-images post-sanity-module-images  \
-	 $(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \
-	 trim-module-image-jre trim-module-image-jdk \
-	 process-module-image-jre process-module-image-jdk
-
-# Don't use these
-module-image-jre:: initial-module-image-jre trim-module-image-jre process-module-image-jre
-module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module-image-jdk
-
-#
-# Paths to these files we need
-JDK_MODULE_DOCFILES   = $(IMAGE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
-JRE_MODULE_DOCFILES   = $(IMAGE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
-
-###### RULES
-
-# JDK files
-$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
-	$(process-doc-file)
-
-# JRE files 
-$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
-	$(process-doc-file)
-ifeq ($(PLATFORM), windows)
-$(JRE_MODULE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
-	$(process-doc-file)
-endif
-
-######################################################
-# JRE Image
-######################################################
-
-MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list
-
-# Modules in the jre/lib/security directory
-POLICY_MODULES = US_export_policy local_policy
-
-# Modules in the modules/ext directory
-EXT_MODULES = localedata security-sunec security-sunjce
-
-# Build PKCS#11 on all platforms except 64-bit Windows.
-PKCS11 = security-sunpkcs11
-ifeq ($(ARCH_DATA_MODEL), 64)
-  ifeq ($(PLATFORM), windows)
-    PKCS11 =
-  endif
-endif
-
-EXT_MODULES += $(PKCS11)
-
-# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform.
-ifeq ($(PLATFORM), windows)
-  ifneq ($(ARCH_DATA_MODEL), 64)
-    EXT_MODULES += security-sunmscapi
-  endif
-endif
-
-# Modules for JDK only
-JDK_MODULES = tools
-
-gen-modules:
-	$(CD) modules; $(MAKE) all
-
-initial-module-image-jre-setup:
-	$(RM) -r $(JRE_MODULE_IMAGE_DIR)
-	$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)
-
-# 64-bit solaris jre image contains only the 64-bit add-on files.
-initial-module-image-jre-sol64:: initial-module-image-jre-setup
-	@# Use tar instead of cp to preserve the symbolic links
-	for dir in bin lib ; do \
-	  ( $(CD) $(OUTPUTDIR) && \
-		$(TAR) cf - `$(FIND) $$dir -name '$(ARCH)' -print` | \
-		($(CD) $(JRE_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
-	done
-	@# Remove some files from the jre area
-	for t in $(NOTJRETOOLS) ; do \
-	    $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
-	done
-	$(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl'`
-	$(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl'`
-
-# Construct an initial jre image (initial jdk jre) no trimming or stripping
-initial-module-image-jre:: initial-module-image-jre-setup \
-		    $(JRE_MODULE_DOCFILES) \
-		    $(BUILDMETAINDEX_JARFILE)
-	@# Copy in bin directory
-	$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
-	@# CTE plugin security change require new empty directory lib/applet
-	$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/applet
-	@# Copy files but not .jar in lib directory 
-	$(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(EGREP) -v ".jar$$" | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
-	@#
-	@# copy modules to jre/lib
-	@#
-	for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \
-	    $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \
-	done
-	$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext
-	for m in $(EXT_MODULES) ; do \
-           $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/ext ; \
-        done
-	for m in $(POLICY_MODULES) ; do \
-           $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/security; \
-        done
-	@# Remove jdk modules
-	for m in $(JDK_MODULES) ; do \
-           $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar ; \
-        done
-
-	@# Make sure all directories are read/execute for everyone
-	$(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d`
-	@# Remove some files from the jre area
-	for t in $(NOTJRETOOLS) ; do \
-	    $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
-	done
-	@# Remove orb.idl and ir.idl from jre
-	$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl' -exec $(RM) \{} \;
-	$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl' -exec $(RM) \{} \;
-	@# Generate meta-index to make boot and extension class loaders lazier
-	$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
-	    $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
-		-o meta-index *.jar
-	@$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && $(java-vm-cleanup)
-	$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && \
-	    $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
-		-o meta-index *.jar
-	@$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && $(java-vm-cleanup)
-ifeq ($(PLATFORM), windows)
-	@# Remove certain *.lib files
-	$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
-            $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
-                  awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
-  ifeq ($(ARCH_DATA_MODEL), 32)
-	@# The Java Kernel JRE image ships with a special VM.  It is not included
-	@# in the full JRE image, so remove it.  Also, is it only for 32-bit windows.
-	$(CD) $(JRE_MODULE_IMAGE_DIR)/bin && $(RM) -r kernel
-  endif
-endif # Windows
-ifneq ($(PLATFORM), windows)
-	$(call copy-man-pages,$(JRE_MODULE_IMAGE_DIR),$(JRE_MAN_PAGES))
-endif # !windows
-
-# Trim out any extra files not for the jre shipment but wanted in the jdk jre.
-#   (Note the jdk WILL want the jre image before this trimming)
-#   Removes server VM on Windows 32bit.
-#   Remove certain shared libraries that should not be in the jre image
-#      but should be in the jdk jre image.
-trim-module-image-jre::
-ifeq ($(PLATFORM), windows)
-  ifeq ($(ARCH_DATA_MODEL), 32)
-	$(RM) -r $(JRE_MODULE_IMAGE_DIR)/bin/server
-  endif
-  ifdef NOTJRE_SHARED_LIBS
-	for l in $(NOTJRE_SHARED_LIBS) ; do \
-	    $(RM) $(JRE_MODULE_IMAGE_DIR)/bin/$$l ; \
-	done ;
-  endif
-else # PLATFORM
-  ifdef NOTJRE_SHARED_LIBS
-	for l in $(NOTJRE_SHARED_LIBS) ; do \
-	    $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$(LIBARCH)/$$l ; \
-	done ;
-  endif
-endif # PLATFORM
-
-# Get list of all Elf files in the jre
-JRE_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jre-elf-files.list
-$(JRE_MODULE_ELF_LIST):
-	@$(prep-target)
-ifneq ($(PLATFORM), windows)
-	$(RM) $@
-	$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
-	$(FILE) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
-	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
-endif
-
-# Post process the image (strips and mcs on Elf files we are shipping)
-#   (Note the jdk WILL want the jre image before this processing)
-process-module-image-jre:: $(JRE_MODULE_ELF_LIST)
-ifneq ($(POST_STRIP_PROCESS), )
-	for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
-	  $(CHMOD) u+w $${f}; \
-	  $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
-	  $(POST_STRIP_PROCESS) $${f}; \
-	  $(CHMOD) go-w $${f}; \
-	done
-endif
-ifneq ($(POST_MCS_PROCESS), )
-	for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
-	  $(CHMOD) u+w $${f}; \
-	  $(ECHO) $(POST_MCS_PROCESS) $${f}; \
-	  $(POST_MCS_PROCESS) $${f}; \
-	  $(CHMOD) go-w $${f}; \
-	done
-endif
-	$(RM) $(JRE_MODULE_ELF_LIST)
-
-######################################################
-# JDK Image
-######################################################
-# Note: cpio ($(CPIO)) sometimes leaves directories without rx access.
-
-initial-module-image-jdk-setup:
-	$(RM) -r $(JDK_MODULE_IMAGE_DIR)
-	$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/jre
-	($(CD) $(JRE_MODULE_IMAGE_DIR) && $(FIND) . -depth -print \
-	      | $(CPIO) -pdum $(JDK_MODULE_IMAGE_DIR)/jre )
-	$(RM) -rf $(JDK_MODULE_IMAGE_DIR)/jre/man
-	$(CHMOD) a+rx `$(FIND) $(JDK_MODULE_IMAGE_DIR) -type d`
-
-initial-module-image-jdk64-bindemos:
-	for dir in bin demo ; do \
-	  ( $(CD) $(OUTPUTDIR) && \
-		$(TAR) cf - `$(FIND) $$dir -name '$(LIBARCH)' -print` | \
-		($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
-        done
-
-# Solaris 64 bit image is special
-initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \
-			  initial-module-image-jdk64-bindemos
-
-# DB files to add
-ifeq ($(OPENJDK),true)
-
-initial-module-image-jdk-db:
-
-else
-
-# Create the list of db *.zip files to bundle with jdk
-ABS_DB_PATH  :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
-DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
-
-initial-module-image-jdk-db: $(DB_ZIP_LIST)
-	$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/db
-	for d in $(DB_ZIP_LIST); do \
-          ($(CD) $(JDK_MODULE_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
-	done
-
-endif
-
-# Standard jdk image
-initial-module-image-jdk:: initial-module-image-jdk-setup \
-		    initial-module-image-jdk-db \
-		    $(JDK_MODULE_DOCFILES)
-	$(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib
-	@#
-	@# copy jdk modules to jdk/lib
-	@#
-	$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib
-	for m in $(JDK_MODULES) ; do \
-	    $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \
-        done
-  ifeq ($(PLATFORM), windows)
-	@#
-	@# lib/
-	@#
-	$(CP) $(LIBDIR)/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
-	$(CP) $(LIBDIR)/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
-	@#
-	@# bin/
-	@#
-	@# copy all EXE files and only certain DLL files from BINDIR
-	$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/bin
-	$(CP) $(BINDIR)/*$(EXE_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
-	$(CP) $(BINDIR)/jli.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
-    ifeq ($(COMPILER_VERSION), VS2010)
-	$(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
-    endif
-    ifeq ($(ARCH_DATA_MODEL), 32)
-      ifeq ($(COMPILER_VERSION), VS2003)
-	$(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
-      endif
-    endif
-  else # PLATFORM
-	@#
-	@# bin/
-	@#
-	($(CD) $(BINDIR)/.. && $(TAR) cf - \
-	    `$(FIND) bin \( -type f -o -type l \) -print `) | \
-	    ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -)
-  endif # PLATFORM
-	@#
-	@# lib/ct.sym
-	@#
-	$(MKDIR) -p $(OUTPUTDIR)/symbols/META-INF/sym
-	$(JAVAC_CMD) -XDprocess.packages -proc:only \
-	    -processor com.sun.tools.javac.sym.CreateSymbols \
-	    -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
-	    -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
-	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS)
-	$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
-	    -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
-	@$(java-vm-cleanup)
-	$(CP) $(LIBDIR)/ct.sym $(JDK_MODULE_IMAGE_DIR)/lib/ct.sym
-	@#
-	@# CORBA supported orb.idl and ir.idl should be copied to lib
-	@#
-	$(CP) $(LIBDIR)/orb.idl $(JDK_MODULE_IMAGE_DIR)/lib/orb.idl
-	$(CP) $(LIBDIR)/ir.idl $(JDK_MODULE_IMAGE_DIR)/lib/ir.idl
-  ifeq ($(PLATFORM), linux)
-	@#
-	@# on Linux copy jexec from jre/lib to /lib
-	@#
-	$(CP) $(LIBDIR)/jexec $(JDK_MODULE_IMAGE_DIR)/lib/jexec
-  endif # PLATFORM
-	@#
-	@# demo, include
-	@#
-	$(CP) -r -f $(DEMODIR) $(JDK_MODULE_IMAGE_DIR)
-	$(CP) -r -f $(SAMPLEDIR) $(JDK_MODULE_IMAGE_DIR)
-	$(CP) -r $(INCLUDEDIR) $(JDK_MODULE_IMAGE_DIR)
-	@#
-	@# Swing BeanInfo generation
-	@#
-	$(CD) javax/swing/beaninfo && $(MAKE) JDK_IMAGE_DIR=$(JDK_MODULE_IMAGE_DIR) swing-1.2-beans
-ifneq ($(PLATFORM), windows)
-	$(call copy-man-pages,$(JDK_MODULE_IMAGE_DIR),$(JDK_MAN_PAGES))
-endif # !windows
-
-# Trim out files we don't want to ship
-trim-module-image-jdk::
-	@# Remove tools that should not be part of SDK.
-	for t in $(NOTJDKTOOLS); do \
-	    $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
-	done
-
-# Get list of Elf files in the jdk
-JDK_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jdk-elf-files.list
-$(JDK_MODULE_ELF_LIST):
-	@$(prep-target)
-ifneq ($(PLATFORM), windows)
-	$(RM) $@
-	$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
-	$(FILE) `$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
-	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
-	file `$(FIND) $(JDK_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
-	    | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
-endif
-
-# Post process the image (strips and mcs on files we are shipping)
-process-module-image-jdk:: $(JDK_MODULE_ELF_LIST)
-ifneq ($(POST_STRIP_PROCESS), )
-	for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
-	  $(CHMOD) u+w $${f}; \
-	  $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
-	  $(POST_STRIP_PROCESS) $${f}; \
-	  $(CHMOD) go-w $${f}; \
-	done
-endif
-ifneq ($(POST_MCS_PROCESS), )
-	for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
-	  $(CHMOD) u+w $${f}; \
-	  $(ECHO) $(POST_MCS_PROCESS) $${f}; \
-	  $(POST_MCS_PROCESS) $${f}; \
-	  $(CHMOD) go-w $${f}; \
-	done
-endif
-	$(RM) $(JDK_MODULE_ELF_LIST)
-
-######################################################
-# clobber
-######################################################
-modules-clobber::
-	$(RM) -r $(JDK_MODULE_IMAGE_DIR)
-	$(RM) -r $(JRE_MODULE_IMAGE_DIR)
-
-#
-# TODO - nop for now
-sanity-module-images post-sanity-module-images:
-
-modules modules-clobber::
-	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
-	@$(java-vm-cleanup)
-
-.PHONY: modules module-image-jre module-image-jdk \
-	initial-module-image-jre initial-module-image-jdk \
-	initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
-        initial-module-image-jdk-setup \
-	initial-module-image-jdk-db \
-        initial-module-image-jdk64-bindemos \
-        initial-module-image-jre-setup \
-	trim-module-image-jre trim-module-image-jdk \
-	process-module-image-jre process-module-image-jdk \
-	install-previous-jre install-previous-jdk \
-	modules-clobber
-
-# Force rule
-FRC:
-
--- a/jdk/make/common/Program.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Program.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -186,7 +186,6 @@
 	$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
 	    $(FILES_o) $(THREADLIBS) $(LDLIBS)
 	@$(call binary_file_verification,$@)
-	$(install-module-file)
 
 endif # PLATFORM
 
--- a/jdk/make/common/Release.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Release.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -60,9 +60,10 @@
 #
 # Include the exported private packages in ct.sym.
 # This is an interim solution until the ct.sym is replaced
-# with a new module system (being discussed for JDK 7).
+# with a new module system (being discussed for JDK 8).
 #
-EXPORTED_PRIVATE_PKGS = com.sun.servicetag
+EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
+                        com.oracle.net
 
 # 64-bit solaris has a few special cases. We define the variable
 # SOLARIS64 for use in this Makefile to easily test those cases
@@ -86,8 +87,14 @@
   IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
 else
   # Where to find these files
-  SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
-  SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
+  ifeq ($(J4B), true)
+      SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdkfb
+      SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jrefb
+  else
+      SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
+      SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
+  endif
+
   IMAGE_DOCLIST_JDK = COPYRIGHT README.html  THIRDPARTYLICENSEREADME.txt
   IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt
   ifeq ($(PLATFORM), windows)
@@ -125,10 +132,8 @@
 	unpack200.1
 
 ifndef OPENJDK
-ifeq ($(ARCH_DATA_MODEL),32)
   JRE_MAN_PAGES += javaws.1
 endif
-endif
 
 JDK_MAN_PAGES =            \
 	$(JRE_MAN_PAGES)   \
@@ -1100,7 +1105,7 @@
 
 # Common way to emit a line into the release or info file
 define info-file-item # name value
-$(PRINTF) "%s=\"%s\"\n" $1 $2 >> $@
+$(PRINTF) '%s="%s"\n' $1 $2 >> $@
 endef
 
 # Values to emit
--- a/jdk/make/common/Sanity.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Sanity.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -71,8 +71,7 @@
     sane-cacerts \
     sane-ant_version \
     sane-zip_version \
-    sane-msvcrt_path \
-    sane-build_modules
+    sane-msvcrt_path
 
 # The rules sanity-* have a one-to-one correspondence with the major targets
 # Each sanity-* rule should have no body to ensure that the post-sanity-* is the
--- a/jdk/make/common/Subdirs.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/Subdirs.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -40,9 +40,6 @@
 #
 # By default, subdirs specified in the SUBDIRS and all SUBDIRS_* 
 # variables will be built.
-# 
-# BUILD_MODULES variable can be used to specify one or more groups
-# to be built (BUILD_MODULES=all will build all groups).
 #
 # Variables of the currently supported groups are:
 #  SUBDIRS_desktop    
@@ -53,15 +50,12 @@
 # 
 # Change to the above list also need to update 
 # make/common/shared/Sanity.gmk.  NOTE: this list is subject
-# to change till the JDK 7 SE profiles/modules are finalized.
+# to change.
 # 
 # Eventually we want to restructure the make directory
 # according to these grouping (e.g. make/desktop/...) and
 # the SUBDIRS_<group> variables would not be needed.
 # 
-# To build the desktop and tools groups only, you can do:
-# gnumake BUILD_MODULES="desktop tools" ...
-# 
 
 # Iterate the subdirectories specified in $1.
 # - cd into each subdir and make them
@@ -96,77 +90,51 @@
 
 #
 # Iterate the list specified in SUBDIRS_<group> only if
-# SUBDIRS_<group> is set and <group> or "all" is specified
-# in the BUILD_MODULES variable
+# SUBDIRS_<group> is set.
 #
 ifdef SUBDIRS_desktop 
-  ifneq (,$(findstring desktop, $(BUILD_MODULES)))
-      define subdirs-desktop-loop
-         @$(call subdirs-group-loop,SUBDIRS_desktop)
-      endef
-  else
-    define subdirs-desktop-loop
-    endef
-  endif
+  define subdirs-desktop-loop
+      @$(call subdirs-group-loop,SUBDIRS_desktop)
+  endef
 else   
   define subdirs-desktop-loop
   endef
 endif   # SUBDIRS_desktop 
 
 ifdef SUBDIRS_enterprise 
-  ifneq (,$(findstring enterprise, $(BUILD_MODULES)))
-      define subdirs-enterprise-loop
-         @$(call subdirs-group-loop,SUBDIRS_enterprise)
-      endef
-  else
-    define subdirs-enterprise-loop
-    endef
-  endif
+  define subdirs-enterprise-loop
+      @$(call subdirs-group-loop,SUBDIRS_enterprise)
+  endef
 else   
 define subdirs-enterprise-loop
 endef
 endif   # SUBDIRS_enterprise 
 
 ifdef SUBDIRS_management 
-  ifneq (,$(findstring management, $(BUILD_MODULES)))
-      define subdirs-management-loop
-         @$(call subdirs-group-loop,SUBDIRS_management)
-      endef
-  else
-    define subdirs-management-loop
-    endef
-  endif
+  define subdirs-management-loop
+      @$(call subdirs-group-loop,SUBDIRS_management)
+  endef
 else   
-define subdirs-management-loop
-endef
+  define subdirs-management-loop
+  endef
 endif   # SUBDIRS_management 
 
 ifdef SUBDIRS_misc 
-  ifneq (,$(findstring misc, $(BUILD_MODULES)))
-      define subdirs-misc-loop
-         @$(call subdirs-group-loop,SUBDIRS_misc)
-      endef
-  else
-    define subdirs-misc-loop
-    endef
-  endif
+  define subdirs-misc-loop
+      @$(call subdirs-group-loop,SUBDIRS_misc)
+  endef
 else   
-define subdirs-misc-loop
-endef
+  define subdirs-misc-loop
+  endef
 endif   # SUBDIRS_misc 
 
 ifdef SUBDIRS_tools 
-  ifneq (,$(findstring tools, $(BUILD_MODULES)))
-      define subdirs-tools-loop
-         @$(call subdirs-group-loop,SUBDIRS_tools)
-      endef
-  else
-    define subdirs-tools-loop
-    endef
-  endif
+  define subdirs-tools-loop
+      @$(call subdirs-group-loop,SUBDIRS_tools)
+  endef
 else   
-define subdirs-tools-loop
-endef
+  define subdirs-tools-loop
+  endef
 endif   # SUBDIRS_tools 
 
 #
@@ -175,30 +143,6 @@
 SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \
 	      $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools)
 
-ifndef BUILD_MODULES
-define SUBDIRS-loop
-  @$(call subdirs-group-loop,SUBDIRS_all)
-endef
-
-else
-
-ifneq (,$(findstring all, $(BUILD_MODULES)))
 define SUBDIRS-loop
   @$(call subdirs-group-loop,SUBDIRS_all)
 endef
-
-else # BUILD_MODULES set 
-#
-# Iterate SUBDIRS and the groups specified in BUILD_MODULES
-#
-define SUBDIRS-loop
-  @$(call subdirs-group-loop,SUBDIRS)
-  @$(subdirs-desktop-loop)
-  @$(subdirs-enterprise-loop)
-  @$(subdirs-management-loop)
-  @$(subdirs-misc-loop)
-  @$(subdirs-tools-loop)
-endef
-
-endif
-endif # BUILD_MODULES
--- a/jdk/make/common/shared/Compiler-msvc.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Compiler-msvc.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -153,6 +153,9 @@
   ifndef COMPILER_VERSION
     COMPILER_VERSION := $(error COMPILER_VERSION cannot be empty here)
   endif
+  ifneq ($(COMPILER_VERSION),VS2010)
+    COMPILER_VERSION := $(error COMPILER_VERSION must be VS2010)
+  endif
   
   # Shared library generation flag
   SHARED_LIBRARY_FLAG = -LD
--- a/jdk/make/common/shared/Defs-java.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Defs-java.gmk	Fri Mar 18 15:44:48 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
@@ -45,7 +45,7 @@
   JAVA_MEM_FLAGS   += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
 endif
 
-# 
+#
 # All java tools (javac, javah, and javadoc) run faster with certain java
 #    options, this macro should be used with all these tools.
 #    In particular, the client VM makes these tools run faster when
@@ -122,6 +122,17 @@
   JAVACFLAGS  += -Werror
 endif
 
+#
+# Some licensees do not get the Security Source bundles.  We will
+# fall back on the prebuilt jce.jar so that we can do a best
+# attempt at building.  If sources exist, we always want to
+# build/use the most recent source instead of an older jce.jar, whether
+# built implicitly/explicitly.
+#
+ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
+  JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
+endif
+
 # Add the source level
 SOURCE_LANGUAGE_VERSION = 7
 LANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION)
@@ -132,11 +143,11 @@
 CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
 JAVACFLAGS  += $(CLASS_VERSION)
 JAVACFLAGS  += -encoding ascii
-JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)"
+JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
 JAVACFLAGS  += $(OTHER_JAVACFLAGS)
 
 # Needed for javah
-JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
+JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
 
 # Needed for javadoc to ensure it builds documentation
 # against the newly built classes
--- a/jdk/make/common/shared/Defs-javadoc.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Defs-javadoc.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -61,33 +61,11 @@
 EMPTY:=
 SPACE:=$(EMPTY) $(EMPTY)
 COPYRIGHT_SYMBOL = &\#x00a9;
-# Macros to handle the optional empty args.
+# Macro to construct the copyright line
 #   (The GNU make 3.78.1 "if" conditional is broken, fixed in GNU make 3.81)
-define OptionalCopyrightUrl # url
-$(shell \
-  if [ "$1" != "" ] ; then \
-    printf "<a href=\"%s\">Copyright</a>" "$1"; \
-  else \
-    printf "Copyright"; \
-  fi)
-endef
-define OptionalCopyrightFirstYear # year
-$(shell \
-  if [ "$1" != "" ] ; then \
-    printf "%s," "$1";\
-  fi)
-endef
-define OptionalCompanyAddress # address
-$(shell \
-  if [ "$1" != "" ] ; then \
-    printf "%s" "$1";\
-  fi)
-endef
 define CopyrightLine # optionalurl optionalfirstyear optionaladdress
-$(call OptionalCopyrightUrl,$1) $(COPYRIGHT_SYMBOL)\
-$(call OptionalCopyrightFirstYear,$2) $(COPYRIGHT_YEAR),\
-$(COMPANY_NAME).\
-$(call OptionalCompanyAddress,$3)\
-All rights reserved.
+$(if $(strip $1),<a href="$(strip $1)">Copyright</a>,Copyright) \
+$(COPYRIGHT_SYMBOL) $(if $2,$2${COMMA},) $(COPYRIGHT_YEAR),\
+$(FULL_COMPANY_NAME). $3 All rights reserved.
 endef
 
--- a/jdk/make/common/shared/Defs-utils.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Defs-utils.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -115,7 +115,6 @@
 PKGMK          = $(UTILS_COMMAND_PATH)pkgmk
 PRINTF         = $(UTILS_USR_BIN_PATH)printf
 PWD            = $(UTILS_COMMAND_PATH)pwd
-RC             = $(UTILS_COMMAND_PATH)rc
 READELF        = $(UTILS_USR_BIN_PATH)readelf
 RMDIR          = $(UTILS_COMMAND_PATH)rmdir
 RPM            = $(UTILS_COMMAND_PATH)rpm
@@ -135,6 +134,7 @@
 UNIQ           = $(UTILS_USR_BIN_PATH)uniq
 UNZIP          = $(UTILS_USR_BIN_PATH)unzip
 UNZIPSFX       = $(UTILS_DEVTOOL_PATH)unzipsfx
+XARGS          = $(UTILS_USR_BIN_PATH)xargs
 WC             = $(UTILS_USR_BIN_PATH)wc
 WHICH          = $(UTILS_USR_BIN_PATH)which
 YACC           = $(UTILS_CCS_BIN_PATH)yacc
--- a/jdk/make/common/shared/Defs.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Defs.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -218,7 +218,11 @@
 else
   LAUNCHER_NAME = java
   PRODUCT_NAME = Java(TM)
-  PRODUCT_SUFFIX = SE Runtime Environment
+  ifeq ($(J4B), true)
+    PRODUCT_SUFFIX = SE Runtime Environment for Business
+  else
+    PRODUCT_SUFFIX = SE Runtime Environment
+  endif
   JDK_RC_PLATFORM_NAME = Platform SE
   COMPANY_NAME = Oracle Corporation
 endif
--- a/jdk/make/common/shared/Platform.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Platform.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -148,7 +148,7 @@
   # Suffix for file bundles used in previous release
   BUNDLE_FILE_SUFFIX=.tar
   # How much RAM does this machine have:
-  MB_OF_MEMORY=$(shell /etc/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3)
+  MB_OF_MEMORY=$(shell /usr/sbin/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3)
 endif
 
 # Platform settings specific to Linux
--- a/jdk/make/common/shared/Sanity.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/common/shared/Sanity.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -113,7 +113,7 @@
   ALSA_INCLUDE=/usr/include/alsa/version.h
   ALSA_LIBRARY=/usr/lib/libasound.so
   _ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \
-           $(SED) -e 's@.*\"\(.*\)\".*@\1@' )
+           $(SED) -e 's@.*"\(.*\)".*@\1@' )
   ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION))
 endif
 
@@ -221,8 +221,7 @@
 	sane-zip_version \
 	sane-unzip_version \
  	sane-msvcrt_path \
-        sane-freetype \
-        sane-build_modules
+        sane-freetype
 
 ######################################################
 # check for COPYRIGHT_YEAR variable
@@ -334,12 +333,12 @@
 ifneq ($(PLATFORM), windows)
 	@if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \
 	  $(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \
-	    "        Try setting LC_ALL to \"C\". \n" \
+	    "        Try setting LC_ALL to 'C'. \n" \
 	    "" >> $(WARNING_FILE) ; \
         fi
 	@if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \
 	  $(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \
-	    "        Try setting LANG to \"C\". \n" \
+	    "        Try setting LANG to 'C'. \n" \
 	    "" >> $(WARNING_FILE) ; \
         fi
 endif
@@ -832,21 +831,6 @@
 endif
 
 ######################################################
-# if specified, BUILD_MODULES must contain valid values.
-######################################################
-MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools"
-sane-build_modules:
-ifdef BUILD_MODULES
-	@for m in $(BUILD_MODULES) ; do \
-            valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \
-            if [ "x$$valid" = "x" ] ; then \
-                $(ECHO) "ERROR: $$m set in the BUILD_MODULES variable is invalid.\n" \
-                "" >> $(ERROR_FILE); \
-            fi \
-	done
-endif
-
-######################################################
 # CUPS_HEADERS_PATH must be valid
 ######################################################
 sane-cups:
@@ -1012,11 +996,6 @@
 	    "" >> $(ERROR_FILE) ; \
 	fi
   else
-    ifeq ($(wildcard $(REBASE)),)
-	@$(ECHO) "ERROR: Cannot find the REBASE utility from path: $(REBASE)\n" \
-	    "      This is normally obtained from the WINDOWSSDKDIR." \
-	    "" >> $(ERROR_FILE)
-    endif
     ifeq ($(wildcard $(RC)),)
 	@$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
 	    "      This is normally obtained from the WINDOWSSDKDIR." \
@@ -1024,7 +1003,7 @@
     endif
     ifeq ($(wildcard $(DUMPBIN)),)
 	@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
-	    "      This is normally obtained from the WINDOWSSDKDIR." \
+	    "      This is normally obtained from the COMPILER_PATH." \
 	    "" >> $(ERROR_FILE)
     endif
   endif
@@ -1131,7 +1110,7 @@
 #    be checked when this represents a full control build (i.e. the
 #    HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
 $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
-	@$(install-non-module-file)
+	@$(install-file)
 	@$(RM) $@.IMPORT
 	@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
 	  $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
@@ -1145,7 +1124,7 @@
 	fi
 
 $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
-	@$(install-non-module-file)
+	@$(install-file)
 	@$(RM) $@.IMPORT
 	@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
 	  $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
@@ -1348,9 +1327,9 @@
 	fi
 	@if [ "$(LINK_CHECK)" != "same" ]; then \
 	  $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
-	    "      $(REQUIRED_COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \
+	    "      $(REQUIRED_COMPILER_VERSION) - link.exe version '$(REQUIRED_LINK_VER)' \n" \
 	      "      Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \
-	    "      $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \
+	    "      $(YOU_ARE_USING) Linker version '$(LINK_VER)' \n" \
 	    "" >> $(WARNING_FILE) ; \
 	fi
 endif
--- a/jdk/make/docs/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/docs/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -43,7 +43,7 @@
 BUG_SUBMIT_URL = http://bugs.sun.com/services/bugreport/index.jsp
 
 # Common line for how to submit a bug or rfe
-BUG_SUBMIT_LINE = <a href=\"$(BUG_SUBMIT_URL)\">Submit a bug or feature</a>
+BUG_SUBMIT_LINE = <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
 
 # Url to devdocs page
 #   Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
@@ -166,24 +166,35 @@
 
 # Common bottom argument
 define CommonBottom # year
-<font size=\"-1\"><p> $(call CopyrightLine,,$1,)</font>
+<font size="-1"><br> $(call CopyrightLine,,$1,)</font>
 endef
 
 # Common trademark bottom argument (Not sure why this is used sometimes)
 define CommonTrademarkBottom # year
-<font size=\"-1\">\
+<font size="-1">\
 $(BUG_SUBMIT_LINE)<br>$(JAVA_TRADEMARK_LINE)<br>\
 $(call CopyrightLine,,$1,$(COMPANY_ADDRESS))\
 </font>
 endef
 
+# Common echo of option
+define OptionOnly # opt
+$(PRINTF) "%s\n" "$1"
+endef
+define OptionPair # opt arg
+$(PRINTF) "%s '%s'\n" "$1" '$2'
+endef
+define OptionTrip # opt arg arg
+$(PRINTF) "%s '%s' '%s'\n" "$1" '$2' '$3'
+endef
+
 # Core api bottom argument (with special sauce)
-COREAPI_BOTTOM = <font size=\"-1\"> $(BUG_SUBMIT_LINE)\
+COREAPI_BOTTOM = <font size="-1"> $(BUG_SUBMIT_LINE)\
 <br>For further API reference and developer documentation, \
-see <a href=\"$(DEV_DOCS_URL)\" target=\"_blank\">Java SE Documentation</a>. \
+see <a href="$(DEV_DOCS_URL)" target="_blank">Java SE Documentation</a>. \
 That documentation contains more detailed, developer-targeted descriptions, \
 with conceptual overviews, definitions of terms, workarounds, \
-and working code examples.<p>\
+and working code examples.<br>\
 $(call CopyrightLine,$(COPYRIGHT_URL),$(FIRST_COPYRIGHT_YEAR),)\
 </font>
 
@@ -212,11 +223,11 @@
     DRAFT_WINTITLE = $(BUILD_NUMBER)
     # Early access top text (not used in FCS releases)
     COREAPI_TOP_EARLYACCESS = \
-<div style=\"background-color: \#EEEEEE\"> \
-<div style=\"padding: 6px; margin-top: 2px; margin-bottom: 6px; \
+<div style="background-color: \#EEEEEE"> \
+<div style="padding: 6px; margin-top: 2px; margin-bottom: 6px; \
 margin-left: 6px; margin-right: 6px; text-align: justify; \
 font-size: 80%; font-family: Helvetica, Arial, sans-serif; \
-font-weight: normal;\"> \
+font-weight: normal;"> \
 Please note that the specifications and other information \
 contained herein are not final and are subject to change. \
 The information is being made available to you solely for purpose of \
@@ -281,15 +292,9 @@
 COREAPI_HEADER = \
 <strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
 
-# Ignored tags
-IGNORED_TAGS =	beaninfo revised since.unbundled spec specdefault Note ToDo
-
 # Java language specification cite
-JLS3_CITE = <a href=\"$(JLS3_URL)\"> \
-		The Java Language Specification, Third Edition</a>
-TAG_JLS3 = -tag 'jls3:a:See <cite>$(JLS3_CITE)</cite>:'
-
-TAGS = $(IGNORED_TAGS:%=-tag %:X) $(TAG_JLS3)
+TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
+The Java Language Specification, Third Edition</a></cite>:
 
 # Overview file for core apis
 COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@@ -314,19 +319,26 @@
 # Create file with javadoc options in it
 $(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "$(TAGS)"						; \
-	  $(ECHO) "-encoding ISO-8859-1"				; \
-	  $(ECHO) "-splitIndex"						; \
-	  $(ECHO) "-overview $(COREAPI_OVERVIEW)" 			; \
-	  $(ECHO) "-doctitle '$(COREAPI_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(COREAPI_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(COREAPI_BOTTOM)$(DRAFT_BOTTOM)'"		; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ISO-8859-1)			; \
+	  $(call OptionPair,-tag,beaninfo:X)				; \
+	  $(call OptionPair,-tag,revised:X)				; \
+	  $(call OptionPair,-tag,since.unbundled:X)			; \
+	  $(call OptionPair,-tag,spec:X)				; \
+	  $(call OptionPair,-tag,specdefault:X)				; \
+	  $(call OptionPair,-tag,Note:X)				; \
+	  $(call OptionPair,-tag,ToDo:X)				; \
+          $(call OptionPair,-tag,$(TAG_JLS3)) 				; \
+	  $(call OptionOnly,-splitIndex)				; \
+	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
+	  $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)) ;\
+	  $(call OptionPair,-header,$(COREAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(COREAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
         ) >> $@
 ifdef COREAPI_TOP_EARLYACCESS
-	@$(ECHO) "-top '$(COREAPI_TOP_EARLYACCESS)'" >> $@
+	@$(call OptionPair,-top,$(COREAPI_TOP_EARLYACCESS)) >> $@
 endif
 
 # Create a file with the package names in it
@@ -375,16 +387,16 @@
 # Create file with javadoc options in it
 $(MIRROR_OPTIONS_FILE): $(MIRROR_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-overview $(MIRROR_OVERVIEW)" 			; \
-	  $(ECHO) "-doctitle '$(MIRROR_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(MIRROR_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-group $(MIRROR_GROUPNAME) $(MIRROR_REGEXP)"		; \
-	  $(ECHO) "-linkoffline $(MIRROR2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-overview,$(MIRROR_OVERVIEW))		; \
+	  $(call OptionPair,-doctitle,$(MIRROR_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(MIRROR_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)) 	; \
+	  $(call OptionTrip,-group,$(MIRROR_GROUPNAME),$(MIRROR_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(MIRROR2COREAPI),$(COREAPI_DOCSDIR)); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -432,16 +444,16 @@
 # Create file with javadoc options in it
 $(DOCLETAPI_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-breakiterator"					; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-doctitle '$(DOCLETAPI_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(DOCLETAPI_HEADER)$(DRAFT_HEADER)'"	; \
-	  $(ECHO) "-bottom '$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM)'"	; \
-	  $(ECHO) "-group $(DOCLETAPI_GROUPNAME) $(DOCLETAPI_REGEXP)"	; \
-	  $(ECHO) "-linkoffline $(DOCLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-breakiterator)				; \
+	  $(call OptionPair,-doctitle,$(DOCLETAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(DOCLETAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(DOCLETAPI_GROUPNAME),$(DOCLETAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(DOCLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -492,13 +504,13 @@
 # Create file with javadoc options in it
 $(TAGLETAPI_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nonavbar"						; \
-	  $(ECHO) "-noindex"						; \
-	  $(ECHO) "-bottom '$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)'"			; \
-	  $(ECHO) "-linkoffline $(TAGLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nonavbar)					; \
+	  $(call OptionOnly,-noindex)					; \
+	  $(call OptionPair,-bottom,$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(TAGLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -543,16 +555,16 @@
 # Create file with javadoc options in it
 $(DOMAPI_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-splitIndex"						; \
-	  $(ECHO) "-doctitle '$(DOMAPI_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(DOMAPI_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-group $(DOMAPI_GROUPNAME) $(DOMAPI_REGEXP)"		; \
-	  $(ECHO) "-linkoffline $(DOMAPI2COREAPI) $(COREAPI_DOCSDIR)/" 	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-splitIndex)				; \
+	  $(call OptionPair,-doctitle,$(DOMAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(DOMAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(DOMAPI_GROUPNAME),$(DOMAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(DOMAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -605,15 +617,15 @@
 # Create file with javadoc options in it
 $(JDI_OPTIONS_FILE): $(JDI_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-overview $(JDI_OVERVIEW)" 				; \
-	  $(ECHO) "-doctitle '$(JDI_DOCTITLE)'"				; \
-	  $(ECHO) "-windowtitle '$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)'"	; \
-	  $(ECHO) "-header '$(JDI_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(JDI_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(JDI2COREAPI) $(COREAPI_DOCSDIR)/" 	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-overview,$(JDI_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JDI_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JDI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JDI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JDI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -693,15 +705,15 @@
 # Create file with javadoc options in it
 $(JAAS_OPTIONS_FILE): $(JAAS_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-overview $(JAAS_OVERVIEW)" 				; \
-	  $(ECHO) "-doctitle '$(JAAS_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
-	  $(ECHO) "-header '$(JAAS_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(JAAS_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(JAAS2COREAPI) $(COREAPI_DOCSDIR)/" 	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-overview,$(JAAS_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JAAS_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JAAS_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JAAS_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JAAS2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -745,16 +757,16 @@
 # Create file with javadoc options in it
 $(JGSS_OPTIONS_FILE): $(JGSS_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-overview $(JGSS_OVERVIEW)" 				; \
-	  $(ECHO) "-doctitle '$(JGSS_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
-	  $(ECHO) "-header '$(JGSS_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(JGSS_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(JGSS2COREAPI) $(COREAPI_DOCSDIR)/" 	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-overview,$(JGSS_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(JGSS_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JGSS_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JGSS_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JGSS2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -797,15 +809,15 @@
 # Create file with javadoc options in it
 $(SMARTCARDIO_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(SMARTCARDIO_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)'"	; \
-	  $(ECHO) "-bottom '$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)'"	; \
-	  $(ECHO) "-linkoffline $(SMARTCARDIO2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(SMARTCARDIO_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(SMARTCARDIO2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -847,15 +859,15 @@
 # Create file with javadoc options in it
 $(HTTPSERVER_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(HTTPSERVER_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(HTTPSERVER_HEADER)$(DRAFT_HEADER)'"	; \
-	  $(ECHO) "-bottom '$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)'"	; \
-	  $(ECHO) "-linkoffline $(HTTPSERVER2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(HTTPSERVER_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(HTTPSERVER_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(HTTPSERVER2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -907,16 +919,16 @@
 # Create file with javadoc options in it
 $(MGMT_OPTIONS_FILE): $(MGMT_OVERVIEW)
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-overview $(MGMT_OVERVIEW)" 				; \
-	  $(ECHO) "-doctitle '$(MGMT_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
-	  $(ECHO) "-header '$(MGMT_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(MGMT_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(MGMT2COREAPI) $(COREAPI_DOCSDIR)/" 	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-overview,$(MGMT_OVERVIEW))			; \
+	  $(call OptionPair,-doctitle,$(MGMT_DOCTITLE))			; \
+	  $(call OptionPair,-windowtitle,$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(MGMT_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(MGMT_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(MGMT2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -958,15 +970,15 @@
 # Create file with javadoc options in it
 $(ATTACH_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(ATTACH_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(ATTACH_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(ATTACH_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(ATTACH2COREAPI) $(COREAPI_DOCSDIR)/"	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(ATTACH_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(ATTACH_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(ATTACH_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(ATTACH2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -1008,15 +1020,15 @@
 # Create file with javadoc options in it
 $(JCONSOLE_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(JCONSOLE_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(JCONSOLE_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(JCONSOLE2COREAPI) $(COREAPI_DOCSDIR)/"; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(JCONSOLE_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(JCONSOLE_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(JCONSOLE2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -1063,15 +1075,15 @@
 # Create file with javadoc options in it
 $(TREEAPI_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-doctitle '$(TREEAPI_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(TREEAPI_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-group $(TREEAPI_GROUPNAME) $(TREEAPI_REGEXP)"	; \
-	  $(ECHO) "-linkoffline $(TREEAPI2COREAPI) $(COREAPI_DOCSDIR)/"	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -1113,15 +1125,15 @@
 # Create file with javadoc options in it
 $(SCTPAPI_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(SCTPAPI_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(SCTPAPI_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(SCTPAPI2COREAPI) $(COREAPI_DOCSDIR)/"	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(SCTPAPI_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(SCTPAPI_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(SCTPAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
@@ -1163,15 +1175,15 @@
 # Create file with javadoc options in it
 $(TRACING_OPTIONS_FILE):
 	$(prep-target)
-	@($(ECHO) "$(COMMON_JAVADOCFLAGS)"				; \
-	  $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\""		; \
-	  $(ECHO) "-encoding ascii"					; \
-	  $(ECHO) "-nodeprecatedlist"					; \
-	  $(ECHO) "-doctitle '$(TRACING_DOCTITLE)'"			; \
-	  $(ECHO) "-windowtitle '$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
-	  $(ECHO) "-header '$(TRACING_HEADER)$(DRAFT_HEADER)'"		; \
-	  $(ECHO) "-bottom '$(TRACING_BOTTOM)$(DRAFT_BOTTOM)'"		; \
-	  $(ECHO) "-linkoffline $(TRACING2COREAPI) $(COREAPI_DOCSDIR)/"	; \
+	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS))			; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH))	; \
+	  $(call OptionPair,-encoding,ascii)				; \
+	  $(call OptionOnly,-nodeprecatedlist)				; \
+	  $(call OptionPair,-doctitle,$(TRACING_DOCTITLE))		; \
+	  $(call OptionPair,-windowtitle,$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE));\
+	  $(call OptionPair,-header,$(TRACING_HEADER)$(DRAFT_HEADER))	; \
+	  $(call OptionPair,-bottom,$(TRACING_BOTTOM)$(DRAFT_BOTTOM))	; \
+	  $(call OptionTrip,-linkoffline,$(TRACING2COREAPI),$(COREAPI_DOCSDIR)/); \
         ) >> $@
 
 # Create a file with the package names in it
--- a/jdk/make/docs/NON_CORE_PKGS.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/docs/NON_CORE_PKGS.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -91,8 +91,6 @@
 TRACING_PKGS     = com.sun.tracing         \
                    com.sun.tracing.dtrace
 
-ORACLENET_PKGS   = com.oracle.net
-
 # non-core packages in rt.jar
 NON_CORE_PKGS    = $(DOMAPI_PKGS) \
                    $(MGMT_PKGS) \
@@ -103,6 +101,5 @@
                    $(HTTPSERVER_PKGS) \
                    $(SMARTCARDIO_PKGS) \
                    $(TRACING_PKGS) \
-                   $(SCTPAPI_PKGS) \
-                   $(ORACLENET_PKGS)
+                   $(SCTPAPI_PKGS)
 
--- a/jdk/make/java/awt/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/awt/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = awt
 PACKAGE = java.awt
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/java/fdlibm/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/fdlibm/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -31,7 +31,6 @@
 #
 
 BUILDDIR     = ../..
-MODULE       = base
 LIBRARY      = fdlibm
 PRODUCT      = java
 
--- a/jdk/make/java/instrument/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/instrument/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -27,7 +27,6 @@
 # agent, supporting java.lang.instrument
 
 BUILDDIR = ../..
-MODULE  = instrument
 PACKAGE = sun.instrument
 LIBRARY = instrument
 PRODUCT = sun
--- a/jdk/make/java/java/FILES_java.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/java/FILES_java.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -466,7 +466,6 @@
     java/security/ProtectionDomain.java \
     java/net/URLClassLoader.java \
     java/net/URLConnection.java \
-    sun/misc/BootClassLoaderHook.java \
     sun/misc/Launcher.java \
     sun/misc/MetaIndex.java \
     sun/misc/URLClassPath.java \
--- a/jdk/make/java/java/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/java/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = base
 PACKAGE = java.lang
 LIBRARY = java
 PRODUCT = java
@@ -244,7 +243,7 @@
 
 $(GENSRCDIR)/java/lang/UNIXProcess.java: \
     $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM)
-	$(install-non-module-file)
+	$(install-file)
 
 clean:: 
 	$(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java
@@ -318,7 +317,6 @@
 	$(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \
 		< $(SHARE_SRC)/classes/java/util/CurrencyData.properties
 	$(MV) $@.temp $@
-	$(install-module-file)
 	$(call chmod-file, 444)
 
 clean:: 
@@ -373,7 +371,7 @@
 		-usecharforbyte 11 4 1
 
 $(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template
-	$(install-non-module-file)
+	$(install-file)
 
 clean::
 	$(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java 
--- a/jdk/make/java/java_crw_demo/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/java_crw_demo/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -25,7 +25,6 @@
 
 BUILDDIR = ../..
 
-MODULE  = demos
 LIBRARY = java_crw_demo
 PRODUCT = sun
 LIBRARY_OUTPUT = java_crw_demo
--- a/jdk/make/java/java_hprof_demo/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/java_hprof_demo/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = instrument
 LIBRARY = hprof
 PRODUCT = sun
 LIBRARY_OUTPUT = hprof_jvmti
--- a/jdk/make/java/jli/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/jli/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -30,7 +30,6 @@
 # its manifestations (java, javaw, javac, ...).
 #
 BUILDDIR = ../..
-MODULE  = base
 LIBRARY = jli
 PRODUCT = java
 
--- a/jdk/make/java/jvm/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/jvm/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE   = base
 
 include $(BUILDDIR)/common/Defs.gmk
 
@@ -39,10 +38,10 @@
 	  $(INCLUDEDIR)/classfile_constants.h
 
 $(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
-	$(install-non-module-file)
+	$(install-file)
 
 $(PLATFORM_INCLUDE)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
-	$(install-non-module-file)
+	$(install-file)
 
 JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg
 
--- a/jdk/make/java/logging/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/logging/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = logging
 PACKAGE = java.util.logging
 PRODUCT = java
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/java/main/java/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/main/java/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = base
 PROGRAM = java
 PRODUCT = java
 
--- a/jdk/make/java/main/javaw/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/main/javaw/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = base
 PROGRAM = javaw
 PRODUCT = java
 
--- a/jdk/make/java/management/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/management/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = management
 PACKAGE = java.lang.management
 LIBRARY = management
 PRODUCT = java
--- a/jdk/make/java/net/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/net/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = base
 PACKAGE = java.net
 LIBRARY = net
 PRODUCT = sun
--- a/jdk/make/java/nio/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/nio/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = nio
 PACKAGE = java.nio
 LIBRARY = nio
 PRODUCT = java
@@ -304,11 +303,7 @@
 # Rules
 #
 
-SUBDIRS_management = mxbean
-include $(BUILDDIR)/common/Subdirs.gmk
-
 build: sources
-	$(SUBDIRS-loop)
 
 clean clobber::
 	$(RM) -r $(NIO_GEN) $(SNIO_GEN)
@@ -821,7 +816,7 @@
 	$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') 
 
 $(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC)
-	$(install-non-module-file)
+	$(install-file)
 
 $(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC)
 	$(prep-target)
--- a/jdk/make/java/nio/mxbean/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-BUILDDIR = ../../..
-MODULE   = management
-PACKAGE  = java.nio
-PRODUCT  = java
-include $(BUILDDIR)/common/Defs.gmk
-
-FILES_java = java/nio/BufferPoolMXBean.java
-
-include $(BUILDDIR)/common/Classes.gmk
--- a/jdk/make/java/npt/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/npt/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -26,7 +26,6 @@
 BUILDDIR = ../..
 
 # It's currently used by jpda and hprof.  Put it in base module for now.
-MODULE  = base
 LIBRARY = npt
 PRODUCT = sun
 LIBRARY_OUTPUT = npt
--- a/jdk/make/java/redist/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/redist/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -35,7 +35,6 @@
 # 
 
 BUILDDIR = ../..
-MODULE   = base
 PRODUCT  = java
 include $(BUILDDIR)/common/Defs.gmk
 
@@ -122,32 +121,26 @@
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME):
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME)  $@
-	@$(install-module-file)
 
 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME):
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME)  $@
-	@$(install-module-file)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME):
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@
-	@$(install-module-file)
 
 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME):
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME)  $@
-	@$(install-module-file)
 
 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME):
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME)  $@
-	@$(install-module-file)
 
 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME): 
 	@$(prep-target)
 	-$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@
-	@$(install-module-file)
 
 #  Windows     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Windows
 else # PLATFORM
@@ -291,7 +284,7 @@
 
 $(LIBDIR)/jce.jar: \
 	    $(BUILDDIR)/closed/tools/crypto/jce/jce.jar
-	$(install-non-module-file)
+	$(install-file)
 $(LIBDIR)/security/US_export_policy.jar: \
 	    $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar
 	$(install-file)
--- a/jdk/make/java/redist/fonts/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/redist/fonts/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE   = font
 PRODUCT  = java
 include $(BUILDDIR)/common/Defs.gmk
 
--- a/jdk/make/java/redist/sajdi/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/redist/sajdi/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE   = sajdi
 PRODUCT  = java
 include $(BUILDDIR)/common/Defs.gmk
 
--- a/jdk/make/java/security/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/security/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = base
 PACKAGE = java.security
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/java/sql/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/sql/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = jdbc-base
 PACKAGE = java.sql
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/java/text/base/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/text/base/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = base
 PACKAGE = java.text
 PRODUCT = sun
 
--- a/jdk/make/java/verify/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/verify/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = base
 PRODUCT = java
 LIBRARY = verify
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/java/zip/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/java/zip/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -25,7 +25,6 @@
 
 
 BUILDDIR = ../..
-MODULE  = base
 PACKAGE = java.util.zip
 LIBRARY = zip
 PRODUCT = sun
--- a/jdk/make/javax/crypto/Defs-jce.gmk	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/crypto/Defs-jce.gmk	Fri Mar 18 15:44:48 2011 -0700
@@ -83,7 +83,7 @@
 
 define release-warning
 	@$(ECHO) \
-	    "\n***The jar files built by the \"release\" target must***" \
+	    "\n***The jar files built by the 'release' target must***" \
 	    "\n***still be checked into the closed workspace!     ***" \
 	    $(README-MAKEFILE_WARNING)
 endef
--- a/jdk/make/javax/crypto/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/crypto/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -108,7 +108,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = base
 PACKAGE = javax.crypto
 PRODUCT = sun
 
@@ -294,7 +293,7 @@
 
 $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar:		\
 	    $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
-	$(install-non-module-file)
+	$(install-file)
 
 $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar:			\
 	    policy/limited/default_local.policy				\
@@ -415,7 +414,7 @@
 else
 $(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar
 endif
-	$(install-non-module-file)
+	$(install-file)
 
 #
 # Install the appropriate policy file, depending on the type of build.
@@ -435,7 +434,7 @@
 	    $(POLICY_DESTDIR)/local_policy.jar
 	$(CP) $^ $(POLICY_DESTDIR)
 
-install-limited: install-limited-jars install-module-files
+install-limited: install-limited-jars
 ifndef OPENJDK
 	$(release-warning)
 endif
@@ -449,7 +448,7 @@
 	    $(POLICY_DESTDIR)/local_policy.jar
 	$(CP) $^ $(POLICY_DESTDIR)
 
-install-unlimited: install-unlimited-jars install-module-files
+install-unlimited: install-unlimited-jars
 ifndef OPENJDK
 	$(release-warning)
 endif
@@ -466,16 +465,9 @@
 	    $(PREBUILT_DIR)/jce/local_policy.jar \
 	    $(POLICY_DESTDIR)
 
-install-prebuilt: install-prebuilt-jars install-module-files
+install-prebuilt: install-prebuilt-jars
 endif
 
-install-module-files: \
-	   $(POLICY_DESTDIR)/US_export_policy.jar \
-	   $(POLICY_DESTDIR)/local_policy.jar
-
-$(POLICY_DESTDIR)/%.jar :
-	$(install-module-file)
-
 # =====================================================
 # Support routines.
 #
--- a/jdk/make/javax/imageio/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/imageio/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = imageio
 PACKAGE = javax.imageio
 PRODUCT = jiio
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/javax/print/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/print/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = print
 PACKAGE = javax.print
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/javax/sound/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/sound/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = sound
 PACKAGE = javax.sound
 LIBRARY = jsound
 PRODUCT = sun
--- a/jdk/make/javax/sound/jsoundalsa/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/sound/jsoundalsa/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = sound
 PACKAGE = javax.sound
 LIBRARY = jsoundalsa
 PRODUCT = sun
--- a/jdk/make/javax/sound/jsoundds/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/sound/jsoundds/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = sound
 PACKAGE = javax.sound
 LIBRARY = jsoundds
 PRODUCT = sun
--- a/jdk/make/javax/sql/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/sql/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = jdbc-enterprise
 PACKAGE = javax.sql
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/javax/swing/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/swing/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR  = ../..
-MODULE    = swing
 PACKAGE   = javax.swing
 PRODUCT   = com
 SWING_SRC = $(SHARE_SRC)/classes/javax/swing
--- a/jdk/make/javax/swing/plaf/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/javax/swing/plaf/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -24,7 +24,6 @@
 #
 
 BUILDDIR  = ../../..
-MODULE    = swing
 PACKAGE   = javax.swing.plaf
 PRODUCT   = com
 SWING_SRC = $(SHARE_SRC)/classes/javax/swing
--- a/jdk/make/jpda/back/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/jpda/back/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = debugging
 LIBRARY = jdwp
 PRODUCT = jpda
 
--- a/jdk/make/jpda/transport/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/jpda/transport/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = debugging
 PRODUCT = jpda
 include $(BUILDDIR)/common/Defs.gmk
 
--- a/jdk/make/jpda/transport/shmem/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/jpda/transport/shmem/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE   = debugging
 LIBRARY  = dt_shmem
 PRODUCT = jbug
 
--- a/jdk/make/jpda/transport/socket/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/jpda/transport/socket/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../../..
-MODULE  = debugging
 LIBRARY = dt_socket
 PRODUCT = jbug
 
--- a/jdk/make/jpda/tty/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/jpda/tty/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = jdb
 PACKAGE = com.sun.tools.example.debug.tty
 PRODUCT = jpda
 PROGRAM = jdb
--- a/jdk/make/launchers/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/launchers/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ..
-MODULE  = tools
 PACKAGE = launchers
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
@@ -38,7 +37,6 @@
 define make-corba-launcher
 $(CD) $(BUILDDIR)/launchers && \
 $(MAKE) -f Makefile.launcher \
-        MODULE=corba \
         PROGRAM=$(strip $1) \
         MAIN_CLASS=$(strip $2) \
         MAIN_JAVA_ARGS="$(strip $3)" \
--- a/jdk/make/mkdemo/jfc/SwingSet2/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mkdemo/jfc/SwingSet2/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -37,6 +37,7 @@
 DEMO_MAINCLASS  = $(DEMONAME)
 DEMO_MANIFEST_ATTR = SplashScreen-Image: resources/images/splash.png
 DEMO_DESTDIR    = $(DEMODIR)/jfc/$(DEMONAME)
+DEMO_INCL_SRC   = true
 
 #
 # Demo jar building rules.
--- a/jdk/make/mkdemo/jpda/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mkdemo/jpda/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -32,6 +32,8 @@
 DEMO_PKGDIR     = com/sun/tools/example
 DEMO_TOPFILES   = ./com/sun/tools/example/README
 DEMO_DESTDIR    = $(DEMODIR)/jpda
+DEMO_JAR_NAME   = examples.jar
+DEMO_ONLY_SRC   = true
 
 #
 # Demo jar building rules.
--- a/jdk/make/mkdemo/jvmti/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mkdemo/jvmti/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = demos
 PRODUCT = demos
 include $(BUILDDIR)/common/Defs.gmk
 
--- a/jdk/make/mkdemo/management/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mkdemo/management/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -28,7 +28,6 @@
 #
 
 BUILDDIR = ../..
-MODULE  = demos
 PRODUCT = demos
 include $(BUILDDIR)/common/Defs.gmk
 
--- a/jdk/make/mksample/dtrace/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/dtrace/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/jmx/jmx-scandir/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/jmx/jmx-scandir/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/nbproject/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/nbproject/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/nio/file/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/nio/file/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/nio/multicast/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/nio/multicast/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/nio/server/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/nio/server/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/scripting/scriptpad/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/scripting/scriptpad/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/webservices/EbayClient/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/webservices/EbayClient/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/mksample/webservices/EbayServer/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ b/jdk/make/mksample/webservices/EbayServer/Makefile	Fri Mar 18 15:44:48 2011 -0700
@@ -29,7 +29,6 @@
 
 BUILDDIR = ../../..
 
-MODULE  = samples
 PRODUCT = java
 
 include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/modules/Makefile	Fri Mar 18 08:42:05 2011 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-BUILDDIR = ..
-include $(BUILDDIR)/common/Defs.gmk
-
-#
-# Modularizing the JDK
-# - Post jdk build process until the source tree is restructured
-#   for modules build
-# - <outputdir>/modules/<module> will be created for each module.
-#
-# Steps:
-# 0. During jdk build before this makefile is invoked, classes, 
-#    resource files, and other non-class files such as native libraries,
-#    properties file, images, etc are created.
-#
-#    Non-class files are copied to <outputdir>/tmp/modules/<MODULE>
-#    directory in this step to prepare for the post-build modularization. 
-#
-#    The MODULE variable defined in other makefiles specifies 
-#    the lowest-level module that the non-class files belong to.
-#    The name might or might not be the same as the name of the modules 
-#    in the resulting <outputdir>/modules directory.
-#    
-# 1. Unpack all jars in the <builddir>/lib directory to a temporary 
-#    location (<outputdir>/tmp/modules/classes) to prepare for modules
-#    creation.
-#
-# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate
-#    class list for all modules and also perform dependency analysis. 
-#
-#    Input configuration files :-
-#
-#    modules.config : defines the low-level modules and specifies 
-#       what classes and resource files each module includes.
-#    modules.group  : defines the module groups and its members.
-#    jdk7.depconfig : lists the dynamic dependencies including
-#       use of reflection Class.forName and JNI FindClass and
-#       service provider.
-#    optional.depconfig : lists the optional dependencies
-#
-# 3. Create one directory for each module (<outputdir>/modules/<module>)
-#    based on the output files from (2).
-#       
-#    modules.list lists the modules to be created for the modules
-#    build and its members. For each module (m) in modules.list,
-#    a. create $m/lib/$m.jar with all classes and resource files
-#       listed in $m.classlist and $m.resources respectively.
-#    b. copy all non-class files from its members to 
-#       <outputdir>/modules/$m.
-
-
-MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf
-MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
-
-TMP = $(ABS_MODULES_TEMPDIR)
-MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist
-MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes
-MODULES_LIST = $(MODULE_CLASSLIST)/modules.list
-
-all:: unpack-jars gen-classlist modularize
-
-JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) 
-unpack-jars:
-	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
-	$(RM) -rf $(MODULE_CLASSES)
-	$(MKDIR) -p $(MODULE_CLASSES)
-	$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES)
-	@for jf in  $(JAR_LIST) ; do \
-	   $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\
-	done
-	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
-
-gen-classlist:
-	$(CD) tools && $(MAKE) all
-
-modularize: $(MODULE_JAR_MANIFEST_FILE)
-	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
-	@$(RM) -rf $(MODULES_DIR)
-
-	@# create jar file for modules and
-	@# copy other files from all members of this module 
-	for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \
-   	   $(ECHO) "Creating module $$m" ; \
-   	   $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \
-	   if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \
-   	       $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \
-           fi ; \
-           $(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \
-	   $(CD) $(MODULE_CLASSES) && \
-               $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \
-		   $(ABS_MODULES_DIR)/$$m/lib/$$m.jar \
-	           @$(TMP)/tmp.cf \
-                   $(BOOT_JAR_JFLAGS); \
-	   for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \
-               if [ -d $(TMP)/$$s ] ; then \
-               	   $(CP) -rf $(TMP)/$$s/*  $(ABS_MODULES_DIR)/$$m; \
-		   $(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \
-	       fi \
-	   done \
-        done
-	@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup)
-	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
-
-$(MODULE_JAR_MANIFEST_FILE):
-	$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@
-
-clean clobber::
-	$(RM) -rf $(MODULE_CLASSLIST)
-	$(RM) -rf $(MODULES_DIR)
-	$(RM) $(MODULE_JAR_MANIFEST_FILE)
--- a/jdk/make/modules/bootmodule.roots	Fri Mar 18 08:42:05 2011 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-#
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# List of root classes/methods, each line of the following syntax:
-# <class name> 
-# <method name> <signature>|*
-# exclude <class>|<method> 
-
-# The boot module generated based on this rootset does not support
-# - security permission check
-# - non-standard charset
-# - logging output
-# - resource bundles
-#   including error output from the launcher 
-
-# VM preloaded classes
-java.lang.Object
-java.lang.String
-java.lang.Class
-java.lang.Cloneable
-java.lang.ClassLoader
-java.lang.System
-java.lang.Throwable
-java.lang.Error